mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
26 lines
1008 B
TypeScript
26 lines
1008 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import { describe, expect, test } from "vitest";
|
|
|
|
describe("supervision parity", () => {
|
|
test("has exactly one runtime callsite for runSupervisor", () => {
|
|
const daemonRunner = readFileSync(
|
|
new URL("./supervisor-entrypoint.ts", import.meta.url),
|
|
"utf8",
|
|
);
|
|
const devRunner = readFileSync(new URL("./dev-runner.ts", import.meta.url), "utf8");
|
|
|
|
const daemonRunnerCalls = (daemonRunner.match(/\brunSupervisor\s*\(/g) ?? []).length;
|
|
const devRunnerCalls = (devRunner.match(/\brunSupervisor\s*\(/g) ?? []).length;
|
|
|
|
expect(daemonRunnerCalls + devRunnerCalls).toBe(1);
|
|
});
|
|
|
|
test("dev runner waits asynchronously for supervisor shutdown", () => {
|
|
const devRunner = readFileSync(new URL("./dev-runner.ts", import.meta.url), "utf8");
|
|
|
|
expect(devRunner).toContain('import { spawn } from "node:child_process"');
|
|
expect(devRunner).not.toContain("spawnSync");
|
|
expect(devRunner).toContain('supervisor.on("exit"');
|
|
});
|
|
});
|