diff --git a/src/plugins/bundled-capability-runtime.test.ts b/src/plugins/bundled-capability-runtime.test.ts index 42adae5a6fe..67ee7b334b5 100644 --- a/src/plugins/bundled-capability-runtime.test.ts +++ b/src/plugins/bundled-capability-runtime.test.ts @@ -1,8 +1,5 @@ import { describe, expect, it } from "vitest"; -import { - buildVitestCapabilityShimAliasMap, - loadBundledCapabilityRuntimeRegistry, -} from "./bundled-capability-runtime.js"; +import { buildVitestCapabilityShimAliasMap } from "./bundled-capability-runtime.js"; describe("buildVitestCapabilityShimAliasMap", () => { it("keeps scoped and unscoped capability shim aliases aligned", () => { @@ -25,21 +22,3 @@ describe("buildVitestCapabilityShimAliasMap", () => { ); }); }); - -describe("loadBundledCapabilityRuntimeRegistry", () => { - it("captures bundled migration providers", () => { - const registry = loadBundledCapabilityRuntimeRegistry({ - pluginIds: ["migrate-hermes"], - pluginSdkResolution: "dist", - }); - - const record = registry.plugins.find((entry) => entry.id === "migrate-hermes"); - expect(record?.migrationProviderIds).toEqual(["hermes"]); - expect( - registry.migrationProviders.map((entry) => ({ - pluginId: entry.pluginId, - providerId: entry.provider.id, - })), - ).toEqual([{ pluginId: "migrate-hermes", providerId: "hermes" }]); - }); -}); diff --git a/test/vitest-unit-fast-config.test.ts b/test/vitest-unit-fast-config.test.ts index 7d7188143d9..a5860b0bf4b 100644 --- a/test/vitest-unit-fast-config.test.ts +++ b/test/vitest-unit-fast-config.test.ts @@ -6,6 +6,7 @@ import { collectBroadUnitFastTestCandidates, collectUnitFastTestCandidates, collectUnitFastTestFileAnalysis, + forcedUnitFastTestFiles, getUnitFastTestFiles, isUnitFastTestFile, resolveUnitFastTestIncludePattern, @@ -59,6 +60,19 @@ describe("unit-fast vitest lane", () => { ); }); + it("routes audited stateful-looking tests through the fast lane", () => { + const analysis = collectUnitFastTestFileAnalysis(); + const forcedAnalysis = analysis.filter((entry) => forcedUnitFastTestFiles.includes(entry.file)); + const unitFastTestFiles = getUnitFastTestFiles(); + + expect(forcedAnalysis).toHaveLength(forcedUnitFastTestFiles.length); + for (const file of forcedUnitFastTestFiles) { + expect(unitFastTestFiles).toContain(file); + expect(isUnitFastTestFile(file)).toBe(true); + } + expect(forcedAnalysis.every((entry) => entry.forced && entry.unitFast)).toBe(true); + }); + it("keeps broad audit candidates separate from automatically routed unit-fast tests", () => { const currentCandidates = collectUnitFastTestCandidates(); const broadCandidates = collectBroadUnitFastTestCandidates(); diff --git a/test/vitest/vitest.unit-fast-paths.mjs b/test/vitest/vitest.unit-fast-paths.mjs index 751aed4ea1c..a04bb28f52f 100644 --- a/test/vitest/vitest.unit-fast-paths.mjs +++ b/test/vitest/vitest.unit-fast-paths.mjs @@ -52,6 +52,15 @@ const unitFastCandidateGlobs = [ "src/wizard/**/*.test.ts", "test/**/*.test.ts", ]; +export const forcedUnitFastTestFiles = [ + "src/crestodian/overview.test.ts", + "src/flows/channel-setup.test.ts", + "src/memory-host-sdk/host/session-files.test.ts", + "src/node-host/invoke-system-run-plan.test.ts", + "src/node-host/invoke-system-run.test.ts", + "src/pairing/pairing-store.test.ts", +]; +const forcedUnitFastTestFileSet = new Set(forcedUnitFastTestFiles); const unitFastCandidateExactFiles = [...pluginSdkLightTestFiles, ...commandsLightTestFiles]; const broadUnitFastCandidateGlobs = [ "src/**/*.test.ts", @@ -171,9 +180,9 @@ export function collectUnitFastTestCandidates(cwd = process.cwd()) { matchesAnyGlob(file, unitFastCandidateGlobs) && !matchesAnyGlob(file, broadUnitFastCandidateSkipGlobs), ); - return [...new Set([...discovered, ...unitFastCandidateExactFiles])].toSorted((a, b) => - a.localeCompare(b), - ); + return [ + ...new Set([...discovered, ...unitFastCandidateExactFiles, ...forcedUnitFastTestFiles]), + ].toSorted((a, b) => a.localeCompare(b)); } export function collectBroadUnitFastTestCandidates(cwd = process.cwd()) { @@ -185,9 +194,9 @@ export function collectBroadUnitFastTestCandidates(cwd = process.cwd()) { matchesAnyGlob(file, broadUnitFastCandidateGlobs) && !matchesAnyGlob(file, broadUnitFastCandidateSkipGlobs), ); - return [...new Set([...discovered, ...unitFastCandidateExactFiles])].toSorted((a, b) => - a.localeCompare(b), - ); + return [ + ...new Set([...discovered, ...unitFastCandidateExactFiles, ...forcedUnitFastTestFiles]), + ].toSorted((a, b) => a.localeCompare(b)); } export function collectUnitFastTestFileAnalysis(cwd = process.cwd(), options = {}) { @@ -208,9 +217,11 @@ export function collectUnitFastTestFileAnalysis(cwd = process.cwd(), options = { }; } const reasons = classifyUnitFastTestFileContent(source); + const forced = forcedUnitFastTestFileSet.has(file); return { file, - unitFast: reasons.length === 0, + unitFast: forced || reasons.length === 0, + forced, reasons, }; });