Fail tests on errors in renderer

This commit is contained in:
Dan Abramov
2019-04-18 17:03:04 +01:00
parent b45e743f52
commit 8c5794eab3
+9
View File
@@ -15,6 +15,15 @@ env.beforeEach(() => {
// Fake timers let us flush Bridge operations between setup and assertions.
jest.useFakeTimers();
const originalConsoleError = console.error;
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 = [];