From f04d17950b83fa45d2ade839d5773cbddc70aee1 Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Thu, 7 Dec 2023 16:51:15 -0800 Subject: [PATCH] Make regression test fail on base --- .../ReactSuspenseWithNoopRenderer-test.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js index 3c4167a099ee0..77aae6ee53d9b 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js @@ -5,7 +5,7 @@ let Scheduler; let act; let waitFor; let waitForAll; -let unstable_waitForExpired; +let waitForMicrotasks; let assertLog; let waitForPaint; let Suspense; @@ -30,7 +30,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { waitFor = InternalTestUtils.waitFor; waitForAll = InternalTestUtils.waitForAll; waitForPaint = InternalTestUtils.waitForPaint; - unstable_waitForExpired = InternalTestUtils.unstable_waitForExpired; + waitForMicrotasks = InternalTestUtils.waitForMicrotasks; assertLog = InternalTestUtils.assertLog; getCacheForType = React.unstable_getCacheForType; @@ -4011,8 +4011,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { }, ); - // @gate enableLegacyCache - // @gate enableRetryLaneExpiration + // @gate enableLegacyCache && enableRetryLaneExpiration it('recurring updates in siblings should not block expensive content in suspense boundary from committing', async () => { const {useState} = React; @@ -4062,14 +4061,14 @@ describe('ReactSuspenseWithNoopRenderer', () => { ); await waitFor(['Async', 'A', 'B']); - ReactNoop.expire(10000000); - await advanceTimers(10000000); + ReactNoop.expire(100000); + await advanceTimers(100000); setText('2'); await waitForPaint(['2']); - ReactNoop.expire(10000000); - await advanceTimers(10000000); - await unstable_waitForExpired(['Async', 'A', 'B', 'C']); + await waitForMicrotasks(); + Scheduler.unstable_flushNumberOfYields(1); + assertLog(['Async', 'A', 'B', 'C']); expect(root).toMatchRenderedOutput( <>