@@ -19,7 +19,11 @@ describe('ProcessManager', () => {
1919 describe ( 'constructor()' , ( ) => {
2020 test ( 'sets the initial state' , ( ) => {
2121 expect ( processManager . errors ) . toEqual ( [ ] ) ;
22- expect ( processManager . forceShutdown ) . toMatchObject ( { promise : expect . any ( Promise ) , reject : expect . any ( Function ) , resolve : expect . any ( Function ) } ) ;
22+ expect ( processManager . forceShutdown ) . toMatchObject ( {
23+ promise : expect . any ( Promise ) ,
24+ reject : expect . any ( Function ) ,
25+ resolve : expect . any ( Function )
26+ } ) ;
2327 expect ( processManager . hooks ) . toEqual ( [ ] ) ;
2428 expect ( processManager . running ) . toEqual ( [ ] ) ;
2529 expect ( processManager . terminating ) . toEqual ( false ) ;
@@ -36,7 +40,14 @@ describe('ProcessManager', () => {
3640
3741 processManager . addHook ( { handler, type } ) ;
3842
39- expect ( processManager . hooks ) . toMatchObject ( [ { handler, name : 'a handler' , timeoutError : { message : 'a handler took too long to complete disconnect hook' } , type } ] ) ;
43+ expect ( processManager . hooks ) . toMatchObject ( [
44+ {
45+ handler,
46+ name : 'a handler' ,
47+ timeoutError : { message : 'a handler took too long to complete disconnect hook' } ,
48+ type
49+ }
50+ ] ) ;
4051 } ) ;
4152
4253 test ( 'identifies the hook if `name` is provided' , ( ) => {
@@ -45,7 +56,9 @@ describe('ProcessManager', () => {
4556
4657 processManager . addHook ( { handler, name : 'foobar' , type } ) ;
4758
48- expect ( processManager . hooks ) . toMatchObject ( [ { handler, name : 'foobar' , timeoutError : { message : 'foobar took too long to complete disconnect hook' } , type } ] ) ;
59+ expect ( processManager . hooks ) . toMatchObject ( [
60+ { handler, name : 'foobar' , timeoutError : { message : 'foobar took too long to complete disconnect hook' } , type }
61+ ] ) ;
4962 } ) ;
5063 } ) ;
5164
@@ -171,7 +184,12 @@ describe('ProcessManager', () => {
171184 test ( 'adds handler errors to `processManager.errors`' , async ( ) => {
172185 const type = 'disconnect' ;
173186
174- processManager . addHook ( { handler : ( ) => { throw new Error ( ) ; } , type } ) ;
187+ processManager . addHook ( {
188+ handler : ( ) => {
189+ throw new Error ( ) ;
190+ } ,
191+ type
192+ } ) ;
175193 processManager . configure ( { timeout : 1 } ) ;
176194
177195 expect ( processManager . errors ) . toHaveLength ( 0 ) ;
@@ -309,7 +327,7 @@ describe('ProcessManager', () => {
309327
310328 let i = 0 ;
311329
312- await processManager . loop ( async ( ) => {
330+ await processManager . loop ( ( ) => {
313331 fn ( ) ;
314332
315333 if ( ++ i === 3 ) {
@@ -325,7 +343,9 @@ describe('ProcessManager', () => {
325343
326344 jest . spyOn ( processManager , 'shutdown' ) ;
327345
328- await processManager . loop ( async ( ) => { throw error ; } ) ;
346+ await processManager . loop ( ( ) => {
347+ throw error ;
348+ } ) ;
329349
330350 expect ( processManager . shutdown ) . toHaveBeenCalledWith ( { error } ) ;
331351 } ) ;
@@ -335,7 +355,7 @@ describe('ProcessManager', () => {
335355 test ( 'calls the given function' , async ( ) => {
336356 const fn = jest . fn ( ) ;
337357
338- const on = processManager . on ( async ( ) => fn ( ) ) ;
358+ const on = processManager . on ( ( ) => fn ( ) ) ;
339359
340360 await on ( ) ;
341361
@@ -345,7 +365,7 @@ describe('ProcessManager', () => {
345365 test ( 'passes arguments to the given function' , async ( ) => {
346366 const fn = jest . fn ( ) ;
347367
348- const on = processManager . on ( async value => fn ( value ) ) ;
368+ const on = processManager . on ( value => fn ( value ) ) ;
349369
350370 await on ( 'foo' ) ;
351371
@@ -358,7 +378,7 @@ describe('ProcessManager', () => {
358378
359379 jest . spyOn ( processManager , 'shutdown' ) ;
360380
361- const on = processManager . on ( async ( ) => fn ( ) ) ;
381+ const on = processManager . on ( ( ) => fn ( ) ) ;
362382
363383 let i = 0 ;
364384 const onArray = [ ] ;
@@ -378,7 +398,7 @@ describe('ProcessManager', () => {
378398 test ( 'calls the given function' , async ( ) => {
379399 const fn = jest . fn ( ) ;
380400
381- await processManager . once ( async ( ) => fn ( ) ) ;
401+ await processManager . once ( ( ) => fn ( ) ) ;
382402
383403 expect ( fn ) . toHaveBeenCalled ( ) ;
384404 } ) ;
@@ -390,7 +410,7 @@ describe('ProcessManager', () => {
390410
391411 processManager . terminating = true ;
392412
393- const result = processManager . run ( async ( ) => fn ( ) ) ;
413+ const result = processManager . run ( ( ) => fn ( ) ) ;
394414
395415 expect ( fn ) . not . toHaveBeenCalled ( ) ;
396416 expect ( result ) . toBeUndefined ( ) ;
@@ -401,7 +421,7 @@ describe('ProcessManager', () => {
401421 done ( ) ;
402422 } ) ;
403423
404- const chain = processManager . run ( async ( ) => { } ) ;
424+ const chain = processManager . run ( ( ) => { } ) ;
405425
406426 expect ( chain . then ) . toBeDefined ( ) ;
407427 expect ( typeof chain . id ) . toBe ( 'symbol' ) ;
@@ -412,15 +432,17 @@ describe('ProcessManager', () => {
412432
413433 jest . spyOn ( processManager , 'shutdown' ) ;
414434
415- await processManager . run ( async ( ) => { throw error ; } ) ;
435+ await processManager . run ( ( ) => {
436+ throw error ;
437+ } ) ;
416438
417439 expect ( processManager . shutdown ) . toHaveBeenCalledWith ( { error } ) ;
418440 } ) ;
419441
420442 test ( 'calls `shutdown` after running the function' , async ( ) => {
421443 jest . spyOn ( processManager , 'shutdown' ) ;
422444
423- await processManager . run ( async ( ) => { } ) ;
445+ await processManager . run ( ( ) => { } ) ;
424446
425447 expect ( processManager . shutdown ) . toHaveBeenCalledWith ( { error : undefined } ) ;
426448 } ) ;
@@ -437,7 +459,7 @@ describe('ProcessManager', () => {
437459 test ( 'it handles `uncaughtException` events' , ( ) => {
438460 processManager . configure ( { timeout : 1 } ) ;
439461
440- const uncaughtExceptionEventFunction = process . on . mock . calls . find ( ( [ event ] ) => event === 'uncaughtException' ) [ 1 ] ;
462+ const [ , uncaughtExceptionEventFunction ] = process . on . mock . calls . find ( ( [ event ] ) => event === 'uncaughtException' ) ;
441463
442464 jest . spyOn ( processManager , 'shutdown' ) ;
443465
@@ -451,7 +473,9 @@ describe('ProcessManager', () => {
451473 test ( 'it handles `unhandledRejection` events' , ( ) => {
452474 processManager . configure ( { timeout : 1 } ) ;
453475
454- const unhandledRejectionEventFunction = process . on . mock . calls . find ( ( [ event ] ) => event === 'unhandledRejection' ) [ 1 ] ;
476+ const [ , unhandledRejectionEventFunction ] = process . on . mock . calls . find (
477+ ( [ event ] ) => event === 'unhandledRejection'
478+ ) ;
455479
456480 jest . spyOn ( processManager , 'shutdown' ) ;
457481
@@ -465,7 +489,7 @@ describe('ProcessManager', () => {
465489 test ( 'it handles `SIGINT` events' , ( ) => {
466490 processManager . configure ( { timeout : 1 } ) ;
467491
468- const sigintEventFunction = process . on . mock . calls . find ( ( [ event ] ) => event === 'SIGINT' ) [ 1 ] ;
492+ const [ , sigintEventFunction ] = process . on . mock . calls . find ( ( [ event ] ) => event === 'SIGINT' ) ;
469493
470494 jest . spyOn ( processManager , 'shutdown' ) ;
471495
@@ -481,7 +505,7 @@ describe('ProcessManager', () => {
481505 test ( 'it handles `SIGTERM` events' , ( ) => {
482506 processManager . configure ( { timeout : 1 } ) ;
483507
484- const sigtermEventFunction = process . on . mock . calls . find ( ( [ event ] ) => event === 'SIGTERM' ) [ 1 ] ;
508+ const [ , sigtermEventFunction ] = process . on . mock . calls . find ( ( [ event ] ) => event === 'SIGTERM' ) ;
485509
486510 jest . spyOn ( processManager , 'shutdown' ) ;
487511
0 commit comments