@@ -40,9 +40,15 @@ import {
4040} from "../vitest/vitest.contracts-shared.ts" ;
4141
4242const normalizeRepoPath = toRepoPath ;
43+ const CODEX_TEST_PROCESS_FILE_LIMIT = 40 ;
4344const MATRIX_TEST_PROCESS_FILE_LIMIT = 40 ;
4445const TELEGRAM_TEST_PROCESS_FILE_LIMIT = 1 ;
4546
47+ function expectedCodexTestProcessCount ( ) {
48+ const testFileCount = listExtensionTestFilesForRoots ( [ "extensions/codex" ] ) . length ;
49+ return Math . max ( 1 , Math . ceil ( testFileCount / CODEX_TEST_PROCESS_FILE_LIMIT ) ) ;
50+ }
51+
4652function expectedMatrixTestProcessCount ( ) {
4753 const testFileCount = listExtensionTestFilesForRoots ( [ "extensions/matrix" ] ) . length ;
4854 return Math . max ( 1 , Math . ceil ( testFileCount / MATRIX_TEST_PROCESS_FILE_LIMIT ) ) ;
@@ -54,9 +60,11 @@ function expectedTelegramTestProcessCount() {
5460}
5561
5662function listExpectedFullExtensionRunPlans ( ) {
63+ const codexConfig = "test/vitest/vitest.extension-codex.config.ts" ;
5764 const matrixConfig = "test/vitest/vitest.extension-matrix.config.ts" ;
5865 const telegramConfig = "test/vitest/vitest.extension-telegram.config.ts" ;
5966 const boundedPlansByConfig = new Map ( [
67+ [ codexConfig , buildVitestRunPlans ( [ "extensions/codex" ] , process . cwd ( ) ) ] ,
6068 [ matrixConfig , buildVitestRunPlans ( [ "extensions/matrix" ] , process . cwd ( ) ) ] ,
6169 [ telegramConfig , buildVitestRunPlans ( [ "extensions/telegram" ] , process . cwd ( ) ) ] ,
6270 ] ) ;
@@ -2105,12 +2113,13 @@ describe("scripts/test-projects changed-target routing", () => {
21052113 } ) ;
21062114
21072115 it ( "routes the top-level extensions target to every extension shard" , ( ) => {
2116+ const codexConfig = "test/vitest/vitest.extension-codex.config.ts" ;
21082117 const matrixConfig = "test/vitest/vitest.extension-matrix.config.ts" ;
21092118 const telegramConfig = "test/vitest/vitest.extension-telegram.config.ts" ;
21102119 const plans = buildVitestRunPlans ( [ "extensions" ] , process . cwd ( ) ) ;
21112120 const matrixPlans = plans . filter ( ( plan ) => plan . config === matrixConfig ) ;
21122121 const telegramPlans = plans . filter ( ( plan ) => plan . config === telegramConfig ) ;
2113- const boundedConfigs = new Set ( [ matrixConfig , telegramConfig ] ) ;
2122+ const boundedConfigs = new Set ( [ codexConfig , matrixConfig , telegramConfig ] ) ;
21142123
21152124 expect ( plans . filter ( ( plan ) => ! boundedConfigs . has ( plan . config ) ) ) . toEqual (
21162125 listFullExtensionVitestProjectConfigs ( )
@@ -2253,6 +2262,37 @@ describe("scripts/test-projects changed-target routing", () => {
22532262 ) ;
22542263 } ) ;
22552264
2265+ it ( "bounds an explicit Codex directory target across process lifetimes" , ( ) => {
2266+ const config = "test/vitest/vitest.extension-codex.config.ts" ;
2267+ const plans = buildVitestRunPlans ( [ "extensions/codex" ] , process . cwd ( ) ) ;
2268+
2269+ expect ( plans . length ) . toBeGreaterThan ( 1 ) ;
2270+ expect ( plans ) . toHaveLength ( expectedCodexTestProcessCount ( ) ) ;
2271+ expect ( plans . every ( ( plan ) => plan . config === config ) ) . toBe ( true ) ;
2272+ expect (
2273+ plans . every ( ( plan ) => ( plan . includePatterns ?. length ?? 0 ) <= CODEX_TEST_PROCESS_FILE_LIMIT ) ,
2274+ ) . toBe ( true ) ;
2275+ expect ( plans . flatMap ( ( plan ) => plan . includePatterns ?? [ ] ) ) . toEqual (
2276+ listExtensionTestFilesForRoots ( [ "extensions/codex" ] ) ,
2277+ ) ;
2278+ } ) ;
2279+
2280+ it ( "keeps an explicit Codex file target in one process" , ( ) => {
2281+ const testFile = listExtensionTestFilesForRoots ( [ "extensions/codex" ] ) [ 0 ] ;
2282+ if ( ! testFile ) {
2283+ throw new Error ( "expected a Codex test fixture" ) ;
2284+ }
2285+
2286+ expect ( buildVitestRunPlans ( [ testFile ] , process . cwd ( ) ) ) . toEqual ( [
2287+ {
2288+ config : "test/vitest/vitest.extension-codex.config.ts" ,
2289+ forwardedArgs : [ ] ,
2290+ includePatterns : [ testFile ] ,
2291+ watchMode : false ,
2292+ } ,
2293+ ] ) ;
2294+ } ) ;
2295+
22562296 it ( "keeps grouped Matrix targets covered when bounding the directory" , ( ) => {
22572297 const testFile = listExtensionTestFilesForRoots ( [ "extensions/matrix" ] ) [ 0 ] ;
22582298 if ( ! testFile ) {
0 commit comments