From edd8fbef41a8686f7b138ffa89f342e896bef543 Mon Sep 17 00:00:00 2001 From: jackpope Date: Fri, 23 Feb 2024 16:38:05 +0000 Subject: [PATCH] [RTR] Add usage warning behind flag (#27903) ## Summary Moving towards deprecation of ReactTestRenderer. Log a warning on each render so we can remove the exports in a future major version. We can enable this flag in web RTR without disrupting RN tests by flipping the flag in `packages/shared/forks/ReactFeatureFlags.test-renderer.js` ## How did you test this change? `yarn test packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js` DiffTrain build for [66c8346401d271588e4c400921c5dab5478fc623](https://github.com/facebook/react/commit/66c8346401d271588e4c400921c5dab5478fc623) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/__test_utils__/ReactAllWarnings.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 7a563e5512..64c6cf9d2d 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -aaf85f3af8c30252edaab5c24975cd086937b2a4 +66c8346401d271588e4c400921c5dab5478fc623 diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index 5d4d5526a2..767a739b90 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -387,6 +387,7 @@ export default [ "memo: The first argument must be a component. Instead received: %s", "onError returned something with a type other than \"string\". onError should return a string and may return null or undefined but must not return anything else. It received something of type \"%s\" instead", "propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.", + "react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer", "render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", "render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.", "render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render.",