@@ -7,7 +7,7 @@ import os from "node:os";
|
7 | 7 | import path from "node:path"; |
8 | 8 | import { setTimeout as delay } from "node:timers/promises"; |
9 | 9 | import { pathToFileURL } from "node:url"; |
10 | | -import { afterEach, describe, expect, it } from "vitest"; |
| 10 | +import { afterEach, describe, expect, it, vi } from "vitest"; |
11 | 11 | import { |
12 | 12 | createPrefixedOutputWriter, |
13 | 13 | isArtifactSetFresh, |
@@ -17,6 +17,7 @@ import {
|
17 | 17 | runNodeStep, |
18 | 18 | runNodeSteps, |
19 | 19 | runNodeStepsInParallel, |
| 20 | +signalNodeStep, |
20 | 21 | } from "../../scripts/prepare-extension-package-boundary-artifacts.mjs"; |
21 | 22 | import { makeTempDir } from "../helpers/temp-dir.js"; |
22 | 23 | |
@@ -123,6 +124,31 @@ describe("prepare-extension-package-boundary-artifacts", () => {
|
123 | 124 | expect(Date.now() - startedAt).toBeLessThan(abortBudgetMs); |
124 | 125 | }, 45_000); |
125 | 126 | |
| 127 | +it("signals Windows node step process trees with taskkill", () => { |
| 128 | +const child = { |
| 129 | +kill: vi.fn(), |
| 130 | +pid: 12345, |
| 131 | +}; |
| 132 | +const runTaskkill = vi.fn(() => ({ error: undefined, status: 0 })); |
| 133 | + |
| 134 | +signalNodeStep(child, "SIGTERM", { |
| 135 | +platform: "win32", |
| 136 | + runTaskkill, |
| 137 | +}); |
| 138 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], { |
| 139 | +stdio: "ignore", |
| 140 | +}); |
| 141 | + |
| 142 | +signalNodeStep(child, "SIGKILL", { |
| 143 | +platform: "win32", |
| 144 | + runTaskkill, |
| 145 | +}); |
| 146 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], { |
| 147 | +stdio: "ignore", |
| 148 | +}); |
| 149 | +expect(child.kill).not.toHaveBeenCalled(); |
| 150 | +}); |
| 151 | + |
126 | 152 | it.runIf(process.platform !== "win32")( |
127 | 153 | "force-kills aborted sibling step process groups", |
128 | 154 | async () => { |
|