diff --git a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js index eabcbd215bfb2..5da6b8de2a42e 100644 --- a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js @@ -254,7 +254,7 @@ describe('React hooks DevTools integration', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index a863c6144abcc..26c9beb97b990 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -77,7 +77,7 @@ describe('InspectedElement', () => { // Used by inspectElementAtIndex() helper function utils.act(() => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); @@ -356,7 +356,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -506,7 +506,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2063,7 +2063,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2123,7 +2123,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2399,7 +2399,7 @@ describe('InspectedElement', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }, false); await utils.actAsync(() => { @@ -2937,7 +2937,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); diff --git a/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js b/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js index 041086690e7fe..f8026d6ea9fab 100644 --- a/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js +++ b/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js @@ -67,7 +67,7 @@ describe('DebugTracing', () => {
, - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); expect(logs).toEqual([]); @@ -179,7 +179,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); @@ -216,7 +216,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); @@ -247,7 +247,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); @@ -278,7 +278,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); }).toErrorDev('Cannot update during an existing state transition'); @@ -305,7 +305,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); @@ -333,7 +333,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }); expect(logs).toEqual([ @@ -358,7 +358,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }); @@ -381,7 +381,7 @@ describe('DebugTracing', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ), ); diff --git a/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js b/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js index 0ce51699849b7..71e047afc5ff6 100644 --- a/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js @@ -59,7 +59,7 @@ describe('ErrorBoundaryReconciliation', () => { , - {isConcurrent: isConcurrent}, + {unstable_isConcurrent: isConcurrent}, ); }); expect(renderer).toMatchRenderedOutput(); diff --git a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js index 5da503c8ca34d..5f09cf997907c 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js @@ -86,7 +86,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0, 0', 'Child: 0, 0', 'Effect: 0, 0']); expect(root).toMatchRenderedOutput('0, 0'); @@ -174,7 +174,7 @@ describe('ReactHooks', () => { Parent = memo(Parent); - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0, 0 (light)', 'Child: 0, 0 (light)']); expect(root).toMatchRenderedOutput('0, 0 (light)'); @@ -232,7 +232,7 @@ describe('ReactHooks', () => { return counter; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Count: 0']); expect(root).toMatchRenderedOutput('0'); @@ -266,7 +266,7 @@ describe('ReactHooks', () => { return counter; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Count: 0']); expect(root).toMatchRenderedOutput('0'); @@ -322,7 +322,7 @@ describe('ReactHooks', () => { }); return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); await act(() => { root.update( @@ -390,7 +390,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0', 'Child: 0', 'Effect: 0']); expect(root).toMatchRenderedOutput('0'); @@ -465,7 +465,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0', 'Child: 0']); expect(root).toMatchRenderedOutput('0'); @@ -523,7 +523,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 1', 'Child: 1']); expect(root).toMatchRenderedOutput('1'); diff --git a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js index f15f6aaf4243b..ff79640f4132e 100644 --- a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js @@ -97,7 +97,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -183,7 +183,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -206,7 +206,7 @@ describe('ReactLazy', () => { const LazyText = lazy(async () => Text); const root = ReactTestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); let error; @@ -240,7 +240,7 @@ describe('ReactLazy', () => { }); const root = ReactTestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); let error; @@ -300,7 +300,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Suspend! [LazyChildA]', 'Loading...']); @@ -335,7 +335,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -392,7 +392,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -438,7 +438,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Not lazy: 0', 'Loading...']); @@ -483,7 +483,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Not lazy: 0', 'Loading...']); @@ -559,7 +559,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -689,7 +689,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -732,7 +732,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -759,7 +759,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -792,7 +792,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -939,7 +939,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -977,7 +977,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1022,7 +1022,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1053,7 +1053,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -1140,7 +1140,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -1187,7 +1187,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1227,7 +1227,7 @@ describe('ReactLazy', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); await waitForAll(['Loading...']); @@ -1335,7 +1335,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Init A', 'Loading...']); @@ -1420,7 +1420,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: false, + unstable_isConcurrent: false, }); assertLog(['Init A', 'Init B', 'Loading...']); @@ -1482,7 +1482,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Init A', 'Loading...']); @@ -1551,7 +1551,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: false, + unstable_isConcurrent: false, }); assertLog(['Init A', 'Loading...']); diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index c5c23290acd69..78515760b41ea 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -52,7 +52,10 @@ import {checkPropStringCoercion} from 'shared/CheckStringCoercion'; import {getPublicInstance} from './ReactFiberConfigTestHost'; import {ConcurrentRoot, LegacyRoot} from 'react-reconciler/src/ReactRootTags'; -import {enableReactTestRendererWarning} from 'shared/ReactFeatureFlags'; +import { + enableReactTestRendererWarning, + enableReactTestRendererLegacyMode, +} from 'shared/ReactFeatureFlags'; const act = React.act; @@ -60,7 +63,6 @@ const act = React.act; type TestRendererOptions = { createNodeMock: (element: React$Element) => any, - isConcurrent: boolean, unstable_isConcurrent: boolean, unstable_strictMode: boolean, }; @@ -478,18 +480,15 @@ function create( } let createNodeMock = defaultTestOptions.createNodeMock; - let isConcurrent = false; + let isConcurrent = true; let isStrictMode = false; if (typeof options === 'object' && options !== null) { if (typeof options.createNodeMock === 'function') { // $FlowFixMe[incompatible-type] found when upgrading Flow createNodeMock = options.createNodeMock; } - if ( - options.unstable_isConcurrent === true || - options.isConcurrent === true - ) { - isConcurrent = true; + if (enableReactTestRendererLegacyMode) { + isConcurrent = options.unstable_isConcurrent; } if (options.unstable_strictMode === true) { isStrictMode = true; diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js index 36b9896952b56..ab0af5b09c786 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js @@ -15,14 +15,14 @@ ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false; const React = require('react'); const ReactTestRenderer = require('react-test-renderer'); const {format: prettyFormat} = require('pretty-format'); +const InternalTestUtils = require('internal-test-utils'); +const waitForAll = InternalTestUtils.waitForAll; +const act = InternalTestUtils.act; // Isolate noop renderer jest.resetModules(); const ReactNoop = require('react-noop-renderer'); -const InternalTestUtils = require('internal-test-utils'); -const waitForAll = InternalTestUtils.waitForAll; - // Kind of hacky, but we nullify all the instances to test the tree structure // with jasmine's deep equality function, and test the instances separate. We // also delete children props because testing them is more annoying and not @@ -54,6 +54,7 @@ describe('ReactTestRenderer', () => { beforeEach(() => { jest.resetModules(); ReactFeatureFlags.enableReactTestRendererWarning = false; + ReactFeatureFlags.enableReactTestRendererLegacyMode = false; }); it('should warn if enableReactTestRendererWarning is enabled', () => { @@ -66,11 +67,14 @@ describe('ReactTestRenderer', () => { ); }); - it('renders a simple component', () => { + it('renders a simple component', async () => { function Link() { return ; } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual({ type: 'a', props: {role: 'link'}, @@ -78,19 +82,25 @@ describe('ReactTestRenderer', () => { }); }); - it('renders a top-level empty component', () => { + it('renders a top-level empty component', async () => { function Empty() { return null; } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual(null); }); - it('exposes a type flag', () => { + it('exposes a type flag', async () => { function Link() { return ; } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const object = renderer.toJSON(); expect(object.$$typeof).toBe(Symbol.for('react.test.json')); @@ -102,7 +112,7 @@ describe('ReactTestRenderer', () => { } }); - it('can render a composite component', () => { + it('can render a composite component', async () => { class Component extends React.Component { render() { return ( @@ -117,7 +127,10 @@ describe('ReactTestRenderer', () => { return ; }; - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual({ type: 'div', props: {className: 'purple'}, @@ -125,7 +138,7 @@ describe('ReactTestRenderer', () => { }); }); - it('renders some basics with an update', () => { + it('renders some basics with an update', async () => { let renders = 0; class Component extends React.Component { @@ -157,7 +170,10 @@ describe('ReactTestRenderer', () => { return null; }; - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual({ type: 'div', props: {className: 'purple'}, @@ -166,7 +182,7 @@ describe('ReactTestRenderer', () => { expect(renders).toBe(6); }); - it('exposes the instance', () => { + it('exposes the instance', async () => { class Mouse extends React.Component { constructor() { super(); @@ -179,7 +195,10 @@ describe('ReactTestRenderer', () => { return
{this.state.mouse}
; } } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual({ type: 'div', @@ -188,7 +207,9 @@ describe('ReactTestRenderer', () => { }); const mouse = renderer.getInstance(); - mouse.handleMoose(); + await act(() => { + mouse.handleMoose(); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: ['moose'], @@ -196,15 +217,20 @@ describe('ReactTestRenderer', () => { }); }); - it('updates types', () => { - const renderer = ReactTestRenderer.create(
mouse
); + it('updates types', async () => { + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(
mouse
); + }); + expect(renderer.toJSON()).toEqual({ type: 'div', props: {}, children: ['mouse'], }); - - renderer.update(mice); + await act(() => { + renderer.update(mice); + }); expect(renderer.toJSON()).toEqual({ type: 'span', props: {}, @@ -212,14 +238,18 @@ describe('ReactTestRenderer', () => { }); }); - it('updates children', () => { - const renderer = ReactTestRenderer.create( -
- A - B - C -
, - ); + it('updates children', async () => { + let renderer; + await act(() => { + renderer = ReactTestRenderer.create( +
+ A + B + C +
, + ); + }); + expect(renderer.toJSON()).toEqual({ type: 'div', props: {}, @@ -230,13 +260,15 @@ describe('ReactTestRenderer', () => { ], }); - renderer.update( -
- D - C - B -
, - ); + await act(() => { + renderer.update( +
+ D + C + B +
, + ); + }); expect(renderer.toJSON()).toEqual({ type: 'div', props: {}, @@ -248,7 +280,7 @@ describe('ReactTestRenderer', () => { }); }); - it('does the full lifecycle', () => { + it('does the full lifecycle', async () => { const log = []; class Log extends React.Component { render() { @@ -263,9 +295,16 @@ describe('ReactTestRenderer', () => { } } - const renderer = ReactTestRenderer.create(); - renderer.update(); - renderer.unmount(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); + await act(() => { + renderer.update(); + }); + await act(() => { + renderer.unmount(); + }); expect(log).toEqual([ 'render Foo', @@ -277,9 +316,11 @@ describe('ReactTestRenderer', () => { ]); }); - it('gives a ref to native components', () => { + it('gives a ref to native components', async () => { const log = []; - ReactTestRenderer.create(
log.push(r)} />); + await act(() => { + ReactTestRenderer.create(
log.push(r)} />); + }); expect(log).toEqual([null]); }); @@ -310,7 +351,7 @@ describe('ReactTestRenderer', () => { ); }); - it('allows an optional createNodeMock function', () => { + it('allows an optional createNodeMock function', async () => { const mockDivInstance = {appendChild: () => {}}; const mockInputInstance = {focus: () => {}}; const mockListItemInstance = {click: () => {}}; @@ -339,27 +380,41 @@ describe('ReactTestRenderer', () => { return {}; } } - ReactTestRenderer.create(
log.push(r)} />, {createNodeMock}); - ReactTestRenderer.create( log.push(r)} />, { - createNodeMock, + await act(() => { + ReactTestRenderer.create(
log.push(r)} />, { + createNodeMock, + }); + }); + await act(() => { + ReactTestRenderer.create( log.push(r)} />, { + createNodeMock, + }); + }); + await act(() => { + ReactTestRenderer.create( +
+ +
    +
  • log.push(r)} /> +
+
    +
  • log.push(r)} /> +
  • log.push(r)} /> +
+
+
, + {createNodeMock, foobar: true}, + ); + }); + await act(() => { + ReactTestRenderer.create(, {createNodeMock}); + }); + await act(() => { + ReactTestRenderer.create(
log.push(r)} />); + }); + await act(() => { + ReactTestRenderer.create(
log.push(r)} />, {}); }); - ReactTestRenderer.create( -
- -
    -
  • log.push(r)} /> -
-
    -
  • log.push(r)} /> -
  • log.push(r)} /> -
-
-
, - {createNodeMock, foobar: true}, - ); - ReactTestRenderer.create(, {createNodeMock}); - ReactTestRenderer.create(
log.push(r)} />); - ReactTestRenderer.create(
log.push(r)} />, {}); expect(log).toEqual([ mockDivInstance, mockInputInstance, @@ -384,7 +439,7 @@ describe('ReactTestRenderer', () => { expect(() => inst.unmount()).not.toThrow(); }); - it('supports unmounting inner instances', () => { + it('supports unmounting inner instances', async () => { let count = 0; class Foo extends React.Component { componentWillUnmount() { @@ -394,19 +449,24 @@ describe('ReactTestRenderer', () => { return
; } } - const inst = ReactTestRenderer.create( -
- -
, - { - createNodeMock: () => 'foo', - }, - ); - expect(() => inst.unmount()).not.toThrow(); + let inst; + await act(() => { + inst = ReactTestRenderer.create( +
+ +
, + { + createNodeMock: () => 'foo', + }, + ); + }); + await act(() => { + inst.unmount(); + }); expect(count).toEqual(1); }); - it('supports updates when using refs', () => { + it('supports updates when using refs', async () => { const log = []; const createNodeMock = element => { log.push(element.type); @@ -421,14 +481,19 @@ describe('ReactTestRenderer', () => { ); } } - const inst = ReactTestRenderer.create(, { - createNodeMock, + let inst; + await act(() => { + inst = ReactTestRenderer.create(, { + createNodeMock, + }); + }); + await act(() => { + inst.update(); }); - inst.update(); expect(log).toEqual(['div', 'span']); }); - it('supports error boundaries', () => { + it('supports error boundaries', async () => { const log = []; class Angry extends React.Component { render() { @@ -477,13 +542,18 @@ describe('ReactTestRenderer', () => { } } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); expect(renderer.toJSON()).toEqual({ type: 'div', props: {}, children: ['Happy Birthday!'], }); expect(log).toEqual([ + 'Boundary render', + 'Angry render', 'Boundary render', 'Angry render', 'Boundary componentDidMount', @@ -492,42 +562,53 @@ describe('ReactTestRenderer', () => { ]); }); - it('can update text nodes', () => { + it('can update text nodes', async () => { class Component extends React.Component { render() { return
{this.props.children}
; } } - const renderer = ReactTestRenderer.create(Hi); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(Hi); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: ['Hi'], props: {}, }); - renderer.update({['Hi', 'Bye']}); + await act(() => { + renderer.update({['Hi', 'Bye']}); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: ['Hi', 'Bye'], props: {}, }); - renderer.update(Bye); + await act(() => { + renderer.update(Bye); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: ['Bye'], props: {}, }); - renderer.update({42}); + await act(() => { + renderer.update({42}); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: ['42'], props: {}, }); - renderer.update( - -
- , - ); + await act(() => { + renderer.update( + +
+ , + ); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: [ @@ -541,10 +622,13 @@ describe('ReactTestRenderer', () => { }); }); - it('toTree() renders simple components returning host components', () => { + it('toTree() renders simple components returning host components', async () => { const Qoo = () => Hello World!; - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const tree = renderer.toTree(); cleanNodeOrArray(tree); @@ -566,13 +650,16 @@ describe('ReactTestRenderer', () => { ); }); - it('toTree() handles nested Fragments', () => { + it('toTree() handles nested Fragments', async () => { const Foo = () => ( <> <>foo ); - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const tree = renderer.toTree(); cleanNodeOrArray(tree); @@ -588,14 +675,17 @@ describe('ReactTestRenderer', () => { ); }); - it('toTree() handles null rendering components', () => { + it('toTree() handles null rendering components', async () => { class Foo extends React.Component { render() { return null; } } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const tree = renderer.toTree(); expect(tree.instance).toBeInstanceOf(Foo); @@ -611,15 +701,18 @@ describe('ReactTestRenderer', () => { }); }); - it('toTree() handles simple components that return arrays', () => { + it('toTree() handles simple components that return arrays', async () => { const Foo = ({children}) => children; - const renderer = ReactTestRenderer.create( - -
One
-
Two
-
, - ); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create( + +
One
+
Two
+
, + ); + }); const tree = renderer.toTree(); @@ -651,25 +744,28 @@ describe('ReactTestRenderer', () => { ); }); - it('toTree() handles complicated tree of arrays', () => { + it('toTree() handles complicated tree of arrays', async () => { class Foo extends React.Component { render() { return this.props.children; } } - const renderer = ReactTestRenderer.create( -
- -
One
-
Two
+ let renderer; + await act(() => { + renderer = ReactTestRenderer.create( +
-
Three
+
One
+
Two
+ +
Three
+
- -
Four
-
, - ); +
Four
+
, + ); + }); const tree = renderer.toTree(); @@ -729,19 +825,22 @@ describe('ReactTestRenderer', () => { ); }); - it('toTree() handles complicated tree of fragments', () => { - const renderer = ReactTestRenderer.create( - <> + it('toTree() handles complicated tree of fragments', async () => { + let renderer; + await act(() => { + renderer = ReactTestRenderer.create( <> -
One
-
Two
<> -
Three
+
One
+
Two
+ <> +
Three
+ - -
Four
- , - ); +
Four
+ , + ); + }); const tree = renderer.toTree(); @@ -781,18 +880,22 @@ describe('ReactTestRenderer', () => { ); }); - it('root instance and createNodeMock ref return the same value', () => { + it('root instance and createNodeMock ref return the same value', async () => { const createNodeMock = ref => ({node: ref}); let refInst = null; - const renderer = ReactTestRenderer.create( -
(refInst = ref)} />, - {createNodeMock}, - ); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create( +
(refInst = ref)} />, + {createNodeMock}, + ); + }); + const root = renderer.getInstance(); expect(root).toEqual(refInst); }); - it('toTree() renders complicated trees of composites and hosts', () => { + it('toTree() renders complicated trees of composites and hosts', async () => { // SFC returning host. no children props. const Qoo = () => Hello World!; @@ -823,7 +926,11 @@ describe('ReactTestRenderer', () => { } } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); + const tree = renderer.toTree(); // we test for the presence of instances before nulling them out @@ -882,30 +989,45 @@ describe('ReactTestRenderer', () => { ); }); - it('can update text nodes when rendered as root', () => { - const renderer = ReactTestRenderer.create(['Hello', 'world']); + it('can update text nodes when rendered as root', async () => { + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(['Hello', 'world']); + }); expect(renderer.toJSON()).toEqual(['Hello', 'world']); - renderer.update(42); + await act(() => { + renderer.update(42); + }); expect(renderer.toJSON()).toEqual('42'); - renderer.update([42, 'world']); + await act(() => { + renderer.update([42, 'world']); + }); expect(renderer.toJSON()).toEqual(['42', 'world']); }); - it('can render and update root fragments', () => { + it('can render and update root fragments', async () => { const Component = props => props.children; - const renderer = ReactTestRenderer.create([ - Hi, - Bye, - ]); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create([ + Hi, + Bye, + ]); + }); + expect(renderer.toJSON()).toEqual(['Hi', 'Bye']); - renderer.update(
); + await act(() => { + renderer.update(
); + }); expect(renderer.toJSON()).toEqual({ type: 'div', children: null, props: {}, }); - renderer.update([
goodbye
, 'world']); + await act(() => { + renderer.update([
goodbye
, 'world']); + }); expect(renderer.toJSON()).toEqual([ { type: 'div', @@ -916,7 +1038,7 @@ describe('ReactTestRenderer', () => { ]); }); - it('supports context providers and consumers', () => { + it('supports context providers and consumers', async () => { const {Consumer, Provider} = React.createContext('a'); function Child(props) { @@ -931,7 +1053,10 @@ describe('ReactTestRenderer', () => { ); } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const child = renderer.root.findByType(Child); expect(child.children).toEqual(['b']); expect(prettyFormat(renderer.toTree())).toEqual( @@ -953,7 +1078,7 @@ describe('ReactTestRenderer', () => { ); }); - it('supports modes', () => { + it('supports modes', async () => { function Child(props) { return props.value; } @@ -966,7 +1091,10 @@ describe('ReactTestRenderer', () => { ); } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const child = renderer.root.findByType(Child); expect(child.children).toEqual(['a']); expect(prettyFormat(renderer.toTree())).toEqual( @@ -990,7 +1118,7 @@ describe('ReactTestRenderer', () => { ); }); - it('supports forwardRef', () => { + it('supports forwardRef', async () => { const InnerRefed = React.forwardRef((props, ref) => (
@@ -1008,7 +1136,10 @@ describe('ReactTestRenderer', () => { } } - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const tree = renderer.toTree(); cleanNodeOrArray(tree); @@ -1053,12 +1184,17 @@ describe('ReactTestRenderer', () => { ); ReactNoop.render(); await waitForAll([]); - ReactTestRenderer.create(); + await act(() => { + ReactTestRenderer.create(); + }); }); - it('calling findByType() with an invalid component will fall back to "Unknown" for component name', () => { + it('calling findByType() with an invalid component will fall back to "Unknown" for component name', async () => { const App = () => null; - const renderer = ReactTestRenderer.create(); + let renderer; + await act(() => { + renderer = ReactTestRenderer.create(); + }); const NonComponent = {}; expect(() => { diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js index 0118fa53f3ad3..e6ed9fa11c291 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js @@ -13,7 +13,7 @@ let ReactDOM; let React; let ReactCache; let ReactTestRenderer; -let waitForAll; +let act; describe('ReactTestRenderer', () => { beforeEach(() => { @@ -26,32 +26,28 @@ describe('ReactTestRenderer', () => { ReactCache = require('react-cache'); ReactTestRenderer = require('react-test-renderer'); const InternalTestUtils = require('internal-test-utils'); - waitForAll = InternalTestUtils.waitForAll; + act = InternalTestUtils.act; }); - it('should warn if used to render a ReactDOM portal', () => { + it('should warn if used to render a ReactDOM portal', async () => { const container = document.createElement('div'); - expect(() => { - let error; - try { + let error; + + await expect(async () => { + await act(() => { ReactTestRenderer.create(ReactDOM.createPortal('foo', container)); - } catch (e) { - error = e; - } - // After the update throws, a subsequent render is scheduled to - // unmount the whole tree. This update also causes an error, so React - // throws an AggregateError. - const errors = error.errors; - expect(errors.length).toBe(2); - expect(errors[0].message.includes('indexOf is not a function')).toBe( - true, - ); - expect(errors[1].message.includes('indexOf is not a function')).toBe( - true, - ); + }).catch(e => (error = e)); }).toErrorDev('An invalid container has been provided.', { withoutStack: true, }); + + // After the update throws, a subsequent render is scheduled to + // unmount the whole tree. This update also causes an error, so React + // throws an AggregateError. + const errors = error.errors; + expect(errors.length).toBe(2); + expect(errors[0].message.includes('indexOf is not a function')).toBe(true); + expect(errors[1].message.includes('indexOf is not a function')).toBe(true); }); describe('timed out Suspense hidden subtrees should not be observable via toJSON', () => { @@ -84,16 +80,23 @@ describe('ReactTestRenderer', () => { ); }; - const root = ReactTestRenderer.create(); - PendingResources.initial('initial'); - await waitForAll([]); + let root; + await act(() => { + root = ReactTestRenderer.create(); + }); + await act(() => { + PendingResources.initial('initial'); + }); expect(root.toJSON()).toEqual('initial'); - root.update(); + await act(() => { + root.update(); + }); expect(root.toJSON()).toEqual('fallback'); - PendingResources.dynamic('dynamic'); - await waitForAll([]); + await act(() => { + PendingResources.dynamic('dynamic'); + }); expect(root.toJSON()).toEqual('dynamic'); }); @@ -108,16 +111,23 @@ describe('ReactTestRenderer', () => { ); }; - const root = ReactTestRenderer.create(); - PendingResources.initial('initial'); - await waitForAll([]); + let root; + await act(() => { + root = ReactTestRenderer.create(); + }); + await act(() => { + PendingResources.initial('initial'); + }); expect(root.toJSON().children).toEqual(['initial']); - root.update(); + await act(() => { + root.update(); + }); expect(root.toJSON().children).toEqual(['fallback']); - PendingResources.dynamic('dynamic'); - await waitForAll([]); + await act(() => { + PendingResources.dynamic('dynamic'); + }); expect(root.toJSON().children).toEqual(['dynamic']); }); }); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js index 2306a895b785c..ef27de6d0fe2f 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js @@ -16,6 +16,7 @@ describe('ReactTestRenderer.act()', () => { const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; + global.IS_REACT_ACT_ENVIRONMENT = true; }); // @gate __DEV__ @@ -91,7 +92,10 @@ describe('ReactTestRenderer.act()', () => { }); return step; } - const root = ReactTestRenderer.create(null); + let root; + await act(() => { + root = ReactTestRenderer.create(null); + }); await act(async () => { root.update(); }); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js index 51c7e0a950ddc..468f62d39a722 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js @@ -34,7 +34,7 @@ describe('ReactTestRendererAsync', () => { return props.children; } const renderer = ReactTestRenderer.create(Hi, { - isConcurrent: true, + unstable_isConcurrent: true, }); // Before flushing, nothing has mounted. @@ -68,7 +68,7 @@ describe('ReactTestRendererAsync', () => { ); } const renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['A:1', 'B:1', 'C:1']); @@ -97,7 +97,7 @@ describe('ReactTestRendererAsync', () => { let renderer; React.startTransition(() => { renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); @@ -137,7 +137,7 @@ describe('ReactTestRendererAsync', () => { let renderer; React.startTransition(() => { renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js index d61f0a7c9075a..b4f79d2c55f19 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js @@ -13,6 +13,7 @@ const React = require('react'); let ReactTestRenderer; let Context; +let act; const RCTView = 'RCTView'; const View = props => ; @@ -21,6 +22,7 @@ describe('ReactTestRendererTraversal', () => { beforeEach(() => { jest.resetModules(); ReactTestRenderer = require('react-test-renderer'); + act = require('internal-test-utils').act; Context = React.createContext(null); }); @@ -68,8 +70,11 @@ describe('ReactTestRendererTraversal', () => { )); - it('initializes', () => { - const render = ReactTestRenderer.create(); + it('initializes', async () => { + let render; + await act(() => { + render = ReactTestRenderer.create(); + }); const hasFooProp = node => node.props.hasOwnProperty('foo'); // assert .props, .type and .parent attributes @@ -80,8 +85,12 @@ describe('ReactTestRendererTraversal', () => { expect(foo.children[0].parent).toBe(foo); }); - it('searches via .find() / .findAll()', () => { - const render = ReactTestRenderer.create(); + it('searches via .find() / .findAll()', async () => { + let render; + await act(() => { + render = ReactTestRenderer.create(); + }); + const hasFooProp = node => node.props.hasOwnProperty('foo'); const hasBarProp = node => node.props.hasOwnProperty('bar'); const hasBazProp = node => node.props.hasOwnProperty('baz'); @@ -135,8 +144,11 @@ describe('ReactTestRendererTraversal', () => { expect(itself.findAll(hasBazProp)).toHaveLength(2); }); - it('searches via .findByType() / .findAllByType()', () => { - const render = ReactTestRenderer.create(); + it('searches via .findByType() / .findAllByType()', async () => { + let render; + await act(() => { + render = ReactTestRenderer.create(); + }); expect(() => render.root.findByType(ExampleFn)).not.toThrow(); // 1 match expect(() => render.root.findByType(View)).not.toThrow(); // 1 match @@ -159,8 +171,11 @@ describe('ReactTestRendererTraversal', () => { expect(fn[0].findAllByType(View)).toHaveLength(1); }); - it('searches via .findByProps() / .findAllByProps()', () => { - const render = ReactTestRenderer.create(); + it('searches via .findByProps() / .findAllByProps()', async () => { + let render; + await act(() => { + render = ReactTestRenderer.create(); + }); const foo = 'foo'; const bar = 'bar'; const baz = 'baz'; @@ -182,8 +197,11 @@ describe('ReactTestRendererTraversal', () => { expect(render.root.findAllByProps({qux})).toHaveLength(3); }); - it('skips special nodes', () => { - const render = ReactTestRenderer.create(); + it('skips special nodes', async () => { + let render; + await act(() => { + render = ReactTestRenderer.create(); + }); expect(render.root.findAllByType(React.Fragment)).toHaveLength(0); expect(render.root.findAllByType(Context.Consumer)).toHaveLength(0); expect(render.root.findAllByType(Context.Provider)).toHaveLength(0); @@ -200,47 +218,62 @@ describe('ReactTestRendererTraversal', () => { expect(nestedViews[2].parent).toBe(expectedParent); }); - it('can have special nodes as roots', () => { + it('can have special nodes as roots', async () => { const FR = React.forwardRef((props, ref) =>
); - expect( - ReactTestRenderer.create( + + let render1; + await act(() => { + render1 = ReactTestRenderer.create(
, - ).root.findAllByType('div').length, - ).toBe(2); - expect( - ReactTestRenderer.create( + ); + }); + expect(render1.root.findAllByType('div').length).toBe(2); + + let render2; + await act(() => { + render2 = ReactTestRenderer.create( <>
, - ).root.findAllByType('div').length, - ).toBe(2); - expect( - ReactTestRenderer.create( + ); + }); + expect(render2.root.findAllByType('div').length).toBe(2); + + let render3; + await act(() => { + render3 = ReactTestRenderer.create(
, - ).root.findAllByType('div').length, - ).toBe(2); - expect( - ReactTestRenderer.create( + ); + }); + expect(render3.root.findAllByType('div').length).toBe(2); + + let render4; + await act(() => { + render4 = ReactTestRenderer.create(
, - ).root.findAllByType('div').length, - ).toBe(2); - expect( - ReactTestRenderer.create( + ); + }); + expect(render4.root.findAllByType('div').length).toBe(2); + + let render5; + await act(() => { + render5 = ReactTestRenderer.create(
, - ).root.findAllByType('div').length, - ).toBe(2); + ); + }); + expect(render5.root.findAllByType('div').length).toBe(2); }); }); diff --git a/packages/react/src/__tests__/ReactProfiler-test.internal.js b/packages/react/src/__tests__/ReactProfiler-test.internal.js index fd42561393101..0762c901cb2e2 100644 --- a/packages/react/src/__tests__/ReactProfiler-test.internal.js +++ b/packages/react/src/__tests__/ReactProfiler-test.internal.js @@ -40,6 +40,7 @@ function loadModules({ enableProfilerNestedUpdateScheduledHook; ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = replayFailedUnitOfWorkWithInvokeGuardedCallback; + ReactFeatureFlags.enableReactTestRendererLegacyMode = true; React = require('react'); Scheduler = require('scheduler'); @@ -213,7 +214,7 @@ describe(`onRender`, () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); }); @@ -752,7 +753,7 @@ describe(`onRender`, () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }); @@ -793,7 +794,7 @@ describe(`onRender`, () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }); @@ -844,7 +845,7 @@ describe(`onRender`, () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }); @@ -897,7 +898,7 @@ describe(`onRender`, () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); // Render everything initially. @@ -1002,7 +1003,7 @@ describe(`onRender`, () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); // Render everything initially. diff --git a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js index 572abd354da63..d28e2ad8de64a 100644 --- a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js @@ -150,7 +150,7 @@ describe('ReactProfiler DevTools integration', () => { return text; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); // Commit something root.update(); diff --git a/packages/react/src/__tests__/ReactStartTransition-test.js b/packages/react/src/__tests__/ReactStartTransition-test.js index c98372a7c74b7..9e689ac6e7105 100644 --- a/packages/react/src/__tests__/ReactStartTransition-test.js +++ b/packages/react/src/__tests__/ReactStartTransition-test.js @@ -49,7 +49,7 @@ describe('ReactStartTransition', () => { await act(() => { ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 1655c4eed031e..079d7a75ca034 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -191,6 +191,7 @@ export const enableRefAsProp = __NEXT_MAJOR__; // Needs more internal cleanup // Warn on any usage of ReactTestRenderer export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = false; // ----------------------------------------------------------------------------- // Chopping Block diff --git a/packages/shared/ReactVersion.js b/packages/shared/ReactVersion.js index d0a14cfff7806..9055167e29cc5 100644 --- a/packages/shared/ReactVersion.js +++ b/packages/shared/ReactVersion.js @@ -1,16 +1 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// TODO: this is special because it gets imported during build. -// -// TODO: 18.0.0 has not been released to NPM; -// It exists as a placeholder so that DevTools can support work tag changes between releases. -// When we next publish a release, update the matching TODO in backend/renderer.js -// TODO: This module is used both by the release scripts and to expose a version -// at runtime. We should instead inject the version number as part of the build -// process, and use the ReactVersions.js module as the single source of truth. -export default '18.2.0'; +export default '18.3.0-PLACEHOLDER'; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 1bf08bdffee0a..c232d28c8943b 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -103,6 +103,7 @@ export const enableInfiniteRenderLoopDetection = false; export const enableRefAsProp = false; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = false; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 703c1b706c113..dd77eb567e418 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -94,6 +94,7 @@ export const enableServerComponentLogs = true; export const enableRefAsProp = false; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = false; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 7a76a71b2750a..76b258ace344e 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -99,6 +99,7 @@ export const enableInfiniteRenderLoopDetection = false; const __NEXT_MAJOR__ = __EXPERIMENTAL__; export const enableRefAsProp = __NEXT_MAJOR__; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = false; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index c0e2ccf107295..7be22a057cab4 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -90,6 +90,7 @@ export const enableServerComponentLogs = true; export const enableRefAsProp = false; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = true; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 7771505830eb1..a9cbcf4ebe921 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -93,6 +93,7 @@ export const enableInfiniteRenderLoopDetection = false; export const enableRefAsProp = false; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = true; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index f54309be42530..7f5f3979c4d64 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -119,6 +119,7 @@ export const enableServerComponentKeys = true; export const enableServerComponentLogs = true; export const enableReactTestRendererWarning = false; +export const enableReactTestRendererLegacyMode = false; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType);