Some way to hide React 16 error boundary warnings ๐
Closed this issue ยท 6 comments
Do you want to request a feature or report a bug?
Somewhere in between?
What is the current behavior?
When I'm running tests on my library, there are some behaviors that I want to test do throw an error. These currently result in:
Consider adding an error boundary to your tree to customize error handling behavior.
You can learn more about error boundaries at https://fb.me/react-error-boundaries.
...being output to the console. This error is great in an application, but not so great for a library test.
What is the expected behavior?
It would be great if I could do something like:
expect(() => {
TestUtils.renderIntoDocument(<DoSomething naughty/>)
})
.toThrow(/Bad developer!/)
.andCatch() // <---- prevents React 16 error boundary warningPlease provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
jest@21.2.1
react@16.0.0
react-dom@16.0.0
See also
To clarify I meant this should probably be filed in React repo ๐
I don't think we saw these warnings. But we probably mocked something in Jest at some point and that's why.
Sorry my comment was confusing. I meant "seeing it in Jest" as a phrase, not "file ... in Jest" ๐
My point was that facebook/react#10474 is a separate issue, and I wanted to ask you to create a new one in React repo specifically about seeing it in Jest.
yep, closing here then.
I filed as facebook/react#11098.