@@ -285,8 +285,8 @@ function setupProcessState(root, globalOptions) {
285285 process . removeListener ( 'unhandledRejection' , rejectionHandler ) ;
286286 process . removeListener ( 'beforeExit' , exitHandler ) ;
287287 if ( globalOptions . isTestRunner ) {
288- process . removeListener ( 'SIGINT' , ( ) => terminationHandler ( kSigInt ) ) ;
289- process . removeListener ( 'SIGTERM' , ( ) => terminationHandler ( kSigTerm ) ) ;
288+ process . removeListener ( 'SIGINT' , sigIntHandler ) ;
289+ process . removeListener ( 'SIGTERM' , sigTermHandler ) ;
290290 }
291291 } ;
292292
@@ -321,13 +321,16 @@ function setupProcessState(root, globalOptions) {
321321 process . exit ( exitCode ) ;
322322 } ;
323323
324+ const sigIntHandler = ( ) => terminationHandler ( kSigInt ) ;
325+ const sigTermHandler = ( ) => terminationHandler ( kSigTerm ) ;
326+
324327 process . on ( 'uncaughtException' , exceptionHandler ) ;
325328 process . on ( 'unhandledRejection' , rejectionHandler ) ;
326329 process . on ( 'beforeExit' , exitHandler ) ;
327330 // TODO(MoLow): Make it configurable to hook when isTestRunner === false.
328331 if ( globalOptions . isTestRunner ) {
329- process . on ( 'SIGINT' , ( ) => terminationHandler ( kSigInt ) ) ;
330- process . on ( 'SIGTERM' , ( ) => terminationHandler ( kSigTerm ) ) ;
332+ process . on ( 'SIGINT' , sigIntHandler ) ;
333+ process . on ( 'SIGTERM' , sigTermHandler ) ;
331334 }
332335
333336 root . harness . coverage = FunctionPrototypeBind ( collectCoverage , null , root , coverage ) ;
0 commit comments