-
Notifications
You must be signed in to change notification settings - Fork 50.2k
test(getComponentName): Increase test coverage #18149
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
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1fae59a:
|
febda60 to
3b1dfd2
Compare
|
Hey @bvaughn is this ok if I ping you to review this? Seems like this concerns more of your work (dev tooling). |
3b1dfd2 to
4852efd
Compare
| expect(() => ReactDOMServer.renderToString(<MyComponent />)).toWarnDev( | ||
| 'componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + | ||
| '* Move code from componentWillMount to componentDidMount (preferred in most cases) or the constructor.\n\n' + | ||
| 'Please update the following components: MyComponent', |
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.
I'm not sure I understand why we updated this test. This test isn't about verifying warnings. It's testing behavior, and the toWarnDev() assertions are just there to suppress the (expected) warnings.
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.
Hm, let me check the git blame for when this warning was added. Might be I got confused or the warning message wasn't checked in the first place.
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.
No worries. I think maybe just revert this file and I'll merge the rest?
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.
Ok so the reason I chose this test was that it was the first one I found that hit
| if (!didWarnAboutDeprecatedWillMount[componentName]) { |
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.
Agreed, the new location seems better.
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js
Outdated
Show resolved
Hide resolved
0ed6d5d to
1fae59a
Compare
Summary
Increases coverage of
getComponentNameto increase likely-hood of #15638 being accepted.The usages of
getComponentNamethat are still uncovered are included in 2979a97. They either affect react-native (don't know how this is tested), affect messages for possibly internal bugs ("file an issue") or aren't tested to begin with.It seems like
react/packages/react-dom/src/server/ReactPartialRenderer.js
Line 1321 in abc8fa9
react/packages/react-dom/src/server/ReactPartialRenderer.js
Line 124 in abc8fa9
react/packages/react-dom/src/server/ReactPartialRenderer.js
Line 1321 in abc8fa9
Test Plan
getComponentName(**)withnullfixmeand push to verify with full CI