What's the correct way to suppress console errors in tests that are expecting them? #9218
Unanswered
kgetz-arista
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Over the years, we've employed a variety of approaches to suppress console errors in tests where the error is expected to appear. We've tried assigning directly to
console.error, we've tried usingmockImplementation, etc. However, starting with Vitest 4.0.7, none of these approaches seem to work anymore. No matter what we try, console errors (from deeply nested React components, for example) are bubbling up and being printed to the screen during testing, which results in a build failure for us.What's the correct, Vitest-approved way of suppressing console errors during testing?
Beta Was this translation helpful? Give feedback.
All reactions