Merge pull request #181 from gaearon/consoleerror

Fail tests on errors in renderer
This commit is contained in:
Brian Vaughn
2019-04-18 10:08:44 -07:00
committed by GitHub
+10
View File
@@ -15,6 +15,16 @@ env.beforeEach(() => {
// Fake timers let us flush Bridge operations between setup and assertions.
jest.useFakeTimers();
const originalConsoleError = console.error;
// $FlowFixMe
console.error = (...args) => {
if (args[0] === 'Warning: React DevTools encountered an error: %s') {
// Rethrow errors from React.
throw args[1];
}
originalConsoleError.apply(console, args);
};
installHook(global);
const bridgeListeners = [];