@@ -12,6 +12,7 @@ import fs from 'node:fs';
1212import path from 'node:path' ;
1313import { runCmdStreaming , runCmdSync } from '../../src/utils/exec.ts' ;
1414import { parseScriptArgs } from './cli-args.ts' ;
15+ import { firstRunArgs , retryRunArgs , type RunModes } from './contention-retry-args.ts' ;
1516import { runWithContentionRetry , type TestRun } from './contention-retry-lane.ts' ;
1617import { FAILURE_FILE_ENV } from './contention-retry-reporter.ts' ;
1718import { RUNNER_TIMEOUT_TOKEN_ENV } from './runner-timeout-meta.ts' ;
@@ -95,6 +96,7 @@ function configHash(): string {
9596 for ( const file of [
9697 'vitest.config.ts' ,
9798 'scripts/lib/contention-retry.ts' ,
99+ 'scripts/lib/contention-retry-args.ts' ,
98100 'scripts/lib/contention-retry-reporter.ts' ,
99101 'scripts/lib/contention-retry-blockers.ts' ,
100102 'scripts/lib/run-blocker-bus.ts' ,
@@ -105,16 +107,19 @@ function configHash(): string {
105107 return `sha256:${ hash . digest ( 'hex' ) . slice ( 0 , 16 ) } ` ;
106108}
107109
108- const projects = ( args . project ?? '' )
109- . split ( ',' )
110- . map ( ( entry ) => entry . trim ( ) )
111- . filter ( Boolean )
112- . flatMap ( ( name ) => [ '--project' , name ] ) ;
110+ const modes : RunModes = {
111+ projects : ( args . project ?? '' )
112+ . split ( ',' )
113+ . map ( ( entry ) => entry . trim ( ) )
114+ . filter ( Boolean ) ,
115+ coverage : args . coverage ,
116+ } ;
113117
114118const startedAtMs = Date . now ( ) ;
115119const result = await runWithContentionRetry ( {
116- runAll : ( ) => runVitest ( [ ...projects , ...( args . coverage ? [ '--coverage' ] : [ ] ) ] , reportPath ) ,
117- runFiles : ( files ) => runVitest ( [ ...files ] , reportPath . replace ( / \. j s o n $ / , '.retry.json' ) ) ,
120+ runAll : ( ) => runVitest ( firstRunArgs ( modes ) , reportPath ) ,
121+ runFiles : ( files ) =>
122+ runVitest ( retryRunArgs ( modes , files ) , reportPath . replace ( / \. j s o n $ / , '.retry.json' ) ) ,
118123 commit : runCmdSync ( 'git' , [ 'rev-parse' , 'HEAD' ] , { cwd : repoRoot } ) . stdout . trim ( ) ,
119124 configHash : configHash ( ) ,
120125 vitestVersion : vitestVersion ( ) ,
0 commit comments