Skip to content

Commit 02935d7

Browse files
authored
test(vitest): unblock subprocess MCP tests on Node >= 25 dev machines (colbymchenry#478) (colbymchenry#479)
Vitest already inherits process.env into every spawned `codegraph serve --mcp` child, but on Node >= 25 the CLI's hard-block (src/bin/codegraph.ts) kills the child before it can respond. Set CODEGRAPH_ALLOW_UNSAFE_NODE=1 via test.env so the test suite is green regardless of the contributor's Node version; the runtime guard itself is unchanged for end users.
1 parent 34240eb commit 02935d7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

vitest.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ export default defineConfig({
55
globals: true,
66
environment: 'node',
77
include: ['__tests__/**/*.test.ts'],
8+
/**
9+
* Several MCP integration tests (mcp-daemon, mcp-initialize, mcp-ppid-watchdog,
10+
* mcp-roots) spawn `dist/bin/codegraph.js serve --mcp` with `process.execPath`
11+
* and rely on the child inheriting `process.env`. On a Node >= 25 dev machine
12+
* the CLI's hard-block (src/bin/codegraph.ts) would otherwise exit the child
13+
* before it ever responds, so every spawn-based test times out — see #478.
14+
*
15+
* Setting the override here keeps the CLI's runtime guard intact for end
16+
* users (it's still enforced when `codegraph` is invoked directly) while
17+
* letting the test suite run on whatever Node the contributor happens to
18+
* have installed. CI on Node 22/23 is unaffected — the guard doesn't fire
19+
* there, so the variable is a no-op.
20+
*/
21+
env: { CODEGRAPH_ALLOW_UNSAFE_NODE: '1' },
822
coverage: {
923
provider: 'v8',
1024
reporter: ['text', 'json', 'html'],

0 commit comments

Comments
 (0)