From 7b4c0c348328b2cb356d59596d3efb3190fb8044 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 4 Jul 2026 18:09:45 -0700 Subject: [PATCH] test: reset windows process-rows snapshot between agent-foreground cases The new module-level Windows rows reader caches for 500ms with real Date.now(), so one case's mocked process table was served to the next case's assertions (7 CI failures in agent-foreground-process.test.ts). Mirror the suite's existing POSIX resetProcessTableSnapshotForTests() with the Windows reset in beforeEach. Co-authored-by: Orca --- src/main/providers/agent-foreground-process.test.ts | 4 ++++ 1 file changed, 4 insertions(+) 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' }) })