@@ -394,23 +394,24 @@ describe('ChildProcessTracker', function () {
394
394
await clock . tickAsync ( ChildProcessTracker . pollingInterval )
395
395
assert . strictEqual ( tracker . has ( childProcess ) , false , 'process was not removed after stopping' )
396
396
} )
397
-
398
- it ( 'multiple processes from same command are tracked seperately' , async function ( ) {
399
- const childProcess1 = new ChildProcess ( getSleepCmd ( ) , [ '90' ] )
400
- const childProcess2 = new ChildProcess ( getSleepCmd ( ) , [ '90' ] )
401
- childProcess1 . run ( ) . catch ( ( ) => assert . fail ( 'sleep command threw an error' ) )
402
- childProcess2 . run ( ) . catch ( ( ) => assert . fail ( 'sleep command threw an error' ) )
403
- tracker . add ( childProcess1 )
404
- tracker . add ( childProcess2 )
405
-
406
- assert . strictEqual ( tracker . has ( childProcess1 ) , true , 'Missing first process' )
407
- assert . strictEqual ( tracker . has ( childProcess2 ) , true , 'Missing second process' )
408
-
409
- childProcess1 . stop ( )
410
- await clock . tickAsync ( ChildProcessTracker . pollingInterval )
411
- assert . strictEqual ( tracker . has ( childProcess2 ) , true , 'first process was not removed after stopping it' )
412
- assert . strictEqual ( tracker . size ( ) , 1 )
413
- } )
397
+ for ( const _ of Array . from ( { length : 1000 } ) ) {
398
+ it ( 'multiple processes from same command are tracked seperately' , async function ( ) {
399
+ const childProcess1 = new ChildProcess ( getSleepCmd ( ) , [ '90' ] )
400
+ const childProcess2 = new ChildProcess ( getSleepCmd ( ) , [ '90' ] )
401
+ childProcess1 . run ( ) . catch ( ( ) => assert . fail ( 'sleep command threw an error' ) )
402
+ childProcess2 . run ( ) . catch ( ( ) => assert . fail ( 'sleep command threw an error' ) )
403
+ tracker . add ( childProcess1 )
404
+ tracker . add ( childProcess2 )
405
+
406
+ assert . strictEqual ( tracker . has ( childProcess1 ) , true , 'Missing first process' )
407
+ assert . strictEqual ( tracker . has ( childProcess2 ) , true , 'Missing second process' )
408
+
409
+ childProcess1 . stop ( )
410
+ await clock . tickAsync ( ChildProcessTracker . pollingInterval )
411
+ assert . strictEqual ( tracker . has ( childProcess2 ) , true , 'second process was mistakenly removed' )
412
+ assert . strictEqual ( tracker . has ( childProcess1 ) , false , 'first process was not removed after stopping it' )
413
+ } )
414
+ }
414
415
415
416
it ( 'logs a warning message when system usage exceeds threshold' , async function ( ) {
416
417
const childProcess = new ChildProcess ( getSleepCmd ( ) , [ '90' ] )
0 commit comments