File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class ProgressPlugin {
83
83
const states = new Array ( compiler . compilers . length ) ;
84
84
compiler . compilers . forEach ( ( compiler , idx ) => {
85
85
new ProgressPlugin ( ( p , msg , ...args ) => {
86
- states [ idx ] = args ;
86
+ states [ idx ] = [ p , msg , ... args ] ;
87
87
handler (
88
88
states
89
89
. map ( state => ( state && state [ 0 ] ) || 0 )
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ const path = require ( "path" ) ;
4
+ const MemoryFs = require ( "memory-fs" ) ;
5
+ const webpack = require ( "../" ) ;
6
+
7
+ const createMultiCompiler = ( ) => {
8
+ const compiler = webpack ( [
9
+ {
10
+ context : path . join ( __dirname , "fixtures" ) ,
11
+ entry : "./a.js"
12
+ } ,
13
+ {
14
+ context : path . join ( __dirname , "fixtures" ) ,
15
+ entry : "./b.js"
16
+ }
17
+ ] ) ;
18
+ compiler . outputFileSystem = new MemoryFs ( ) ;
19
+ return compiler ;
20
+ } ;
21
+
22
+ describe ( "ProgressPlugin" , function ( ) {
23
+ it ( "should not contain NaN as a percentage when it is applied to MultiCompiler" , function ( done ) {
24
+ const compiler = createMultiCompiler ( ) ;
25
+
26
+ let percentage = 0 ;
27
+ new webpack . ProgressPlugin ( ( p , msg , ...args ) => {
28
+ percentage += p ;
29
+ } ) . apply ( compiler ) ;
30
+
31
+ compiler . run ( err => {
32
+ if ( err ) {
33
+ throw err ;
34
+ } else {
35
+ expect ( percentage ) . not . toBe ( NaN ) ;
36
+ done ( ) ;
37
+ }
38
+ } ) ;
39
+ } ) ;
40
+ } ) ;
You can’t perform that action at this time.
0 commit comments