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:
fuomag9
2026-03-08 02:39:29 +01:00
parent 05f06cf386
commit b5bb668bd9

View File

@@ -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;
},
},
});