45bfae6e94
Initial import of all source code, config, and README assets: the packages workspace (cli, core, server, web, docs, landing, skills), build scripts, tooling config, and CI workflows. Includes the data-layout revision made on this branch: the local data root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the installer keeps its binaries in ~/.penguin), and every Agent lives under <project>/agents/<agent>/ — path helpers, the three agent-enumeration scans, the system prompt, built-in Skills, tests and docs all follow the new layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
/**
|
|
* Process-lifecycle behavior tests for WakeSignal.
|
|
*/
|
|
import { spawnSync } from "node:child_process";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
describe("WakeSignal", () => {
|
|
it("keeps a standalone process alive while wait() is pending without leaving timers behind", () => {
|
|
const moduleUrl = new URL("../src/environment/tools/background/wake-signal.ts", import.meta.url)
|
|
.href;
|
|
const script = `
|
|
const { WakeSignal } = await import(${JSON.stringify(moduleUrl)});
|
|
|
|
await new WakeSignal().wait(50);
|
|
process.stdout.write("timeout\\n");
|
|
|
|
const signal = new WakeSignal();
|
|
setTimeout(() => signal.notify(), 10);
|
|
await signal.wait(60_000);
|
|
process.stdout.write("notified\\n");
|
|
`;
|
|
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
["--import", "tsx", "--input-type=module", "--eval", script],
|
|
{ encoding: "utf8", timeout: 3_000 },
|
|
);
|
|
|
|
expect(result.error).toBeUndefined();
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("timeout\nnotified\n");
|
|
});
|
|
});
|