Skip to content

Commit 49b0f87

Browse files
author
Brian Vaughn
committed
Suppress act/renderer warning for DevTools tests
1 parent 8c684bf commit 49b0f87

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react-devtools-shared/src/__tests__/setupTests.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@ env.beforeEach(() => {
2727
const originalConsoleError = console.error;
2828
// $FlowFixMe
2929
console.error = (...args) => {
30-
if (args[0] === 'Warning: React DevTools encountered an error: %s') {
30+
const firstArg = args[0];
31+
if (firstArg === 'Warning: React DevTools encountered an error: %s') {
3132
// Rethrow errors from React.
3233
throw args[1];
34+
} else if (
35+
typeof firstArg === 'string' &&
36+
firstArg.startsWith("Warning: It looks like you're using the wrong act()")
37+
) {
38+
// DevTools intentionally wraps updates with acts from both DOM and test-renderer,
39+
// since test updates are expected to impact both renderers.
40+
return;
3341
}
3442
originalConsoleError.apply(console, args);
3543
};

0 commit comments

Comments
 (0)