@@ -4819,6 +4819,48 @@ describe('rerun --wait — dashboardUrl on terminal output', () => {
48194819 } ) ;
48204820} ) ;
48214821
4822+ // ---------------------------------------------------------------------------
4823+ // Batch --all --wait fan-out: RequestTimeoutError must not leave stdout empty
4824+ // ---------------------------------------------------------------------------
4825+ describe ( '[finding-5] batch rerun --wait: RequestTimeoutError during fan-out poll writes JSON stdout + exit 7' , ( ) => {
4826+ it ( 'stdout contains accepted[] with runIds when member polls throw RequestTimeoutError' , async ( ) => {
4827+ const batchResp : BatchRerunResponse = {
4828+ accepted : [
4829+ { testId : 'test_1' , runId : 'run_b1' , enqueuedAt : '2026-06-03T10:00:00.000Z' } ,
4830+ { testId : 'test_2' , runId : 'run_b2' , enqueuedAt : '2026-06-03T10:00:00.000Z' } ,
4831+ ] ,
4832+ deferred : [ ] ,
4833+ conflicts : [ ] ,
4834+ closure : { byProject : [ ] } ,
4835+ } ;
4836+
4837+ const fetchImpl = makeFetch ( url => {
4838+ if ( url . includes ( '/tests/batch/rerun' ) ) {
4839+ return { status : 202 , body : batchResp } ;
4840+ }
4841+ if ( url . includes ( '/runs/' ) ) {
4842+ throw new RequestTimeoutError ( 120000 , 'req_timeout_batch_rerun' ) ;
4843+ }
4844+ return errorBody ( 'NOT_FOUND' ) ;
4845+ } ) ;
4846+
4847+ const stdoutLines : string [ ] = [ ] ;
4848+ const err = await runTestRerun (
4849+ { testIds : [ 'test_1' , 'test_2' ] , all : false , wait : true , timeoutSeconds : 60 , autoHeal : false , autoHealExplicit : false , skipDependencies : false } ,
4850+ fetchImpl ,
4851+ ( line ) => stdoutLines . push ( line )
4852+ ) ;
4853+
4854+ expect ( err ) . toMatchObject ( { exitCode : 7 } ) ;
4855+ const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) as {
4856+ accepted : Array < { testId : string ; runId : string ; status : string } > ;
4857+ } ;
4858+ expect ( parsed . accepted ) . toHaveLength ( 2 ) ;
4859+ expect ( parsed . accepted . map ( r => r . runId ) . sort ( ) ) . toEqual ( [ 'run_b1' , 'run_b2' ] ) ;
4860+ expect ( parsed . accepted . every ( r => r . status === 'timeout' ) ) . toBe ( true ) ;
4861+ } ) ;
4862+ } ) ;
4863+
48224864// ---------------------------------------------------------------------------
48234865// TimeoutError on single FE rerun --wait: partial stdout + exit 7
48244866// ---------------------------------------------------------------------------
0 commit comments