Open spiffytech opened 4 years ago
spyOn(console, 'error')
?
That would suppress e.g., errors in my tests, or code errors I didn't catch in my tests. I only want to suppress errors that are caught as part of expect().toThrow()
.
From this post, it sounds like there's supposed to be an official React way to suppress the errors, but I'm not sure I whether can do that with the existing Enzyme API.
That post only describes a browser mechanism to handle it, not a universal one :-/ if you can provide a PR with a test case (mocking out console.error
to assert on what's called), i can try to look into it.
Is your feature request related to a problem? Please describe. When I'm testing a component that throws an error, I get a React error boundary message in my console. This makes it difficult to see what really went wrong with my tests.
Describe the solution you'd like I'd like an API call I can make that will prevent React from putting the errors into my console