Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some way to hide React 16 error boundary warnings 🙈 #4597

Closed
erikras opened this issue Oct 4, 2017 · 6 comments
Closed

Some way to hide React 16 error boundary warnings 🙈 #4597

erikras opened this issue Oct 4, 2017 · 6 comments

Comments

@erikras
Copy link

erikras commented Oct 4, 2017

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 warning

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

See also

@cpojer
Copy link
Member

cpojer commented Oct 4, 2017

cc @gaearon

@erikras
Copy link
Author

erikras commented Oct 4, 2017

LOL. @gaearon knows. 😄 I've been bugging him all day.

@gaearon
Copy link
Contributor

gaearon commented Oct 4, 2017

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.

@gaearon
Copy link
Contributor

gaearon commented Oct 4, 2017

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.

@cpojer
Copy link
Member

cpojer commented Oct 4, 2017

yep, closing here then.

@gaearon
Copy link
Contributor

gaearon commented Oct 4, 2017

I filed as facebook/react#11098.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants