-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Remove react-test-renderer/shallow export #28497
Conversation
Comparing: f73d11f...a4c5ff6 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
It's a bit unfortunate that we never landed a deprecation warning. Instead of removing, can we throw in the entrypoint with a message pointing to the new package? |
f93af47
to
ddf78a7
Compare
module.exports = require('react-shallow-renderer'); | ||
function ReactShallowRenderer() { | ||
throw new Error( | ||
'react-test-renderer is deprecated. To use react-test-renderer/shallow, import react-shallow-renderer directly. See https://react.dev/warnings/react-test-renderer' |
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.
Nit: "deprecated" usually doesn't mean "removed" but in this case, this is removed. I would say something like this instead:
react-test-renderer/shallow has been removed. See https://react.dev/warnings/react-test-renderer.
I'm not sure we should direct to react-shallow-renderer in the error message, or if we should mention it on the warning page instead. Really, people shouldn't be using shallow rendering at all, and direct people to that package would lead them in the wrong direction.
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 can move more detail to the warning page. My thinking for letting people know about the package movement is just to minimize the amount of blockers for adopting 19. If an app happens to use a bunch of shallow renderer in their test suite, hopefully they can drop in the original package we were reexporting and work on an incremental migration instead of being blocked completely.
ddf78a7
to
0275564
Compare
0275564
to
31ac7d7
Compare
Based on - #28497 - #28419 Reusing the disableLegacyMode flag, we set ReactTestRenderer to always render with concurrent root where legacy APIs are no longer available. If disableLegacyMode is false, we continue to allow the unstable_isConcurrent option determine the root type. Also checking a global `IS_REACT_NATIVE_TEST_ENVIRONMENT` so we can maintain the existing behavior for RN until we remove legacy root support there.
Based on - #28497 - #28419 Reusing the disableLegacyMode flag, we set ReactTestRenderer to always render with concurrent root where legacy APIs are no longer available. If disableLegacyMode is false, we continue to allow the unstable_isConcurrent option determine the root type. Also checking a global `IS_REACT_NATIVE_TEST_ENVIRONMENT` so we can maintain the existing behavior for RN until we remove legacy root support there. DiffTrain build for [bb66aa3](bb66aa3)
Based on - facebook#28419 ## Summary The shallow renderer was extracted from the repo years ago and published by enzyme: https://github.com/enzymejs/react-shallow-renderer We no longer need to reexport under the react-test-renderer namespace. People can import `react-shallow-renderer` as needed ## How did you test this change? - Observe shallow.js in react-test-renderer package from standard build - Run build with changes on this branch - Observe no more shallow.js export in build output
Based on - facebook#28497 - facebook#28419 Reusing the disableLegacyMode flag, we set ReactTestRenderer to always render with concurrent root where legacy APIs are no longer available. If disableLegacyMode is false, we continue to allow the unstable_isConcurrent option determine the root type. Also checking a global `IS_REACT_NATIVE_TEST_ENVIRONMENT` so we can maintain the existing behavior for RN until we remove legacy root support there.
Based on
Summary
The shallow renderer was extracted from the repo years ago and published by enzyme: https://github.com/enzymejs/react-shallow-renderer
We no longer need to reexport under the react-test-renderer namespace. People can import
react-shallow-renderer
as neededHow did you test this change?