@@ -174,6 +174,15 @@ export const comparisonBase = Effect.fn("checkChanged.comparisonBase")(function*
174174
175175const CODE = / \. [ c m ] ? [ j t ] s x ? $ / ;
176176const TEST = / \. t e s t \. [ c m ] ? [ j t ] s x ? $ / ;
177+ // CI runs the .github/scripts tests with `node --test`; vitest passes a failing node:test file.
178+ const NODE_TEST = / ^ \. g i t h u b [ / \\ ] s c r i p t s [ / \\ ] / ;
179+ export const splitTests = ( tests : Iterable < string > ) => {
180+ const all = [ ...tests ] ;
181+ return {
182+ vitestTests : all . filter ( ( file ) => ! NODE_TEST . test ( file ) ) ,
183+ nodeTests : all . filter ( ( file ) => NODE_TEST . test ( file ) ) ,
184+ } ;
185+ } ;
177186const escapeRegExp = ( text : string ) => text . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, "\\$&" ) ;
178187
179188// A flag wins over its environment variable; either must be a positive integer.
@@ -319,6 +328,7 @@ const checkChanged = Effect.fn("checkChanged")(function* (input: {
319328 for ( const test of docReaderTests ( files ) ) tests . add ( test ) ;
320329 // It reads files other than the ones beside it, so no changed file selects it.
321330 if ( affected . includes ( "t3" ) ) tests . add ( "apps/server/src/provider/AgentContextBudget.test.ts" ) ;
331+ const { vitestTests, nodeTests } = splitTests ( tests ) ;
322332
323333 // React Compiler coverage compiles every client source file, so run only the
324334 // changed files' cases, in one extra step: a -t filter in the main test step
@@ -485,19 +495,29 @@ const checkChanged = Effect.fn("checkChanged")(function* (input: {
485495 ]
486496 : [ ] ) ,
487497 // From the repo root, the root vite.config.ts hands each file to its package's config.
488- ...( tests . size > 0
498+ ...( vitestTests . length > 0
489499 ? [
490500 {
491- ...command ( `test (${ tests . size } files)` , [
501+ ...command ( `test (${ vitestTests . length } files)` , [
492502 "test" ,
493503 "run" ,
494504 "--passWithNoTests" ,
495- ...tests ,
505+ ...vitestTests ,
496506 ] ) ,
497507 serial : true ,
498508 } ,
499509 ]
500510 : [ ] ) ,
511+ ...( nodeTests . length > 0
512+ ? [
513+ command ( `node --test (${ nodeTests . length } files)` , [
514+ "exec" ,
515+ "node" ,
516+ "--test" ,
517+ ...nodeTests ,
518+ ] ) ,
519+ ]
520+ : [ ] ) ,
501521 ...( compilerApps . length > 0
502522 ? [
503523 {
0 commit comments