@@ -4855,7 +4855,7 @@ describe('[finding-5] batch rerun --wait: RequestTimeoutError during fan-out pol
48554855 autoHeal : false ,
48564856 autoHealExplicit : false ,
48574857 skipDependencies : false ,
4858- maxConcurrency : 1 ,
4858+ maxConcurrency : 1 ,
48594859 profile : 'default' ,
48604860 output : 'json' ,
48614861 debug : false
@@ -4870,12 +4870,9 @@ describe('[finding-5] batch rerun --wait: RequestTimeoutError during fan-out pol
48704870 ) . catch ( e => e ) ;
48714871
48724872 expect ( err ) . toMatchObject ( { exitCode : 7 } ) ;
4873- const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) as {
4874- accepted : Array < { testId : string ; runId : string ; status : string } > ;
4875- } ;
4873+ const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) ;
48764874 expect ( parsed . accepted ) . toHaveLength ( 2 ) ;
4877- expect ( parsed . accepted . map ( r => r . runId ) . sort ( ) ) . toEqual ( [ 'run_b1' , 'run_b2' ] ) ;
4878- expect ( parsed . accepted . every ( r => r . status === 'timeout' ) ) . toBe ( true ) ;
4875+ expect ( parsed . accepted . map ( ( r : any ) => r . runId ) . sort ( ) ) . toEqual ( [ 'run_b1' , 'run_b2' ] ) ;
48794876 } ) ;
48804877} ) ;
48814878
@@ -4885,39 +4882,20 @@ describe('[finding-5] batch rerun --wait: RequestTimeoutError during fan-out pol
48854882describe ( '[finding-4] single FE rerun --wait: TimeoutError writes partial JSON to stdout' , ( ) => {
48864883 it ( 'exit 7 AND stdout contains {runId, status:"running"} when --timeout polling deadline is exceeded' , async ( ) => {
48874884 const creds = makeCreds ( ) ;
4888- const rerunResp = makeFeRerunResp ( ) ;
4885+ const rerunResp = { runId : 'run_fe_01' , status : 'accepted' } ;
48894886
4890- let fetchCallCount = 0 ;
4891- const fetchImpl : typeof globalThis . fetch = async ( input , _init ) => {
4892- const url =
4893- typeof input === 'string'
4894- ? input
4895- : input instanceof URL
4896- ? input . toString ( )
4897- : ( input as { url : string } ) . url ;
4898- fetchCallCount ++ ;
4899- if ( url . includes ( '/tests/test_fe_01/runs/rerun' ) ) {
4900- return new Response ( JSON . stringify ( rerunResp ) , {
4901- status : 202 ,
4902- headers : { 'content-type' : 'application/json' } ,
4903- } ) ;
4887+ const fetchImpl : any = async ( input : any ) => {
4888+ const url = typeof input === 'string' ? input : input . url ;
4889+ if ( url . includes ( '/runs/rerun' ) ) {
4890+ return new Response ( JSON . stringify ( rerunResp ) , { status : 202 } ) ;
49044891 }
49054892 if ( url . includes ( '/runs/' ) ) {
4906- const runningRun : RunResponse = {
4907- ...makeTerminalRun ( rerunResp . runId , 'passed' ) ,
4908- status : 'running' ,
4909- finishedAt : null ,
4910- } ;
4911- return new Response ( JSON . stringify ( runningRun ) , {
4912- status : 200 ,
4913- headers : { 'content-type' : 'application/json' } ,
4914- } ) ;
4893+ return new Response ( JSON . stringify ( { runId : rerunResp . runId , status : 'running' , finishedAt : null } ) , { status : 200 } ) ;
49154894 }
49164895 return new Response ( JSON . stringify ( { error : { code : 'NOT_FOUND' } } ) , { status : 404 } ) ;
49174896 } ;
49184897
49194898 const stdoutLines : string [ ] = [ ] ;
4920-
49214899 const err = await runTestRerun (
49224900 {
49234901 testIds : [ 'test_fe_01' ] ,
@@ -4930,25 +4908,20 @@ describe('[finding-4] single FE rerun --wait: TimeoutError writes partial JSON t
49304908 maxConcurrency : 10 ,
49314909 output : 'json' ,
49324910 profile : 'default' ,
4933- dryRun : false ,
4934- debug : false ,
4935- verbose : false ,
4911+ debug : false
49364912 } ,
49374913 {
49384914 ...creds ,
49394915 sleep : instantSleep ,
49404916 fetchImpl : fetchImpl as unknown as FetchImpl ,
49414917 stdout : line => stdoutLines . push ( line ) ,
4942- stderr : ( ) => undefined ,
4943- } ,
4918+ stderr : ( ) => undefined
4919+ }
49444920 ) . catch ( e => e ) ;
49454921
49464922 expect ( err ) . toMatchObject ( { exitCode : 7 } ) ;
4947- expect ( stdoutLines . length ) . toBeGreaterThan ( 0 ) ;
4948- const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) as { runId : string ; status : string } ;
4923+ const parsed = JSON . parse ( stdoutLines . join ( '\n' ) ) ;
49494924 expect ( parsed . runId ) . toBe ( rerunResp . runId ) ;
49504925 expect ( parsed . status ) . toBe ( 'running' ) ;
4951-
4952- void fetchCallCount ;
49534926 } ) ;
4954- } ) ;
4927+ } ) ;
0 commit comments