File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ var ExtractedModule = require("./ExtractedModule");
9
9
var Chunk = require ( "webpack/lib/Chunk" ) ;
10
10
var OrderUndefinedError = require ( "./OrderUndefinedError" ) ;
11
11
var loaderUtils = require ( "loader-utils" ) ;
12
- var schemaTester = require ( './schema/valid ' ) ;
12
+ var schemaTester = require ( './schema/validator ' ) ;
13
13
14
14
var NS = fs . realpathSync ( __dirname ) ;
15
15
@@ -105,7 +105,6 @@ function getOrder(a, b) {
105
105
}
106
106
107
107
function ExtractTextPlugin ( options ) {
108
- schemaTester ( options ) ;
109
108
if ( arguments . length > 1 ) {
110
109
throw new Error ( "Breaking change: ExtractTextPlugin now only takes a single argument. Either an options " +
111
110
"object *or* the name of the result file.\n" +
@@ -120,6 +119,8 @@ function ExtractTextPlugin(options) {
120
119
}
121
120
if ( isString ( options ) ) {
122
121
options = { filename : options } ;
122
+ } else {
123
+ schemaTester ( options ) ;
123
124
}
124
125
this . filename = options . filename ;
125
126
this . id = options . id != null ? options . id : ++ nextId ;
Original file line number Diff line number Diff line change 16
16
"type" : " string"
17
17
},
18
18
"filename" : {
19
- "description" : " The filename and path that ExtractTextPlugin will extract to. " ,
19
+ "description" : " The filename and path that ExtractTextPlugin will extract to" ,
20
20
"type" : " string"
21
21
},
22
22
"loader" : {
27
27
"description" : " " ,
28
28
"type" : " string"
29
29
}
30
- },
31
- "required" : [" loader" ]
30
+ }
32
31
}
File renamed without changes.
Original file line number Diff line number Diff line change @@ -10,6 +10,26 @@ describe("ExtractTextPlugin.extract()", function() {
10
10
} ) ;
11
11
} ) ;
12
12
13
+ context ( "json schema validation" , function ( ) {
14
+ it ( "does not throw if a filename is specified" , function ( ) {
15
+ should . doesNotThrow ( function ( ) {
16
+ ExtractTextPlugin . extract ( "file.css" ) ;
17
+ } ) ;
18
+ } ) ;
19
+
20
+ it ( "does not throw if a correct config object is passed in" , function ( ) {
21
+ should . doesNotThrow ( function ( ) {
22
+ ExtractTextPlugin . extract ( { loader : 'css-loader' } ) ;
23
+ } ) ;
24
+ } ) ;
25
+
26
+ it ( "throws if an incorrect config is passed in" , function ( ) {
27
+ should . throws ( function ( ) {
28
+ ExtractTextPlugin . extract ( { style : 'file.css' } ) ;
29
+ } ) ;
30
+ } ) ;
31
+ } ) ;
32
+
13
33
context ( "specifying loader" , function ( ) {
14
34
it ( "accepts a loader string" , function ( ) {
15
35
ExtractTextPlugin . extract ( "css-loader" ) . should . deepEqual ( [
You can’t perform that action at this time.
0 commit comments