From 9fb5014dec48cca827464e8700010a06142b7e17 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Mon, 30 Nov 2020 22:41:37 -0500 Subject: [PATCH] Use timers instead of act to force fallbacks to show --- .../src/__tests__/ReactLazy-test.internal.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js index 23d333ab8ba24..b7f1570823c14 100644 --- a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js @@ -1344,10 +1344,9 @@ describe('ReactLazy', () => { expect(root).toMatchRenderedOutput('AB'); // Swap the position of A and B - ReactTestRenderer.act(() => { - root.update(); - expect(Scheduler).toFlushAndYield(['Init B2', 'Loading...']); - }); + root.update(); + expect(Scheduler).toFlushAndYield(['Init B2', 'Loading...']); + jest.runAllTimers(); // The suspense boundary should've triggered now. expect(root).toMatchRenderedOutput('Loading...');