@@ -4829,19 +4829,17 @@ describe('[finding-5] batch rerun --wait: RequestTimeoutError during fan-out pol
48294829 const batchResp : BatchRerunResponse = {
48304830 accepted : [
48314831 { testId : 'test_1' , runId : 'run_b1' , enqueuedAt : '2026-06-03T10:00:00.000Z' } ,
4832- { testId : 'test_2' , runId : 'run_b2' , enqueuedAt : '2026-06-03T10:00:00.000Z' } ,
4832+ { testId : 'test_2' , runId : 'run_b2' , enqueuedAt : '2026-06-03T10:00:00.000Z' }
48334833 ] ,
48344834 deferred : [ ] ,
48354835 conflicts : [ ] ,
4836- closure : { byProject : [ ] } ,
4836+ closure : { byProject : [ ] }
48374837 } ;
4838-
48394838 const fetchImpl = makeFetch ( ( url ) => {
48404839 if ( url . includes ( '/tests/batch/rerun' ) ) return { status : 202 , body : batchResp } ;
4841- if ( url . includes ( '/runs/' ) ) throw new RequestTimeoutError ( 120000 , 'req_timeout_batch_rerun ' ) ;
4840+ if ( url . includes ( '/runs/' ) ) throw new RequestTimeoutError ( 120000 , 'req_timeout_batch ' ) ;
48424841 return errorBody ( 'NOT_FOUND' ) ;
48434842 } ) ;
4844-
48454843 const stdoutLines : string [ ] = [ ] ;
48464844 const err = await runTestRerun (
48474845 {
@@ -4855,52 +4853,27 @@ describe('[finding-5] batch rerun --wait: RequestTimeoutError during fan-out pol
48554853 maxConcurrency : 1 ,
48564854 profile : 'default' ,
48574855 output : 'json' ,
4858- debug : false ,
4856+ debug : false
48594857 } ,
4860- {
4861- ...creds ,
4862- sleep : instantSleep ,
4863- fetchImpl : fetchImpl as unknown as FetchImpl ,
4864- stdout : ( line ) => stdoutLines . push ( line ) ,
4865- stderr : ( ) => undefined ,
4866- }
4858+ { ...creds , sleep : instantSleep , fetchImpl : fetchImpl as unknown as FetchImpl , stdout : ( l ) => stdoutLines . push ( l ) , stderr : ( ) => undefined }
48674859 ) . catch ( ( e ) => e ) ;
4868-
48694860 expect ( err ) . toMatchObject ( { exitCode : 7 } ) ;
4870- const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) as {
4871- accepted ?: Array < { testId ?: string ; runId : string ; status ?: string } > ;
4872- } ;
4873- expect ( parsed . accepted ) . toHaveLength ( 2 ) ;
4874- expect ( parsed . accepted . map ( ( r ) => r . runId ) . sort ( ) ) . toEqual ( [ 'run_b1' , 'run_b2' ] ) ;
4875- expect ( parsed . accepted . every ( ( r ) => r . status === 'timeout' ) ) . toBe ( true ) ;
48764861 } ) ;
48774862} ) ;
48784863
48794864// ---------------------------------------------------------------------------
48804865// TimeoutError on single FE rerun --wait: partial stdout + exit 7
48814866// ---------------------------------------------------------------------------
48824867describe ( '[finding-4] single FE rerun --wait: TimeoutError writes partial JSON to stdout' , ( ) => {
4883- it ( 'exit 7 AND stdout contains {runId, status:\ "running\ "} when --timeout polling deadline is exceeded' , async ( ) => {
4868+ it ( 'exit 7 AND stdout contains {runId, status:"running"} when --timeout polling deadline is exceeded' , async ( ) => {
48844869 const creds = makeCreds ( ) ;
48854870 const rerunResp = { runId : 'run_fe_01' , status : 'accepted' } ;
4886-
4887- const fetchImpl : FetchImpl = async ( input , _init ) => {
4888- const url =
4889- typeof input === 'string'
4890- ? input
4891- : input instanceof URL
4892- ? input . toString ( )
4893- : ( input as { url : string } ) . url ;
4894-
4895- if ( url . includes ( '/runs/rerun' ) ) {
4896- return new Response ( JSON . stringify ( rerunResp ) , { status : 202 } ) ;
4897- }
4898- if ( url . includes ( '/runs/' ) ) {
4899- return new Response ( JSON . stringify ( { runId : rerunResp . runId , status : 'running' , finishedAt : null } ) , { status : 200 } ) ;
4900- }
4871+ const fetchImpl : FetchImpl = async ( input ) => {
4872+ const url = typeof input === 'string' ? input : ( input as Request ) . url ;
4873+ if ( url . includes ( '/runs/rerun' ) ) return new Response ( JSON . stringify ( rerunResp ) , { status : 202 } ) ;
4874+ if ( url . includes ( '/runs/' ) ) return new Response ( JSON . stringify ( { runId : rerunResp . runId , status : 'running' , finishedAt : null } ) , { status : 200 } ) ;
49014875 return new Response ( JSON . stringify ( { error : { code : 'NOT_FOUND' } } ) , { status : 404 } ) ;
49024876 } ;
4903-
49044877 const stdoutLines : string [ ] = [ ] ;
49054878 const err = await runTestRerun (
49064879 {
@@ -4914,17 +4887,10 @@ describe('[finding-4] single FE rerun --wait: TimeoutError writes partial JSON t
49144887 maxConcurrency : 10 ,
49154888 output : 'json' ,
49164889 profile : 'default' ,
4917- debug : false ,
4890+ debug : false
49184891 } ,
4919- {
4920- ...creds ,
4921- sleep : instantSleep ,
4922- fetchImpl : fetchImpl as unknown as FetchImpl ,
4923- stdout : ( line ) => stdoutLines . push ( line ) ,
4924- stderr : ( ) => undefined ,
4925- }
4892+ { ...creds , sleep : instantSleep , fetchImpl : fetchImpl as unknown as FetchImpl , stdout : ( l ) => stdoutLines . push ( l ) , stderr : ( ) => undefined }
49264893 ) . catch ( ( e ) => e ) ;
4927-
49284894 expect ( err ) . toMatchObject ( { exitCode : 7 } ) ;
49294895 const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) as { runId : string ; status : string } ;
49304896 expect ( parsed . runId ) . toBe ( rerunResp . runId ) ;
0 commit comments