@@ -2631,6 +2631,130 @@ describe("scripts/test-projects changed-target routing", () => {
26312631 } ,
26322632 ) ;
26332633
2634+ it . each ( [
2635+ [ "src/agents/agent-scope.test.ts" , "test/vitest/vitest.agents-core.config.ts" ] ,
2636+ [
2637+ "src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts" ,
2638+ "test/vitest/vitest.agents-embedded-agent.config.ts" ,
2639+ ] ,
2640+ [
2641+ "src/agents/embedded-agent-runner/run.incomplete-turn.test.ts" ,
2642+ "test/vitest/vitest.agents-embedded-agent-incomplete-turn.config.ts" ,
2643+ ] ,
2644+ [
2645+ "src/agents/embedded-agent-runner/run.overflow-compaction.test.ts" ,
2646+ "test/vitest/vitest.agents-embedded-agent-overflow-compaction.config.ts" ,
2647+ ] ,
2648+ [
2649+ "src/agents/embedded-agent-runner/run/attempt.abort-race.test.ts" ,
2650+ "test/vitest/vitest.agents-embedded-agent-run.config.ts" ,
2651+ ] ,
2652+ [ "src/agents/runtime-plan/tools.test.ts" , "test/vitest/vitest.agents-support.config.ts" ] ,
2653+ [ "src/agents/tools/cron-tool.pacing.test.ts" , "test/vitest/vitest.agents-tools.config.ts" ] ,
2654+ ] ) ( "routes focused agent test %s to its owning shard" , ( testFile , config ) => {
2655+ expect ( buildVitestRunPlans ( [ testFile ] ) ) . toEqual ( [
2656+ {
2657+ config,
2658+ forwardedArgs : [ ] ,
2659+ includePatterns : [ testFile ] ,
2660+ watchMode : false ,
2661+ } ,
2662+ ] ) ;
2663+ } ) ;
2664+
2665+ it . each ( [
2666+ [
2667+ "src/agents/embedded-agent-runner/run" ,
2668+ "test/vitest/vitest.agents-embedded-agent-run.config.ts" ,
2669+ ] ,
2670+ [ "src/agents/runtime-plan" , "test/vitest/vitest.agents-support.config.ts" ] ,
2671+ [ "src/agents/tools" , "test/vitest/vitest.agents-tools.config.ts" ] ,
2672+ ] ) ( "routes focused agent directory %s to its owning shard" , ( directory , config ) => {
2673+ const plans = buildVitestRunPlans ( [ directory ] ) ;
2674+
2675+ expect ( plans ) . toEqual (
2676+ expect . arrayContaining ( [
2677+ {
2678+ config,
2679+ forwardedArgs : [ ] ,
2680+ includePatterns : [ `${ directory } /**/*.test.ts` ] ,
2681+ watchMode : false ,
2682+ } ,
2683+ ] ) ,
2684+ ) ;
2685+ expect ( plans . map ( ( plan ) => plan . config ) ) . not . toContain (
2686+ "test/vitest/vitest.agents-core.config.ts" ,
2687+ ) ;
2688+ } ) ;
2689+
2690+ it ( "splits the embedded-agent parent directory across every isolated harness" , ( ) => {
2691+ const root = "src/agents/embedded-agent-runner" ;
2692+ const plans = buildVitestRunPlans ( [ root ] ) ;
2693+
2694+ expect ( plans ) . toEqual (
2695+ expect . arrayContaining ( [
2696+ {
2697+ config : "test/vitest/vitest.agents-embedded-agent.config.ts" ,
2698+ forwardedArgs : [ ] ,
2699+ includePatterns : [ `${ root } /*.test.ts` ] ,
2700+ watchMode : false ,
2701+ } ,
2702+ {
2703+ config : "test/vitest/vitest.agents-embedded-agent-incomplete-turn.config.ts" ,
2704+ forwardedArgs : [ ] ,
2705+ includePatterns : [ `${ root } /run.incomplete-turn.test.ts` ] ,
2706+ watchMode : false ,
2707+ } ,
2708+ {
2709+ config : "test/vitest/vitest.agents-embedded-agent-overflow-compaction.config.ts" ,
2710+ forwardedArgs : [ ] ,
2711+ includePatterns : [ `${ root } /run.overflow-compaction.test.ts` ] ,
2712+ watchMode : false ,
2713+ } ,
2714+ {
2715+ config : "test/vitest/vitest.agents-embedded-agent-run.config.ts" ,
2716+ forwardedArgs : [ ] ,
2717+ includePatterns : [ `${ root } /run/**/*.test.ts` ] ,
2718+ watchMode : false ,
2719+ } ,
2720+ ] ) ,
2721+ ) ;
2722+ expect ( plans . map ( ( plan ) => plan . config ) ) . not . toContain ( "test/vitest/vitest.agents.config.ts" ) ;
2723+ } ) ;
2724+
2725+ it ( "keeps the broad agent test glob in the all-agents shard" , ( ) => {
2726+ const target = "src/agents/**/*.test.ts" ;
2727+
2728+ expect ( buildVitestRunPlans ( [ target ] ) ) . toEqual ( [
2729+ {
2730+ config : "test/vitest/vitest.agents.config.ts" ,
2731+ forwardedArgs : [ ] ,
2732+ includePatterns : [ target ] ,
2733+ watchMode : false ,
2734+ } ,
2735+ ] ) ;
2736+ } ) ;
2737+
2738+ it ( "keeps mixed embedded-agent and cron-tool targets in their owning shards" , ( ) => {
2739+ const embeddedTest = "src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts" ;
2740+ const cronToolTest = "src/agents/tools/cron-tool.pacing.test.ts" ;
2741+
2742+ expect ( buildVitestRunPlans ( [ embeddedTest , cronToolTest ] ) ) . toEqual ( [
2743+ {
2744+ config : "test/vitest/vitest.agents-embedded-agent.config.ts" ,
2745+ forwardedArgs : [ ] ,
2746+ includePatterns : [ embeddedTest ] ,
2747+ watchMode : false ,
2748+ } ,
2749+ {
2750+ config : "test/vitest/vitest.agents-tools.config.ts" ,
2751+ forwardedArgs : [ ] ,
2752+ includePatterns : [ cronToolTest ] ,
2753+ watchMode : false ,
2754+ } ,
2755+ ] ) ;
2756+ } ) ;
2757+
26342758 it ( "routes Docker E2E script targets to their owner tooling tests" , ( ) => {
26352759 const targets = [
26362760 "scripts/e2e/kitchen-sink-plugin-docker.sh" ,
0 commit comments