File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1619,3 +1619,26 @@ By default Vitest will run all of your test cases even if some of them fail. Thi
1619
1619
- ** Version:** Since Vitest 0.32.3
1620
1620
1621
1621
Retry the test specific number of times if it fails.
1622
+
1623
+ ### onConsoleLog
1624
+
1625
+ - ** Type** : ` (log: string, type: 'stdout' | 'stderr') => false | void `
1626
+
1627
+ Custom handler for ` console.log ` in tests. If you return ` false ` , Vitest will not print the log to the console.
1628
+
1629
+ Can be useful for filtering out logs from third-party libraries.
1630
+
1631
+ ``` ts
1632
+ import { defineConfig } from ' vitest/config'
1633
+
1634
+ export default defineConfig ({
1635
+ test: {
1636
+ onConsoleLog(log : string , type : ' stdout' | ' stderr' ): boolean | void {
1637
+ if (log === ' message from third party library' && type === ' stdout' ) {
1638
+ return false ;
1639
+ }
1640
+ },
1641
+ },
1642
+ })
1643
+ ```
1644
+
You can’t perform that action at this time.
0 commit comments