-
Notifications
You must be signed in to change notification settings - Fork 46.3k
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
react-test-renderer: improve findByType() error message #17439
react-test-renderer: improve findByType() error message #17439
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 72ff92a:
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
I still think this is a valid fix. Let me know if there is anything else needed from me. |
Could you rebase this and add a test for the |
…rns a falsy value. The error message in this case not the most descriptive but seems consistent with the `getComponentName(type) || 'Unknown'` pattern seen in multiple places in this code base.
278787b
to
72ff92a
Compare
Thanks @threepointone. I just rebased and added the suggested test. |
Looks good to me, thanks! |
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 noticed that The
findByType()
method throws unhelpful error messages when using a string as thetype
argument. For example:I am also running into this when searching for components using
React.memo
. My solution was to usegetComponentName()
. Thanks!