test(integration): address daemon reaping review feedback (#1964)

This commit is contained in:
whoisasx 2026-05-21 00:25:29 +05:30
parent 5b5120d727
commit 9307ccf3df
1 changed files with 8 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
clearDaemonChildrenRegistry,
getDaemonChildren,
isWindows,
killProcessTree,
registerDaemonChild,
} from "@aoagents/ao-core";
@ -19,7 +20,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const repoRoot = resolve(__dirname, "..", "..", "..");
const cliEntry = join(repoRoot, "packages", "cli", "dist", "index.js");
const canRun = existsSync(cliEntry);
const canRun = !isWindows() && existsSync(cliEntry);
function isAlive(pid: number): boolean {
if (pid <= 0) return false;
@ -145,8 +146,12 @@ describe.skipIf(!canRun)("daemon child reaping (integration)", () => {
});
expect(stdout).toContain("Swept 1 registered daemon child");
expect(await waitForChildExit(registeredChild, childPid)).toBe(true);
expect(await waitForChildExit(daemonParent, daemonPid)).toBe(true);
const [registeredChildExited, daemonParentExited] = await Promise.all([
waitForChildExit(registeredChild, childPid),
waitForChildExit(daemonParent, daemonPid),
]);
expect(registeredChildExited).toBe(true);
expect(daemonParentExited).toBe(true);
expect(getDaemonChildren()).toEqual([]);
}, 30_000);
});