test: overhaul deterministic suite architecture
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
cleanupWindowsProcessTree,
|
||||
type WindowsProcessTreeHost,
|
||||
} from "../../../src/process/ProcessOwnership.js";
|
||||
describe("Windows P0 process-tree cleanup", () => {
|
||||
it("reports whether taskkill signaled or found an exited tree", async () => {
|
||||
const terminated: WindowsProcessTreeHost = {
|
||||
terminateTree: () => Promise.resolve("terminated"),
|
||||
};
|
||||
const missing: WindowsProcessTreeHost = {
|
||||
terminateTree: () => Promise.resolve("missing"),
|
||||
};
|
||||
await expect(cleanupWindowsProcessTree(42, terminated)).resolves.toEqual({
|
||||
cleaned: true,
|
||||
signaled: true,
|
||||
});
|
||||
await expect(cleanupWindowsProcessTree(42, missing)).resolves.toEqual({
|
||||
cleaned: true,
|
||||
signaled: false,
|
||||
});
|
||||
});
|
||||
it("keeps invalid identity and termination failures explicit", async () => {
|
||||
const failing: WindowsProcessTreeHost = {
|
||||
terminateTree: () => Promise.reject(new Error("taskkill failed")),
|
||||
};
|
||||
await expect(cleanupWindowsProcessTree(0, failing)).resolves.toEqual({
|
||||
cleaned: false,
|
||||
reason: "Windows process-tree PID is invalid",
|
||||
});
|
||||
await expect(cleanupWindowsProcessTree(42, failing)).resolves.toEqual({
|
||||
cleaned: false,
|
||||
reason:
|
||||
"Windows P0 process-tree termination failed; Job Object ownership is unavailable",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user