Skip to content

Commit 438a272

Browse files
committed
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.
1 parent b214cb0 commit 438a272

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/search-and-replace.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('searchAndReplace', () => {
9898
})
9999

100100
it('should handle errors gracefully', async () => {
101-
const consoleErrorSpy = vi.spyOn(console, 'error')
101+
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
102102

103103
// Mock the file system and simulate an error for readFile
104104
mockFs({

0 commit comments

Comments
 (0)