1a88ab3199
The v0.8 milestone: installable on any Debian-based server via docker (Gitea registry image, honest sandbox degrade), deb (amd64+arm64, advisory postinst), and arch-aware binary — with release consistency enforced by pre-commit hooks + Gitea Actions (3-runner fleet on CT 113, machine-made releases with the full 8-asset matrix + registry image), the CLI carrying the full suite (guide, channel-aware doctor), and the admin runbook (deploy/README.md, evidence-backed recipes). ---ci--- phase: 6 milestone: v0.8 status: complete requirements: covered: [REQ-8-001, REQ-8-002, REQ-8-003, REQ-8-004, REQ-8-005] partial: [] ---/ci---
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { run } from "../src/lib/spawn.ts";
|
|
|
|
test("spawn: returns exit code of short process", async () => {
|
|
const res = await run("node", ["-e", "process.exit(3)"], { capture: true, timeoutMs: 5000 });
|
|
assert.equal(res.code, 3);
|
|
assert.equal(res.timedOut, false);
|
|
});
|
|
|
|
test("spawn: timeout kills and reports timedOut", async () => {
|
|
const res = await run("node", ["-e", "setTimeout(() => {}, 10000)"], {
|
|
capture: true,
|
|
timeoutMs: 300,
|
|
});
|
|
assert.equal(res.timedOut, true);
|
|
assert.ok(res.code !== 0);
|
|
});
|
|
|
|
test("spawn: missing binary resolves code 127, never rejects", async () => {
|
|
const res = await run("definitely-not-a-real-binary-xyz", [], { capture: true, timeoutMs: 1000 });
|
|
assert.equal(res.code, 127);
|
|
});
|
|
|
|
test("spawn: capture collects stdout", async () => {
|
|
const res = await run("node", ["-e", "process.stdout.write('hello')"], {
|
|
capture: true,
|
|
timeoutMs: 5000,
|
|
});
|
|
assert.equal(res.stdout, "hello");
|
|
});
|