diff --git a/docs/config/index.md b/docs/config/index.md index 5c9c75c87be6..408459b6d736 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -1956,7 +1956,7 @@ Retry the test specific number of times if it fails. ### onConsoleLog -- **Type**: `(log: string, type: 'stdout' | 'stderr') => false | void` +- **Type**: `(log: string, type: 'stdout' | 'stderr') => boolean | void` Custom handler for `console.log` in tests. If you return `false`, Vitest will not print the log to the console. @@ -1967,9 +1967,8 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { - onConsoleLog(log: string, type: 'stdout' | 'stderr'): false | void { - if (log === 'message from third party library' && type === 'stdout') - return false + onConsoleLog(log: string, type: 'stdout' | 'stderr'): boolean | void { + return !(log === 'message from third party library' && type === 'stdout') }, }, })