@@ -473,9 +473,9 @@ describe('agent', () => {
473473 describe ( 'execNpm argument transformation' , ( ) => {
474474 it ( 'should have a function that returns a promise' , ( ) => {
475475 const result = execNpm ( [ '--version' ] )
476- expect ( result ) . toBeInstanceOf ( Promise )
477- // Catch promise to prevent unhandled rejection on Windows.
476+ // Catch promise immediately to prevent unhandled rejection on Windows.
478477 result . catch ( ( ) => { } )
478+ expect ( result ) . toBeInstanceOf ( Promise )
479479 } )
480480
481481 it ( 'should be a function' , ( ) => {
@@ -486,9 +486,9 @@ describe('agent', () => {
486486 describe ( 'execPnpm argument transformation' , ( ) => {
487487 it ( 'should have a function that returns a promise' , ( ) => {
488488 const result = execPnpm ( [ '--version' ] )
489- expect ( result ) . toBeInstanceOf ( Promise )
490- // Catch promise to prevent unhandled rejection on Windows.
489+ // Catch promise immediately to prevent unhandled rejection on Windows.
491490 result . catch ( ( ) => { } )
491+ expect ( result ) . toBeInstanceOf ( Promise )
492492 } )
493493
494494 it ( 'should be a function' , ( ) => {
@@ -499,9 +499,9 @@ describe('agent', () => {
499499 describe ( 'execYarn argument transformation' , ( ) => {
500500 it ( 'should have a function that returns a promise' , ( ) => {
501501 const result = execYarn ( [ '--version' ] )
502- expect ( result ) . toBeInstanceOf ( Promise )
503- // Catch promise to prevent unhandled rejection on Windows.
502+ // Catch promise immediately to prevent unhandled rejection on Windows.
504503 result . catch ( ( ) => { } )
504+ expect ( result ) . toBeInstanceOf ( Promise )
505505 } )
506506
507507 it ( 'should be a function' , ( ) => {
@@ -512,9 +512,9 @@ describe('agent', () => {
512512 describe ( 'execScript argument transformation' , ( ) => {
513513 it ( 'should have a function that returns a promise' , ( ) => {
514514 const result = execScript ( 'test' )
515- expect ( result ) . toBeInstanceOf ( Promise )
516- // Catch promise to prevent unhandled rejection on Windows.
515+ // Catch promise immediately to prevent unhandled rejection on Windows.
517516 result . catch ( ( ) => { } )
517+ expect ( result ) . toBeInstanceOf ( Promise )
518518 } )
519519
520520 it ( 'should be a function' , ( ) => {
@@ -523,25 +523,25 @@ describe('agent', () => {
523523
524524 it ( 'should handle script name with array args' , ( ) => {
525525 const result = execScript ( 'test' , [ '--coverage' ] )
526- expect ( result ) . toBeInstanceOf ( Promise )
527- // Catch promise to prevent unhandled rejection on Windows.
526+ // Catch promise immediately to prevent unhandled rejection on Windows.
528527 result . catch ( ( ) => { } )
528+ expect ( result ) . toBeInstanceOf ( Promise )
529529 } )
530530
531531 it ( 'should handle script name with options object' , ( ) => {
532532 const result = execScript ( 'test' , { cwd : process . cwd ( ) } )
533- expect ( result ) . toBeInstanceOf ( Promise )
534- // Catch promise to prevent unhandled rejection on Windows.
533+ // Catch promise immediately to prevent unhandled rejection on Windows.
535534 result . catch ( ( ) => { } )
535+ expect ( result ) . toBeInstanceOf ( Promise )
536536 } )
537537
538538 it ( 'should handle script name with args and options' , ( ) => {
539539 const result = execScript ( 'test' , [ '--coverage' ] , {
540540 cwd : process . cwd ( ) ,
541541 } )
542- expect ( result ) . toBeInstanceOf ( Promise )
543- // Catch promise to prevent unhandled rejection on Windows.
542+ // Catch promise immediately to prevent unhandled rejection on Windows.
544543 result . catch ( ( ) => { } )
544+ expect ( result ) . toBeInstanceOf ( Promise )
545545 } )
546546 } )
547547 } )
0 commit comments