File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed
src/renderers/shared/fiber/__tests__ Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,7 @@ src/renderers/dom/__tests__/ReactDOMProduction-test.js
453
453
* should use prod React
454
454
* should handle a simple flow
455
455
* should call lifecycle methods
456
+ * should throw with an error code in production
456
457
457
458
src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
458
459
* should render strings as children
@@ -816,6 +817,7 @@ src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js
816
817
* continues work on other roots despite caught errors
817
818
* continues work on other roots despite uncaught errors
818
819
* force unmounts failed subtree before rerendering
820
+ * force unmounts failed subtree before rerendering (fragment)
819
821
* force unmounts failed root
820
822
821
823
src/renderers/shared/fiber/__tests__/ReactIncrementalReflection-test.js
Original file line number Diff line number Diff line change @@ -1482,30 +1482,26 @@ describe('ReactIncremental', () => {
1482
1482
ReactNoop . flush ( ) ;
1483
1483
ops = [ ] ;
1484
1484
1485
- expect ( instance . state . n ) . toEqual ( 0 ) ;
1486
-
1487
- // first good callback
1488
- instance . setState ( { n : 1 } , ( ) => ops . push ( 'first good callback' ) ) ;
1489
- ReactNoop . flush ( ) ;
1485
+ function updater ( { n } ) {
1486
+ return { n : n + 1 } ;
1487
+ }
1490
1488
1491
- // callback throws
1492
- instance . setState ( { n : 2 } , ( ) => {
1493
- throw new Error ( 'Bail' ) ;
1489
+ instance . setState ( updater , ( ) => ops . push ( 'first callback' ) ) ;
1490
+ instance . setState ( updater , ( ) => {
1491
+ ops . push ( 'second callback' ) ;
1492
+ throw new Error ( 'callback error' ) ;
1494
1493
} ) ;
1494
+ instance . setState ( updater , ( ) => ops . push ( 'third callback' ) ) ;
1495
+
1495
1496
expect ( ( ) => {
1496
1497
ReactNoop . flush ( ) ;
1497
- } ) . toThrow ( 'Bail' ) ;
1498
-
1499
- // should set state to 2 even if callback throws up
1500
- expect ( instance . state . n ) . toEqual ( 2 ) ;
1501
-
1502
- // another good callback
1503
- instance . setState ( { n : 3 } , ( ) => ops . push ( 'second good callback' ) ) ;
1504
- ReactNoop . flush ( ) ;
1498
+ } ) . toThrow ( 'callback error' ) ;
1505
1499
1500
+ // Should call all callbacks, even though the second one throws
1506
1501
expect ( ops ) . toEqual ( [
1507
- 'first good callback' ,
1508
- 'second good callback' ,
1502
+ 'first callback' ,
1503
+ 'second callback' ,
1504
+ 'third callback' ,
1509
1505
] ) ;
1510
1506
expect ( instance . state . n ) . toEqual ( 3 ) ;
1511
1507
} ) ;
You can’t perform that action at this time.
0 commit comments