From e8d59c43512fb8e0ff20b421aa7c889e5bf876f7 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Wed, 8 Mar 2023 11:53:56 -0500 Subject: [PATCH] Move internalAct to internal-test-utils package This is not a public API. We only use it for our internal tests, the ones in this repo. Let's move it to this private package. Practically speaking this will also let us use async/await in the implementation. --- .../ReactInternalTestUtils.js | 4 ++-- .../__tests__/ReactInternalTestUtils-test.js | 2 +- .../internalAct.js | 23 ++++++++----------- packages/jest-react/src/JestReact.js | 2 -- .../src/__tests__/ReactFlight-test.js | 4 ++-- .../ReactHooksInspectionIntegration-test.js | 2 +- .../src/__tests__/inspectedElement-test.js | 4 ++-- .../__tests__/storeComponentFilters-test.js | 2 +- .../ReactDOMConsoleErrorReporting-test.js | 2 +- .../src/__tests__/ReactDOMFiberAsync-test.js | 2 +- .../ReactDOMFizzShellHydration-test.js | 2 +- .../src/__tests__/ReactDOMHooks-test.js | 2 +- .../ReactDOMNativeEventHeuristic-test.js | 2 +- .../__tests__/ReactDOMNestedEvents-test.js | 2 +- .../src/__tests__/ReactDOMRoot-test.js | 2 +- .../ReactDOMSafariMicrotaskBug-test.js | 2 +- ...DOMServerPartialHydration-test.internal.js | 2 +- ...MServerSelectiveHydration-test.internal.js | 2 +- .../ReactDOMServerSuspense-test.internal.js | 2 +- .../ReactDOMSuspensePlaceholder-test.js | 2 +- .../src/__tests__/ReactDOMUseId-test.js | 2 +- .../ReactErrorBoundaries-test.internal.js | 2 +- .../src/__tests__/ReactUpdates-test.js | 2 +- .../__tests__/ReactWrongReturnPointer-test.js | 2 +- .../ReactDOMServerIntegrationTestUtils.js | 2 +- .../DOMPluginEventSystem-test.internal.js | 4 ++-- .../__tests__/ChangeEventPlugin-test.js | 2 +- .../__tests__/SimpleEventPlugin-test.js | 2 +- .../__tests__/useFocusWithin-test.internal.js | 2 +- .../__tests__/ReactFabric-test.internal.js | 2 +- .../ReactFabricHostComponent-test.internal.js | 2 +- .../src/__tests__/ReactCPUSuspense-test.js | 2 +- .../src/__tests__/ReactCache-test.js | 2 +- .../ReactClassSetStateCallback-test.js | 2 +- .../ReactConcurrentErrorRecovery-test.js | 2 +- .../__tests__/ReactContextPropagation-test.js | 2 +- .../src/__tests__/ReactDeferredValue-test.js | 2 +- .../src/__tests__/ReactEffectOrdering-test.js | 2 +- .../src/__tests__/ReactExpiration-test.js | 2 +- .../src/__tests__/ReactFlushSync-test.js | 2 +- .../src/__tests__/ReactHooks-test.internal.js | 2 +- .../ReactHooksWithNoopRenderer-test.js | 2 +- ...tIncrementalErrorHandling-test.internal.js | 2 +- .../ReactIncrementalScheduling-test.js | 2 +- .../__tests__/ReactIncrementalUpdates-test.js | 2 +- .../__tests__/ReactInterleavedUpdates-test.js | 2 +- .../src/__tests__/ReactMemo-test.js | 2 +- .../__tests__/ReactNoopRendererAct-test.js | 2 +- .../src/__tests__/ReactOffscreen-test.js | 2 +- .../ReactOffscreenStrictMode-test.js | 2 +- .../__tests__/ReactOffscreenSuspense-test.js | 2 +- .../ReactSchedulerIntegration-test.js | 2 +- .../ReactSubtreeFlagsWarning-test.js | 2 +- .../__tests__/ReactSuspense-test.internal.js | 2 +- .../ReactSuspenseEffectsSemantics-test.js | 2 +- .../ReactSuspenseEffectsSemanticsDOM-test.js | 2 +- .../ReactSuspenseFuzz-test.internal.js | 2 +- .../src/__tests__/ReactSuspenseList-test.js | 2 +- .../ReactSuspenseWithNoopRenderer-test.js | 2 +- .../src/__tests__/ReactThenable-test.js | 2 +- .../src/__tests__/ReactTransition-test.js | 2 +- .../__tests__/ReactTransitionTracing-test.js | 2 +- .../src/__tests__/ReactUpdatePriority-test.js | 2 +- .../__tests__/ReactUpdaters-test.internal.js | 2 +- .../src/__tests__/StrictEffectsMode-test.js | 2 +- ...StrictEffectsModeDefaults-test.internal.js | 2 +- .../src/__tests__/useEffectEvent-test.js | 2 +- .../src/__tests__/useMemoCache-test.js | 2 +- .../useMutableSource-test.internal.js | 2 +- .../useMutableSourceHydration-test.js | 2 +- .../src/__tests__/useRef-test.internal.js | 2 +- .../__tests__/useSyncExternalStore-test.js | 2 +- .../src/__tests__/ReactFresh-test.js | 4 ++-- .../ReactFlightDOMRelay-test.internal.js | 2 +- .../src/__tests__/ReactFlightDOM-test.js | 2 +- .../__tests__/ReactFlightDOMBrowser-test.js | 2 +- .../__tests__/ReactProfiler-test.internal.js | 2 +- .../__tests__/ReactStartTransition-test.js | 2 +- .../ReactStrictMode-test.internal.js | 2 +- .../src/__tests__/ReactStrictMode-test.js | 2 +- .../src/__tests__/useSubscription-test.js | 2 +- .../useSyncExternalStoreNative-test.js | 2 +- .../useSyncExternalStoreShared-test.js | 2 +- 83 files changed, 96 insertions(+), 101 deletions(-) rename packages/{jest-react/src => internal-test-utils}/internalAct.js (85%) diff --git a/packages/internal-test-utils/ReactInternalTestUtils.js b/packages/internal-test-utils/ReactInternalTestUtils.js index 77c67b15600a8..3051cefaedd64 100644 --- a/packages/internal-test-utils/ReactInternalTestUtils.js +++ b/packages/internal-test-utils/ReactInternalTestUtils.js @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -// TODO: Move `internalAct` and other test helpers to this package, too - import * as SchedulerMock from 'scheduler/unstable_mock'; import {diff} from 'jest-diff'; import {equals} from '@jest/expect-utils'; import enqueueTask from './enqueueTask'; +export {act} from './internalAct'; + function assertYieldsWereCleared(Scheduler) { const actualYields = Scheduler.unstable_clearLog(); if (actualYields.length !== 0) { diff --git a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js index f05a46e3a71a1..e561c9b3dbbe2 100644 --- a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js +++ b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js @@ -20,7 +20,7 @@ const { waitForThrow, assertLog, } = require('internal-test-utils'); -const act = require('jest-react').act; +const act = require('internal-test-utils').act; const Scheduler = require('scheduler/unstable_mock'); describe('ReactInternalTestUtils', () => { diff --git a/packages/jest-react/src/internalAct.js b/packages/internal-test-utils/internalAct.js similarity index 85% rename from packages/jest-react/src/internalAct.js rename to packages/internal-test-utils/internalAct.js index 4f759dc60315c..654d31d005e75 100644 --- a/packages/jest-react/src/internalAct.js +++ b/packages/internal-test-utils/internalAct.js @@ -40,32 +40,29 @@ export function act(scope: () => Thenable): Thenable { const previousIsActEnvironment = global.IS_REACT_ACT_ENVIRONMENT; const previousActingUpdatesScopeDepth = actingUpdatesScopeDepth; actingUpdatesScopeDepth++; - if (__DEV__ && actingUpdatesScopeDepth === 1) { + if (actingUpdatesScopeDepth === 1) { // Because this is not the "real" `act`, we set this to `false` so React // knows not to fire `act` warnings. global.IS_REACT_ACT_ENVIRONMENT = false; } const unwind = () => { - if (__DEV__ && actingUpdatesScopeDepth === 1) { + if (actingUpdatesScopeDepth === 1) { global.IS_REACT_ACT_ENVIRONMENT = previousIsActEnvironment; } actingUpdatesScopeDepth--; - if (__DEV__) { - if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) { - // if it's _less than_ previousActingUpdatesScopeDepth, then we can - // assume the 'other' one has warned - console.error( - 'You seem to have overlapping act() calls, this is not supported. ' + - 'Be sure to await previous act() calls before making a new one. ', - ); - } + if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) { + // if it's _less than_ previousActingUpdatesScopeDepth, then we can + // assume the 'other' one has warned + throw new Error( + 'You seem to have overlapping act() calls, this is not supported. ' + + 'Be sure to await previous act() calls before making a new one. ', + ); } }; - // TODO: This would be way simpler if we could use async/await. Move this - // function to the internal-test-utils package. + // TODO: This would be way simpler if we used async/await. try { const result = scope(); if ( diff --git a/packages/jest-react/src/JestReact.js b/packages/jest-react/src/JestReact.js index 1d43861165037..b660ad49f94b1 100644 --- a/packages/jest-react/src/JestReact.js +++ b/packages/jest-react/src/JestReact.js @@ -9,8 +9,6 @@ import {REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE} from 'shared/ReactSymbols'; import isArray from 'shared/isArray'; -export {act} from './internalAct'; - function captureAssertion(fn) { // Trick to use a Jest matcher inside another Jest matcher. `fn` contains an // assertion; if it throws, we capture the error and return it, so the stack diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js index fd6d4eb2e700c..50608dcca5e3e 100644 --- a/packages/react-client/src/__tests__/ReactFlight-test.js +++ b/packages/react-client/src/__tests__/ReactFlight-test.js @@ -32,7 +32,7 @@ describe('ReactFlight', () => { ReactNoop = require('react-noop-renderer'); ReactNoopFlightServer = require('react-noop-renderer/flight-server'); ReactNoopFlightClient = require('react-noop-renderer/flight-client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; @@ -1184,7 +1184,7 @@ describe('ReactFlight', () => { ReactNoop = require('react-noop-renderer'); ReactNoopFlightServer = require('react-noop-renderer/flight-server'); ReactNoopFlightClient = require('react-noop-renderer/flight-client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); await act(async () => { diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index 61e3505eb1758..118a961767ec3 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -22,7 +22,7 @@ describe('ReactHooksInspectionIntegration', () => { React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; ReactDebugTools = require('react-debug-tools'); }); diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index 2ec03ab8588ab..19c836a91ad75 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -55,9 +55,9 @@ describe('InspectedElement', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); PropTypes = require('prop-types'); - TestUtilsAct = require('jest-react').act; + TestUtilsAct = require('internal-test-utils').act; TestRenderer = utils.requireTestRenderer(); - TestRendererAct = require('jest-react').act; + TestRendererAct = require('internal-test-utils').act; BridgeContext = require('react-devtools-shared/src/devtools/views/context').BridgeContext; diff --git a/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js b/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js index 14e928ba82efc..fd30b41a45b5a 100644 --- a/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js +++ b/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js @@ -34,7 +34,7 @@ describe('Store component filters', () => { React = require('react'); Types = require('react-devtools-shared/src/types'); utils = require('./utils'); - internalAct = require('jest-react').act; + internalAct = require('internal-test-utils').act; legacyRender = utils.legacyRender; }); diff --git a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js index 8764c1907bac7..d4cc22e44668a 100644 --- a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js @@ -21,7 +21,7 @@ describe('ReactDOMConsoleErrorReporting', () => { beforeEach(() => { jest.resetModules(); - act = require('jest-react').act; + act = require('internal-test-utils').act; React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js index c89ba90866e04..f0e984de05d7d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js @@ -31,7 +31,7 @@ describe('ReactDOMFiberAsync', () => { React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js index 7d60cb0f33134..3c2260d83bd6f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js @@ -32,7 +32,7 @@ describe('ReactDOMFizzShellHydration', () => { React = require('react'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - clientAct = require('jest-react').act; + clientAct = require('internal-test-utils').act; ReactDOMFizzServer = require('react-dom/server'); Stream = require('stream'); diff --git a/packages/react-dom/src/__tests__/ReactDOMHooks-test.js b/packages/react-dom/src/__tests__/ReactDOMHooks-test.js index 50f25190e3f3c..aaaf5c5044497 100644 --- a/packages/react-dom/src/__tests__/ReactDOMHooks-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMHooks-test.js @@ -25,7 +25,7 @@ describe('ReactDOMHooks', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; container = document.createElement('div'); document.body.appendChild(container); diff --git a/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js b/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js index fd49b824efd71..a03b8c80ff921 100644 --- a/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js @@ -28,7 +28,7 @@ describe('ReactDOMNativeEventHeuristic-test', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js b/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js index e34e2f7a6789f..881077b498a84 100644 --- a/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js @@ -22,7 +22,7 @@ describe('ReactDOMNestedEvents', () => { React = require('react'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index c8f67f580eb7b..b81d1cdc30036 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -30,7 +30,7 @@ describe('ReactDOMRoot', () => { ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useEffect = React.useEffect; const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js b/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js index 2afdb8b0d353c..9c7fb089b9908 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js @@ -39,7 +39,7 @@ describe('ReactDOMSafariMicrotaskBug-test', () => { container = document.createElement('div'); React = require('react'); ReactDOMClient = require('react-dom/client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; document.body.appendChild(container); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js index 18833b0f64da4..bf433b50b5433 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js @@ -108,7 +108,7 @@ describe('ReactDOMServerPartialHydration', () => { React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; ReactDOMServer = require('react-dom/server'); Scheduler = require('scheduler'); Suspense = React.Suspense; diff --git a/packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js index dcc99a570358e..62cd50fdfb3b6 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js @@ -137,7 +137,7 @@ describe('ReactDOMServerSelectiveHydration', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); Suspense = React.Suspense; diff --git a/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js index 78672c05f61c2..2e986c332a38d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js @@ -28,7 +28,7 @@ function initModules() { ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); ReactTestUtils = require('react-dom/test-utils'); - act = require('jest-react').act; + act = require('internal-test-utils').act; if (gate(flags => flags.enableSuspenseList)) { SuspenseList = React.SuspenseList; } diff --git a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js index 129ae2746dc21..28909ccb67165 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js @@ -26,7 +26,7 @@ describe('ReactDOMSuspensePlaceholder', () => { ReactDOM = require('react-dom'); ReactCache = require('react-cache'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; container = document.createElement('div'); document.body.appendChild(container); diff --git a/packages/react-dom/src/__tests__/ReactDOMUseId-test.js b/packages/react-dom/src/__tests__/ReactDOMUseId-test.js index 97502104dda20..656ec21f5da59 100644 --- a/packages/react-dom/src/__tests__/ReactDOMUseId-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMUseId-test.js @@ -31,7 +31,7 @@ describe('useId', () => { JSDOM = require('jsdom').JSDOM; React = require('react'); ReactDOMClient = require('react-dom/client'); - clientAct = require('jest-react').act; + clientAct = require('internal-test-utils').act; ReactDOMFizzServer = require('react-dom/server'); Stream = require('stream'); Suspense = React.Suspense; diff --git a/packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js b/packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js index f9a2a10e74b7a..7b9eb15326762 100644 --- a/packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js @@ -46,7 +46,7 @@ describe('ReactErrorBoundaries', () => { ReactFeatureFlags.skipUnmountedBoundaries = true; ReactDOM = require('react-dom'); React = require('react'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactUpdates-test.js b/packages/react-dom/src/__tests__/ReactUpdates-test.js index 5e39cb88d59c3..56c2db3b724cb 100644 --- a/packages/react-dom/src/__tests__/ReactUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactUpdates-test.js @@ -26,7 +26,7 @@ describe('ReactUpdates', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); ReactTestUtils = require('react-dom/test-utils'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js b/packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js index 3ad00cedd9cc2..a329d300b7e9a 100644 --- a/packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js +++ b/packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js @@ -22,7 +22,7 @@ beforeEach(() => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js b/packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js index 868c59be61a09..f4a35184bcafc 100644 --- a/packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js +++ b/packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js @@ -19,7 +19,7 @@ module.exports = function (initModules) { function resetModules() { ({ReactDOM, ReactDOMServer} = initModules()); - act = require('jest-react').act; + act = require('internal-test-utils').act; } function shouldUseDocument(reactElement) { diff --git a/packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js b/packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js index 8a81d5582f6e0..7b06794d62a41 100644 --- a/packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js +++ b/packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js @@ -80,7 +80,7 @@ describe('DOMPluginEventSystem', () => { ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); ReactDOMServer = require('react-dom/server'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; @@ -1279,7 +1279,7 @@ describe('DOMPluginEventSystem', () => { ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); ReactDOMServer = require('react-dom/server'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js b/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js index 7eea8f9c98970..5ea94e056fc16 100644 --- a/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js +++ b/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js @@ -60,7 +60,7 @@ describe('ChangeEventPlugin', () => { React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js b/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js index c6f0fbd333f3b..9cfddd9ca8779 100644 --- a/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js +++ b/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js @@ -250,7 +250,7 @@ describe('SimpleEventPlugin', function () { assertLog = InternalTestUtils.assertLog; waitForAll = InternalTestUtils.waitForAll; - act = require('jest-react').act; + act = require('internal-test-utils').act; }); it('flushes pending interactive work before exiting event handler', async () => { diff --git a/packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js b/packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js index cb8c4ab76a0dc..9199f24b0a8a0 100644 --- a/packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js +++ b/packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js @@ -29,7 +29,7 @@ function initializeModules(hasPointerEvents) { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; // TODO: This import throws outside of experimental mode. Figure out better // strategy for gated imports. diff --git a/packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js b/packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js index 7b7731018eb83..c40f0d1aec76f 100644 --- a/packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js +++ b/packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js @@ -41,7 +41,7 @@ describe('ReactFabric', () => { require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface') .ReactNativeViewConfigRegistry.register; - act = require('jest-react').act; + act = require('internal-test-utils').act; }); it('should be able to create and render a native component', async () => { diff --git a/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js b/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js index d816471b3e8a8..a4a692967f300 100644 --- a/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js +++ b/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js @@ -35,7 +35,7 @@ async function mockRenderKeys(keyLists) { const createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface') .ReactNativeViewConfigRegistry.register; - const {act} = require('jest-react'); + const act = require('internal-test-utils').act; const mockContainerTag = 11; const MockView = createReactNativeComponentClass('RCTMockView', () => ({ diff --git a/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js b/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js index 2d2c522a0f980..5be9669d0fe16 100644 --- a/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js @@ -20,7 +20,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; useState = React.useState; diff --git a/packages/react-reconciler/src/__tests__/ReactCache-test.js b/packages/react-reconciler/src/__tests__/ReactCache-test.js index 770ebaaac9150..a0ba653bfaa83 100644 --- a/packages/react-reconciler/src/__tests__/ReactCache-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCache-test.js @@ -24,7 +24,7 @@ describe('ReactCache', () => { ReactNoop = require('react-noop-renderer'); Cache = React.unstable_Cache; Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; cache = React.cache; Offscreen = React.unstable_Offscreen; diff --git a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js index 82bb637cafe5d..257a74b2462ff 100644 --- a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js +++ b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js @@ -11,7 +11,7 @@ describe('ReactClassSetStateCallback', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js b/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js index 67e3c4f340a5f..051efa1cd5c39 100644 --- a/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js +++ b/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js @@ -17,7 +17,7 @@ describe('ReactConcurrentErrorRecovery', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; startTransition = React.startTransition; diff --git a/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js b/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js index 5a56c47dfe069..e00f4f6c98098 100644 --- a/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js +++ b/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js @@ -18,7 +18,7 @@ describe('ReactLazyContextPropagation', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; useContext = React.useContext; Suspense = React.Suspense; diff --git a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js index 82e701106d91a..4787410a10ac7 100644 --- a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js +++ b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js @@ -25,7 +25,7 @@ describe('ReactDeferredValue', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; startTransition = React.startTransition; useDeferredValue = React.useDeferredValue; useMemo = React.useMemo; diff --git a/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js b/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js index 07e052fdc558c..d9cd4bfb48b6e 100644 --- a/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js +++ b/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js @@ -28,7 +28,7 @@ describe('ReactEffectOrdering', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useEffect = React.useEffect; useLayoutEffect = React.useLayoutEffect; diff --git a/packages/react-reconciler/src/__tests__/ReactExpiration-test.js b/packages/react-reconciler/src/__tests__/ReactExpiration-test.js index 4e561ab2a516b..61146e208feee 100644 --- a/packages/react-reconciler/src/__tests__/ReactExpiration-test.js +++ b/packages/react-reconciler/src/__tests__/ReactExpiration-test.js @@ -29,7 +29,7 @@ describe('ReactExpiration', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; startTransition = React.startTransition; useState = React.useState; useEffect = React.useEffect; diff --git a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js index 4bf1b05dcd282..7b017aa9b858c 100644 --- a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js +++ b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js @@ -17,7 +17,7 @@ describe('ReactFlushSync', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; useEffect = React.useEffect; startTransition = React.startTransition; diff --git a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js index dc4ef2135f281..743a58711a8b4 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js @@ -32,7 +32,7 @@ describe('ReactHooks', () => { ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); ReactDOMServer = require('react-dom/server'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js index 4d1668263c8d7..dba27054bba81 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js @@ -49,7 +49,7 @@ describe('ReactHooksWithNoopRenderer', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; useReducer = React.useReducer; useEffect = React.useEffect; diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js index e18ca39f6f39d..2507c5c9f42b9 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js @@ -30,7 +30,7 @@ describe('ReactIncrementalErrorHandling', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js index 1a76bacaa3b1e..27109f0b0b5e6 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js @@ -26,7 +26,7 @@ describe('ReactIncrementalScheduling', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js index f9dcf753baecd..dd88d959aacef 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js @@ -26,7 +26,7 @@ describe('ReactIncrementalUpdates', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; ContinuousEventPriority = require('react-reconciler/constants').ContinuousEventPriority; diff --git a/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js b/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js index 06feedd1584e4..5c520a4f8ab20 100644 --- a/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js +++ b/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js @@ -16,7 +16,7 @@ describe('ReactInterleavedUpdates', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; startTransition = React.startTransition; useState = React.useState; useEffect = React.useEffect; diff --git a/packages/react-reconciler/src/__tests__/ReactMemo-test.js b/packages/react-reconciler/src/__tests__/ReactMemo-test.js index 45d58a436c9b6..ca8c4d987d1e8 100644 --- a/packages/react-reconciler/src/__tests__/ReactMemo-test.js +++ b/packages/react-reconciler/src/__tests__/ReactMemo-test.js @@ -29,7 +29,7 @@ describe('memo', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; ({Suspense} = React); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js b/packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js index 8de0496bad9ed..c607dfbc42432 100644 --- a/packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js +++ b/packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js @@ -12,7 +12,7 @@ const React = require('react'); const ReactNoop = require('react-noop-renderer'); const Scheduler = require('scheduler'); -const act = require('jest-react').act; +const act = require('internal-test-utils').act; const {assertLog, waitForAll} = require('internal-test-utils'); // TODO: These tests are no longer specific to the noop renderer diff --git a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js index 937df702f1a84..a3f56fb464926 100644 --- a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js +++ b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js @@ -21,7 +21,7 @@ describe('ReactOffscreen', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; LegacyHidden = React.unstable_LegacyHidden; Offscreen = React.unstable_Offscreen; useState = React.useState; diff --git a/packages/react-reconciler/src/__tests__/ReactOffscreenStrictMode-test.js b/packages/react-reconciler/src/__tests__/ReactOffscreenStrictMode-test.js index 49d0e0c4b8959..bfe200ee35465 100644 --- a/packages/react-reconciler/src/__tests__/ReactOffscreenStrictMode-test.js +++ b/packages/react-reconciler/src/__tests__/ReactOffscreenStrictMode-test.js @@ -12,7 +12,7 @@ describe('ReactOffscreenStrictMode', () => { React = require('react'); Offscreen = React.unstable_Offscreen; ReactNoop = require('react-noop-renderer'); - act = require('jest-react').act; + act = require('internal-test-utils').act; }); function Component({label}) { diff --git a/packages/react-reconciler/src/__tests__/ReactOffscreenSuspense-test.js b/packages/react-reconciler/src/__tests__/ReactOffscreenSuspense-test.js index d93bcbad2b989..dfbd37a477123 100644 --- a/packages/react-reconciler/src/__tests__/ReactOffscreenSuspense-test.js +++ b/packages/react-reconciler/src/__tests__/ReactOffscreenSuspense-test.js @@ -19,7 +19,7 @@ describe('ReactOffscreen', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; LegacyHidden = React.unstable_LegacyHidden; Offscreen = React.unstable_Offscreen; Suspense = React.Suspense; diff --git a/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js b/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js index 684cba12da214..7af23a8261aca 100644 --- a/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js @@ -30,7 +30,7 @@ describe('ReactSchedulerIntegration', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; NormalPriority = Scheduler.unstable_NormalPriority; IdlePriority = Scheduler.unstable_IdlePriority; runWithPriority = Scheduler.unstable_runWithPriority; diff --git a/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js b/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js index 2f8e4e5447445..d795aca8053ac 100644 --- a/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js @@ -17,7 +17,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; useEffect = React.useEffect; diff --git a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js index ee3ea935ace91..19413e8987063 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js @@ -19,7 +19,7 @@ describe('ReactSuspense', () => { ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false; React = require('react'); ReactTestRenderer = require('react-test-renderer'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Scheduler = require('scheduler'); Suspense = React.Suspense; diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js index 914f58c2bdb23..3da25f2467f67 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js @@ -29,7 +29,7 @@ describe('ReactSuspenseEffectsSemantics', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; getCacheForType = React.unstable_getCacheForType; diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js index 2eb1dae06f142..760e4d1cc27ee 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js @@ -27,7 +27,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js index 2bb0b4f67a6f0..1990e1fd7bf81 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js @@ -28,7 +28,7 @@ describe('ReactSuspenseFuzz', () => { Suspense = React.Suspense; ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Random = require('random-seed'); }); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js index e24e44a22f917..a33c68cc7f6c2 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js @@ -16,7 +16,7 @@ describe('ReactSuspenseList', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Profiler = React.Profiler; Suspense = React.Suspense; if (gate(flags => flags.enableSuspenseList)) { diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js index 25e37f9d60e94..e21b01f97adb1 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js @@ -21,7 +21,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { Fragment = React.Fragment; ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; Suspense = React.Suspense; const InternalTestUtils = require('internal-test-utils'); waitFor = InternalTestUtils.waitFor; diff --git a/packages/react-reconciler/src/__tests__/ReactThenable-test.js b/packages/react-reconciler/src/__tests__/ReactThenable-test.js index fce0c0b173602..4b2eef866be50 100644 --- a/packages/react-reconciler/src/__tests__/ReactThenable-test.js +++ b/packages/react-reconciler/src/__tests__/ReactThenable-test.js @@ -24,7 +24,7 @@ describe('ReactThenable', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; use = React.use; useDebugValue = React.useDebugValue; useState = React.useState; diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.js index 50312dec897eb..54dabd07445f4 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransition-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.js @@ -40,7 +40,7 @@ describe('ReactTransition', () => { Suspense = React.Suspense; startTransition = React.startTransition; getCacheForType = React.unstable_getCacheForType; - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js index 1d240498acf94..658775a7be915 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js @@ -43,7 +43,7 @@ describe('ReactInteractionTracing', () => { ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js b/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js index 7798deb2b3e9a..82314744eb706 100644 --- a/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js +++ b/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js @@ -17,7 +17,7 @@ describe('ReactUpdatePriority', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; ContinuousEventPriority = require('react-reconciler/constants').ContinuousEventPriority; startTransition = React.startTransition; diff --git a/packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js b/packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js index ba7e5c23afb15..da02d0b208663 100644 --- a/packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js @@ -93,7 +93,7 @@ describe('updaters', () => { ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitFor = InternalTestUtils.waitFor; diff --git a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js index d1f1bc72a9ed4..da230678ec65f 100644 --- a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js +++ b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js @@ -21,7 +21,7 @@ describe('StrictEffectsMode', () => { React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/react-reconciler/src/__tests__/StrictEffectsModeDefaults-test.internal.js b/packages/react-reconciler/src/__tests__/StrictEffectsModeDefaults-test.internal.js index 9a7f736fff91a..b1ceb8ed7e247 100644 --- a/packages/react-reconciler/src/__tests__/StrictEffectsModeDefaults-test.internal.js +++ b/packages/react-reconciler/src/__tests__/StrictEffectsModeDefaults-test.internal.js @@ -25,7 +25,7 @@ describe('StrictEffectsMode defaults', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitFor = InternalTestUtils.waitFor; diff --git a/packages/react-reconciler/src/__tests__/useEffectEvent-test.js b/packages/react-reconciler/src/__tests__/useEffectEvent-test.js index 2d6bceffbbc84..a2bfbb67ed076 100644 --- a/packages/react-reconciler/src/__tests__/useEffectEvent-test.js +++ b/packages/react-reconciler/src/__tests__/useEffectEvent-test.js @@ -35,7 +35,7 @@ describe('useEffectEvent', () => { ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; createContext = React.createContext; useContext = React.useContext; useState = React.useState; diff --git a/packages/react-reconciler/src/__tests__/useMemoCache-test.js b/packages/react-reconciler/src/__tests__/useMemoCache-test.js index cbc42c5eda989..0d08481d3618c 100644 --- a/packages/react-reconciler/src/__tests__/useMemoCache-test.js +++ b/packages/react-reconciler/src/__tests__/useMemoCache-test.js @@ -22,7 +22,7 @@ describe('useMemoCache()', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; useMemoCache = React.unstable_useMemoCache; MemoCacheSentinel = Symbol.for('react.memo_cache_sentinel'); diff --git a/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js b/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js index a5d9391c668fc..a85a41b9afb60 100644 --- a/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js +++ b/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js @@ -34,7 +34,7 @@ function loadModules() { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitFor = InternalTestUtils.waitFor; diff --git a/packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js b/packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js index d008bb9c65a80..96eef57c9484e 100644 --- a/packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js +++ b/packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js @@ -28,7 +28,7 @@ describe('useMutableSourceHydration', () => { ReactDOMServer = require('react-dom/server'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; // Stable entrypoints export with "unstable_" prefix. createMutableSource = diff --git a/packages/react-reconciler/src/__tests__/useRef-test.internal.js b/packages/react-reconciler/src/__tests__/useRef-test.internal.js index 805b27e58c3f9..1acac1a5bbc9c 100644 --- a/packages/react-reconciler/src/__tests__/useRef-test.internal.js +++ b/packages/react-reconciler/src/__tests__/useRef-test.internal.js @@ -33,7 +33,7 @@ describe('useRef', () => { const ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; - act = require('jest-react').act; + act = require('internal-test-utils').act; useCallback = React.useCallback; useEffect = React.useEffect; useLayoutEffect = React.useLayoutEffect; diff --git a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js index 9e371268c404c..64e5a102a21bb 100644 --- a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js +++ b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js @@ -49,7 +49,7 @@ describe('useSyncExternalStore', () => { waitForAll = InternalTestUtils.waitForAll; assertLog = InternalTestUtils.assertLog; - act = require('jest-react').act; + act = require('internal-test-utils').act; }); function Text({text}) { diff --git a/packages/react-refresh/src/__tests__/ReactFresh-test.js b/packages/react-refresh/src/__tests__/ReactFresh-test.js index cea25d05c1248..cdb5c2eaa90a8 100644 --- a/packages/react-refresh/src/__tests__/ReactFresh-test.js +++ b/packages/react-refresh/src/__tests__/ReactFresh-test.js @@ -35,7 +35,7 @@ describe('ReactFresh', () => { ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); act = require('react-dom/test-utils').act; - internalAct = require('jest-react').act; + internalAct = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); waitFor = InternalTestUtils.waitFor; @@ -3793,7 +3793,7 @@ describe('ReactFresh', () => { ReactDOM = require('react-dom'); Scheduler = require('scheduler'); act = require('react-dom/test-utils').act; - internalAct = require('jest-react').act; + internalAct = require('internal-test-utils').act; // Important! Inject into the global hook *after* ReactDOM runs: ReactFreshRuntime = require('react-refresh/runtime'); diff --git a/packages/react-server-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js b/packages/react-server-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js index c42757b481cc2..dd5a08fdd467e 100644 --- a/packages/react-server-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js +++ b/packages/react-server-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js @@ -19,7 +19,7 @@ describe('ReactFlightDOMRelay', () => { beforeEach(() => { jest.resetModules(); - act = require('jest-react').act; + act = require('internal-test-utils').act; React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMFlightRelayServer = require('react-server-dom-relay/server'); diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js index 85b452ccc1a06..2fd621c34cead 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js @@ -34,7 +34,7 @@ let ErrorBoundary; describe('ReactFlightDOM', () => { beforeEach(() => { jest.resetModules(); - act = require('jest-react').act; + act = require('internal-test-utils').act; const WebpackMock = require('./utils/WebpackMock'); clientExports = WebpackMock.clientExports; clientModuleError = WebpackMock.clientModuleError; diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js index 81826f456cf26..d5aadf7418caa 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js @@ -30,7 +30,7 @@ let use; describe('ReactFlightDOMBrowser', () => { beforeEach(() => { jest.resetModules(); - act = require('jest-react').act; + act = require('internal-test-utils').act; const WebpackMock = require('./utils/WebpackMock'); clientExports = WebpackMock.clientExports; serverExports = WebpackMock.serverExports; diff --git a/packages/react/src/__tests__/ReactProfiler-test.internal.js b/packages/react/src/__tests__/ReactProfiler-test.internal.js index 0165e1cf9948c..f0ae798c1236b 100644 --- a/packages/react/src/__tests__/ReactProfiler-test.internal.js +++ b/packages/react/src/__tests__/ReactProfiler-test.internal.js @@ -43,7 +43,7 @@ function loadModules({ React = require('react'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; if (useNoopRenderer) { ReactNoop = require('react-noop-renderer'); diff --git a/packages/react/src/__tests__/ReactStartTransition-test.js b/packages/react/src/__tests__/ReactStartTransition-test.js index 8cab56798de5c..adf668fc70e14 100644 --- a/packages/react/src/__tests__/ReactStartTransition-test.js +++ b/packages/react/src/__tests__/ReactStartTransition-test.js @@ -22,7 +22,7 @@ describe('ReactStartTransition', () => { jest.resetModules(); React = require('react'); ReactTestRenderer = require('react-test-renderer'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useState = React.useState; useTransition = React.useTransition; }); diff --git a/packages/react/src/__tests__/ReactStrictMode-test.internal.js b/packages/react/src/__tests__/ReactStrictMode-test.internal.js index b0c65c7e22561..3383fe46ba359 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.internal.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.internal.js @@ -19,7 +19,7 @@ describe('ReactStrictMode', () => { React = require('react'); ReactDOMClient = require('react-dom/client'); - act = require('jest-react').act; + act = require('internal-test-utils').act; }); describe('levels', () => { diff --git a/packages/react/src/__tests__/ReactStrictMode-test.js b/packages/react/src/__tests__/ReactStrictMode-test.js index 93ad52fe34fb9..59dad3f5cf60f 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.js @@ -29,7 +29,7 @@ describe('ReactStrictMode', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); - act = require('jest-react').act; + act = require('internal-test-utils').act; useMemo = React.useMemo; useState = React.useState; useReducer = React.useReducer; diff --git a/packages/use-subscription/src/__tests__/useSubscription-test.js b/packages/use-subscription/src/__tests__/useSubscription-test.js index aa4aa5cd0b8c7..46bf1910bbd4a 100644 --- a/packages/use-subscription/src/__tests__/useSubscription-test.js +++ b/packages/use-subscription/src/__tests__/useSubscription-test.js @@ -30,7 +30,7 @@ describe('useSubscription', () => { ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; BehaviorSubject = require('rxjs').BehaviorSubject; ReplaySubject = require('rxjs').ReplaySubject; diff --git a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js index 10e62b19a52c4..560cb390a1adb 100644 --- a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js +++ b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js @@ -49,7 +49,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => { React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); - act = require('jest-react').act; + act = require('internal-test-utils').act; const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; diff --git a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js index f252711f62437..67a0c4b0a8f06 100644 --- a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js +++ b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js @@ -59,7 +59,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => { const InternalTestUtils = require('internal-test-utils'); assertLog = InternalTestUtils.assertLog; - const internalAct = require('jest-react').act; + const internalAct = require('internal-test-utils').act; // The internal act implementation doesn't batch updates by default, since // it's mostly used to test concurrent mode. But since these tests run