fix(regression): route contract paths through test wrapper

This commit is contained in:
Tak Hoffman
2026-03-27 19:16:10 -05:00
parent 67fba9c5e1
commit 27decb9649
3 changed files with 34 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { isUnitConfigTestFile } from "../../vitest.unit-paths.mjs";
import { dedupeFilesPreserveOrder, loadTestRunnerBehavior } from "../test-runner-manifest.mjs";
const baseConfigPrefixes = ["src/agents/", "src/auto-reply/", "src/commands/", "test/", "ui/"];
const contractTestPrefixes = ["src/channels/plugins/contracts/", "src/plugins/contracts/"];
export const normalizeRepoPath = (value) => value.split(path.sep).join("/");
@@ -96,6 +97,8 @@ export function loadTestCatalog() {
let surface = "base";
if (isUnitConfigTestFile(normalizedFile)) {
surface = "unit";
} else if (contractTestPrefixes.some((prefix) => normalizedFile.startsWith(prefix))) {
surface = "contracts";
} else if (normalizedFile.endsWith(".live.test.ts")) {
surface = "live";
} else if (normalizedFile.endsWith(".e2e.test.ts")) {
@@ -185,4 +188,13 @@ export function loadTestCatalog() {
};
}
export const testSurfaces = ["unit", "extensions", "channels", "gateway", "live", "e2e", "base"];
export const testSurfaces = [
"unit",
"extensions",
"channels",
"contracts",
"gateway",
"live",
"e2e",
"base",
];

View File

@@ -782,6 +782,16 @@ const createTargetedUnit = (context, classification, filters) => {
...filters,
];
}
if (owner === "contracts") {
return [
"vitest",
"run",
"--config",
"vitest.contracts.config.ts",
...context.noIsolateArgs,
...filters,
];
}
if (owner === "live") {
return [
"vitest",

View File

@@ -388,6 +388,17 @@ describe("scripts/test-parallel lane planning", () => {
expect(output).toContain("pool=forks");
});
it("routes targeted contract tests through the contracts config", () => {
const output = runPlannerPlan([
"--explain",
"src/channels/plugins/contracts/registry-backed.contract.test.ts",
]);
expect(output).toContain("surface=contracts");
expect(output).toContain("vitest.contracts.config.ts");
expect(output).not.toContain("vitest.unit.config.ts");
});
it("prints the planner-backed CI manifest as JSON", () => {
const output = runPlannerPlan(["--ci-manifest"], {
GITHUB_EVENT_NAME: "pull_request",