(cwd: string, handshakeTimeoutMs: number)
| 28 | const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js'); |
| 29 | |
| 30 | function spawnServer(cwd: string, handshakeTimeoutMs: number): ChildProcessWithoutNullStreams { |
| 31 | return spawn(process.execPath, [BIN, 'serve', '--mcp'], { |
| 32 | cwd, |
| 33 | stdio: ['pipe', 'pipe', 'pipe'], |
| 34 | env: { |
| 35 | ...process.env, |
| 36 | // Direct mode: hermetic (no detached daemon to leak from the suite). |
| 37 | // The backstop is armed identically on the proxy path. |
| 38 | CODEGRAPH_NO_DAEMON: '1', |
| 39 | // Single process (skip the --liftoff-only re-exec) so exit-code and |
| 40 | // liveness assertions observe the server itself. |
| 41 | CODEGRAPH_WASM_RELAUNCHED: '1', |
| 42 | // One less helper child; the liveness watchdog is not under test. |
| 43 | CODEGRAPH_NO_WATCHDOG: '1', |
| 44 | CODEGRAPH_TELEMETRY: '0', |
| 45 | DO_NOT_TRACK: '1', |
| 46 | CODEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS: String(handshakeTimeoutMs), |
| 47 | }, |
| 48 | }) as ChildProcessWithoutNullStreams; |
| 49 | } |
| 50 | |
| 51 | function waitForExit(child: ChildProcessWithoutNullStreams, timeoutMs: number): Promise<number | null> { |
| 52 | return new Promise((resolve, reject) => { |
no outgoing calls
no test coverage detected