diff --git a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js index 3bd57a8e7eec1..5d249674bcf4a 100644 --- a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js @@ -444,20 +444,16 @@ describe('ReactDOMServerHydration', () => { }); it('should be able to use lazy components after hydrating', async () => { - async function fakeImport(result) { - return {default: result}; - } - const Lazy = React.lazy( () => new Promise(resolve => { setTimeout( () => - resolve( - fakeImport(function World() { + resolve({ + default: function World() { return 'world'; - }), - ), + }, + }), 1000, ); }), @@ -491,7 +487,7 @@ describe('ReactDOMServerHydration', () => { expect(element.textContent).toBe('Hello loading'); jest.runAllTimers(); - await Lazy; + await Promise.resolve(); expect(element.textContent).toBe('Hello world'); }); }); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js index c8f4c2452300a..a7df3fd83b274 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js @@ -573,7 +573,7 @@ describe('ReactDebugFiberPerf', () => { return ; } - async function fakeImport(result) { + function fakeImport(result) { return {default: result}; } @@ -600,7 +600,8 @@ describe('ReactDebugFiberPerf', () => { return
; }), ); - await LazyFoo; + + await Promise.resolve(); ReactNoop.render(