File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class BundleAnalyzerPlugin {
6969 // Making analyzer logs to be after all webpack logs in the console
7070 setImmediate ( async ( ) => {
7171 try {
72- await Promise . all ( actions . map ( action => action ( ) ) ) ;
72+ await Promise . all ( actions . map ( ( action ) => action ( ) ) ) ;
7373 } finally {
7474 callback ( ) ;
7575 }
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const webpack = require ( "webpack" ) ;
4+ const BundleAnalyzerPlugin = require ( "../src/BundleAnalyzerPlugin" ) ;
5+
6+ describe ( "Issue #499" , ( ) => {
7+ it ( "should not cause WebpackLogger 'done hook' error when callback throws" , ( done ) => {
8+ expect . assertions ( 1 ) ;
9+
10+ const compiler = webpack ( {
11+ mode : "development" ,
12+ entry : __filename ,
13+ plugins : [ new BundleAnalyzerPlugin ( { analyzerMode : "disabled" } ) ] ,
14+ } ) ;
15+
16+ let webpackLoggerError = false ;
17+ const originalConsoleError = console . error ;
18+
19+ console . error = ( ...args ) => {
20+ const message = args . join ( " " ) ;
21+ if ( message . includes ( "No such label 'done hook'" ) ) {
22+ webpackLoggerError = true ;
23+ }
24+ // eslint-disable-next-line no-console
25+ originalConsoleError . apply ( console , args ) ;
26+ } ;
27+
28+ compiler . run ( ( ) => {
29+ try {
30+ throw new Error ( "Intentional test error" ) ;
31+ } catch {
32+ // Swallow expected error
33+ }
34+ } ) ;
35+
36+ setTimeout ( ( ) => {
37+ console . error = originalConsoleError ;
38+
39+ expect ( webpackLoggerError ) . toBe ( false ) ;
40+ done ( ) ;
41+ } , 1000 ) ;
42+ } ) ;
43+ } ) ;
You can’t perform that action at this time.
0 commit comments