Fail tests on errors in renderer
Dan Abramov committed
Apr 18, 2019 at 17:03 UTC
8c5794eab3cfb8a027bd6eb338a3ba16f03d3564
1 file changed
+9
src/__tests__/setupTests.js
+9
@@ -15,6 +15,15 @@ env.beforeEach(() => {
15
// Fake timers let us flush Bridge operations between setup and assertions.
16
jest.useFakeTimers();
17
18
+ const originalConsoleError = console.error;
19
+ console.error = (...args) => {
20
+ if (args[0] === 'Warning: React DevTools encountered an error: %s') {
21
+ // Rethrow errors from React.
22
+ throw args[1];
23
+ }
24
+ originalConsoleError.apply(console, args);
25
+ };
26
+
27
installHook(global);
28
29
const bridgeListeners = [];