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: wait for backup test child processes

[._.]/ Adam Eivy727217648dbb
diff --git a/server/services/backup.test.js b/server/services/backup.test.js
index cb9ba8d3ea..eca39d7335 100644
--- a/server/services/backup.test.js
+++ b/server/services/backup.test.js
@@ -118,11 +118,10 @@ function fakeProc() {
return proc;
}
-// dumpPostgres awaits checkHealth() before calling spawn() and attaching its
-// close/error listeners. Flush the microtask queue so the listeners exist
-// before the test drives the fake process — otherwise an 'error' emit throws
-// (no listener) and 'close' emits fall into the void (test hangs).
-const flush = () => new Promise((r) => setTimeout(r, 0));
+// The restore/dump helpers await filesystem and health checks before calling
+// spawn() and attaching child-process listeners. Wait for the mocked spawn
+// call itself so CI scheduling cannot emit into an uninitialized fake process.
+const flush = () => vi.waitFor(() => expect(spawn).toHaveBeenCalled());
const overridable = DEFAULT_EXCLUDES.filter(e => e.overridable).map(e => e.path);
const nonOverridable = DEFAULT_EXCLUDES.filter(e => !e.overridable).map(e => e.path);