diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index cdfb267006b1e..1c011ea4ab7fe 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -47,7 +47,7 @@ describe('ReactDOMRoot', () => { expect(container.textContent).toEqual('Hi'); }); - // @gate !classic || !__DEV__ + // @gate !disableLegacyMode it('warns if you import createRoot from react-dom', async () => { expect(() => ReactDOM.createRoot(container)).toErrorDev( 'You are importing createRoot from "react-dom" which is not supported. ' + @@ -58,7 +58,7 @@ describe('ReactDOMRoot', () => { ); }); - // @gate !classic || !__DEV__ + // @gate !disableLegacyMode it('warns if you import hydrateRoot from react-dom', async () => { expect(() => ReactDOM.hydrateRoot(container, null)).toErrorDev( 'You are importing hydrateRoot from "react-dom" which is not supported. ' + diff --git a/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js b/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js index 4ad7bab5614bb..940b718c8a5f5 100644 --- a/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js @@ -393,6 +393,7 @@ describe('ReactScope', () => { }); // @gate www + // @gate !disableLegacyMode it('DO_NOT_USE_queryAllNodes() works as intended', () => { const testScopeQuery = (type, props) => true; const TestScope = React.unstable_Scope; @@ -430,6 +431,7 @@ describe('ReactScope', () => { }); // @gate www + // @gate !disableLegacyMode it('DO_NOT_USE_queryFirstNode() works as intended', () => { const testScopeQuery = (type, props) => true; const TestScope = React.unstable_Scope; @@ -467,6 +469,7 @@ describe('ReactScope', () => { }); // @gate www + // @gate !disableLegacyMode it('containsNode() works as intended', () => { const TestScope = React.unstable_Scope; const scopeRef = React.createRef(); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js index 14c58cb0d6581..16b603bac77e5 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js @@ -379,6 +379,7 @@ describe('ReactSuspense', () => { }); // @gate forceConcurrentByDefaultForTesting + // @gate !disableLegacyMode it( 'interrupts current render when something suspends with a ' + "delay and we've already skipped over a lower priority update in " + diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index 4a4fa99abac77..b661423d36c92 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -114,9 +114,10 @@ export const useModernStrictMode = true; // because JSX is an extremely hot path. export const disableStringRefs = false; -export const disableLegacyMode = false; - -export const disableDOMTestUtils = false; +// These flags need to be on together because disabled legacy mode breaks test utils +// since it is written on top of legacy mode +export const disableLegacyMode = __EXPERIMENTAL__; +export const disableDOMTestUtils = __EXPERIMENTAL__; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/scripts/jest/setupHostConfigs.js b/scripts/jest/setupHostConfigs.js index 5fde144c255e3..1c4acabde5bbd 100644 --- a/scripts/jest/setupHostConfigs.js +++ b/scripts/jest/setupHostConfigs.js @@ -14,11 +14,6 @@ function resolveEntryFork(resolvedEntry, isFBBundle) { // .js if (isFBBundle) { - if (__EXPERIMENTAL__) { - // We can't currently use the true modern entry point because too many tests fail. - // TODO: Fix tests to not use ReactDOM.render or gate them. Then we can remove this. - return resolvedEntry; - } const resolvedFBEntry = resolvedEntry.replace( '.js', __EXPERIMENTAL__ ? '.modern.fb.js' : '.classic.fb.js'