diff --git a/packages/cli/src/__tests__/vitest-workspace-resolution.test.ts b/packages/cli/src/__tests__/vitest-workspace-resolution.test.ts index 8a5fcd2149..acd5305e12 100644 --- a/packages/cli/src/__tests__/vitest-workspace-resolution.test.ts +++ b/packages/cli/src/__tests__/vitest-workspace-resolution.test.ts @@ -9,6 +9,7 @@ const hiddenDistRootPrefix = ".tmp-fn-vitest-workspace-resolution-"; const hiddenDistRoot = join(workspaceRoot, `${hiddenDistRootPrefix}${process.pid}`); const internalPackages = ["core", "engine", "dashboard"] as const; +const claudeRuntimeDist = join(workspaceRoot, "plugins", "fusion-plugin-claude-runtime", "dist"); const movedDistDirs: Array<{ from: string; to: string }> = []; function rmSyncWithRetry(path: string) { @@ -50,23 +51,28 @@ function cleanupStaleHiddenDistRoots() { } } +function hideDistDir(name: string, distPath: string) { + if (!existsSync(distPath)) { + return; + } + + const hiddenPath = join(hiddenDistRoot, `${name}-dist`); + if (existsSync(hiddenPath)) { + rmSyncWithRetry(hiddenPath); + } + renameSync(distPath, hiddenPath); + movedDistDirs.push({ from: distPath, to: hiddenPath }); +} + function hideInternalPackageDistDirs() { cleanupStaleHiddenDistRoots(); mkdirSync(hiddenDistRoot, { recursive: true }); for (const pkg of internalPackages) { - const distPath = join(workspaceRoot, "packages", pkg, "dist"); - if (!existsSync(distPath)) { - continue; - } - - const hiddenPath = join(hiddenDistRoot, `${pkg}-dist`); - if (existsSync(hiddenPath)) { - rmSyncWithRetry(hiddenPath); - } - renameSync(distPath, hiddenPath); - movedDistDirs.push({ from: distPath, to: hiddenPath }); + hideDistDir(pkg, join(workspaceRoot, "packages", pkg, "dist")); } + + hideDistDir("claude-runtime", claudeRuntimeDist); } function restoreInternalPackageDistDirs() { @@ -156,6 +162,18 @@ describe("CLI Vitest workspace resolution", () => { find: String(/^@fusion-plugin-examples\/droid-runtime$/), replacement: join(workspaceRoot, "plugins", "fusion-plugin-droid-runtime", "src", "index.ts"), }, + ...[ + "hermes", + "openclaw", + "cursor", + "grok", + "claude", + "omp", + "paperclip", + ].map((runtime) => ({ + find: String(new RegExp(`^@fusion-plugin-examples/${runtime}-runtime$`)), + replacement: join(workspaceRoot, "plugins", `fusion-plugin-${runtime}-runtime`, "src", "index.ts"), + })), { find: String(/^@fusion\/test-utils$/), replacement: join(workspaceRoot, "packages", "core", "src", "__test-utils__", "workspace.ts"), @@ -183,17 +201,26 @@ describe("CLI Vitest workspace resolution", () => { expect(dashboardIndex).toBeGreaterThan(planningIndex); }); - it("resolves non-mocked symbols from internal workspace packages when dist outputs are absent", async () => { - const [{ tempWorkspace }, { PRIORITY_EXECUTE }, { createRuntimeLogger }, { parseAgentResponse }] = await Promise.all([ + it("resolves non-mocked symbols from internal workspace packages and Claude runtime when dist outputs are absent", async () => { + const [ + { tempWorkspace }, + { PRIORITY_EXECUTE }, + { createRuntimeLogger }, + { parseAgentResponse }, + { probeClaudeBinary, discoverClaudeProviderModels }, + ] = await Promise.all([ import("@fusion/test-utils"), import("@fusion/engine"), import("@fusion/dashboard"), import("@fusion/dashboard/planning"), + import("@fusion-plugin-examples/claude-runtime"), ]); expect(typeof tempWorkspace).toBe("function"); expect(typeof PRIORITY_EXECUTE).toBe("number"); expect(typeof createRuntimeLogger).toBe("function"); + expect(typeof probeClaudeBinary).toBe("function"); + expect(typeof discoverClaudeProviderModels).toBe("function"); expect(parseAgentResponse('{"type":"question","data":{"id":"q","type":"confirm","question":"Ok?","description":"desc"}}')).toEqual({ type: "question", data: { diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index 62071903da..91cd396045 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -121,6 +121,19 @@ const quarantinedCliTests: string[] = [ "src/commands/dashboard-tui/__tests__/terminal-attach.test.ts", ]; +/* +FNXC:CliTests 2026-07-18-02:15: +The full CLI suite must continue excluding quarantined integration tests, but an explicitly named quarantined file needs to remain runnable for focused diagnosis and regression verification. Preserve the quarantine for discovery runs while removing only the exact requested path from Vitest's exclude list (FN-8268). +*/ +const explicitlyRequestedTestFiles = new Set( + process.argv + .filter((argument) => /(^|[/\\])src[/\\].+\.test\.(?:ts|tsx)$/.test(argument)) + .map((argument) => argument.replace(/\\/g, "/").replace(/^\.\//, "")), +); +const activeQuarantinedCliTests = quarantinedCliTests.filter( + (testFile) => !explicitlyRequestedTestFiles.has(testFile), +); + export default defineConfig({ resolve: { // Keep these aliases exact and ordered (subpaths before package roots). @@ -179,6 +192,14 @@ export default defineConfig({ replacement: resolve(__dirname, "../../plugins/fusion-plugin-grok-runtime/src/index.ts"), }, /* + FNXC:PluginTests 2026-07-18-01:58: + runtime-provider-probes.ts is reached from @fusion/dashboard through server.ts, routes.ts, and register-runtime-provider-routes.ts, where it imports @fusion-plugin-examples/claude-runtime. Mirror the Cursor, Grok, and OMP source aliases so source checkouts without built plugin dist resolve the Claude runtime (FN-8268). + */ + { + find: /^@fusion-plugin-examples\/claude-runtime$/, + replacement: resolve(__dirname, "../../plugins/fusion-plugin-claude-runtime/src/index.ts"), + }, + /* FNXC:OmpAcp 2026-07-11-23:35: runtime-provider-probes imports @fusion-plugin-examples/omp-runtime; alias source for checkout tests. */ @@ -214,7 +235,7 @@ export default defineConfig({ // build-exe + build-exe-cross live in their own vitest project // (see vitest.build-exe.config.ts) so the rest of the CLI suite can // run with file parallelism enabled. - exclude: ["**/node_modules/**", "**/dist/**", "src/__tests__/build-exe*.test.ts", ...quarantinedCliTests], + exclude: ["**/node_modules/**", "**/dist/**", "src/__tests__/build-exe*.test.ts", ...activeQuarantinedCliTests], setupFiles: [ resolve(__dirname, "../core/src/__test-utils__/vitest-setup.ts"), ],