vitest.config.ts 1.1 KB

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