diff --git a/src/main/providers/agent-foreground-process.test.ts b/src/main/providers/agent-foreground-process.test.ts index a54ee116ca5..c21d501b49a 100644 --- a/src/main/providers/agent-foreground-process.test.ts +++ b/src/main/providers/agent-foreground-process.test.ts @@ -10,6 +10,7 @@ vi.mock('child_process', () => ({ import { resetProcessTableSnapshotForTests } from '../../shared/process-table-snapshot' import { resolveAgentForegroundProcess } from './agent-foreground-process' +import { resetWindowsProcessRowsSnapshotForTests } from './windows-foreground-process-rows' // Why: the module wraps execFile with promisify, so the mock must honor the // Node callback contract — invoke the last arg with (err, { stdout, stderr }). @@ -73,6 +74,9 @@ describe('resolveAgentForegroundProcess', () => { beforeEach(() => { execFileMock.mockReset() resetProcessTableSnapshotForTests() + // Why: the Windows rows reader caches across calls (500ms TTL), so each + // case's execFile mock must not be answered by the previous case's rows. + resetWindowsProcessRowsSnapshotForTests() platform = Object.getOwnPropertyDescriptor(process, 'platform') Object.defineProperty(process, 'platform', { value: 'darwin' }) })