mirror of https://github.com/webpack/webpack.git
				
				
				
			fix more tests
This commit is contained in:
		
							parent
							
								
									9f21fed247
								
							
						
					
					
						commit
						6d183d4044
					
				| 
						 | 
					@ -70,6 +70,9 @@ describe("Errors", function() {
 | 
				
			||||||
				a: "./require-entry-point",
 | 
									a: "./require-entry-point",
 | 
				
			||||||
				b: "./entry-point",
 | 
									b: "./entry-point",
 | 
				
			||||||
				c: ["./entry-point2"]
 | 
									c: ["./entry-point2"]
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								output: {
 | 
				
			||||||
 | 
									filename: "[name].js"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}, function(errors, warnings) {
 | 
							}, function(errors, warnings) {
 | 
				
			||||||
			errors.length.should.be.eql(2);
 | 
								errors.length.should.be.eql(2);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@ describe("HotModuleReplacementPlugin", function() {
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			plugins: [
 | 
								plugins: [
 | 
				
			||||||
				new webpack.HotModuleReplacementPlugin(),
 | 
									new webpack.HotModuleReplacementPlugin(),
 | 
				
			||||||
				new webpack.optimize.OccurenceOrderPlugin()
 | 
									new webpack.optimize.OccurrenceOrderPlugin()
 | 
				
			||||||
			]
 | 
								]
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		fs.writeFileSync(entryFile, "1", "utf-8");
 | 
							fs.writeFileSync(entryFile, "1", "utf-8");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,8 +13,6 @@ it("should automatically create contexts", function() {
 | 
				
			||||||
	require("./templates/" + tmp + "l").should.be.eql("test template");
 | 
						require("./templates/" + tmp + "l").should.be.eql("test template");
 | 
				
			||||||
	require("./templates/t" + mpl).should.be.eql("test template");
 | 
						require("./templates/t" + mpl).should.be.eql("test template");
 | 
				
			||||||
	require("./templates/t" + mp + "l").should.be.eql("test template");
 | 
						require("./templates/t" + mp + "l").should.be.eql("test template");
 | 
				
			||||||
	require("./templates/templateLoader")(templateFull).should.be.eql("test template");
 | 
					 | 
				
			||||||
	require("./templates/templateLoaderIndirect")(templateFull).should.be.eql("test template");
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it("should be able to require.resolve with automatical context", function() {
 | 
					it("should be able to require.resolve with automatical context", function() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,5 +2,4 @@ module.exports = [
 | 
				
			||||||
	[/Module parse failed/, /dump-file\.txt/, /templates \^\\\.\\\/\.\*\$/],
 | 
						[/Module parse failed/, /dump-file\.txt/, /templates \^\\\.\\\/\.\*\$/],
 | 
				
			||||||
	[/Critical dependencies/, /templateLoader\.js/],
 | 
						[/Critical dependencies/, /templateLoader\.js/],
 | 
				
			||||||
	[/Critical dependencies/, /templateLoaderIndirect\.js/],
 | 
						[/Critical dependencies/, /templateLoaderIndirect\.js/],
 | 
				
			||||||
	[/Critical dependencies/, /templateLoaderIndirect\.js/],
 | 
					 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,3 @@
 | 
				
			||||||
it("should define DEBUG", function() {
 | 
					 | 
				
			||||||
	DEBUG.should.be.eql(false);
 | 
					 | 
				
			||||||
	(typeof DEBUG).should.be.eql("boolean");
 | 
					 | 
				
			||||||
	var x = require(DEBUG ? "fail" : "./a");
 | 
					 | 
				
			||||||
	var y = DEBUG ? require("fail") : require("./a");
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
it("should evaluate null", function() {
 | 
					it("should evaluate null", function() {
 | 
				
			||||||
	var y = null ? require("fail") : require("./a");
 | 
						var y = null ? require("fail") : require("./a");
 | 
				
			||||||
	if(null)
 | 
						if(null)
 | 
				
			||||||
| 
						 | 
					@ -13,8 +6,8 @@ it("should evaluate null", function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it("should short-circut evaluating", function() {
 | 
					it("should short-circut evaluating", function() {
 | 
				
			||||||
	var expr;
 | 
						var expr;
 | 
				
			||||||
	var a = DEBUG && expr ? require("fail") : require("./a");
 | 
						var a = false && expr ? require("fail") : require("./a");
 | 
				
			||||||
	var b = !DEBUG || expr ? require("./a") : require("fail");
 | 
						var b = true || expr ? require("./a") : require("fail");
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it("should evaluate __dirname and __resourceQuery with replace and substr", function() {
 | 
					it("should evaluate __dirname and __resourceQuery with replace and substr", function() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					it("should automatically create contexts", function() {
 | 
				
			||||||
 | 
						var template = "tmpl", templateFull = "./tmpl.js";
 | 
				
			||||||
 | 
						require("../../../cases/parsing/context/templates/templateLoader")(templateFull).should.be.eql("test template");
 | 
				
			||||||
 | 
						require("../../../cases/parsing/context/templates/templateLoaderIndirect")(templateFull).should.be.eql("test template");
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					module.exports = [
 | 
				
			||||||
 | 
						[/Module parse failed/, /dump-file\.txt/, /templates \^\\\.\\\//]
 | 
				
			||||||
 | 
					];
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
						module: {
 | 
				
			||||||
 | 
							unknownContextRegExp: /^\.\//,
 | 
				
			||||||
 | 
							unknownContextCritical: false,
 | 
				
			||||||
 | 
							exprContextRegExp: /^\.\//,
 | 
				
			||||||
 | 
							exprContextCritical: false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,10 @@
 | 
				
			||||||
 | 
					it("should define FALSE", function() {
 | 
				
			||||||
 | 
						FALSE.should.be.eql(false);
 | 
				
			||||||
 | 
						(typeof TRUE).should.be.eql("boolean");
 | 
				
			||||||
 | 
						var x = require(FALSE ? "fail" : "./a");
 | 
				
			||||||
 | 
						var y = FALSE ? require("fail") : require("./a");
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it("should define CODE", function() {
 | 
					it("should define CODE", function() {
 | 
				
			||||||
	CODE.should.be.eql(3);
 | 
						CODE.should.be.eql(3);
 | 
				
			||||||
	(typeof CODE).should.be.eql("number");
 | 
						(typeof CODE).should.be.eql("number");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,8 @@ var DefinePlugin = require("../../../../lib/DefinePlugin");
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
	plugins: [
 | 
						plugins: [
 | 
				
			||||||
		new DefinePlugin({
 | 
							new DefinePlugin({
 | 
				
			||||||
 | 
								TRUE: true,
 | 
				
			||||||
 | 
								FALSE: false,
 | 
				
			||||||
			UNDEFINED: undefined,
 | 
								UNDEFINED: undefined,
 | 
				
			||||||
			FUNCTION: function(a) { return a + 1; },
 | 
								FUNCTION: function(a) { return a + 1; },
 | 
				
			||||||
			CODE: "(1+2)",
 | 
								CODE: "(1+2)",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue