From 438a27236675d072dcf03363d5aa19e56b7779f9 Mon Sep 17 00:00:00 2001 From: 0xObsidian <131651958+0xObsidian@users.noreply.github.com> Date: Sat, 4 Oct 2025 11:19:34 +0200 Subject: [PATCH] fix(test): error handling in search-and-replace test Description ----------- The "should handle errors gracefully" test was intentionally triggering errors to verify error handling, but `console.error` was not mocked to suppress output, causing noisy `stderr` logs during test despite all tests passing. Testing the introduced fix -------------------------- ``` npm run test ``` All tests will now pass cleanly without `stderr` error output. --- test/search-and-replace.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/search-and-replace.test.ts b/test/search-and-replace.test.ts index bbf34e9..de4a663 100644 --- a/test/search-and-replace.test.ts +++ b/test/search-and-replace.test.ts @@ -98,7 +98,7 @@ describe('searchAndReplace', () => { }) it('should handle errors gracefully', async () => { - const consoleErrorSpy = vi.spyOn(console, 'error') + const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}) // Mock the file system and simulate an error for readFile mockFs({