Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move flag definition
  • Loading branch information
Jack Pope committed Feb 20, 2024
commit 866ea334d7985a03e1ad2ce24d66905a6c1d84bb
25 changes: 2 additions & 23 deletions packages/react-test-renderer/shallow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import ReactShallowRenderer from 'react-shallow-renderer';
import {enableReactTestRendererWarning} from 'shared/ReactFeatureFlags';

let Renderer = ReactShallowRenderer;

if (enableReactTestRendererWarning === true) {
const emptyObject = {};
Renderer = class ReactShallowRendererWithWarning extends (
ReactShallowRenderer
) {
render(element, context = emptyObject) {
if (__DEV__) {
console.warn(
'react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer',
);
}

return super.render(element, context);
}
};
}

export default Renderer;
export {default} from 'react-shallow-renderer';

This file was deleted.

This file was deleted.

8 changes: 5 additions & 3 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ export const enableInfiniteRenderLoopDetection = true;
// during element creation.
export const enableRefAsProp = __NEXT_MAJOR__;

// Not ready to break experimental yet.
// Needs more internal cleanup
// Warn on any usage of ReactTestRenderer
export const enableReactTestRendererWarning = false;

// -----------------------------------------------------------------------------
// Chopping Block
//
Expand All @@ -204,9 +209,6 @@ export const enableUnifiedSyncLane = true;
// Adds an opt-in to time slicing for updates that aren't wrapped in startTransition.
export const allowConcurrentByDefault = false;

// Warn on any usage of ReactTestRenderer
export const enableReactTestRendererWarning = false;

// -----------------------------------------------------------------------------
// React DOM Chopping Block
//
Expand Down