mirror of
https://github.com/f/awesome-chatgpt-prompts.git
synced 2026-02-12 15:52:47 +00:00
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.
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user