@@ -364,6 +364,7 @@ function getSleepCmd() {
364
364
async function stopAndWait ( cp : ChildProcess , clock : FakeTimers . InstalledClock ) {
365
365
cp . stop ( true )
366
366
await clock . tickAsync ( ChildProcess . stopTimeout * 2 )
367
+ assert . ok ( cp . stopped , `Failed to stop process with id: ${ cp . pid ( ) } ` )
367
368
}
368
369
369
370
function startSleepProcess ( timeout : number = 90 ) {
@@ -405,7 +406,7 @@ describe('ChildProcessTracker', function () {
405
406
await clock . tickAsync ( ChildProcessTracker . pollingInterval )
406
407
assert . strictEqual ( tracker . has ( childProcess ) , false , 'process was not removed after stopping' )
407
408
} )
408
- for ( const _ of Array . from ( { length : 100 } ) ) {
409
+ for ( const _ of Array . from ( { length : 1000 } ) ) {
409
410
it ( 'multiple processes from same command are tracked seperately' , async function ( ) {
410
411
const childProcess1 = startSleepProcess ( )
411
412
const childProcess2 = startSleepProcess ( )
@@ -417,6 +418,10 @@ describe('ChildProcessTracker', function () {
417
418
418
419
await stopAndWait ( childProcess1 , clock )
419
420
await clock . tickAsync ( ChildProcessTracker . pollingInterval )
421
+ if ( tracker . has ( childProcess1 ) ) {
422
+ console . log ( 'process: %O' , childProcess1 )
423
+ console . log ( 'tracker: %O' , tracker )
424
+ }
420
425
assert . strictEqual ( tracker . has ( childProcess2 ) , true , 'second process was mistakenly removed' )
421
426
assert . strictEqual ( tracker . has ( childProcess1 ) , false , 'first process was not removed after stopping it' )
422
427
} )
0 commit comments