Files
proffesor-for-testing__agen…/vitest.config.ts
Dragan Spiridonov 4e513b431d fix: resolve 3 P0 blockers and CI failures from QE v3.8.13 audit
- Delete dead MCP server.ts (911 lines, never used in production — entry.ts
  imports MCPProtocolServer). Add legacy aliases in index.ts for backwards compat.
- Fix ESLint: rename .eslintrc.js to .eslintrc.cjs (CommonJS in ESM project)
- Fix hardcoded version '3.0.0' in protocol-server.ts and http-server.ts —
  now reads dynamically from package.json
- Fix vitest process hang: add worker-level afterAll force-exit (setup-worker.ts)
  and global teardown safety net. Native modules (better-sqlite3, hnswlib-node)
  held open handles preventing fork worker exit.
- Add test gate to npm-publish.yml — 194 unit test files must pass before publish
- Disable benchmark.yml release trigger (benchmarks/suite.ts doesn't exist)
- Remove continue-on-error from test steps in optimized-ci.yml (was masking failures)
- Add getToolDefinitions() to MCPProtocolServer for test introspection
- Update e2e and integration tests to use production server API

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 16:51:59 +00:00

77 lines
2.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Agentic QE v3 - Vitest Configuration
*/
import { defineConfig } from 'vitest/config';
import path from 'path';
import os from 'os';
export default defineConfig({
test: {
globals: true,
environment: 'node',
env: {
// ISOLATION: Use temp directory so tests never write to production memory.db.
// Each test process (via forks pool) gets its own DB in the OS temp dir.
// This prevents test runs from inflating .agentic-qe/memory.db.
AQE_PROJECT_ROOT: path.join(os.tmpdir(), `aqe-vitest-${process.pid}`),
},
reporters: ['default', 'junit'],
outputFile: {
junit: 'junit.xml',
},
globalSetup: ['tests/global-teardown.ts'],
setupFiles: ['tests/setup-worker.ts'],
teardownTimeout: 5000,
include: ['tests/**/*.test.ts'],
benchmark: {
include: ['tests/**/*.bench.ts'],
},
exclude: [
'node_modules',
'dist',
'**/_archived/**',
'**/browser/**',
'**/*.e2e.test.ts',
'**/vibium/**',
'**/browser-swarm-coordinator.test.ts',
],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'junit'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.d.ts', 'src/**/index.ts'],
},
testTimeout: 10000,
hookTimeout: 15000, // Prevent beforeEach/afterEach hangs (e.g., fleet init)
// OOM & Segfault Prevention for DevPod/Codespaces (Vitest 4 format)
// Process isolation via forks prevents HNSW native module segfaults.
// fileParallelism is OFF in DevPod to prevent concurrent fleet inits from
// allocating multiple HNSW indices + Queen + Kernel stacks simultaneously.
// CI uses sequential execution too since test files share global fleet state.
pool: 'forks',
// OOM Prevention (Issue #294):
// DevPod has 16GB total. VS Code (~2GB) + Claude (~5GB) = 7GB overhead.
// Each fleet init allocates ~200-400MB (13 domain plugins + HNSW native memory).
// With maxForks=2 + main process: 3 × 1GB heap + native = ~4-5GB for tests.
// Setting maxForks=1 keeps peak at ~2-3GB, leaving headroom for the environment.
fileParallelism: false,
maxForks: 1,
minForks: 1,
isolate: true, // Full process isolation prevents native module conflicts
// Fail fast on OOM-prone environments
bail: process.env.CI ? 5 : 3,
},
resolve: {
alias: {
'@shared': path.resolve(__dirname, './src/shared'),
'@kernel': path.resolve(__dirname, './src/kernel'),
'@domains': path.resolve(__dirname, './src/domains'),
'@coordination': path.resolve(__dirname, './src/coordination'),
'@adapters': path.resolve(__dirname, './src/adapters'),
'@integrations': path.resolve(__dirname, './src/integrations'),
'@': path.resolve(__dirname, './src'),
},
},
});