tests: the agent-target suite arms the live-server reaper

The suite spawned its live servers directly and stopped them in after()
hooks only, so a run killed mid-test could leave them behind. It now arms
the shared reaper and tracks each child like the other live suites do.

Written with AI assistance (Claude).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Abdul Wahab
2026-09-15 05:45:49 +05:00
committed by Abdul Wahab
co-authored by Claude Fable 5.1
parent 2d2009d7c1
commit 0166cbb870
+5 -2
View File
@@ -16,11 +16,14 @@ import { tmpdir } from 'node:os';
import { execFile, execFileSync, spawn } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { ENGINE_MISSING_MESSAGE, engineEnv, findEngineBinary } from './lib/engine-bin.mjs';
import { armLiveServerReaper, trackServerChild } from './lib/live-servers.mjs';
// Resolve the repo from this file, not from cwd: the runner may be invoked
// from tests/ or anywhere else.
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
const ENGINE_BIN = findEngineBinary();
// Every live server this file starts dies with it, whichever way it exits.
armLiveServerReaper();
// The action vocabulary lives in the engine (crates/live/src/vocabulary.rs);
// read it from the Rust source so the matrix below can never drift from what
@@ -48,11 +51,11 @@ function runGenerate(cwd, args) {
function startServer(port, { cwd, env = {} } = {}) {
return new Promise((resolve, reject) => {
const proc = spawn(ENGINE_BIN, ['live-server', '--port=' + port], {
const proc = trackServerChild(spawn(ENGINE_BIN, ['live-server', '--port=' + port], {
cwd,
stdio: ['ignore', 'pipe', 'pipe'],
env: engineEnv(ENGINE_BIN, { IMPECCABLE_LIVE_COPY_AGENT: 'off', ...env }),
});
}));
let output = '';
proc.stdout.on('data', (d) => { output += d.toString(); });
proc.stderr.on('data', (d) => { output += d.toString(); });