Skip to content

Commit

Permalink
docs: update onConsoleLog return type (#5391)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenghan34 authored Mar 16, 2024
1 parent a8da192 commit ab25a52
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ Retry the test specific number of times if it fails.
### onConsoleLog<NonProjectOption />
- **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.
Expand All @@ -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')
},
},
})
Expand Down

0 comments on commit ab25a52

Please sign in to comment.