| 25 | const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js'); |
| 26 | |
| 27 | function spawnServer(cwd: string): ChildProcessWithoutNullStreams { |
| 28 | // --no-watch keeps the test deterministic and avoids watcher startup noise. |
| 29 | return spawn(process.execPath, [BIN, 'serve', '--mcp', '--no-watch'], { |
| 30 | cwd, |
| 31 | stdio: ['pipe', 'pipe', 'pipe'], |
| 32 | }) as ChildProcessWithoutNullStreams; |
| 33 | } |
| 34 | |
| 35 | /** Parse every JSON-RPC message the server writes to stdout into an array. */ |
| 36 | function collectMessages(child: ChildProcessWithoutNullStreams): Array<Record<string, any>> { |