From c25594cf09760793c30825ab0145da00a30b8c97 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Sun, 22 Mar 2026 02:47:59 -0700 Subject: [PATCH] test: Remove duplicate killWithTimeout tests (#2870) * test: remove duplicate and theatrical tests - cmd-fix-cov.test.ts: remove 6 duplicate fixSpawn tests already covered in cmd-fix.test.ts; keep only the unique success message assertion - icon-integrity.test.ts: consolidate 54 per-entity it() blocks into 4 data-driven tests (same 67 expect() calls, 50 fewer test cases) - manifest-type-contracts.test.ts: consolidate per-field for-loop it() blocks into 3 grouped tests (same 662 expect() calls, 15 fewer cases) Co-Authored-By: Claude Sonnet 4.6 * test: remove duplicate killWithTimeout tests from ssh-cov.test.ts The `killWithTimeout additional` describe block in ssh-cov.test.ts duplicated scenarios already covered in kill-with-timeout.test.ts: - "sends SIGTERM then SIGKILL" == kill-with-timeout's SIGKILL grace test - "does nothing when first kill throws" == kill-with-timeout's SIGTERM throw test Removed the 2 duplicate tests from ssh-cov.test.ts. The dedicated kill-with-timeout.test.ts file is the canonical location for killWithTimeout coverage. --------- Co-authored-by: spawn-qa-bot Co-authored-by: Claude Sonnet 4.6 Co-authored-by: L <6723574+louisgv@users.noreply.github.com> --- packages/cli/src/__tests__/ssh-cov.test.ts | 39 +++------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/packages/cli/src/__tests__/ssh-cov.test.ts b/packages/cli/src/__tests__/ssh-cov.test.ts index dd1bfb5c..8cd2289c 100644 --- a/packages/cli/src/__tests__/ssh-cov.test.ts +++ b/packages/cli/src/__tests__/ssh-cov.test.ts @@ -1,7 +1,7 @@ /** * ssh-cov.test.ts — Coverage tests for shared/ssh.ts * - * Covers: spawnInteractive, sleep, killWithTimeout, startSshTunnel, + * Covers: spawnInteractive, sleep, startSshTunnel, * waitForSsh, SSH_BASE_OPTS, SSH_INTERACTIVE_OPTS */ @@ -13,8 +13,9 @@ import * as net from "node:net"; // Suppress stderr during tests — restored in afterAll to avoid contamination let stderrSpy: ReturnType; -const { spawnInteractive, sleep, killWithTimeout, startSshTunnel, waitForSsh, SSH_BASE_OPTS, SSH_INTERACTIVE_OPTS } = - await import("../shared/ssh.js"); +const { spawnInteractive, sleep, startSshTunnel, waitForSsh, SSH_BASE_OPTS, SSH_INTERACTIVE_OPTS } = await import( + "../shared/ssh.js" +); /** Create a fake socket (EventEmitter) that satisfies net.Socket interface for testing. */ function createFakeSocket(): net.Socket { @@ -158,38 +159,6 @@ describe("sleep", () => { }); }); -// ── killWithTimeout (additional coverage) ────────────────────────────── - -describe("killWithTimeout additional", () => { - it("sends SIGTERM immediately then SIGKILL after grace period", async () => { - const signals: (number | undefined)[] = []; - const proc = { - kill(signal?: number) { - signals.push(signal); - }, - }; - killWithTimeout(proc, 50); - expect(signals).toEqual([ - undefined, - ]); // SIGTERM sent immediately - await sleep(100); - expect(signals).toEqual([ - undefined, - 9, - ]); // SIGKILL sent after grace - }); - - it("does nothing when first kill throws (process already dead)", () => { - const proc = { - kill() { - throw new Error("No such process"); - }, - }; - // Should not throw - killWithTimeout(proc, 50); - }); -}); - // ── startSshTunnel ───────────────────────────────────────────────────── describe("startSshTunnel", () => {