From 49b0f87d10a2fab056c29f24228acf3ce2bcc26b Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 27 Aug 2019 10:46:27 -0700 Subject: [PATCH] Suppress act/renderer warning for DevTools tests --- .../react-devtools-shared/src/__tests__/setupTests.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-devtools-shared/src/__tests__/setupTests.js b/packages/react-devtools-shared/src/__tests__/setupTests.js index f228001ce56bb..d845003ebce77 100644 --- a/packages/react-devtools-shared/src/__tests__/setupTests.js +++ b/packages/react-devtools-shared/src/__tests__/setupTests.js @@ -27,9 +27,17 @@ env.beforeEach(() => { const originalConsoleError = console.error; // $FlowFixMe console.error = (...args) => { - if (args[0] === 'Warning: React DevTools encountered an error: %s') { + const firstArg = args[0]; + if (firstArg === 'Warning: React DevTools encountered an error: %s') { // Rethrow errors from React. throw args[1]; + } else if ( + typeof firstArg === 'string' && + firstArg.startsWith("Warning: It looks like you're using the wrong act()") + ) { + // DevTools intentionally wraps updates with acts from both DOM and test-renderer, + // since test updates are expected to impact both renderers. + return; } originalConsoleError.apply(console, args); };