1313let React ;
1414let ReactNoop ;
1515
16+ // NOTE: This test requires traditional spies for console.error verification.
17+ // The .toWarnDev() matcher treates unexpected warnings as errors.
18+ // Unfortunately, if an error boundary is active, ReactFiberScheduler swallows
19+ // any Errors that are thrown synchronously by .toWarnDev().
20+ // And Errors that are queued to be returned later by the matcher are preempted
21+ // by the errors intentionally thrown by the Components in this test.
22+ // This means the matcher could only produce false positives.
1623describe ( 'ReactIncrementalErrorLogging' , ( ) => {
1724 beforeEach ( ( ) => {
1825 jest . resetModules ( ) ;
@@ -25,7 +32,7 @@ describe('ReactIncrementalErrorLogging', () => {
2532 }
2633
2734 it ( 'should log errors that occur during the begin phase' , ( ) => {
28- spyOnDevAndProd ( console , 'error' ) ;
35+ spyOnDevAndProd ( console , 'error' , true ) ;
2936
3037 class ErrorThrowingComponent extends React . Component {
3138 componentWillMount ( ) {
@@ -70,7 +77,7 @@ describe('ReactIncrementalErrorLogging', () => {
7077 } ) ;
7178
7279 it ( 'should log errors that occur during the commit phase' , ( ) => {
73- spyOnDevAndProd ( console , 'error' ) ;
80+ spyOnDevAndProd ( console , 'error' , true ) ;
7481
7582 class ErrorThrowingComponent extends React . Component {
7683 componentDidMount ( ) {
@@ -120,7 +127,7 @@ describe('ReactIncrementalErrorLogging', () => {
120127 try {
121128 React = require ( 'react' ) ;
122129 ReactNoop = require ( 'react-noop-renderer' ) ;
123- spyOnDevAndProd ( console , 'error' ) ;
130+ spyOnDevAndProd ( console , 'error' , true ) ;
124131
125132 class ErrorThrowingComponent extends React . Component {
126133 render ( ) {
@@ -167,7 +174,7 @@ describe('ReactIncrementalErrorLogging', () => {
167174 } ) ;
168175
169176 it ( 'should relay info about error boundary and retry attempts if applicable' , ( ) => {
170- spyOnDevAndProd ( console , 'error' ) ;
177+ spyOnDevAndProd ( console , 'error' , true ) ;
171178
172179 class ParentComponent extends React . Component {
173180 render ( ) {
0 commit comments