-
Notifications
You must be signed in to change notification settings - Fork 220
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-testing does not print name of component wrapped in memo correctly #1237
Comments
@patsissons points out that quilt/packages/react-testing/src/toReactString.ts Lines 97 to 112 in 7044ae7
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Still an issue |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Overview
I was recently testing some stuff in web when I came across a case where react-testing was not returning the name of a component correctly and was instead falling back to the default of "Component"
I would have expected that to say:
I believe this is because this Toast component in question is the one from polaris which is a Component wrapped in a React.memo, rather than a plain old functional component.
I suspect this is because the printType utility does not correctly handle finding the name for components that are wrapped in
React.memo()
. I'd wager components wrapped inReact.forwardRef()
are also affected in the same way. You should also test components that are doReact.memo(React.forwardRef(function SomeComponent() { return 'hi'; }))
facebook/react#17274 from the react repo might be some useful related reading as it fixes up some logic around how names are extracted from these exotic components in the react dev tools.
The text was updated successfully, but these errors were encountered: