From 1f62563922495ff8058af97dec1dcbab12cefc69 Mon Sep 17 00:00:00 2001 From: Martin Porwoll Date: Mon, 15 Dec 2025 10:45:19 +0000 Subject: [PATCH] fix: clear console mocks between tests in data-masking spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test was failing because mock.calls[0] was getting calls from the previous test. Added mockClear() in beforeEach to ensure each test starts with fresh mock state. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- tests/unit/security/data-masking.unit.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/security/data-masking.unit.spec.ts b/tests/unit/security/data-masking.unit.spec.ts index 923549f..36a4765 100644 --- a/tests/unit/security/data-masking.unit.spec.ts +++ b/tests/unit/security/data-masking.unit.spec.ts @@ -347,6 +347,10 @@ describe('Data Masking', () => { vi.spyOn(console, 'log').mockImplementation(() => {}) vi.spyOn(console, 'error').mockImplementation(() => {}) vi.spyOn(console, 'warn').mockImplementation(() => {}) + // Clear any previous calls + vi.mocked(console.log).mockClear() + vi.mocked(console.error).mockClear() + vi.mocked(console.warn).mockClear() }) it('creates logger with info method', () => {