Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(cli): make runtimes tests platform-independent
Gener589e8a3327a2
diff --git a/src/cli/lib/runtimes.test.ts b/src/cli/lib/runtimes.test.tsindex 87bd35763..3851efc34 100644--- a/src/cli/lib/runtimes.test.ts+++ b/src/cli/lib/runtimes.test.ts@@ -8,9 +8,15 @@ import { execSync } from "child_process";import { isCommandAvailable, detectRuntimes } from "./runtimes.js";const mockedExecSync = vi.mocked(execSync);+const originalPlatform = process.platform;beforeEach(() => {vi.clearAllMocks();+ Object.defineProperty(process, "platform", { value: "linux" });+});++afterEach(() => {+ Object.defineProperty(process, "platform", { value: originalPlatform });});describe("isCommandAvailable", () => {@@ -31,6 +37,13 @@ describe("isCommandAvailable", () => {isCommandAvailable("claude");expect(mockedExecSync).toHaveBeenCalledWith("which claude", { stdio: "ignore" });});++ it("uses 'where' on windows", () => {+ Object.defineProperty(process, "platform", { value: "win32" });+ mockedExecSync.mockReturnValue("");+ isCommandAvailable("claude");+ expect(mockedExecSync).toHaveBeenCalledWith("where claude", { stdio: "ignore" });+ });});describe("detectRuntimes", () => {@@ -60,6 +73,23 @@ describe("detectRuntimes", () => {]);});+ it("detects runtimes on windows using 'where'", () => {+ Object.defineProperty(process, "platform", { value: "win32" });+ mockedExecSync.mockImplementation((cmd: string) => {+ if (cmd === "where claude") return "";+ if (cmd === "claude --version") return "1.0.0\n";+ if (cmd === "where codex") return "";+ if (cmd === "codex --version") return "2.0.0\n";+ throw new Error("not found");+ });++ const result = detectRuntimes();+ expect(result).toEqual([+ { type: "claude", version: "1.0.0" },+ { type: "codex", version: "2.0.0" },+ ]);+ });+it("includes runtime with empty version when --version fails", () => {mockedExecSync.mockImplementation((cmd: string) => {if (cmd === "which claude") return "";