From 0166cbb87045f412109fb35546baa557c85a246b Mon Sep 17 00:00:00 2001 From: Abdul Wahab Date: Mon, 14 Sep 2026 23:28:14 +0500 Subject: [PATCH] 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 --- tests/live-agent-target.test.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/live-agent-target.test.mjs b/tests/live-agent-target.test.mjs index 63b4a9026..8a39df39d 100644 --- a/tests/live-agent-target.test.mjs +++ b/tests/live-agent-target.test.mjs @@ -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(); });