Skip to content

Commit

Permalink
Suppress act/renderer warning for DevTools tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 27, 2019
1 parent 8c684bf commit 49b0f87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react-devtools-shared/src/__tests__/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 49b0f87

Please sign in to comment.