-
Notifications
You must be signed in to change notification settings - Fork 208
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
Fix test failing because of react error boundaries #222
Conversation
Oops, now it is failing for older react versions 😿 I'll try something else |
It's working now 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Looks good to me, just one small change before we can merge it.
test/waypoint_test.jsx
Outdated
this.props.children = [ | ||
<div key={1} />, | ||
<div key={2} />, | ||
<div key={3} />, | ||
]; | ||
|
||
expect(this.subject).toThrowError(notValidErrorMessage); | ||
|
||
window.onerror = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If window.onerror had been previously set to something else, this will break it. It would be a good idea to store the original value before assigning it, and then set it back to that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, forgot about that! Fixed :)
Thanks for fixing this! |
No problem! Happy to help! 😄 |
Fixing the test that was disabled due to the React 16 error boundaries handling: #215 (comment)
I found out that with error boundaries, error throws twice in development mode, here is a justification for that from React team: facebook/react#10384 (comment)
I found a fix for that although it looks a little hacky. The other option could be to run tests in
production
mode, but that breaks debug tests and I'm not sure how to fix this.