From d3668f47cb21e1c7d90fd4b2e067e76f53025085 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Tue, 7 Feb 2023 16:58:39 +0100 Subject: [PATCH] test: Don't retry flushActWork if flushUntilNextPaint threw Fixes "ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down." in `ReactIncrementalErrorHandling-test.internal.js` --- packages/jest-react/src/internalAct.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/jest-react/src/internalAct.js b/packages/jest-react/src/internalAct.js index 1b5349554c4..414750c2717 100644 --- a/packages/jest-react/src/internalAct.js +++ b/packages/jest-react/src/internalAct.js @@ -128,6 +128,7 @@ function flushActWork(resolve: () => void, reject: (error: any) => void) { Scheduler.unstable_flushUntilNextPaint(); } catch (error) { reject(error); + return; } // If Scheduler yields while there's still work, it's so that we can