@@ -331,6 +331,13 @@ describe("BatchCluster", function () {
331331 opts . healthCheckCommand = "flaky 0.5" ; // fail half the time (ensure we get a proc end due to "unhealthy")
332332 }
333333
334+ // Expensive tests (recycling, recovery, multi-line,
335+ // multi-process) only run on critical config combos.
336+ // minDelayBetweenSpawnMillis and ignoreExit don't change
337+ // recycling or recovery code paths.
338+ const runExpensiveTests =
339+ minDelayBetweenSpawnMillis === 0 && ignoreExit === true ;
340+
334341 // failrate needs to be high enough to trigger but low enough to allow
335342 // retries to succeed.
336343
@@ -347,7 +354,7 @@ describe("BatchCluster", function () {
347354 return ;
348355 } ) ;
349356
350- if ( maxProcs > 1 ) {
357+ if ( runExpensiveTests && maxProcs > 1 ) {
351358 it ( "completes work on multiple child processes" , async function ( ) {
352359 // Measure spawn time to set appropriate timeouts
353360 const baselineSpawnMs = await measureSpawnTime ( ) ;
@@ -428,6 +435,7 @@ describe("BatchCluster", function () {
428435 postAssertions ( ) ;
429436 } ) ;
430437
438+ if ( runExpensiveTests )
431439 it ( "calling .end() after running shuts down child procs" , async ( ) => {
432440 // This just warms up bc to make child procs:
433441 const iterations =
@@ -453,6 +461,7 @@ describe("BatchCluster", function () {
453461 postAssertions ( ) ;
454462 } ) ;
455463
464+ if ( runExpensiveTests )
456465 it (
457466 "runs a given batch process roughly " +
458467 opts . maxTasksPerProcess +
@@ -472,9 +481,9 @@ describe("BatchCluster", function () {
472481 const pids = bc . pids ( ) ;
473482 // Ensure enough iterations for statistical reliability:
474483 // With 60% fail rate, probability of zero failures = 0.4^N.
475- // 15 tasks gives 0.4^15 ≈ 0.00001 % chance of zero failures.
484+ // 10 tasks gives 0.4^10 ≈ 0.01 % chance of zero failures.
476485 const iters = Math . max (
477- 15 ,
486+ 10 ,
478487 Math . floor ( maxProcs * opts . maxTasksPerProcess * 1.5 ) ,
479488 ) ;
480489 results . push (
@@ -546,6 +555,7 @@ describe("BatchCluster", function () {
546555 } ,
547556 ) ;
548557
558+ if ( runExpensiveTests )
549559 it ( "recovers from invalid commands" , async function ( ) {
550560 this . slow ( 1 ) ;
551561 assertExpectedResults (
@@ -579,13 +589,7 @@ describe("BatchCluster", function () {
579589 const errorStr = convertErrorToString ( ea ) ;
580590 return ! errorStr . includes ( "EUNLUCKY" ) ;
581591 } ) ;
582- if (
583- maxProcs === 1 &&
584- ignoreExit === false &&
585- healthCheck === false
586- ) {
587- // We don't expect these to pass with this config:
588- } else if ( maxProcs === 1 && errorResults . length === 0 ) {
592+ if ( maxProcs === 1 && errorResults . length === 0 ) {
589593 console . warn ( "(all processes were unlucky)" ) ;
590594 return this . skip ( ) ;
591595 } else {
@@ -618,6 +622,7 @@ describe("BatchCluster", function () {
618622 postAssertions ( ) ;
619623 } ) ;
620624
625+ if ( runExpensiveTests )
621626 it ( "accepts single and multi-line responses" , async ( ) => {
622627 setFailRatePct ( 0 ) ;
623628 // Measure spawn time to set appropriate timeouts
@@ -732,7 +737,7 @@ describe("BatchCluster", function () {
732737 } ) ;
733738
734739 describe ( "maxProcs" , function ( ) {
735- const iters = 100 ;
740+ const iters = 50 ;
736741 const maxProcs = 10 ;
737742 const sleepTimeMs = 250 ;
738743 let bc : BatchCluster ;
0 commit comments