Create a separate test file for incremental error handling
Dan Abramov committed
Nov 4, 2016 at 19:09 UTC
e2be9830b88957c6865ce588bdd430d5794b0eb3
2 files changed
+46
-23
src/renderers/shared/fiber/__tests__/ReactIncremental-test.js
-23
@@ -1465,27 +1465,4 @@ describe('ReactIncremental', () => {
1465
]);
1466
expect(instance.state.n).toEqual(4);
1467
});
1468
-
1469
- it('propagates an error from a noop error boundary', () => {
1470
- class NoopBoundary extends React.Component {
1471
- unstable_handleError() {
1472
- // Noop
1473
- }
1474
- render() {
1475
- return this.props.children;
1476
- }
1477
- }
1478
-
1479
- function RenderError() {
1480
- throw new Error('render error');
1481
- }
1482
-
1483
- ReactNoop.render(
1484
- <NoopBoundary>
1485
- <RenderError />
1486
- </NoopBoundary>
1487
- );
1488
-
1489
- expect(ReactNoop.flush).toThrow('render error');
1490
- });
1468
});
src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js
new
+46
@@ -0,0 +1,46 @@
1
+/**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @emails react-core
10
+ */
11
+
12
+'use strict';
13
+
14
+var React;
15
+var ReactNoop;
16
+
17
+describe('ReactIncrementalErrorHandling', () => {
18
+ beforeEach(() => {
19
+ jest.resetModuleRegistry();
20
+ React = require('React');
21
+ ReactNoop = require('ReactNoop');
22
+ });
23
+
24
+ it('propagates an error from a noop error boundary', () => {
25
+ class NoopBoundary extends React.Component {
26
+ unstable_handleError() {
27
+ // Noop
28
+ }
29
+ render() {
30
+ return this.props.children;
31
+ }
32
+ }
33
+
34
+ function RenderError() {
35
+ throw new Error('render error');
36
+ }
37
+
38
+ ReactNoop.render(
39
+ <NoopBoundary>
40
+ <RenderError />
41
+ </NoopBoundary>
42
+ );
43
+
44
+ expect(ReactNoop.flush).toThrow('render error');
45
+ });
46
+});