diff --git a/packages/react-art/src/__tests__/ReactART-test.js b/packages/react-art/src/__tests__/ReactART-test.js index b59af8ee02b9d..063c8df8244c5 100644 --- a/packages/react-art/src/__tests__/ReactART-test.js +++ b/packages/react-art/src/__tests__/ReactART-test.js @@ -22,21 +22,11 @@ import Circle from 'react-art/Circle'; import Rectangle from 'react-art/Rectangle'; import Wedge from 'react-art/Wedge'; -// Isolate DOM renderer. -jest.resetModules(); - -const ReactDOMClient = require('react-dom/client'); -const act = require('internal-test-utils').act; - -// Isolate test renderer. -jest.resetModules(); -const ReactTestRenderer = require('react-test-renderer'); - -// Isolate the noop renderer -jest.resetModules(); -const ReactNoop = require('react-noop-renderer'); -const Scheduler = require('scheduler'); - +let ReactDOMClient; +let act; +let ReactTestRenderer; +let ReactNoop; +let Scheduler; let Group; let Shape; let Surface; @@ -73,6 +63,21 @@ describe('ReactART', () => { let container; beforeEach(() => { + // Isolate DOM renderer. + jest.resetModules(); + + ReactDOMClient = require('react-dom/client'); + act = require('internal-test-utils').act; + + // Isolate test renderer. + jest.resetModules(); + ReactTestRenderer = require('react-test-renderer'); + + // Isolate the noop renderer + jest.resetModules(); + ReactNoop = require('react-noop-renderer'); + Scheduler = require('scheduler'); + container = document.createElement('div'); document.body.appendChild(container); diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js index 8ac4ab404f1cd..eb1b16e7f22ab 100644 --- a/packages/react-client/src/__tests__/ReactFlight-test.js +++ b/packages/react-client/src/__tests__/ReactFlight-test.js @@ -42,7 +42,6 @@ let assertLog; describe('ReactFlight', () => { beforeEach(() => { - jest.resetModules(); jest.mock('react', () => require('react/react.react-server')); ReactServer = require('react'); ReactNoopFlightServer = require('react-noop-renderer/flight-server'); diff --git a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js index eabcbd215bfb2..695efc7418ad3 100644 --- a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js @@ -34,8 +34,6 @@ describe('React hooks DevTools integration', () => { onCommitFiberUnmount: () => {}, }; - jest.resetModules(); - React = require('react'); ReactDebugTools = require('react-debug-tools'); ReactTestRenderer = require('react-test-renderer'); diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js index 1524751c5ae41..48037fc0321d6 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js @@ -15,7 +15,6 @@ let ReactDebugTools; describe('ReactHooksInspection', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDebugTools = require('react-debug-tools'); }); diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index ac4cb2e4a2b0f..d185cd4df634c 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -19,7 +19,6 @@ let useMemoCache; describe('ReactHooksInspectionIntegration', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactTestRenderer = require('react-test-renderer'); ReactDOM = require('react-dom'); diff --git a/packages/react-devtools-shared/src/__tests__/console-test.js b/packages/react-devtools-shared/src/__tests__/console-test.js index e8f5376c7bf2e..384b28c976858 100644 --- a/packages/react-devtools-shared/src/__tests__/console-test.js +++ b/packages/react-devtools-shared/src/__tests__/console-test.js @@ -924,8 +924,6 @@ describe('console', () => { describe('console error', () => { beforeEach(() => { - jest.resetModules(); - const Console = require('react-devtools-shared/src/backend/console'); patchConsole = Console.patch; unpatchConsole = Console.unpatch; diff --git a/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js b/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js index 01135909b5692..254a17717fbc4 100644 --- a/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js +++ b/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js @@ -48,8 +48,6 @@ describe('parseHookNames', () => { let parseHookNames; beforeEach(() => { - jest.resetModules(); - jest.mock('source-map-support', () => { console.trace('source-map-support'); }); diff --git a/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js b/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js index 87885ca07b4a5..05e1d1234e991 100644 --- a/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js +++ b/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js @@ -21,7 +21,6 @@ describe('DOMPropertyOperations', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ({act} = require('internal-test-utils')); diff --git a/packages/react-dom/src/__tests__/InvalidEventListeners-test.js b/packages/react-dom/src/__tests__/InvalidEventListeners-test.js index e7c9b5f9610ca..de35dae0f967d 100644 --- a/packages/react-dom/src/__tests__/InvalidEventListeners-test.js +++ b/packages/react-dom/src/__tests__/InvalidEventListeners-test.js @@ -18,7 +18,6 @@ describe('InvalidEventListeners', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js b/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js index 1dd665ce01145..cf8e5203a5d49 100644 --- a/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js +++ b/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js @@ -45,7 +45,6 @@ let container; // It should probably be rewritten but we're keeping it for some extra coverage. describe('ReactBrowserEventEmitter', () => { beforeEach(() => { - jest.resetModules(); LISTENER.mockClear(); React = require('react'); diff --git a/packages/react-dom/src/__tests__/ReactChildReconciler-test.js b/packages/react-dom/src/__tests__/ReactChildReconciler-test.js index ef584a7856921..2e1d9418c8cf8 100644 --- a/packages/react-dom/src/__tests__/ReactChildReconciler-test.js +++ b/packages/react-dom/src/__tests__/ReactChildReconciler-test.js @@ -18,8 +18,6 @@ let act; describe('ReactChildReconciler', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactComponent-test.js b/packages/react-dom/src/__tests__/ReactComponent-test.js index 5fa2a4f9f2e6e..7be43e9cef806 100644 --- a/packages/react-dom/src/__tests__/ReactComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactComponent-test.js @@ -17,8 +17,6 @@ let act; describe('ReactComponent', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js index 4567ee62a0a3e..a05e7bd16fc28 100644 --- a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js +++ b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js @@ -90,8 +90,6 @@ function getLifeCycleState(instance): ComponentLifeCycle { */ describe('ReactComponentLifeCycle', () => { beforeEach(() => { - jest.resetModules(); - act = require('internal-test-utils').act; React = require('react'); diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index c58e825203f8e..b478f4fe37e8b 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -63,7 +63,6 @@ describe('ReactCompositeComponent', () => { } beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js index a2894b2ca7b27..299efe1672cd5 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js @@ -520,78 +520,82 @@ describe('ReactCompositeComponent-state', () => { assertLog([ 'render -- step: 3, extra: false', 'callback -- step: 3, extra: false', - - // A second time for the retry. - 'render -- step: 3, extra: false', - 'callback -- step: 3, extra: false', ]); }); - if (!require('shared/ReactFeatureFlags').disableModulePatternComponents) { - it('should support stateful module pattern components', async () => { - function Child() { - return { - state: { - count: 123, - }, - render() { - return
{`count:${this.state.count}`}
; - }, - }; - } - - const el = document.createElement('div'); - const root = ReactDOMClient.createRoot(el); - expect(() => { - ReactDOM.flushSync(() => { - root.render(); - }); - }).toErrorDev( - 'Warning: The component appears to be a function component that returns a class instance. ' + - 'Change Child to a class that extends React.Component instead. ' + - "If you can't use a class try assigning the prototype on the function as a workaround. " + - '`Child.prototype = React.Component.prototype`. ' + - "Don't use an arrow function since it cannot be called with `new` by React.", - ); + // @gate !disableModulePatternComponents + it('should support stateful module pattern components', async () => { + function Child() { + return { + state: { + count: 123, + }, + render() { + return
{`count:${this.state.count}`}
; + }, + }; + } - expect(el.textContent).toBe('count:123'); - }); + const el = document.createElement('div'); + const root = ReactDOMClient.createRoot(el); + expect(() => { + ReactDOM.flushSync(() => { + root.render(); + }); + }).toErrorDev( + 'Warning: The component appears to be a function component that returns a class instance. ' + + 'Change Child to a class that extends React.Component instead. ' + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + '`Child.prototype = React.Component.prototype`. ' + + "Don't use an arrow function since it cannot be called with `new` by React.", + ); + + expect(el.textContent).toBe('count:123'); + }); - it('should support getDerivedStateFromProps for module pattern components', async () => { - function Child() { - return { - state: { - count: 1, - }, - render() { - return
{`count:${this.state.count}`}
; - }, - }; - } - Child.getDerivedStateFromProps = (props, prevState) => { - return { - count: prevState.count + props.incrementBy, - }; + // @gate !disableModulePatternComponents + it('should support getDerivedStateFromProps for module pattern components', async () => { + function Child() { + return { + state: { + count: 1, + }, + render() { + return
{`count:${this.state.count}`}
; + }, + }; + } + Child.getDerivedStateFromProps = (props, prevState) => { + return { + count: prevState.count + props.incrementBy, }; + }; - const el = document.createElement('div'); - const root = ReactDOMClient.createRoot(el); - await act(() => { + const el = document.createElement('div'); + const root = ReactDOMClient.createRoot(el); + expect(() => { + ReactDOM.flushSync(() => { root.render(); }); + }).toErrorDev( + 'Warning: The component appears to be a function component that returns a class instance. ' + + 'Change Child to a class that extends React.Component instead. ' + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + '`Child.prototype = React.Component.prototype`. ' + + "Don't use an arrow function since it cannot be called with `new` by React.", + ); - expect(el.textContent).toBe('count:1'); - await act(() => { - root.render(); - }); - expect(el.textContent).toBe('count:3'); + expect(el.textContent).toBe('count:1'); + await act(() => { + root.render(); + }); + expect(el.textContent).toBe('count:3'); - await act(() => { - root.render(); - }); - expect(el.textContent).toBe('count:4'); + await act(() => { + root.render(); }); - } + expect(el.textContent).toBe('count:4'); + }); it('should not support setState in componentWillUnmount', async () => { let subscription; diff --git a/packages/react-dom/src/__tests__/ReactDOM-test.js b/packages/react-dom/src/__tests__/ReactDOM-test.js index 00356cc725392..b12226d201d51 100644 --- a/packages/react-dom/src/__tests__/ReactDOM-test.js +++ b/packages/react-dom/src/__tests__/ReactDOM-test.js @@ -19,7 +19,6 @@ let act; describe('ReactDOM', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMAttribute-test.js b/packages/react-dom/src/__tests__/ReactDOMAttribute-test.js index e88bde84826b9..0d0dcfa32c7fa 100644 --- a/packages/react-dom/src/__tests__/ReactDOMAttribute-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMAttribute-test.js @@ -15,7 +15,6 @@ describe('ReactDOM unknown attribute', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 006b29fd97ab3..3126ef8119bd1 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -20,7 +20,6 @@ describe('ReactDOMComponent', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js index ad5826fe393ea..7072a58acac11 100644 --- a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js @@ -19,7 +19,6 @@ describe('ReactDOMConsoleErrorReporting', () => { let waitForThrow; beforeEach(() => { - jest.resetModules(); act = require('internal-test-utils').act; React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReportingLegacy-test.js b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReportingLegacy-test.js index bb1e9c83ecf65..11ad2c99bcb75 100644 --- a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReportingLegacy-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReportingLegacy-test.js @@ -19,7 +19,6 @@ describe('ReactDOMConsoleErrorReporting', () => { let waitForThrow; beforeEach(() => { - jest.resetModules(); act = require('internal-test-utils').act; React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js b/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js index d884b92d7fd49..26382c9dc5841 100644 --- a/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js @@ -17,7 +17,6 @@ describe('ReactDOMEventListener', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js b/packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js index b90ca9efdb32e..dbb9409cea268 100644 --- a/packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js @@ -18,7 +18,6 @@ describe('ReactDOMEventListener', () => { beforeEach(() => { window.TextEvent = function () {}; - jest.resetModules(); jest.isolateModules(() => { React = require('react'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js index 94172ab77b237..6b9eb722282ce 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js @@ -22,7 +22,6 @@ describe('ReactDOMFiber', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); PropTypes = require('prop-types'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js index 0b3335dfbacb8..6120a0ef0e2e7 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js @@ -32,7 +32,6 @@ let Suspense; describe('ReactDOMFizzForm', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); Scheduler = require('scheduler'); ReactDOMServer = require('react-dom/server.browser'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzForm-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzForm-test.js index ae56c5eae4dd2..9385e53b92f6b 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzForm-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzForm-test.js @@ -27,7 +27,6 @@ let useFormState; describe('ReactDOMFizzForm', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server.browser'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js index 5a796c5446f06..0e16d217ea150 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js @@ -49,7 +49,6 @@ let streamingContainer; describe('ReactDOMFizzServer', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; const jsdom = new JSDOM( diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js index ab5f8509260df..d3d44a24fe0e5 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js @@ -20,7 +20,6 @@ let Suspense; describe('ReactDOMFizzServerBrowser', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMFizzServer = require('react-dom/server.browser'); Suspense = React.Suspense; diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServerEdge-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServerEdge-test.js index c442f1813836c..b75fc78716977 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServerEdge-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServerEdge-test.js @@ -21,7 +21,6 @@ let ReactDOMFizzServer; describe('ReactDOMFizzServerEdge', () => { beforeEach(() => { - jest.resetModules(); jest.useRealTimers(); React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js index f7bab722bb386..748d9ed7c58d0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js @@ -17,7 +17,6 @@ let Suspense; describe('ReactDOMFizzServerNode', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMFizzServer = require('react-dom/server'); Stream = require('stream'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js index 3c2260d83bd6f..8838acfb1e37f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js @@ -27,7 +27,6 @@ let assertLog; describe('ReactDOMFizzShellHydration', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStatic-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStatic-test.js index 49afa26f65e02..83fcf4a6d131b 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStatic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStatic-test.js @@ -27,7 +27,6 @@ let fatalError = undefined; describe('ReactDOMFizzStatic', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js index 7482c7adaac8c..d063ba798b8ab 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js @@ -29,7 +29,6 @@ let container; describe('ReactDOMFizzStaticBrowser', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMFizzServer = require('react-dom/server.browser'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticFloat-test.js index 9a825bf1e3871..eafe097f9b871 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticFloat-test.js @@ -28,7 +28,6 @@ let container; describe('ReactDOMFizzStaticFloat', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMFizzServer = require('react-dom/server.browser'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js index a049ec4c49222..c22c688432775 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js @@ -16,7 +16,6 @@ let Suspense; describe('ReactDOMFizzStaticNode', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); if (__EXPERIMENTAL__) { ReactDOMFizzStatic = require('react-dom/static'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js index 3300297b77ee0..7c145dc145d7e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js @@ -26,7 +26,6 @@ let waitForAll; describe('ReactDOMFizzServerHydrationWarning', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; Scheduler = require('scheduler'); React = require('react'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js index eaad571ad9759..8ab5e1db04680 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js @@ -40,7 +40,6 @@ let streamingContainer; describe('ReactDOMFloat', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; const jsdom = new JSDOM( diff --git a/packages/react-dom/src/__tests__/ReactDOMForm-test.js b/packages/react-dom/src/__tests__/ReactDOMForm-test.js index 795909b6eaf46..9d2e37f49db5e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMForm-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMForm-test.js @@ -44,7 +44,6 @@ describe('ReactDOMForm', () => { let useFormState; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMHooks-test.js b/packages/react-dom/src/__tests__/ReactDOMHooks-test.js index ad8fadad1ff97..ccf555a4f9b14 100644 --- a/packages/react-dom/src/__tests__/ReactDOMHooks-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMHooks-test.js @@ -19,8 +19,6 @@ describe('ReactDOMHooks', () => { let container; beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js index 76a8229e5a89f..ff150066f9a1b 100644 --- a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js @@ -21,7 +21,6 @@ describe('ReactDOMServerHydration', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMInReactServer-test.js b/packages/react-dom/src/__tests__/ReactDOMInReactServer-test.js index f3bc6ea8aded2..f1067ef3d4922 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInReactServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInReactServer-test.js @@ -11,7 +11,6 @@ describe('ReactDOMInReactServer', () => { beforeEach(() => { - jest.resetModules(); jest.mock('react', () => require('react/react.react-server')); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index 2ccd1c043661a..dc9456bc8bb72 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -79,8 +79,6 @@ describe('ReactDOMInput', () => { } beforeEach(() => { - jest.resetModules(); - setUntrackedValue = Object.getOwnPropertyDescriptor( HTMLInputElement.prototype, 'value', diff --git a/packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js b/packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js index 1768ec14ea9e0..ca262e28b7e44 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js @@ -16,7 +16,6 @@ describe('ReactDOMInvalidARIAHook', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactDOMLegacyFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMLegacyFloat-test.js index 94876e41641f9..f05dd4a444198 100644 --- a/packages/react-dom/src/__tests__/ReactDOMLegacyFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMLegacyFloat-test.js @@ -15,8 +15,6 @@ let ReactDOMFizzServer; describe('ReactDOMFloat', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMFizzServer = require('react-dom/server'); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js b/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js index 6b445f9cf8d61..c549af0cee062 100644 --- a/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js @@ -22,7 +22,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => { let container; beforeEach(() => { - jest.resetModules(); container = document.createElement('div'); React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js b/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js index f7b0db175e5f6..89841f7ef955d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js @@ -18,7 +18,6 @@ describe('ReactDOMNestedEvents', () => { let assertLog; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); diff --git a/packages/react-dom/src/__tests__/ReactDOMOption-test.js b/packages/react-dom/src/__tests__/ReactDOMOption-test.js index c0597c36b20d1..8d6849e32ec7a 100644 --- a/packages/react-dom/src/__tests__/ReactDOMOption-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMOption-test.js @@ -17,7 +17,6 @@ describe('ReactDOMOption', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index 7967cf84a2672..8453150a38a35 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -24,7 +24,6 @@ describe('ReactDOMRoot', () => { let container; beforeEach(() => { - jest.resetModules(); container = document.createElement('div'); React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js b/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js index 17b1aed89ce72..b137ead3c34a1 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js @@ -43,7 +43,6 @@ describe('ReactDOMSafariMicrotaskBug-test', () => { } }; - jest.resetModules(); container = document.createElement('div'); React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMSelect-test.js b/packages/react-dom/src/__tests__/ReactDOMSelect-test.js index 35aaba29a6a46..c61289011d6ae 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSelect-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSelect-test.js @@ -26,7 +26,6 @@ describe('ReactDOMSelect', () => { const noop = function () {}; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js index bda021b5e06a7..1acbda0c29177 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js @@ -20,8 +20,6 @@ let ReactTestUtils; let ReactDOMServer; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js index 2821dd088bb48..25a443da7d55e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js @@ -20,8 +20,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationCheckbox-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationCheckbox-test.js index 178ed7982a44f..bfc6d410bfaa0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationCheckbox-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationCheckbox-test.js @@ -20,8 +20,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationClassContextType-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationClassContextType-test.js index 2df2d66b9b9fa..28db8815550f7 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationClassContextType-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationClassContextType-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js index ea30b45e3d61c..2e1f419ca945f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js @@ -22,7 +22,6 @@ let ReactFeatureFlags; let ReactTestUtils; function initModules() { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationFragment-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationFragment-test.js index 8e8fc2aa8fe27..586fe8b016e82 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationFragment-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationFragment-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js index 7e46bea5f93d9..6f42b23ca9fcc 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js @@ -35,9 +35,6 @@ let yieldValue; let clearLog; function initModules() { - // Reset warning cache. - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js index 54780dae52cdb..4dfc3628f749d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js @@ -20,8 +20,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js index 1481fcd326bb0..a9594872155e0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js @@ -19,8 +19,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); PropTypes = require('prop-types'); React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js index 99cf33b821f17..2ea05bd56ed36 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js index cf0167eef1fd2..718dc983cb371 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js index 76612f510d7d2..5329a419d4283 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js @@ -19,9 +19,6 @@ let ReactTestUtils; describe('ReactDOMServerIntegration', () => { function initModules() { - // Reset warning cache. - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); @@ -459,9 +456,6 @@ describe('ReactDOMServerIntegration', () => { describe('ReactDOMServerIntegration (legacy)', () => { function initModules() { - // Reset warning cache. - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationRefs-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationRefs-test.js index e5564d3d9348c..d14b38f3dcb8f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationRefs-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationRefs-test.js @@ -17,8 +17,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js index 9e503be7520b2..bc55cf89232ee 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js index 8ea1c9d53baee..94336a7611c67 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js @@ -23,8 +23,6 @@ let log; let clearLog; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js index dd19385e62c56..07e65b7eabdb2 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUntrustedURL-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUntrustedURL-test.js index 55336a2cb5636..f0780da48a628 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUntrustedURL-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUntrustedURL-test.js @@ -32,7 +32,6 @@ describe('ReactDOMServerIntegration - Untrusted URLs', () => { } function initModules() { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); @@ -197,7 +196,6 @@ describe('ReactDOMServerIntegration - Untrusted URLs - disableJavaScriptURLs', ( } function initModules() { - jest.resetModules(); const ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.disableJavaScriptURLs = true; diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUserInteraction-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUserInteraction-test.js index bc5980f23dda2..5d6abf288d2ba 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUserInteraction-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationUserInteraction-test.js @@ -17,8 +17,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js b/packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js index 8b3ea97816427..53999c560c25f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js @@ -15,8 +15,6 @@ let React; let ReactDOMServer; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.js b/packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.js index b04bbb0ab4eb3..7cd7c77b0fea7 100644 --- a/packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.js @@ -16,8 +16,6 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => { let ReactDOMClient; beforeEach(() => { - jest.resetModules(); - act = require('internal-test-utils').act; React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js b/packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js index 9c4c3fc913be1..65bc8a830dd3e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js @@ -26,7 +26,6 @@ let waitForAll; describe('ReactDOM HostSingleton', () => { beforeEach(() => { - jest.resetModules(); JSDOM = require('jsdom').JSDOM; React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js index 537e448f86dd8..1f655eee2ed4e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js @@ -21,7 +21,6 @@ describe('ReactDOMSuspensePlaceholder', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactDOMTestSelectors-test.js b/packages/react-dom/src/__tests__/ReactDOMTestSelectors-test.js index 65bb49e06a1c8..c194b8184b964 100644 --- a/packages/react-dom/src/__tests__/ReactDOMTestSelectors-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMTestSelectors-test.js @@ -27,10 +27,7 @@ describe('ReactDOMTestSelectors', () => { let container; beforeEach(() => { - jest.resetModules(); - React = require('react'); - act = require('internal-test-utils').act; if (__EXPERIMENTAL__ || global.__WWW__) { diff --git a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js index 3d21ca64e399e..74b46850911aa 100644 --- a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js @@ -22,8 +22,6 @@ describe('ReactDOMTextarea', () => { const ReactFeatureFlags = require('shared/ReactFeatureFlags'); beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMserverIntegrationProgress-test.js b/packages/react-dom/src/__tests__/ReactDOMserverIntegrationProgress-test.js index cf51eff4aced3..1a64e54d6f37e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMserverIntegrationProgress-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMserverIntegrationProgress-test.js @@ -18,8 +18,6 @@ let ReactDOMServer; let ReactTestUtils; function initModules() { - // Reset warning cache. - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.js b/packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.js index f8b318b2f995e..ba503d093f24d 100644 --- a/packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.js +++ b/packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.js @@ -16,7 +16,6 @@ let waitForAll; describe('ReactDeprecationWarnings', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js b/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js index 9316ad4392f61..c2586a4d2a237 100644 --- a/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js @@ -21,8 +21,6 @@ let container; describe('ReactEmptyComponent', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactEventIndependence-test.js b/packages/react-dom/src/__tests__/ReactEventIndependence-test.js index 05cbca61752f6..085f07bbed98c 100644 --- a/packages/react-dom/src/__tests__/ReactEventIndependence-test.js +++ b/packages/react-dom/src/__tests__/ReactEventIndependence-test.js @@ -15,8 +15,6 @@ let act; describe('ReactEventIndependence', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js b/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js index 1ec444bea047c..b28ece61e1e2e 100644 --- a/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js @@ -21,7 +21,6 @@ function FunctionComponent(props) { describe('ReactFunctionComponent', () => { beforeEach(() => { - jest.resetModules(); PropTypes = require('prop-types'); React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactIdentity-test.js b/packages/react-dom/src/__tests__/ReactIdentity-test.js index 5c25daf7d8f30..98e8e0533cecb 100644 --- a/packages/react-dom/src/__tests__/ReactIdentity-test.js +++ b/packages/react-dom/src/__tests__/ReactIdentity-test.js @@ -16,7 +16,6 @@ let act; describe('ReactIdentity', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactTestUtils = require('react-dom/test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js index 42908a693cce3..96629906f7cf5 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js @@ -17,7 +17,6 @@ let act; describe('ReactLegacyCompositeComponent', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactLegacyMount-test.js b/packages/react-dom/src/__tests__/ReactLegacyMount-test.js index 78492811428c3..d33325bd4dd98 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyMount-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyMount-test.js @@ -22,8 +22,6 @@ let waitForAll; describe('ReactMount', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js b/packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js index 9504de2c0a97e..23da335dce0e0 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js @@ -4,7 +4,6 @@ describe('ReactDOMRoot', () => { let container; beforeEach(() => { - jest.resetModules(); container = document.createElement('div'); ReactDOM = require('react-dom'); }); diff --git a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js index d1e54dbb055ca..462e90f2c04ca 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js @@ -20,7 +20,6 @@ let assertLog; // Can be deleted when we remove both. describe('ReactLegacyUpdates', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactTestUtils = require('react-dom/test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactMultiChild-test.js b/packages/react-dom/src/__tests__/ReactMultiChild-test.js index 96413378f6aef..cf31e0914547f 100644 --- a/packages/react-dom/src/__tests__/ReactMultiChild-test.js +++ b/packages/react-dom/src/__tests__/ReactMultiChild-test.js @@ -15,7 +15,6 @@ describe('ReactMultiChild', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js b/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js index 3a2a5126882ce..1c10335e9b524 100644 --- a/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js +++ b/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js @@ -304,10 +304,6 @@ async function testPropsSequence(sequence) { } describe('ReactMultiChildReconcile', () => { - beforeEach(() => { - jest.resetModules(); - }); - it('should reset internal state if removed then readded in an array', async () => { // Test basics. const props = { diff --git a/packages/react-dom/src/__tests__/ReactRenderDocument-test.js b/packages/react-dom/src/__tests__/ReactRenderDocument-test.js index 1ca24a5cdb39a..d918e27d3b58c 100644 --- a/packages/react-dom/src/__tests__/ReactRenderDocument-test.js +++ b/packages/react-dom/src/__tests__/ReactRenderDocument-test.js @@ -26,8 +26,6 @@ function getTestDocument(markup) { describe('rendering React components at document', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.js index 02f02187cb351..c2c89c8093499 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.js @@ -17,7 +17,6 @@ let ReactCurrentDispatcher; describe('ReactDOMServer', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); PropTypes = require('prop-types'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactServerRenderingBrowser-test.js b/packages/react-dom/src/__tests__/ReactServerRenderingBrowser-test.js index e99bc4904d1e4..375e12ec176b9 100644 --- a/packages/react-dom/src/__tests__/ReactServerRenderingBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRenderingBrowser-test.js @@ -16,7 +16,6 @@ let ReactDOMServerBrowser; describe('ReactServerRenderingBrowser', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server'); // For extra isolation between what would be two bundles on npm diff --git a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js index c7416b255d471..1b054e6530c89 100644 --- a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js @@ -22,7 +22,6 @@ let act; // If a test only needs ReactDOMServer, put it in ReactServerRendering-test instead. describe('ReactDOMServerHydration', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js b/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js index 9f24801907ba1..b7f4890fac9d1 100644 --- a/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js +++ b/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js @@ -81,7 +81,6 @@ describe('ReactTestUtils.act()', () => { function runActTests(render, unmount, rerender) { describe('concurrent render', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactTestUtils = require('react-dom/test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactTestUtilsActUnmockedScheduler-test.js b/packages/react-dom/src/__tests__/ReactTestUtilsActUnmockedScheduler-test.js index 45babfd4032d3..618317dab8e04 100644 --- a/packages/react-dom/src/__tests__/ReactTestUtilsActUnmockedScheduler-test.js +++ b/packages/react-dom/src/__tests__/ReactTestUtilsActUnmockedScheduler-test.js @@ -27,7 +27,6 @@ function clearLog() { beforeEach(() => { prevActGlobal = global.IS_REACT_ACT_ENVIRONMENT; global.IS_REACT_ACT_ENVIRONMENT = true; - jest.resetModules(); jest.unmock('scheduler'); yields = []; React = require('react'); diff --git a/packages/react-dom/src/__tests__/ReactUpdates-test.js b/packages/react-dom/src/__tests__/ReactUpdates-test.js index b460e9247646f..cd37619374c57 100644 --- a/packages/react-dom/src/__tests__/ReactUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactUpdates-test.js @@ -21,7 +21,6 @@ let assertLog; describe('ReactUpdates', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/escapeTextForBrowser-test.js b/packages/react-dom/src/__tests__/escapeTextForBrowser-test.js index be8dccf9f63ea..22ae71222c370 100644 --- a/packages/react-dom/src/__tests__/escapeTextForBrowser-test.js +++ b/packages/react-dom/src/__tests__/escapeTextForBrowser-test.js @@ -14,7 +14,6 @@ let ReactDOMServer; describe('escapeTextForBrowser', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server'); }); diff --git a/packages/react-dom/src/__tests__/quoteAttributeValueForBrowser-test.js b/packages/react-dom/src/__tests__/quoteAttributeValueForBrowser-test.js index 902e3c155c3ca..b4274d04d0767 100644 --- a/packages/react-dom/src/__tests__/quoteAttributeValueForBrowser-test.js +++ b/packages/react-dom/src/__tests__/quoteAttributeValueForBrowser-test.js @@ -14,7 +14,6 @@ let ReactDOMServer; describe('quoteAttributeValueForBrowser', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server'); }); diff --git a/packages/react-dom/src/__tests__/refs-destruction-test.js b/packages/react-dom/src/__tests__/refs-destruction-test.js index 97009c9e77806..bf391a18c3fbe 100644 --- a/packages/react-dom/src/__tests__/refs-destruction-test.js +++ b/packages/react-dom/src/__tests__/refs-destruction-test.js @@ -20,8 +20,6 @@ let theInnerClassComponentRef; describe('refs-destruction', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-dom/src/__tests__/refs-test.js b/packages/react-dom/src/__tests__/refs-test.js index e42661abd5a1f..916835fd03d7f 100644 --- a/packages/react-dom/src/__tests__/refs-test.js +++ b/packages/react-dom/src/__tests__/refs-test.js @@ -22,7 +22,6 @@ describe('reactiverefs', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactFeatureFlags = require('shared/ReactFeatureFlags'); @@ -233,7 +232,6 @@ if (!ReactFeatureFlags.disableModulePatternComponents) { describe('ref swapping', () => { let RefHopsAround; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); ReactFeatureFlags = require('shared/ReactFeatureFlags'); @@ -569,6 +567,14 @@ describe('creating element with string ref in constructor', () => { }); describe('strings refs across renderers', () => { + beforeEach(() => { + React = require('react'); + ReactDOMClient = require('react-dom/client'); + ReactFeatureFlags = require('shared/ReactFeatureFlags'); + ReactTestUtils = require('react-dom/test-utils'); + act = require('internal-test-utils').act; + }); + it('does not break', async () => { class Parent extends React.Component { render() { @@ -584,11 +590,13 @@ describe('strings refs across renderers', () => { class Indirection extends React.Component { componentDidUpdate() { - // One ref is being rendered later using another renderer copy. jest.resetModules(); + // One ref is being rendered later using another renderer copy. const AnotherCopyOfReactDOM = require('react-dom'); const AnotherCopyOfReactDOMClient = require('react-dom/client'); const root = AnotherCopyOfReactDOMClient.createRoot(div2); + + // TODO: this should error since flushSync is called in a lifecycle. AnotherCopyOfReactDOM.flushSync(() => { root.render(this.props.child2); }); diff --git a/packages/react-dom/src/__tests__/refsLegacy-test.js b/packages/react-dom/src/__tests__/refsLegacy-test.js index c3af817892ffa..5e19289d395c7 100644 --- a/packages/react-dom/src/__tests__/refsLegacy-test.js +++ b/packages/react-dom/src/__tests__/refsLegacy-test.js @@ -14,7 +14,6 @@ let ReactDOM = require('react-dom'); describe('root level refs with legacy APIs', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); }); diff --git a/packages/react-dom/src/events/__tests__/SyntheticFocusEvent-test.js b/packages/react-dom/src/events/__tests__/SyntheticFocusEvent-test.js index ef889c4b60d10..bf4fab696741e 100644 --- a/packages/react-dom/src/events/__tests__/SyntheticFocusEvent-test.js +++ b/packages/react-dom/src/events/__tests__/SyntheticFocusEvent-test.js @@ -14,7 +14,6 @@ describe('SyntheticFocusEvent', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/events/__tests__/SyntheticMouseEvent-test.js b/packages/react-dom/src/events/__tests__/SyntheticMouseEvent-test.js index a20886a3e2c04..5c252a74beb5c 100644 --- a/packages/react-dom/src/events/__tests__/SyntheticMouseEvent-test.js +++ b/packages/react-dom/src/events/__tests__/SyntheticMouseEvent-test.js @@ -17,7 +17,6 @@ describe('SyntheticMouseEvent', () => { let container; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; 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 fab10a36e16d1..dd5cc0130fb17 100644 --- a/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js +++ b/packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js @@ -37,7 +37,6 @@ describe('ChangeEventPlugin', () => { let container; beforeEach(() => { - jest.resetModules(); // TODO pull this into helper method, reduce repetition. // mock the browser APIs which are used in schedule: // - calling 'window.postMessage' should actually fire postmessage handlers diff --git a/packages/react-dom/src/events/plugins/__tests__/EnterLeaveEventPlugin-test.js b/packages/react-dom/src/events/plugins/__tests__/EnterLeaveEventPlugin-test.js index 569a29a22a5b8..ee4cb594f721f 100644 --- a/packages/react-dom/src/events/plugins/__tests__/EnterLeaveEventPlugin-test.js +++ b/packages/react-dom/src/events/plugins/__tests__/EnterLeaveEventPlugin-test.js @@ -18,8 +18,6 @@ describe('EnterLeaveEventPlugin', () => { let container; beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); 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 4cd9c8f27e6f5..1110c62e61977 100644 --- a/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js +++ b/packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js @@ -44,7 +44,6 @@ describe('SimpleEventPlugin', function () { } beforeEach(function () { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); @@ -257,8 +256,6 @@ describe('SimpleEventPlugin', function () { describe('interactive events, in concurrent mode', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); diff --git a/packages/react-is/src/__tests__/ReactIs-test.js b/packages/react-is/src/__tests__/ReactIs-test.js index 5b63eebd529fd..07d90eae157d2 100644 --- a/packages/react-is/src/__tests__/ReactIs-test.js +++ b/packages/react-is/src/__tests__/ReactIs-test.js @@ -16,8 +16,6 @@ let SuspenseList; describe('ReactIs', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactIs = require('react-is'); diff --git a/packages/react-reconciler/src/__tests__/Activity-test.js b/packages/react-reconciler/src/__tests__/Activity-test.js index fc6a8b563d197..780cb065c088c 100644 --- a/packages/react-reconciler/src/__tests__/Activity-test.js +++ b/packages/react-reconciler/src/__tests__/Activity-test.js @@ -16,8 +16,6 @@ let assertLog; describe('Activity', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ActivityStrictMode-test.js b/packages/react-reconciler/src/__tests__/ActivityStrictMode-test.js index a8b8d286dc6aa..b7a1306e28303 100644 --- a/packages/react-reconciler/src/__tests__/ActivityStrictMode-test.js +++ b/packages/react-reconciler/src/__tests__/ActivityStrictMode-test.js @@ -6,7 +6,6 @@ let log; describe('Activity StrictMode', () => { beforeEach(() => { - jest.resetModules(); log = []; React = require('react'); diff --git a/packages/react-reconciler/src/__tests__/ActivitySuspense-test.js b/packages/react-reconciler/src/__tests__/ActivitySuspense-test.js index a2b4de2e0ce51..c27b0de4cb507 100644 --- a/packages/react-reconciler/src/__tests__/ActivitySuspense-test.js +++ b/packages/react-reconciler/src/__tests__/ActivitySuspense-test.js @@ -15,8 +15,6 @@ let assertLog; describe('Activity Suspense', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactActWarnings-test.js b/packages/react-reconciler/src/__tests__/ReactActWarnings-test.js index 61cde5648a9e6..378e8b250caa2 100644 --- a/packages/react-reconciler/src/__tests__/ReactActWarnings-test.js +++ b/packages/react-reconciler/src/__tests__/ReactActWarnings-test.js @@ -24,7 +24,6 @@ let caches; // React 17. describe('act warnings', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); Scheduler = require('scheduler'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js b/packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js index 0a29be2b6fec9..b8c5a9005d06f 100644 --- a/packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js +++ b/packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js @@ -10,8 +10,6 @@ let textCache; describe('ReactAsyncActions', () => { beforeEach(() => { - jest.resetModules(); - global.reportError = error => { Scheduler.log('reportError: ' + error.message); }; diff --git a/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js b/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js index d640f87205e45..a504ed874d30f 100644 --- a/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js @@ -15,8 +15,6 @@ let waitForPaint; describe('ReactSuspenseWithNoopRenderer', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactCache-test.js b/packages/react-reconciler/src/__tests__/ReactCache-test.js index b32479b70bbf5..7caf1e7e9678f 100644 --- a/packages/react-reconciler/src/__tests__/ReactCache-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCache-test.js @@ -17,7 +17,6 @@ let cache; describe('ReactCache', () => { beforeEach(() => { - jest.resetModules(); jest.mock('react', () => require('react/react.react-server')); React = require('react'); @@ -204,7 +203,6 @@ describe('ReactCache', () => { it('introspection of returned wrapper function is same on client and server', async () => { // When the variant flag is true, test the client version of `cache`. if (gate(flags => flags.variant)) { - jest.resetModules(); jest.mock('react', () => jest.requireActual('react')); const ClientReact = require('react'); cache = ClientReact.cache; diff --git a/packages/react-reconciler/src/__tests__/ReactCacheElement-test.js b/packages/react-reconciler/src/__tests__/ReactCacheElement-test.js index 19d3180af650c..4baae39b440eb 100644 --- a/packages/react-reconciler/src/__tests__/ReactCacheElement-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCacheElement-test.js @@ -17,8 +17,6 @@ let seededCache; describe('ReactCacheElement', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Cache = React.unstable_Cache; diff --git a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js index e9b25f2ca74dc..f4fa62a524ae3 100644 --- a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js +++ b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js @@ -6,8 +6,6 @@ let assertLog; describe('ReactClassSetStateCallback', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js b/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js index 8c4f0d3415cec..ffbf330a876c4 100644 --- a/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js +++ b/packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js @@ -12,8 +12,6 @@ let seededCache; describe('ReactConcurrentErrorRecovery', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js b/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js index 3247e8758e079..37c4771778554 100644 --- a/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js +++ b/packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js @@ -13,8 +13,6 @@ let assertLog; describe('ReactLazyContextPropagation', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js index b321f4bba0de4..fb0de990d7d97 100644 --- a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js +++ b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js @@ -23,8 +23,6 @@ let textCache; describe('ReactDeferredValue', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js b/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js index 259492f294cfc..29ef30d639257 100644 --- a/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js +++ b/packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js @@ -22,7 +22,6 @@ let assertLog; describe('ReactEffectOrdering', () => { beforeEach(() => { - jest.resetModules(); jest.useFakeTimers(); React = require('react'); diff --git a/packages/react-reconciler/src/__tests__/ReactExpiration-test.js b/packages/react-reconciler/src/__tests__/ReactExpiration-test.js index cd09ca347885b..ef560f4ffe4c2 100644 --- a/packages/react-reconciler/src/__tests__/ReactExpiration-test.js +++ b/packages/react-reconciler/src/__tests__/ReactExpiration-test.js @@ -25,8 +25,6 @@ let unstable_waitForExpired; describe('ReactExpiration', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); @@ -405,7 +403,6 @@ describe('ReactExpiration', () => { // Tests an implementation detail where expiration times are computed using // bitwise operations. - jest.resetModules(); Scheduler = require('scheduler'); if (gate(flags => flags.forceConcurrentByDefaultForTesting)) { diff --git a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js index e2d9ba76660f9..8e965cc12bdbd 100644 --- a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js +++ b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js @@ -12,8 +12,6 @@ let waitForPaint; describe('ReactFlushSync', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js b/packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js index 8c1bc7475be36..9f87497b3fd67 100644 --- a/packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js +++ b/packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js @@ -11,8 +11,6 @@ let flushFakeMicrotasks; describe('ReactFlushSync (AggregateError not available)', () => { beforeEach(() => { - jest.resetModules(); - global.AggregateError = undefined; // When AggregateError is not available, the errors are rethrown in a diff --git a/packages/react-reconciler/src/__tests__/ReactFragment-test.js b/packages/react-reconciler/src/__tests__/ReactFragment-test.js index 3db7702f4cfef..29ad974f4ad99 100644 --- a/packages/react-reconciler/src/__tests__/ReactFragment-test.js +++ b/packages/react-reconciler/src/__tests__/ReactFragment-test.js @@ -15,8 +15,6 @@ let waitForAll; describe('ReactFragment', () => { beforeEach(function () { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js index 89d150ed09888..204c1a2089e40 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js @@ -43,7 +43,6 @@ let assertLog; describe('ReactHooksWithNoopRenderer', () => { beforeEach(() => { - jest.resetModules(); jest.useFakeTimers(); React = require('react'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncremental-test.js b/packages/react-reconciler/src/__tests__/ReactIncremental-test.js index 13f904bf9d014..d3ddfa900524c 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncremental-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncremental-test.js @@ -21,7 +21,6 @@ let assertLog; describe('ReactIncremental', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); @@ -2719,7 +2718,6 @@ describe('ReactIncremental', () => { // First, verify that this code path normally receives Fibers as keys, // and that they're not extensible. - jest.resetModules(); let receivedNonExtensibleObjects; // eslint-disable-next-line no-extend-native Map.prototype.set = function (key) { diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.js index e56d0f30d7bce..d366ccc0970fa 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.js @@ -18,7 +18,6 @@ let waitForThrow; describe('ReactIncrementalErrorLogging', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.js index ed4317d95706e..eb8ef9095a190 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.js @@ -17,7 +17,6 @@ let waitForThrow; describe('ReactIncrementalErrorReplay', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.js index cffd690e64715..65dba58d4fe7e 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.js @@ -18,8 +18,6 @@ let waitForAll; describe('ReactIncrementalReflection', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js index 8c00ec741206e..445ff979839e3 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js @@ -21,8 +21,6 @@ let waitForPaint; describe('ReactIncrementalScheduling', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js index b47897e54d92e..9dac866df1ad7 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js @@ -19,8 +19,6 @@ let waitForPaint; describe('ReactIncrementalSideEffects', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js index f3d5cbc675c52..d75193883e3db 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js @@ -21,8 +21,6 @@ let assertLog; describe('ReactIncrementalUpdates', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism-test.js index 5f1959de160af..79110760d315e 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism-test.js @@ -16,7 +16,6 @@ let act; describe('ReactIncrementalUpdatesMinimalism', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js b/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js index 7e676861b5d31..47ea906808323 100644 --- a/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js +++ b/packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js @@ -11,8 +11,6 @@ let waitForPaint; describe('ReactInterleavedUpdates', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactMemo-test.js b/packages/react-reconciler/src/__tests__/ReactMemo-test.js index a7b47621d53e2..2f51e8fc81b89 100644 --- a/packages/react-reconciler/src/__tests__/ReactMemo-test.js +++ b/packages/react-reconciler/src/__tests__/ReactMemo-test.js @@ -23,8 +23,6 @@ let assertLog; describe('memo', () => { beforeEach(() => { - jest.resetModules(); - PropTypes = require('prop-types'); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactNewContext-test.js b/packages/react-reconciler/src/__tests__/ReactNewContext-test.js index 61a5a273b9dfc..ad5eba5150ee0 100644 --- a/packages/react-reconciler/src/__tests__/ReactNewContext-test.js +++ b/packages/react-reconciler/src/__tests__/ReactNewContext-test.js @@ -20,8 +20,6 @@ let waitForThrow; describe('ReactNewContext', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); useContext = React.useContext; ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactPersistent-test.js b/packages/react-reconciler/src/__tests__/ReactPersistent-test.js index 7900ccdadd451..06560430c7792 100644 --- a/packages/react-reconciler/src/__tests__/ReactPersistent-test.js +++ b/packages/react-reconciler/src/__tests__/ReactPersistent-test.js @@ -16,8 +16,6 @@ let waitForAll; describe('ReactPersistent', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoopPersistent = require('react-noop-renderer/persistent'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-reconciler/src/__tests__/ReactPersistentUpdatesMinimalism-test.js b/packages/react-reconciler/src/__tests__/ReactPersistentUpdatesMinimalism-test.js index 359c80c247f02..173b3064a5cba 100644 --- a/packages/react-reconciler/src/__tests__/ReactPersistentUpdatesMinimalism-test.js +++ b/packages/react-reconciler/src/__tests__/ReactPersistentUpdatesMinimalism-test.js @@ -16,7 +16,6 @@ let act; describe('ReactPersistentUpdatesMinimalism', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoopPersistent = require('react-noop-renderer/persistent'); act = require('internal-test-utils').act; diff --git a/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js b/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js index a29280b36c569..7658fbadbae30 100644 --- a/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js @@ -25,8 +25,6 @@ let waitFor; describe('ReactSchedulerIntegration', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); @@ -195,8 +193,6 @@ describe( let logDuringShouldYield = false; beforeEach(() => { - jest.resetModules(); - jest.mock('scheduler', () => { const actual = jest.requireActual('scheduler/unstable_mock'); return { @@ -326,8 +322,6 @@ describe('`act` bypasses Scheduler methods completely,', () => { let infiniteLoopGuard; beforeEach(() => { - jest.resetModules(); - infiniteLoopGuard = 0; jest.mock('scheduler', () => { diff --git a/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js b/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js index 49bde67837cdf..4ae9f7f61ca1c 100644 --- a/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js @@ -12,8 +12,6 @@ let assertLog; describe('ReactSuspenseWithNoopRenderer', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js index 8706d9e248ce6..7e354f858a5ed 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js @@ -16,8 +16,6 @@ let act; describe('ReactSuspense', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js index 5200635b6fca4..8c8edb39c0f97 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js @@ -24,8 +24,6 @@ let assertLog; describe('ReactSuspenseEffectsSemantics', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js index 2a6b02acfe4f3..87eb80c3b2342 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js @@ -21,8 +21,6 @@ let fakeModuleCache; describe('ReactSuspenseEffectsSemanticsDOM', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js index 8dcf5fda13695..07968fcae55c4 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js @@ -17,8 +17,6 @@ let waitForAll; describe('ReactSuspenseFallback', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js index 432546c683f5b..b5e753e4aca2a 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js @@ -11,8 +11,6 @@ let waitFor; describe('ReactSuspenseList', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js index 77aae6ee53d9b..c1b8e34368378 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js @@ -17,8 +17,6 @@ let seededCache; describe('ReactSuspenseWithNoopRenderer', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); Fragment = React.Fragment; ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js index 52fd9ef3f27d8..e64a2873b8541 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js @@ -14,8 +14,6 @@ let waitForPaint; describe('ReactSuspenseyCommitPhase', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactTopLevelFragment-test.js b/packages/react-reconciler/src/__tests__/ReactTopLevelFragment-test.js index 38b0d0a52633a..20b307886fdd3 100644 --- a/packages/react-reconciler/src/__tests__/ReactTopLevelFragment-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTopLevelFragment-test.js @@ -18,7 +18,6 @@ let waitForAll; // probably move to one of the other test files once it is official. describe('ReactTopLevelFragment', function () { beforeEach(function () { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js b/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js index 30a3fa093b4ab..7fe6c4dfb84b2 100644 --- a/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js @@ -18,7 +18,6 @@ let waitForAll; // probably move to one of the other test files once it is official. describe('ReactTopLevelText', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.js index e5c69665f31c2..67fc502d101ce 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransition-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.js @@ -30,7 +30,6 @@ let seededCache; describe('ReactTransition', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js index 72397a8446a52..1a2b7c859e779 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js @@ -37,8 +37,6 @@ describe('ReactInteractionTracing', () => { .join(', '); } beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js b/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js index c5de798366334..6128180319b5f 100644 --- a/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js +++ b/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js @@ -12,8 +12,6 @@ let assertLog; describe('ReactUpdatePriority', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/ReactUse-test.js b/packages/react-reconciler/src/__tests__/ReactUse-test.js index 12e93620b5ded..d66b27c81d477 100644 --- a/packages/react-reconciler/src/__tests__/ReactUse-test.js +++ b/packages/react-reconciler/src/__tests__/ReactUse-test.js @@ -20,8 +20,6 @@ let waitForMicrotasks; describe('ReactUse', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js index 62ff0e19e6230..fd7d6c4ef31c6 100644 --- a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js +++ b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js @@ -17,7 +17,6 @@ let assertLog; describe('StrictEffectsMode', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-reconciler/src/__tests__/useEffectEvent-test.js b/packages/react-reconciler/src/__tests__/useEffectEvent-test.js index 38cdae73f0124..f140351a02698 100644 --- a/packages/react-reconciler/src/__tests__/useEffectEvent-test.js +++ b/packages/react-reconciler/src/__tests__/useEffectEvent-test.js @@ -12,8 +12,6 @@ 'use strict'; -import {useInsertionEffect} from 'react'; - describe('useEffectEvent', () => { let React; let ReactNoop; @@ -25,6 +23,7 @@ describe('useEffectEvent', () => { let useEffectEvent; let useEffect; let useLayoutEffect; + let useInsertionEffect; let useMemo; let waitForAll; let assertLog; @@ -43,6 +42,7 @@ describe('useEffectEvent', () => { useEffect = React.useEffect; useLayoutEffect = React.useLayoutEffect; useMemo = React.useMemo; + useInsertionEffect = React.useInsertionEffect; const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/useMemoCache-test.js b/packages/react-reconciler/src/__tests__/useMemoCache-test.js index 94571df0f9d83..1eea6bd3394cc 100644 --- a/packages/react-reconciler/src/__tests__/useMemoCache-test.js +++ b/packages/react-reconciler/src/__tests__/useMemoCache-test.js @@ -18,8 +18,6 @@ let ErrorBoundary; describe('useMemoCache()', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); act = require('internal-test-utils').act; diff --git a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js index 67cefa180aa74..4222bff18368b 100644 --- a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js +++ b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js @@ -32,8 +32,6 @@ let assertLog; // React DOM versions (16, 17, etc) instead of React Noop. describe('useSyncExternalStore', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-refresh/src/__tests__/ReactFresh-test.js b/packages/react-refresh/src/__tests__/ReactFresh-test.js index 38b74563c30a7..50ea4cb6b7e7d 100644 --- a/packages/react-refresh/src/__tests__/ReactFresh-test.js +++ b/packages/react-refresh/src/__tests__/ReactFresh-test.js @@ -27,7 +27,6 @@ describe('ReactFresh', () => { beforeEach(() => { if (__DEV__) { - jest.resetModules(); React = require('react'); ReactFreshRuntime = require('react-refresh/runtime'); ReactFreshRuntime.injectIntoGlobalHook(global); diff --git a/packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js b/packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js index ed8c56072a217..c5eec3f2c4187 100644 --- a/packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js +++ b/packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js @@ -29,7 +29,6 @@ describe('ReactFreshIntegration', () => { beforeEach(() => { if (__DEV__) { - jest.resetModules(); React = require('react'); ReactFreshRuntime = require('react-refresh/runtime'); ReactFreshRuntime.injectIntoGlobalHook(global); diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMBrowser-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMBrowser-test.js index d797946a3fd3d..0a214a259fc5f 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMBrowser-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMBrowser-test.js @@ -21,8 +21,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMBrowser', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/server', () => diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMEdge-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMEdge-test.js index 67d25c967f472..3b736f7f8c3c6 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMEdge-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMEdge-test.js @@ -30,8 +30,6 @@ let use; describe('ReactFlightDOMEdge', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/server', () => diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMForm-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMForm-test.js index 3f63222d0ae2d..0ec3bc184275f 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMForm-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMForm-test.js @@ -31,7 +31,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMForm', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/server', () => diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMNode-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMNode-test.js index e06ee0a32f950..448d5f3e01626 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMNode-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMNode-test.js @@ -26,8 +26,6 @@ let use; describe('ReactFlightDOMNode', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/server', () => diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReply-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReply-test.js index e47352cfe981d..d83237681f207 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReply-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReply-test.js @@ -22,7 +22,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMReply', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/server', () => diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReplyEdge-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReplyEdge-test.js index 0cd8605c7e8d6..99fad128bab53 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReplyEdge-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMReplyEdge-test.js @@ -22,7 +22,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMReply', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-turbopack/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 91ba06dd329b9..b5b66df1b91e1 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js @@ -42,8 +42,6 @@ describe('ReactFlightDOM', () => { // For this first reset we are going to load the dom-node version of react-server-dom-webpack/server // This can be thought of as essentially being the React Server Components scope with react-server // condition - jest.resetModules(); - JSDOM = require('jsdom').JSDOM; // Simulate the condition resolution 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 2427317ce2c32..59e34256f0547 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js @@ -33,8 +33,6 @@ let ReactServerDOM; describe('ReactFlightDOMBrowser', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js index 7c9271fcdcc19..2ab419c780aa4 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js @@ -31,8 +31,6 @@ let use; describe('ReactFlightDOMEdge', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js index dcab688b10c83..604ac14a095ee 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js @@ -36,7 +36,6 @@ let act; describe('ReactFlightDOMForm', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js index 87fc83360018e..82b35657f26dd 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js @@ -26,8 +26,6 @@ let use; describe('ReactFlightDOMNode', () => { beforeEach(() => { - jest.resetModules(); - // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReply-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReply-test.js index 1162d1d0fe738..6df1655e5121a 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReply-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReply-test.js @@ -22,7 +22,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMReply', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReplyEdge-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReplyEdge-test.js index 8e45472956294..9cdc60969a1ba 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReplyEdge-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMReplyEdge-test.js @@ -22,7 +22,6 @@ let ReactServerDOMClient; describe('ReactFlightDOMReplyEdge', () => { beforeEach(() => { - jest.resetModules(); // Simulate the condition resolution jest.mock('react', () => require('react/react.react-server')); jest.mock('react-server-dom-webpack/server', () => diff --git a/packages/react-server/src/__tests__/ReactServer-test.js b/packages/react-server/src/__tests__/ReactServer-test.js index d827e82de0cac..0293d3593364f 100644 --- a/packages/react-server/src/__tests__/ReactServer-test.js +++ b/packages/react-server/src/__tests__/ReactServer-test.js @@ -15,8 +15,6 @@ let ReactNoopServer; describe('ReactServer', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactNoopServer = require('react-noop-renderer/server'); }); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js index 0118fa53f3ad3..6de4d6be4a425 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js @@ -17,7 +17,6 @@ let waitForAll; describe('ReactTestRenderer', () => { beforeEach(() => { - jest.resetModules(); ReactDOM = require('react-dom'); // Isolate test renderer. diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js index 2306a895b785c..aa89d2fc0b775 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js @@ -8,7 +8,6 @@ let assertLog; describe('ReactTestRenderer.act()', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js index 51c7e0a950ddc..7c319a2f50aaa 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js @@ -18,8 +18,6 @@ let waitFor; describe('ReactTestRendererAsync', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js index d61f0a7c9075a..cffc417ab775e 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js @@ -19,7 +19,6 @@ const View = props => ; describe('ReactTestRendererTraversal', () => { beforeEach(() => { - jest.resetModules(); ReactTestRenderer = require('react-test-renderer'); Context = React.createContext(null); }); diff --git a/packages/react/src/__tests__/ReactChildren-test.js b/packages/react/src/__tests__/ReactChildren-test.js index 8ff0ea625c04f..4a3898e4bd8ce 100644 --- a/packages/react/src/__tests__/ReactChildren-test.js +++ b/packages/react/src/__tests__/ReactChildren-test.js @@ -15,7 +15,6 @@ describe('ReactChildren', () => { let act; beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react/src/__tests__/ReactContextValidator-test.js b/packages/react/src/__tests__/ReactContextValidator-test.js index ac6fc10343d04..79f1957acc6f3 100644 --- a/packages/react/src/__tests__/ReactContextValidator-test.js +++ b/packages/react/src/__tests__/ReactContextValidator-test.js @@ -24,8 +24,6 @@ let act; describe('ReactContextValidator', () => { beforeEach(() => { - jest.resetModules(); - PropTypes = require('prop-types'); React = require('react'); ReactDOMClient = require('react-dom/client'); diff --git a/packages/react/src/__tests__/ReactCreateElement-test.js b/packages/react/src/__tests__/ReactCreateElement-test.js index 6d1a16e3bb145..7c6a623be1700 100644 --- a/packages/react/src/__tests__/ReactCreateElement-test.js +++ b/packages/react/src/__tests__/ReactCreateElement-test.js @@ -20,8 +20,6 @@ describe('ReactCreateElement', () => { let ComponentClass; beforeEach(() => { - jest.resetModules(); - act = require('internal-test-utils').act; React = require('react'); diff --git a/packages/react/src/__tests__/ReactCreateRef-test.js b/packages/react/src/__tests__/ReactCreateRef-test.js index 5c560152b0b26..9e45930ce8454 100644 --- a/packages/react/src/__tests__/ReactCreateRef-test.js +++ b/packages/react/src/__tests__/ReactCreateRef-test.js @@ -14,8 +14,6 @@ let ReactTestRenderer; describe('ReactCreateRef', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactTestRenderer = require('react-test-renderer'); }); diff --git a/packages/react/src/__tests__/ReactFetch-test.js b/packages/react/src/__tests__/ReactFetch-test.js index 2b42bfdd25a3e..5be624e2f8244 100644 --- a/packages/react/src/__tests__/ReactFetch-test.js +++ b/packages/react/src/__tests__/ReactFetch-test.js @@ -40,7 +40,6 @@ let cache; describe('ReactFetch', () => { beforeEach(() => { - jest.resetModules(); fetchCount = 0; global.fetch = fetchMock; diff --git a/packages/react/src/__tests__/ReactFetchEdge-test.js b/packages/react/src/__tests__/ReactFetchEdge-test.js index 741306a9a2e4a..67afab7ca3e84 100644 --- a/packages/react/src/__tests__/ReactFetchEdge-test.js +++ b/packages/react/src/__tests__/ReactFetchEdge-test.js @@ -44,7 +44,6 @@ let use; describe('ReactFetch', () => { beforeEach(() => { - jest.resetModules(); fetchCount = 0; global.fetch = fetchMock; diff --git a/packages/react/src/__tests__/ReactJSXElementValidator-test.js b/packages/react/src/__tests__/ReactJSXElementValidator-test.js index b7cdff0ce0aa1..3b2a9fd83bd1d 100644 --- a/packages/react/src/__tests__/ReactJSXElementValidator-test.js +++ b/packages/react/src/__tests__/ReactJSXElementValidator-test.js @@ -23,8 +23,6 @@ describe('ReactJSXElementValidator', () => { let RequiredPropComponent; beforeEach(() => { - jest.resetModules(); - PropTypes = require('prop-types'); React = require('react'); ReactDOM = require('react-dom'); diff --git a/packages/react/src/__tests__/ReactJSXRuntime-test.js b/packages/react/src/__tests__/ReactJSXRuntime-test.js index 713430fa5ead9..aee64650d1c50 100644 --- a/packages/react/src/__tests__/ReactJSXRuntime-test.js +++ b/packages/react/src/__tests__/ReactJSXRuntime-test.js @@ -22,8 +22,6 @@ let act; // transform that we use in our tests configuration. describe('ReactJSXRuntime', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); JSXRuntime = require('react/jsx-runtime'); JSXDEVRuntime = require('react/jsx-dev-runtime'); diff --git a/packages/react/src/__tests__/ReactJSXTransformIntegration-test.js b/packages/react/src/__tests__/ReactJSXTransformIntegration-test.js index 6f764db3b11ce..ede9d60261e3f 100644 --- a/packages/react/src/__tests__/ReactJSXTransformIntegration-test.js +++ b/packages/react/src/__tests__/ReactJSXTransformIntegration-test.js @@ -26,8 +26,6 @@ describe('ReactJSXTransformIntegration', () => { let Component; beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); ReactTestUtils = require('react-dom/test-utils'); diff --git a/packages/react/src/__tests__/ReactStartTransition-test.js b/packages/react/src/__tests__/ReactStartTransition-test.js index c98372a7c74b7..b60cb7b6ca1e1 100644 --- a/packages/react/src/__tests__/ReactStartTransition-test.js +++ b/packages/react/src/__tests__/ReactStartTransition-test.js @@ -19,7 +19,6 @@ const SUSPICIOUS_NUMBER_OF_FIBERS_UPDATED = 10; describe('ReactStartTransition', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactTestRenderer = require('react-test-renderer'); act = require('internal-test-utils').act; diff --git a/packages/react/src/__tests__/ReactStrictMode-test.js b/packages/react/src/__tests__/ReactStrictMode-test.js index 28dd94ad06ca2..4ccc9a2687175 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.js @@ -23,7 +23,6 @@ const ReactFeatureFlags = require('shared/ReactFeatureFlags'); describe('ReactStrictMode', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); @@ -569,8 +568,6 @@ describe('ReactStrictMode', () => { describe('Concurrent Mode', () => { beforeEach(() => { - jest.resetModules(); - React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; @@ -833,7 +830,6 @@ Please update the following components: Parent`, describe('symbol checks', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; @@ -961,7 +957,6 @@ describe('symbol checks', () => { describe('string refs', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); @@ -1047,7 +1042,6 @@ describe('string refs', () => { describe('context legacy', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; @@ -1138,7 +1132,6 @@ describe('context legacy', () => { describe('console logs logging', () => { beforeEach(() => { - jest.resetModules(); React = require('react'); ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; diff --git a/packages/react/src/__tests__/createReactClassIntegration-test.js b/packages/react/src/__tests__/createReactClassIntegration-test.js index dfba4146f443a..5c1babb401f7f 100644 --- a/packages/react/src/__tests__/createReactClassIntegration-test.js +++ b/packages/react/src/__tests__/createReactClassIntegration-test.js @@ -18,7 +18,6 @@ let createReactClass; describe('create-react-class-integration', () => { beforeEach(() => { - jest.resetModules(); ({act} = require('internal-test-utils')); PropTypes = require('prop-types'); React = require('react'); diff --git a/packages/react/src/__tests__/forwardRef-test.js b/packages/react/src/__tests__/forwardRef-test.js index 0cfa0031266eb..ed361d9015a1d 100644 --- a/packages/react/src/__tests__/forwardRef-test.js +++ b/packages/react/src/__tests__/forwardRef-test.js @@ -16,7 +16,6 @@ describe('forwardRef', () => { let waitForAll; beforeEach(() => { - jest.resetModules(); PropTypes = require('prop-types'); React = require('react'); ReactNoop = require('react-noop-renderer'); diff --git a/packages/scheduler/src/__tests__/Scheduler-test.js b/packages/scheduler/src/__tests__/Scheduler-test.js index 14ef25f3ad4f5..7972876894623 100644 --- a/packages/scheduler/src/__tests__/Scheduler-test.js +++ b/packages/scheduler/src/__tests__/Scheduler-test.js @@ -33,7 +33,6 @@ let NormalPriority; // assumes as little as possible about the order and timing of events. describe('SchedulerBrowser', () => { beforeEach(() => { - jest.resetModules(); runtime = installMockBrowserRuntime(); jest.unmock('scheduler'); diff --git a/packages/scheduler/src/__tests__/SchedulerMock-test.js b/packages/scheduler/src/__tests__/SchedulerMock-test.js index d71957ef3ebae..e93af4b29ea33 100644 --- a/packages/scheduler/src/__tests__/SchedulerMock-test.js +++ b/packages/scheduler/src/__tests__/SchedulerMock-test.js @@ -28,7 +28,6 @@ let waitForPaint; describe('Scheduler', () => { beforeEach(() => { - jest.resetModules(); jest.mock('scheduler', () => require('scheduler/unstable_mock')); Scheduler = require('scheduler'); diff --git a/packages/scheduler/src/__tests__/SchedulerPostTask-test.js b/packages/scheduler/src/__tests__/SchedulerPostTask-test.js index c572ec595bb10..5b40873406b31 100644 --- a/packages/scheduler/src/__tests__/SchedulerPostTask-test.js +++ b/packages/scheduler/src/__tests__/SchedulerPostTask-test.js @@ -30,7 +30,6 @@ let shouldYield; // and timing of events. describe('SchedulerPostTask', () => { beforeEach(() => { - jest.resetModules(); jest.mock('scheduler', () => jest.requireActual('scheduler/unstable_post_task'), ); diff --git a/packages/scheduler/src/__tests__/SchedulerProfiling-test.js b/packages/scheduler/src/__tests__/SchedulerProfiling-test.js index eef602d90ac3d..cf44e6ae244c9 100644 --- a/packages/scheduler/src/__tests__/SchedulerProfiling-test.js +++ b/packages/scheduler/src/__tests__/SchedulerProfiling-test.js @@ -57,7 +57,6 @@ describe('Scheduler', () => { } beforeEach(() => { - jest.resetModules(); jest.mock('scheduler', () => require('scheduler/unstable_mock')); Scheduler = require('scheduler'); diff --git a/packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js b/packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js index 52b71b569f415..fb41dad71e1f5 100644 --- a/packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js +++ b/packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js @@ -32,7 +32,6 @@ let UserBlockingPriority; // assumes as little as possible about the order and timing of events. describe('SchedulerDOMSetImmediate', () => { beforeEach(() => { - jest.resetModules(); runtime = installMockBrowserRuntime(); jest.unmock('scheduler'); diff --git a/packages/scheduler/src/__tests__/SchedulerSetTimeout-test.js b/packages/scheduler/src/__tests__/SchedulerSetTimeout-test.js index 986d329632c27..6fb55ed19bc3f 100644 --- a/packages/scheduler/src/__tests__/SchedulerSetTimeout-test.js +++ b/packages/scheduler/src/__tests__/SchedulerSetTimeout-test.js @@ -20,7 +20,6 @@ describe('SchedulerNoDOM', () => { // Scheduler falls back to a naive implementation using setTimeout. // This is only meant to be used for testing purposes, like with jest's fake timer API. beforeEach(() => { - jest.resetModules(); jest.useFakeTimers(); delete global.setImmediate; delete global.MessageChannel; @@ -100,7 +99,6 @@ describe('SchedulerNoDOM', () => { // See: https://github.com/facebook/react/pull/13088 describe('does not crash non-node SSR environments', () => { it('if setTimeout is undefined', () => { - jest.resetModules(); const originalSetTimeout = global.setTimeout; try { delete global.setTimeout; @@ -114,7 +112,6 @@ describe('does not crash non-node SSR environments', () => { }); it('if clearTimeout is undefined', () => { - jest.resetModules(); const originalClearTimeout = global.clearTimeout; try { delete global.clearTimeout; diff --git a/packages/shared/__tests__/ReactDOMFrameScheduling-test.js b/packages/shared/__tests__/ReactDOMFrameScheduling-test.js index 9295dc1010864..a06e7189557e3 100644 --- a/packages/shared/__tests__/ReactDOMFrameScheduling-test.js +++ b/packages/shared/__tests__/ReactDOMFrameScheduling-test.js @@ -11,8 +11,6 @@ describe('ReactDOMFrameScheduling', () => { beforeEach(() => { - jest.resetModules(); - jest.unmock('scheduler'); }); diff --git a/packages/use-subscription/src/__tests__/useSubscription-test.js b/packages/use-subscription/src/__tests__/useSubscription-test.js index 9c971bd14bbb3..47f59d1e25c14 100644 --- a/packages/use-subscription/src/__tests__/useSubscription-test.js +++ b/packages/use-subscription/src/__tests__/useSubscription-test.js @@ -22,7 +22,6 @@ let waitFor; describe('useSubscription', () => { beforeEach(() => { - jest.resetModules(); jest.mock('scheduler', () => require('scheduler/unstable_mock')); useSubscription = require('use-subscription').useSubscription; 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 fef2d1e76f581..e3bd6c4ac0ca7 100644 --- a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js +++ b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js @@ -23,8 +23,6 @@ let assertLog; // (Node) environment describe('useSyncExternalStore (userspace shim, server rendering)', () => { beforeEach(() => { - jest.resetModules(); - // Remove useSyncExternalStore from the React imports so that we use the // shim instead. Also removing startTransition, since we use that to detect // outdated 18 alphas that don't yet include useSyncExternalStore. 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 2fe71bf73c528..29559bb5079d4 100644 --- a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js +++ b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js @@ -26,8 +26,6 @@ let assertLog; // of useSyncExternalStore. describe('Shared useSyncExternalStore behavior (shim and built-in)', () => { beforeEach(() => { - jest.resetModules(); - if (gate(flags => flags.enableUseSyncExternalStoreShim)) { // Test the shim against React 17. jest.mock('react', () => { diff --git a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js index 6eacb9a99c606..cf7ed2148fe04 100644 --- a/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js +++ b/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js @@ -22,8 +22,6 @@ let assertLog; // (Node) environment describe('useSyncExternalStore (userspace shim, server rendering)', () => { beforeEach(() => { - jest.resetModules(); - // Remove useSyncExternalStore from the React imports so that we use the // shim instead. Also removing startTransition, since we use that to detect // outdated 18 alphas that don't yet include useSyncExternalStore. diff --git a/scripts/jest/config.base.js b/scripts/jest/config.base.js index 0460888a0e869..911a6b6e3d74a 100644 --- a/scripts/jest/config.base.js +++ b/scripts/jest/config.base.js @@ -6,6 +6,7 @@ module.exports = { '/scripts/rollup/shims/', '/scripts/bench/', ], + resetModules: true, transform: { '.*': require.resolve('./preprocessor.js'), },