Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-790]): address codex review — fake taskkill child in timeout tests

[._.]/ Adam Eivy183605352e2f
diff --git a/server/lib/bufferedSpawn.test.js b/server/lib/bufferedSpawn.test.js
index e4f2bac410..b74d95a537 100644
--- a/server/lib/bufferedSpawn.test.js
+++ b/server/lib/bufferedSpawn.test.js
@@ -24,11 +24,17 @@ function makeFakeChild({ pid = 1234 } = {}) {
child.stdout = new EventEmitter();
child.stderr = new EventEmitter();
child.kill = vi.fn();
+ child.unref = vi.fn();
return child;
}
beforeEach(() => {
spawnMock.mockReset();
+ // Default: any spawn returns a fresh fake child. On a Windows test runner the
+ // timeout path also spawns `taskkill` via killProcessTree — without a default
+ // it would get `undefined` and crash on `.on(...)`. Tests that need to drive a
+ // specific child queue it explicitly with mockReturnValueOnce.
+ spawnMock.mockImplementation(() => makeFakeChild());
vi.useRealTimers();
});