test(setup): isolate client fixtures across host platforms

This commit is contained in:
morluto
2026-10-05 23:13:56 +08:00
parent 348323dd23
commit f73bb0fe11
3 changed files with 44 additions and 17 deletions
@@ -1,7 +1,7 @@
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { parse as parseJsonc, type ParseError } from "jsonc-parser";
import { readClientRegistrationStatuses } from "../../../src/application/ClientRegistrationStatus.js";
@@ -19,6 +19,20 @@ const command = [
"mcp",
] as const;
beforeEach(() => {
for (const name of [
"APPDATA",
"CLAUDE_CONFIG_DIR",
"CODEX_HOME",
"COPILOT_HOME",
"OPENCODE_CONFIG",
"XDG_CONFIG_HOME",
])
vi.stubEnv(name, undefined);
});
afterEach(() => vi.unstubAllEnvs());
const getClients = (home: string) =>
supportedClients(home).filter(({ name }) =>
["opencode", "antigravity", "copilot_cli", "vscode", "devin"].includes(