Files
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

24 lines
848 B
TypeScript

/**
* Worker-level setup for vitest fork pool.
*
* This runs inside the forked worker process for each test file.
* It registers an afterAll hook that schedules a force-exit, preventing
* the fork worker from hanging on native module handles (better-sqlite3,
* hnswlib-node) after all tests in a file complete.
*
* The 2-second delay allows vitest to collect results from the worker
* before the process terminates.
*/
import { afterAll } from 'vitest';
afterAll(() => {
// Schedule force-exit after vitest has collected test results.
// The worker process communicates results to the main process via IPC
// before afterAll completes. The setTimeout gives the IPC message time
// to flush, then kills the worker to release native handles.
const timer = setTimeout(() => {
process.exit(0);
}, 2000);
timer.unref();
});