Skip to content

Commit 9e29e39

Browse files
committed
test(ci): reuse race-safe process cleanup in report fixtures
1 parent 57e060b commit 9e29e39

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎test/scripts/test-group-report.test.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
spawnText,
2626
} from "../../scripts/test-group-report.mts";
2727
import { withEnv } from "../../src/test-utils/env.js";
28+
import { killPidIfAlive } from "../../src/test-utils/process-tree.js";
2829
import {
2930
isProcessAlive,
3031
waitForChildClose,
@@ -1011,9 +1012,7 @@ describe("scripts/test-group-report child process guard", () => {
10111012
});
10121013
expect(parsed.output).toContain("sending SIGKILL");
10131014
} finally {
1014-
if (childPid !== undefined && isProcessAlive(childPid)) {
1015-
process.kill(childPid, "SIGKILL");
1016-
}
1015+
killPidIfAlive(childPid);
10171016
fs.rmSync(tempDir, { recursive: true, force: true });
10181017
}
10191018
});
@@ -1082,9 +1081,7 @@ describe("scripts/test-group-report child process guard", () => {
10821081
if (runner?.pid && isProcessAlive(runner.pid)) {
10831082
runner.kill("SIGKILL");
10841083
}
1085-
if (childPid !== undefined && isProcessAlive(childPid)) {
1086-
process.kill(childPid, "SIGKILL");
1087-
}
1084+
killPidIfAlive(childPid);
10881085
fs.rmSync(tempDir, { recursive: true, force: true });
10891086
}
10901087
});
@@ -1140,8 +1137,8 @@ describe("scripts/test-group-report child process guard", () => {
11401137
try {
11411138
await releaseAndWait();
11421139
} finally {
1143-
if (childPid !== undefined && isProcessAlive(childPid)) {
1144-
process.kill(childPid, "SIGKILL");
1140+
if (childPid !== undefined) {
1141+
killPidIfAlive(childPid);
11451142
await waitForDead(childPid, 2_000);
11461143
}
11471144
}

0 commit comments

Comments
 (0)