File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ function makeSchema(schemaOptions, schemaExtension) {
67
67
return schemaExtension ? schema . concat ( schemaExtension ) : schema
68
68
}
69
69
70
- function validate ( config , options ) {
70
+ function validate ( config , options = { } ) {
71
71
const {
72
72
// Don't return the config object and throw on error, but just return the validation result
73
73
returnValidation, // bool
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import sinon from 'sinon'
2
2
import configs from '../test/passing-configs'
3
3
import failingConfigs from '../test/failing-configs'
4
4
import { validateRoot as validate , Joi } from './'
5
+ const validatecjs = require ( './' )
5
6
6
7
describe ( '.' , ( ) => {
7
8
let sandbox
@@ -34,6 +35,25 @@ describe('.', () => {
34
35
} )
35
36
} )
36
37
38
+ configs . forEach ( ( { config, name } ) => {
39
+ // This is not the multi-compiler, so we explictly pull that configuration out
40
+ if ( name === 'webpack-multi-compiler' ) return
41
+
42
+ it ( `validates ${ name } using CJS` , ( ) => {
43
+ validatecjs ( config )
44
+
45
+ // The success message should have been printed
46
+ assert ( consoleInfoStub . callCount === 0 )
47
+
48
+ // The error message should not have been printed
49
+ if ( consoleErrorStub . callCount !== 0 ) {
50
+ throw new Error ( consoleErrorStub . args [ 0 ] )
51
+ }
52
+ // process.exit should not have been called
53
+ assert ( processExitStub . callCount === 0 )
54
+ } )
55
+ } )
56
+
37
57
failingConfigs . forEach ( ( { config, name } ) => {
38
58
it ( `throws for ${ name } ` , ( ) => {
39
59
validate ( config )
You can’t perform that action at this time.
0 commit comments