diff --git a/cli/__tests__/adapters.claude.test.mjs b/cli/__tests__/adapters.claude.test.mjs index 0010db47b4..5cebc89cea 100644 --- a/cli/__tests__/adapters.claude.test.mjs +++ b/cli/__tests__/adapters.claude.test.mjs @@ -255,17 +255,14 @@ describe('claude adapter — spawn()', () => { }); test('rejects on timeout and SIGTERMs the child', async () => { - // Child never emits close within the window. + // Child closes only after the timeout kills it, independent of host load. const proc = new EventEmitter(); proc.stdout = new EventEmitter(); proc.stderr = new EventEmitter(); - proc.kill = jest.fn(); + proc.kill = jest.fn(() => queueMicrotask(() => proc.emit('close', null))); const impl = () => proc; const p = claude.spawn('x', { sessionId: 'sid-1', timeoutMs: 20, _spawnImpl: impl }); - // After kill, simulate the process closing so the adapter resolves its close handler. - setTimeout(() => proc.emit('close', null), 40); - await expect(p).rejects.toThrow(/timed out after 20ms/); expect(proc.kill).toHaveBeenCalledWith('SIGTERM'); }); diff --git a/cli/__tests__/adapters.opencode.test.mjs b/cli/__tests__/adapters.opencode.test.mjs index 57abedbf89..a651fe6186 100644 --- a/cli/__tests__/adapters.opencode.test.mjs +++ b/cli/__tests__/adapters.opencode.test.mjs @@ -331,6 +331,9 @@ describe('opencode public seat withholds a turn whose Commonly tools failed', () })); await writeFile(join(pkgDir, 'src', 'index.js'), ''); await writeFile(join(home, 'current'), '0.3.13\n'); + // The selected MCP is already installed for this fixture. Keep the + // detached warmer from racing with withTemp's teardown. + await writeFile(join(home, '.warm.lock'), 'warming\n'); const workspace = join(root, 'workspace'); await mkdir(workspace); const keyFile = join(root, 'provider-key');