diff --git a/__tests__/daemon-registry.test.ts b/__tests__/daemon-registry.test.ts index f430983a8..be47f79b4 100644 --- a/__tests__/daemon-registry.test.ts +++ b/__tests__/daemon-registry.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } from 'vitest'; +import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, onTestFinished, vi } from 'vitest'; import { execFileSync, spawn } from 'child_process'; import * as fs from 'fs'; import * as net from 'net'; @@ -60,6 +60,22 @@ function startDetachedProcess(): number { return pid; } +/** + * Same allowance daemon-lock-holder.test.ts makes: each OS lookup gets a + * minute, not the 5 s production default — on a loaded runner PowerShell can + * take longer to start, and a timed-out Windows lookup returns no command + * line, flipping 'not-running' verdicts to 'unverified'. + */ +const LOOKUP_ENV = 'CODEGRAPH_PROCESS_LOOKUP_TIMEOUT_MS'; +const savedLookupTimeout = process.env[LOOKUP_ENV]; +beforeAll(() => { + process.env[LOOKUP_ENV] = '60000'; +}); +afterAll(() => { + if (savedLookupTimeout === undefined) delete process.env[LOOKUP_ENV]; + else process.env[LOOKUP_ENV] = savedLookupTimeout; +}); + describe('daemon-registry', () => { let tmpHome: string; let prevHome: string | undefined; diff --git a/__tests__/mcp-daemon.test.ts b/__tests__/mcp-daemon.test.ts index 6fc3cec73..8be3edfd6 100644 --- a/__tests__/mcp-daemon.test.ts +++ b/__tests__/mcp-daemon.test.ts @@ -32,7 +32,7 @@ * end is itself the proof the canonicalization works. */ -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { ChildProcessWithoutNullStreams, spawn } from 'child_process'; import * as fs from 'fs'; import * as net from 'net'; @@ -265,6 +265,21 @@ async function staleIndex(root: string): Promise { return before; } +/** + * Same allowance daemon-lock-holder.test.ts makes: each OS lookup gets a + * minute, not the 5 s production default — on a loaded runner PowerShell can + * take longer to start, and lookups time out while handovers wait on them. + */ +const LOOKUP_ENV = 'CODEGRAPH_PROCESS_LOOKUP_TIMEOUT_MS'; +const savedLookupTimeout = process.env[LOOKUP_ENV]; +beforeAll(() => { + process.env[LOOKUP_ENV] = '60000'; +}); +afterAll(() => { + if (savedLookupTimeout === undefined) delete process.env[LOOKUP_ENV]; + else process.env[LOOKUP_ENV] = savedLookupTimeout; +}); + describe('Shared MCP daemon (issue #411)', () => { let tempDir: string; // the (possibly symlinked) path processes are spawned with let realRoot: string; // its canonical form — what the daemon keys paths on