test: suppress console output noise in vitest
Add onConsoleLog: () => false to vitest config to silence expected warn/error calls from production code when tests deliberately feed bad input (e.g. parseJson with malformed JSON). Tests can still use vi.spyOn(console, ...) to assert on console calls explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,5 +18,11 @@ export default defineConfig({
|
||||
resolve(__dirname, 'unit/**/*.test.ts'),
|
||||
resolve(__dirname, 'integration/**/*.test.ts'),
|
||||
],
|
||||
// Suppress console output from production code during tests (e.g. expected
|
||||
// warn/error calls when intentionally feeding bad input to parsers).
|
||||
// Tests that need to assert on console calls can still use vi.spyOn(console, ...).
|
||||
onConsoleLog() {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user