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

test: warm the heavy socket.js import outside the per-test budget (#8484)

Adam Eivy8927bb0fd6bf
diff --git a/server/services/peerSocketRelayAuth.test.js b/server/services/peerSocketRelayAuth.test.js
index 08a17fe604..22281080bf 100644
--- a/server/services/peerSocketRelayAuth.test.js
+++ b/server/services/peerSocketRelayAuth.test.js
@@ -10,7 +10,7 @@
* two files this fix touches) and a REAL socket.io-client over a loopback
* HTTP server, so the handshake and per-event middleware run unmocked.
*/
-import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { createServer } from 'http';
import { Server } from 'socket.io';
import { io as ioClient } from 'socket.io-client';
@@ -154,6 +154,16 @@ const waitFor = (emitter, event) => new Promise((resolve, reject) => {
if (event !== 'disconnect') emitter.on('disconnect', onDisconnect);
});
+// socket.js pulls in nearly the whole server graph. Measured under CPU
+// contention, that cold import alone took ~7.5s on the first test (later
+// tests hit the transform cache in ~0.2s), so under full-suite load it ate the
+// per-test 30s budget before any socket work began (#8484). Pay it once in a
+// hook with its own budget so each test's budget covers only the socket exchange.
+beforeAll(async () => {
+ await import('./authGate.js');
+ await import('./socket.js');
+}, 120_000);
+
describe('peer socket relay stays connected through cos:subscribe on a password-gated peer (#8386)', () => {
beforeEach(async () => {
vi.resetModules();