Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions __tests__/mcp-writer-lock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import { recordSpawns, removeSpawnLog, settleLosingCandidates } from './daemon-c
// Exercise the shipped lazy CommonJS loader as well as the engine lifecycle.
const { MCPEngine: BuiltMCPEngine } = require('../dist/mcp/engine') as typeof import('../src/mcp/engine');

// The reader-only setup (init plus a one-file index) takes well under a second on
// a desktop but has run past Vitest's 10 s hook default on a Windows CI runner, so
// that group's deadlines are looser on Windows and unchanged elsewhere.
const onWindows = process.platform === 'win32';

const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js');

function sleep(ms: number): Promise<void> {
Expand Down Expand Up @@ -254,7 +259,7 @@ describe('reader-only MCP engine (#1963)', () => {
fs.writeFileSync(path.join(root, 'app.ts'), 'export function originalSymbol() { return 1; }\n');
const cg = await CodeGraph.init(root);
try { await cg.indexAll(); } finally { cg.close(); }
});
}, onWindows ? 30_000 : undefined);

afterEach(async () => {
await engine?.stop();
Expand Down Expand Up @@ -290,7 +295,7 @@ describe('reader-only MCP engine (#1963)', () => {
expect(db.pragma('data_version', { simple: true })).toBe(version);
expect(fs.readFileSync(lockPath, 'utf8')).toBe(owner);
} finally { db.close(); }
});
}, onWindows ? 30_000 : undefined);

it('watch:false still performs the normal startup catch-up', async () => {
fs.writeFileSync(path.join(root, 'app.ts'), 'export function changedSymbol() {}\n');
Expand Down
9 changes: 7 additions & 2 deletions __tests__/runtime-control.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ import * as updateCheck from '../src/upgrade/update-check';
import { getWriterPidPath } from '../src/mcp/writer-lock';
import { builtinPatchingReachesImporters } from './helpers/runtime-capabilities';

// Windows CI runners take several times longer than Linux and macOS for the same
// real daemon start, index and refresh (4-10 s on Windows runners against 0.5-0.75 s),
// so the deadlines below are looser there and unchanged elsewhere.
const onWindows = process.platform === 'win32';

let root: string;
let server: net.Server | null = null;
let statusProjectPath: unknown;
Expand Down Expand Up @@ -455,7 +460,7 @@ describe('ordinary watcher startup', () => {
}
const started = outcome === 'previous-successor' ? null : once(child, 'message');
let settled = false;
const pending = checkRuntimeReady(root, identity, 2000, { requireWatcher: true, refresh: true })
const pending = checkRuntimeReady(root, identity, onWindows ? 20_000 : 2000, { requireWatcher: true, refresh: true })
.then(value => ({ value, error: null }), error => ({ value: null, error: error as Error }))
.finally(() => { settled = true; });
if (started) {
Expand All @@ -479,7 +484,7 @@ describe('ordinary watcher startup', () => {
? 'injected daemon refresh failure' : 'ownership changed');
expect(fs.readFileSync(getDaemonPidPath(root), 'utf8')).toBe(daemonBefore);
expect(fs.readFileSync(getWriterPidPath(root), 'utf8')).toBe(writerBefore);
}, 10000,
}, onWindows ? 30_000 : 10000,
);

it('rejects a different selected CLI build before creating the index or ownership records', async () => {
Expand Down
Loading