-
Notifications
You must be signed in to change notification settings - Fork 47k
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
tests: add regression test for reading ReactCurrentOwner stateNode #12412
Conversation
Maybe something like this @gaearon? |
expect(() => { | ||
ReactDOM.render(<App />, container); | ||
}).not.toThrow(stateNodeErr); | ||
} |
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.
It's enough to replace this whole block with just ReactDOM.render(<App />, container)
. If it did throw, the test would fail anyway. You can remove the error declaration too.
@@ -377,6 +377,26 @@ describe('ReactDOM', () => { | |||
} | |||
}); | |||
|
|||
it('should not throw a TypeError when reading stateNode on ReactCurrentOwner', () => { |
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.
We avoid implementation details in test titles. Just "should not crash calling findDOMNode inside a functional component".
Updated. |
…acebook#12412) * tests: add regression test for reading ReactCurrentOwner stateNode * tests: replace expect with just rendering the component
Follow up PR for #12407. Adds a regression test related to issue #12299.
Before the #12407 fix this test case would fail as: