From 6e9128e060c1680ac02fa1d6acde8f2d23c646a7 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 23 Mar 2026 20:03:45 +0900 Subject: [PATCH] fix: add fetch mock to install test to prevent CI timeout The first test case 'non-TUI mode: should show warning but continue when OpenCode binary not found' was missing a globalThis.fetch mock, causing it to make a real HTTP request to npm registry via fetchNpmDistTags(). The npm fetch timeout (5s) collided with the test timeout (5s), causing flaky CI failures. Added the same fetch mock pattern already used by the other two test cases. Test runtime dropped from 5000ms+ to ~2ms. --- src/cli/install.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cli/install.test.ts b/src/cli/install.test.ts index a83f48c79..e967ed6b4 100644 --- a/src/cli/install.test.ts +++ b/src/cli/install.test.ts @@ -53,6 +53,14 @@ describe("install CLI - binary check behavior", () => { isOpenCodeInstalledSpy = spyOn(configManager, "isOpenCodeInstalled").mockResolvedValue(false) getOpenCodeVersionSpy = spyOn(configManager, "getOpenCodeVersion").mockResolvedValue(null) + // given mock npm fetch + globalThis.fetch = mock(() => + Promise.resolve({ + ok: true, + json: () => Promise.resolve({ latest: "3.0.0" }), + } as Response) + ) as unknown as typeof fetch + const args: InstallArgs = { tui: false, claude: "yes",