-
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
ReactTestUtils.mockComponent() supports function and forwardRef components #13192
Conversation
Details of bundled changes.Comparing: afd4649...3fcb666 react-dom
Generated by 🚫 dangerJS |
This is an unfortunate Facebook-ism that leaked into open source but I don't think anybody ever figured out how to use it there. It's been broken for functional components for a long time which further discouraged its use. I think we should just deprecate and delete it in next major instead of trying to fix it. Unlike any other code in test renderer, it's tied to Jest (which is very odd but probably made sense in FB environment at some very early stage). Internally, we can convert it to a standalone utility since it's not actually sharing any state with test utils. |
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.
Let's deprecate instead and convert internal callsites (which can then use this fix)
Ah, I actually only encountered it because an FB engineer was trying to use it with a ref-forwarding component and was unable. |
I'll re-purpose this PR to be a deprecation, and suggest the FB engineer just pulls the code into an internal module. |
Closing in favor of #13193 |
I'm not very familiar with this method, or how it's used, so let me know if I'm overlooking anything 😄