test: Remove duplicate killWithTimeout tests (#2870)
Some checks are pending
CLI Release / Build and release CLI (push) Waiting to run
Lint / ShellCheck (push) Waiting to run
Lint / Biome Lint (push) Waiting to run
Lint / macOS Compatibility (push) Waiting to run

* 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 <noreply@anthropic.com>

* 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 <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
A 2026-03-22 02:47:59 -07:00 committed by GitHub
parent 57e06bab4a
commit c25594cf09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<typeof spyOn>;
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", () => {