@@ -8,19 +8,35 @@ describe('merge flag configuration', () => {
8
8
9
9
expect ( exitCode ) . toBe ( 0 ) ;
10
10
expect ( stderr ) . toBeFalsy ( ) ;
11
- expect ( stdout ) . toContain ( 'option has not been set, webpack will fallback to' ) ;
11
+ expect ( stdout ) . toContain ( 'WebpackCLITestPlugin' ) ; // from 1.js
12
+ expect ( stdout ) . toContain ( 'second-output.js' ) ; // from 2.js
13
+ } ) ;
14
+
15
+ it ( 'merges more than two configurations together' , ( ) => {
16
+ const { exitCode, stderr, stdout } = run (
17
+ __dirname ,
18
+ [ '--config' , './1.js' , '--config' , './2.js' , '--config' , './3.js' , '--merge' ] ,
19
+ false ,
20
+ ) ;
21
+
22
+ expect ( exitCode ) . toBe ( 0 ) ;
23
+ expect ( stderr ) . toBeFalsy ( ) ;
24
+ expect ( stdout ) . toContain ( 'WebpackCLITestPlugin' ) ; // from 1.js
25
+ expect ( stdout ) . toContain ( "target: 'node'" ) ; // from 2.js
26
+ expect ( stdout ) . toContain ( 'third-output.js' ) ; // from 3.js
12
27
} ) ;
13
28
14
29
it ( 'merges two configurations together with flag alias' , ( ) => {
15
30
const { exitCode, stderr, stdout } = run ( __dirname , [ '--config' , './1.js' , '--config' , './2.js' , '-m' ] , false ) ;
16
31
17
32
expect ( exitCode ) . toBe ( 0 ) ;
18
33
expect ( stderr ) . toBeFalsy ( ) ;
19
- expect ( stdout ) . toContain ( 'merged.js' ) ;
34
+ expect ( stdout ) . toContain ( 'WebpackCLITestPlugin' ) ; // from 1.js
35
+ expect ( stdout ) . toContain ( 'second-output.js' ) ; // from 2.js
20
36
} ) ;
21
37
22
38
it ( 'fails when there are less than 2 configurations to merge' , ( ) => {
23
- const { exitCode, stderr, stdout } = run ( __dirname , [ '--config' , './1.js' , '-m ' ] , false ) ;
39
+ const { exitCode, stderr, stdout } = run ( __dirname , [ '--config' , './1.js' , '--merge ' ] , false ) ;
24
40
25
41
expect ( exitCode ) . toBe ( 2 ) ;
26
42
expect ( stderr ) . toContain ( 'At least two configurations are required for merge.' ) ;
0 commit comments