@@ -15,8 +15,12 @@ function processAlive(pid: number): boolean {
1515}
1616
1717// These probes are `bun -e` one-liners, so they never import project modules
18- // and finish in milliseconds. Stall windows are tiny (300-500ms) to keep the
19- // file fast while still exercising the watchdog's timing logic.
18+ // and finish in seconds. Stall windows are ~1.5s: under the `--parallel`
19+ // load this runner exists to enable, a delayed output tick can look like a
20+ // stall against a tighter window, so the window keeps several ticks of
21+ // scheduling headroom while a broken never-resetting timer still fires
22+ // mid-run (the tick test's total runtime exceeds the window).
23+ const TEST_STALL_MS = 1_500 ;
2024
2125describe ( "runWithWatchdog" , ( ) => {
2226 test ( "passes through a successful run without retrying" , async ( ) => {
@@ -48,15 +52,15 @@ describe("runWithWatchdog", () => {
4852 } ) ;
4953
5054 test ( "output resets the stall timer" , async ( ) => {
51- // Prints every 100ms for ~700ms against a 300ms stall window: a broken
52- // timer that never reset would fire on the second tick .
55+ // Prints every 250ms for ~2.5s against a 1.5s stall window: a broken
56+ // timer that never reset would fire mid-run .
5357 const result = await runWithWatchdog ( {
5458 command : process . execPath ,
5559 args : [
5660 "-e" ,
57- "for (let i = 0; i < 7 ; i++) { console.log('tick', i); await new Promise(r => setTimeout(r, 100 )); }" ,
61+ "for (let i = 0; i < 10 ; i++) { console.log('tick', i); await new Promise(r => setTimeout(r, 250 )); }" ,
5862 ] ,
59- stallMs : 300 ,
63+ stallMs : TEST_STALL_MS ,
6064 } ) ;
6165 expect ( result . exitCode ) . toBe ( 0 ) ;
6266 expect ( result . stalled ) . toBe ( false ) ;
@@ -79,7 +83,7 @@ describe("runWithWatchdog", () => {
7983 const result = await runWithWatchdog ( {
8084 command : process . execPath ,
8185 args : [ "-e" , code ] ,
82- stallMs : 300 ,
86+ stallMs : TEST_STALL_MS ,
8387 onStall : ( attempt , max ) => stalls . push ( [ attempt , max ] ) ,
8488 } ) ;
8589 expect ( result . exitCode ) . toBe ( 0 ) ;
@@ -93,7 +97,7 @@ describe("runWithWatchdog", () => {
9397 const result = await runWithWatchdog ( {
9498 command : process . execPath ,
9599 args : [ "-e" , "setTimeout(() => {}, 30_000)" ] ,
96- stallMs : 300 ,
100+ stallMs : TEST_STALL_MS ,
97101 attempts : 2 ,
98102 onStall : ( attempt , max ) => stalls . push ( [ attempt , max ] ) ,
99103 } ) ;
@@ -117,7 +121,7 @@ describe("runWithWatchdog", () => {
117121 const result = await runWithWatchdog ( {
118122 command : process . execPath ,
119123 args : [ "-e" , code ] ,
120- stallMs : 300 ,
124+ stallMs : TEST_STALL_MS ,
121125 attempts : 1 ,
122126 } ) ;
123127 expect ( result . exitCode ) . toBe ( 1 ) ;
0 commit comments