From 48870c72adec002cc615a3280b0c18183bca808a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Jan 2026 08:58:45 +0000 Subject: [PATCH] fix(tests): suppress expected console output during tests Mock console.error and console.log in test setup to prevent noisy stderr output from error handling tests. The error messages were expected behavior being tested, not actual failures. --- vitest.setup.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vitest.setup.ts b/vitest.setup.ts index 49e00078..725d2b1a 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -1,5 +1,20 @@ import "@testing-library/jest-dom"; -import { vi } from "vitest"; +import { vi, beforeAll, afterAll } from "vitest"; + +// Suppress console.error and console.log during tests to reduce noise +// These are expected outputs from error handling tests +const originalConsoleError = console.error; +const originalConsoleLog = console.log; + +beforeAll(() => { + console.error = vi.fn(); + console.log = vi.fn(); +}); + +afterAll(() => { + console.error = originalConsoleError; + console.log = originalConsoleLog; +}); // Mock environment variables process.env.NEXTAUTH_SECRET = "test-secret";