fix(scripts): resolve taskkill in test group report

This commit is contained in:
Vincent Koc
2026-06-21 09:34:00 +02:00
parent f8d2c4b25a
commit e016f0b496
2 changed files with 41 additions and 14 deletions

View File

@@ -12,6 +12,7 @@ import {
resolveGroupKey,
resolveTestArea,
} from "../../scripts/lib/test-group-report.mjs";
import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs";
import {
parseTestGroupReportArgs,
resolveFullSuiteVitestEnv,
@@ -65,6 +66,10 @@ async function waitForDead(pid: number, timeoutMs: number): Promise<void> {
throw new Error(`timed out waiting for pid ${pid} to exit`);
}
function expectedTaskkillPath(): string {
return resolveWindowsTaskkillPath();
}
function waitForChildClose(
child: ReturnType<typeof spawn>,
timeoutMs = 5_000,
@@ -622,17 +627,27 @@ describe("scripts/test-group-report child process guard", () => {
platform: "win32",
runTaskkill,
});
expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
stdio: "ignore",
});
expect(runTaskkill).toHaveBeenNthCalledWith(
1,
expectedTaskkillPath(),
["/PID", "12345", "/T"],
{
stdio: "ignore",
},
);
signalTestGroupReportChild(child, "SIGKILL", {
platform: "win32",
runTaskkill,
});
expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
stdio: "ignore",
});
expect(runTaskkill).toHaveBeenNthCalledWith(
2,
expectedTaskkillPath(),
["/PID", "12345", "/T", "/F"],
{
stdio: "ignore",
},
);
expect(child.kill).not.toHaveBeenCalled();
});
@@ -651,12 +666,22 @@ describe("scripts/test-group-report child process guard", () => {
runTaskkill,
});
expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
stdio: "ignore",
});
expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
stdio: "ignore",
});
expect(runTaskkill).toHaveBeenNthCalledWith(
1,
expectedTaskkillPath(),
["/PID", "12345", "/T"],
{
stdio: "ignore",
},
);
expect(runTaskkill).toHaveBeenNthCalledWith(
2,
expectedTaskkillPath(),
["/PID", "12345", "/T", "/F"],
{
stdio: "ignore",
},
);
expect(child.kill).not.toHaveBeenCalled();
});