Files
hyperframes/packages/cli/src/utils/cancellableProcess.killFailure.test.ts
T
Miguel Ángel 93f2fcca49 fix(cli): Windows kills end only the process the CLI started, never a reused pid (#8382)
* test(cli): the Windows Chrome watchdog spares a pid that now runs another program

* fix(cli): the Windows Chrome watchdog kills only its own Chrome, never a reused pid

* test(cli): no preview lifecycle test may end a real process by a made-up pid

* fix(cli): the log-path preview test stops its made-up child through a fake, not a real kill

* test(cli): the Windows child reaper spares a held pid that now runs another program

* fix(cli): the Windows child reaper kills only the child it started, never a reused pid

* test(cli): the reaper's stand-ins outlive the fixture, so only the reaper can end them

* test(cli): the kill-failure test keeps processTree's other exports, which the reaper reads
2026-11-21 16:25:40 +00:00

22 lines
753 B
TypeScript

import { describe, expect, it, vi } from "vitest";
vi.mock("./processTree.js", async (importOriginal) => ({
...(await importOriginal<typeof import("./processTree.js")>()),
terminateProcessTree: () => Promise.reject(new Error("taskkill exited with status 128")),
}));
const { runCancellableProcess } = await import("./cancellableProcess.js");
describe("runCancellableProcess when the tree kill fails", () => {
it("still rejects with the timeout, not the kill failure", async () => {
const run = runCancellableProcess(process.execPath, ["-e", "setTimeout(() => {}, 400)"], {
timeoutMs: 50,
});
await expect(run).rejects.toMatchObject({
message: "Process timed out after 50 ms",
code: "ETIMEDOUT",
});
});
});