mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 00:03:08 +00:00
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 <help@stably.ai>
This commit is contained in:
@@ -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' })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user