File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed 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