mirror of https://github.com/webpack/webpack.git
				
				
				
			add two tests for non-absolute and absolute paths check
This commit is contained in:
		
							parent
							
								
									8ccf068c59
								
							
						
					
					
						commit
						7d0a442183
					
				| 
						 | 
				
			
			@ -175,6 +175,65 @@ describe("Validation", function() {
 | 
			
		|||
			"    * configuration.devtool should be a string.",
 | 
			
		||||
			"    * configuration.devtool should be false"
 | 
			
		||||
		]
 | 
			
		||||
	}, {
 | 
			
		||||
		name: "non-absolute path",
 | 
			
		||||
		config: {
 | 
			
		||||
			entry: "foo.js",
 | 
			
		||||
			output: {
 | 
			
		||||
				filename: "/bar"
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		message: [
 | 
			
		||||
			" - configuration.output.filename A non-absolut path is expected. However the provided value \"/bar\" is an absolute path!",
 | 
			
		||||
			"    ({",
 | 
			
		||||
			"     \"keyword\": \"absolutePath\",",
 | 
			
		||||
			"     \"params\": {",
 | 
			
		||||
			"       \"absolutePath\": \"/bar\"",
 | 
			
		||||
			"     },",
 | 
			
		||||
			"     \"message\": \"A non-absolut path is expected. However the provided value \\\"/bar\\\" is an absolute path!\\n\",",
 | 
			
		||||
			"     \"parentSchema\": {",
 | 
			
		||||
			"       \"description\": \"Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.\",",
 | 
			
		||||
			"       \"type\": \"string\",",
 | 
			
		||||
			"       \"absolutePath\": false",
 | 
			
		||||
			"     },",
 | 
			
		||||
			"     \"dataPath\": \".output.filename\",",
 | 
			
		||||
			"     \"schemaPath\": \"#/definitions/output/properties/filename/absolutePath\",",
 | 
			
		||||
			"     \"schema\": false,",
 | 
			
		||||
			"     \"data\": \"/bar\"",
 | 
			
		||||
			"   }).",
 | 
			
		||||
			"   string",
 | 
			
		||||
			"   Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files."
 | 
			
		||||
		]
 | 
			
		||||
	}, {
 | 
			
		||||
		name: "absolute path",
 | 
			
		||||
		config: {
 | 
			
		||||
			entry: "foo.js",
 | 
			
		||||
			output: {
 | 
			
		||||
				filename: "bar"
 | 
			
		||||
			},
 | 
			
		||||
			context: "baz"
 | 
			
		||||
		},
 | 
			
		||||
		message: [
 | 
			
		||||
			" - configuration.context The provided value \"baz\" is not an absolute path!",
 | 
			
		||||
			"    ({",
 | 
			
		||||
			"     \"keyword\": \"absolutePath\",",
 | 
			
		||||
			"     \"params\": {",
 | 
			
		||||
			"       \"absolutePath\": \"baz\"",
 | 
			
		||||
			"     },",
 | 
			
		||||
			"     \"message\": \"The provided value \\\"baz\\\" is not an absolute path!\\n\",",
 | 
			
		||||
			"     \"parentSchema\": {",
 | 
			
		||||
			"       \"description\": \"The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.\",",
 | 
			
		||||
			"       \"type\": \"string\",",
 | 
			
		||||
			"       \"absolutePath\": true",
 | 
			
		||||
			"     },",
 | 
			
		||||
			"     \"dataPath\": \".context\",",
 | 
			
		||||
			"     \"schemaPath\": \"#/properties/context/absolutePath\",",
 | 
			
		||||
			"     \"schema\": true,",
 | 
			
		||||
			"     \"data\": \"baz\"",
 | 
			
		||||
			"   }).",
 | 
			
		||||
			"   string",
 | 
			
		||||
			"   The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory."
 | 
			
		||||
		]
 | 
			
		||||
	}];
 | 
			
		||||
	testCases.forEach(function(testCase) {
 | 
			
		||||
		it("should fail validation for " + testCase.name, function() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue