From ee4806f47ae594ea20b5296dd913ed67d7809b86 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 26 Aug 2019 13:08:35 -0700 Subject: [PATCH] Fixed flushing problem with tests --- packages/react-devtools-shared/src/__tests__/utils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/utils.js b/packages/react-devtools-shared/src/__tests__/utils.js index 4c28732e65df2..bd652d7381c65 100644 --- a/packages/react-devtools-shared/src/__tests__/utils.js +++ b/packages/react-devtools-shared/src/__tests__/utils.js @@ -18,11 +18,13 @@ export function act(callback: Function): void { }); // Flush Bridge operations - actDOM(() => { - actTestRenderer(() => { - jest.runAllTimers(); + while (global.mockGetTimersCount() > 0) { + actDOM(() => { + actTestRenderer(() => { + jest.runAllTimers(); + }); }); - }); + } } export async function actAsync(