@@ -67,14 +67,28 @@ describe("check gate", () => {
6767 } ) ;
6868
6969 test ( "CI test shards cover exactly the suite's paths" , ( ) => {
70- // Sharding must never silently drop part of the suite: the union of the
71- // matrix shards has to equal the unsharded `test` script's paths.
72- const shardPaths = [ ... ci . matchAll ( / ^ \s + p a t h s : ( . + ) $ / gm ) ]
73- . flatMap ( ( match ) => match [ 1 ] ?. trim ( ) . split ( / \s + / ) ?? [ ] )
74- . sort ( ) ;
70+ // Time-balanced --shard slices each run the full union (bun splits by
71+ // file, balanced by --timings), so coverage holds when the matrix has
72+ // all four slices and the shard command template carries the suite's
73+ // paths plus the interpolated --shard flag. Sharding must never
74+ // silently drop part of the suite.
7575 const suitePaths = TEST_SUITE . split ( " " )
7676 . filter ( ( part ) => part . startsWith ( "./" ) )
7777 . sort ( ) ;
78- expect ( shardPaths ) . toEqual ( suitePaths ) ;
78+ for ( const shard of [ "1/4" , "2/4" , "3/4" , "4/4" ] ) {
79+ expect ( ci ) . toContain ( `"${ shard } "` ) ;
80+ }
81+ const runArgs = [
82+ ...ci . matchAll ( / ^ \s * r u n : b u n r u n c h e c k : p r o j e c t s - d i r - g u a r d ( .+ ) $ / gm) ,
83+ ]
84+ . map ( ( match ) => match [ 1 ] ?? "" )
85+ . find ( ( args ) => args . includes ( "--shard=${{ matrix.shard }}" ) ) ;
86+ expect ( runArgs ) . toBeDefined ( ) ;
87+ const runPaths = ( runArgs ?? "" )
88+ . split ( / \s + / )
89+ . filter ( ( part ) => part . startsWith ( "./" ) )
90+ . sort ( ) ;
91+ expect ( runPaths ) . toEqual ( suitePaths ) ;
92+ expect ( runArgs ) . toContain ( "--timings=./scripts/ci-timings.json" ) ;
7993 } ) ;
8094} ) ;
0 commit comments