Files
Kazuki YamadaandClaude Opus 5.5 0fbf578630 test(config): Restore and clear mocks globally via Vitest config
intent(test-hygiene): stop repeating mock cleanup by hand in 60 test files
decision(vitest-config): enable restoreMocks and clearMocks; both run before each test, ahead of beforeEach hooks, so every vi.spyOn() is back on the original method and every mock starts with empty call history
decision(mock-reset): keep mockReset off; it would rewind vi.fn() doubles configured once at module or describe scope (e.g. createMcpServerDouble, file-level deps objects)
decision(reset-calls): keep vi.resetAllMocks() in configLoad, globalDirectory, packageJsonParse, fileProcessContent, fileSearch, permissionCheck and sandbox.contract, whose file-scoped vi.fn() doubles get persistent or possibly unconsumed Once implementations inside tests; drop it where doubles are rebuilt in beforeEach or per test
constraint(vitest-5): clearMocks already defaults to true and restoreAllMocks only touches vi.spyOn(), not vi.fn(), so removing the manual calls does not change behaviour of vi.fn() doubles
learned(logger-doubles): silenceLogger() spies are restored before every test now, so they must be (re)created in beforeEach, after any vi.resetAllMocks()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 00:14:46 +09:00
..