Run some tests in Node environment (#11948)
* Run some tests in Node environment * Separate SSR tests that require DOM This allow us to run others with Node environment.
Dan Abramov committed
Jan 2, 2018 at 18:42 UTC
0deea326674077598e351803d7a204a1c744a578
28 files changed
+306
-255
packages/react-cs-renderer/src/__tests__/ReactNativeCS-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-dom/src/__tests__/ReactServerRendering-test.js
+1
-254
@@ -5,15 +5,14 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
12
13
let React;
14
let ReactCallReturn;
14
-let ReactDOM;
15
let ReactDOMServer;
16
-let ReactTestUtils;
16
let PropTypes;
17
18
function normalizeCodeLocInfo(str) {
@@ -25,8 +24,6 @@ describe('ReactDOMServer', () => {
24
jest.resetModules();
25
React = require('react');
26
ReactCallReturn = require('react-call-return');
28
- ReactDOM = require('react-dom');
29
- ReactTestUtils = require('react-dom/test-utils');
27
PropTypes = require('prop-types');
28
ReactDOMServer = require('react-dom/server');
29
});
@@ -157,243 +154,6 @@ describe('ReactDOMServer', () => {
154
runTest();
155
});
156
160
- it('should have the correct mounting behavior (old hydrate API)', () => {
161
- spyOnDev(console, 'warn');
162
- spyOnDev(console, 'error');
163
-
164
- let mountCount = 0;
165
- let numClicks = 0;
166
-
167
- class TestComponent extends React.Component {
168
- componentDidMount() {
169
- mountCount++;
170
- }
171
-
172
- click = () => {
173
- numClicks++;
174
- };
175
-
176
- render() {
177
- return (
178
- <span ref="span" onClick={this.click}>
179
- Name: {this.props.name}
180
- </span>
181
- );
182
- }
183
- }
184
-
185
- const element = document.createElement('div');
186
- ReactDOM.render(<TestComponent />, element);
187
-
188
- let lastMarkup = element.innerHTML;
189
-
190
- // Exercise the update path. Markup should not change,
191
- // but some lifecycle methods should be run again.
192
- ReactDOM.render(<TestComponent name="x" />, element);
193
- expect(mountCount).toEqual(1);
194
-
195
- // Unmount and remount. We should get another mount event and
196
- // we should get different markup, as the IDs are unique each time.
197
- ReactDOM.unmountComponentAtNode(element);
198
- expect(element.innerHTML).toEqual('');
199
- ReactDOM.render(<TestComponent name="x" />, element);
200
- expect(mountCount).toEqual(2);
201
- expect(element.innerHTML).not.toEqual(lastMarkup);
202
-
203
- // Now kill the node and render it on top of server-rendered markup, as if
204
- // we used server rendering. We should mount again, but the markup should
205
- // be unchanged. We will append a sentinel at the end of innerHTML to be
206
- // sure that innerHTML was not changed.
207
- ReactDOM.unmountComponentAtNode(element);
208
- expect(element.innerHTML).toEqual('');
209
-
210
- lastMarkup = ReactDOMServer.renderToString(<TestComponent name="x" />);
211
- element.innerHTML = lastMarkup;
212
-
213
- let instance = ReactDOM.render(<TestComponent name="x" />, element);
214
- expect(mountCount).toEqual(3);
215
- if (__DEV__) {
216
- expect(console.warn.calls.count()).toBe(1);
217
- expect(console.warn.calls.argsFor(0)[0]).toContain(
218
- 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
219
- 'will stop working in React v17. Replace the ReactDOM.render() call ' +
220
- 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
221
- );
222
- console.warn.calls.reset();
223
- }
224
- expect(element.innerHTML).toBe(lastMarkup);
225
-
226
- // Ensure the events system works after mount into server markup
227
- expect(numClicks).toEqual(0);
228
- ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
229
- expect(numClicks).toEqual(1);
230
-
231
- ReactDOM.unmountComponentAtNode(element);
232
- expect(element.innerHTML).toEqual('');
233
-
234
- // Now simulate a situation where the app is not idempotent. React should
235
- // warn but do the right thing.
236
- element.innerHTML = lastMarkup;
237
- instance = ReactDOM.render(<TestComponent name="y" />, element);
238
- expect(mountCount).toEqual(4);
239
- if (__DEV__) {
240
- expect(console.error.calls.count()).toBe(1);
241
- expect(console.error.calls.argsFor(0)[0]).toContain(
242
- 'Text content did not match. Server: "x" Client: "y"',
243
- );
244
- console.error.calls.reset();
245
- }
246
- expect(element.innerHTML.length > 0).toBe(true);
247
- expect(element.innerHTML).not.toEqual(lastMarkup);
248
-
249
- // Ensure the events system works after markup mismatch.
250
- expect(numClicks).toEqual(1);
251
- ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
252
- expect(numClicks).toEqual(2);
253
- if (__DEV__) {
254
- expect(console.warn.calls.count()).toBe(0);
255
- expect(console.error.calls.count()).toBe(0);
256
- }
257
- });
258
-
259
- it('should have the correct mounting behavior (new hydrate API)', () => {
260
- spyOnDev(console, 'error');
261
-
262
- let mountCount = 0;
263
- let numClicks = 0;
264
-
265
- class TestComponent extends React.Component {
266
- componentDidMount() {
267
- mountCount++;
268
- }
269
-
270
- click = () => {
271
- numClicks++;
272
- };
273
-
274
- render() {
275
- return (
276
- <span ref="span" onClick={this.click}>
277
- Name: {this.props.name}
278
- </span>
279
- );
280
- }
281
- }
282
-
283
- const element = document.createElement('div');
284
- ReactDOM.render(<TestComponent />, element);
285
-
286
- let lastMarkup = element.innerHTML;
287
-
288
- // Exercise the update path. Markup should not change,
289
- // but some lifecycle methods should be run again.
290
- ReactDOM.render(<TestComponent name="x" />, element);
291
- expect(mountCount).toEqual(1);
292
-
293
- // Unmount and remount. We should get another mount event and
294
- // we should get different markup, as the IDs are unique each time.
295
- ReactDOM.unmountComponentAtNode(element);
296
- expect(element.innerHTML).toEqual('');
297
- ReactDOM.render(<TestComponent name="x" />, element);
298
- expect(mountCount).toEqual(2);
299
- expect(element.innerHTML).not.toEqual(lastMarkup);
300
-
301
- // Now kill the node and render it on top of server-rendered markup, as if
302
- // we used server rendering. We should mount again, but the markup should
303
- // be unchanged. We will append a sentinel at the end of innerHTML to be
304
- // sure that innerHTML was not changed.
305
- ReactDOM.unmountComponentAtNode(element);
306
- expect(element.innerHTML).toEqual('');
307
-
308
- lastMarkup = ReactDOMServer.renderToString(<TestComponent name="x" />);
309
- element.innerHTML = lastMarkup;
310
-
311
- let instance = ReactDOM.hydrate(<TestComponent name="x" />, element);
312
- expect(mountCount).toEqual(3);
313
- expect(element.innerHTML).toBe(lastMarkup);
314
-
315
- // Ensure the events system works after mount into server markup
316
- expect(numClicks).toEqual(0);
317
- ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
318
- expect(numClicks).toEqual(1);
319
-
320
- ReactDOM.unmountComponentAtNode(element);
321
- expect(element.innerHTML).toEqual('');
322
-
323
- // Now simulate a situation where the app is not idempotent. React should
324
- // warn but do the right thing.
325
- element.innerHTML = lastMarkup;
326
- instance = ReactDOM.hydrate(<TestComponent name="y" />, element);
327
- expect(mountCount).toEqual(4);
328
- if (__DEV__) {
329
- expect(console.error.calls.count()).toBe(1);
330
- }
331
- expect(element.innerHTML.length > 0).toBe(true);
332
- expect(element.innerHTML).not.toEqual(lastMarkup);
333
-
334
- // Ensure the events system works after markup mismatch.
335
- expect(numClicks).toEqual(1);
336
- ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
337
- expect(numClicks).toEqual(2);
338
- });
339
-
340
- // We have a polyfill for autoFocus on the client, but we intentionally don't
341
- // want it to call focus() when hydrating because this can mess up existing
342
- // focus before the JS has loaded.
343
- it('should emit autofocus on the server but not focus() when hydrating', () => {
344
- const element = document.createElement('div');
345
- element.innerHTML = ReactDOMServer.renderToString(
346
- <input autoFocus={true} />,
347
- );
348
- expect(element.firstChild.autofocus).toBe(true);
349
-
350
- // It should not be called on mount.
351
- element.firstChild.focus = jest.fn();
352
- ReactDOM.hydrate(<input autoFocus={true} />, element);
353
- expect(element.firstChild.focus).not.toHaveBeenCalled();
354
-
355
- // Or during an update.
356
- ReactDOM.render(<input autoFocus={true} />, element);
357
- expect(element.firstChild.focus).not.toHaveBeenCalled();
358
- });
359
-
360
- it('should not focus on either server or client with autofocus={false}', () => {
361
- const element = document.createElement('div');
362
- element.innerHTML = ReactDOMServer.renderToString(
363
- <input autoFocus={false} />,
364
- );
365
- expect(element.firstChild.autofocus).toBe(false);
366
-
367
- element.firstChild.focus = jest.fn();
368
- ReactDOM.hydrate(<input autoFocus={false} />, element);
369
- expect(element.firstChild.focus).not.toHaveBeenCalled();
370
-
371
- ReactDOM.render(<input autoFocus={false} />, element);
372
- expect(element.firstChild.focus).not.toHaveBeenCalled();
373
- });
374
-
375
- // Regression test for https://github.com/facebook/react/issues/11726
376
- it('should not focus on either server or client with autofocus={false} even if there is a markup mismatch', () => {
377
- spyOnDev(console, 'error');
378
-
379
- const element = document.createElement('div');
380
- element.innerHTML = ReactDOMServer.renderToString(
381
- <button autoFocus={false}>server</button>,
382
- );
383
- expect(element.firstChild.autofocus).toBe(false);
384
-
385
- element.firstChild.focus = jest.fn();
386
- ReactDOM.hydrate(<button autoFocus={false}>client</button>, element);
387
-
388
- expect(element.firstChild.focus).not.toHaveBeenCalled();
389
- if (__DEV__) {
390
- expect(console.error.calls.count()).toBe(1);
391
- expect(console.error.calls.argsFor(0)[0]).toBe(
392
- 'Warning: Text content did not match. Server: "server" Client: "client"',
393
- );
394
- }
395
- });
396
-
157
it('should throw with silly args', () => {
158
expect(
159
ReactDOMServer.renderToString.bind(ReactDOMServer, {x: 123}),
@@ -797,20 +557,7 @@ describe('ReactDOMServer', () => {
557
}
558
});
559
800
- it('should throw rendering portals on the server', () => {
801
- const div = document.createElement('div');
802
- expect(() => {
803
- ReactDOMServer.renderToString(
804
- <div>{ReactDOM.createPortal(<div />, div)}</div>,
805
- );
806
- }).toThrow(
807
- 'Portals are not currently supported by the server renderer. ' +
808
- 'Render them conditionally so that they only appear on the client render.',
809
- );
810
- });
811
-
560
it('should throw rendering call/return on the server', () => {
813
- const div = document.createElement('div');
561
expect(() => {
562
ReactDOMServer.renderToString(
563
<div>{ReactCallReturn.unstable_createReturn(42)}</div>,
packages/react-dom/src/__tests__/ReactServerRenderingBrowser-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-dom/src/__tests__/ReactServerRenderingHydration.js
new
+276
@@ -0,0 +1,276 @@
1
+/**
2
+ * Copyright (c) 2013-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @emails react-core
8
+ */
9
+
10
+'use strict';
11
+
12
+let React;
13
+let ReactDOM;
14
+let ReactDOMServer;
15
+let ReactTestUtils;
16
+
17
+// These tests rely both on ReactDOMServer and ReactDOM.
18
+// If a test only needs ReactDOMServer, put it in ReactServerRendering-test instead.
19
+describe('ReactDOMServerHydration', () => {
20
+ beforeEach(() => {
21
+ jest.resetModules();
22
+ React = require('react');
23
+ ReactDOM = require('react-dom');
24
+ ReactTestUtils = require('react-dom/test-utils');
25
+ ReactDOMServer = require('react-dom/server');
26
+ });
27
+
28
+ it('should have the correct mounting behavior (old hydrate API)', () => {
29
+ spyOnDev(console, 'warn');
30
+ spyOnDev(console, 'error');
31
+
32
+ let mountCount = 0;
33
+ let numClicks = 0;
34
+
35
+ class TestComponent extends React.Component {
36
+ componentDidMount() {
37
+ mountCount++;
38
+ }
39
+
40
+ click = () => {
41
+ numClicks++;
42
+ };
43
+
44
+ render() {
45
+ return (
46
+ <span ref="span" onClick={this.click}>
47
+ Name: {this.props.name}
48
+ </span>
49
+ );
50
+ }
51
+ }
52
+
53
+ const element = document.createElement('div');
54
+ ReactDOM.render(<TestComponent />, element);
55
+
56
+ let lastMarkup = element.innerHTML;
57
+
58
+ // Exercise the update path. Markup should not change,
59
+ // but some lifecycle methods should be run again.
60
+ ReactDOM.render(<TestComponent name="x" />, element);
61
+ expect(mountCount).toEqual(1);
62
+
63
+ // Unmount and remount. We should get another mount event and
64
+ // we should get different markup, as the IDs are unique each time.
65
+ ReactDOM.unmountComponentAtNode(element);
66
+ expect(element.innerHTML).toEqual('');
67
+ ReactDOM.render(<TestComponent name="x" />, element);
68
+ expect(mountCount).toEqual(2);
69
+ expect(element.innerHTML).not.toEqual(lastMarkup);
70
+
71
+ // Now kill the node and render it on top of server-rendered markup, as if
72
+ // we used server rendering. We should mount again, but the markup should
73
+ // be unchanged. We will append a sentinel at the end of innerHTML to be
74
+ // sure that innerHTML was not changed.
75
+ ReactDOM.unmountComponentAtNode(element);
76
+ expect(element.innerHTML).toEqual('');
77
+
78
+ lastMarkup = ReactDOMServer.renderToString(<TestComponent name="x" />);
79
+ element.innerHTML = lastMarkup;
80
+
81
+ let instance = ReactDOM.render(<TestComponent name="x" />, element);
82
+ expect(mountCount).toEqual(3);
83
+ if (__DEV__) {
84
+ expect(console.warn.calls.count()).toBe(1);
85
+ expect(console.warn.calls.argsFor(0)[0]).toContain(
86
+ 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
87
+ 'will stop working in React v17. Replace the ReactDOM.render() call ' +
88
+ 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
89
+ );
90
+ console.warn.calls.reset();
91
+ }
92
+ expect(element.innerHTML).toBe(lastMarkup);
93
+
94
+ // Ensure the events system works after mount into server markup
95
+ expect(numClicks).toEqual(0);
96
+ ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
97
+ expect(numClicks).toEqual(1);
98
+
99
+ ReactDOM.unmountComponentAtNode(element);
100
+ expect(element.innerHTML).toEqual('');
101
+
102
+ // Now simulate a situation where the app is not idempotent. React should
103
+ // warn but do the right thing.
104
+ element.innerHTML = lastMarkup;
105
+ instance = ReactDOM.render(<TestComponent name="y" />, element);
106
+ expect(mountCount).toEqual(4);
107
+ if (__DEV__) {
108
+ expect(console.error.calls.count()).toBe(1);
109
+ expect(console.error.calls.argsFor(0)[0]).toContain(
110
+ 'Text content did not match. Server: "x" Client: "y"',
111
+ );
112
+ console.error.calls.reset();
113
+ }
114
+ expect(element.innerHTML.length > 0).toBe(true);
115
+ expect(element.innerHTML).not.toEqual(lastMarkup);
116
+
117
+ // Ensure the events system works after markup mismatch.
118
+ expect(numClicks).toEqual(1);
119
+ ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
120
+ expect(numClicks).toEqual(2);
121
+ if (__DEV__) {
122
+ expect(console.warn.calls.count()).toBe(0);
123
+ expect(console.error.calls.count()).toBe(0);
124
+ }
125
+ });
126
+
127
+ it('should have the correct mounting behavior (new hydrate API)', () => {
128
+ spyOnDev(console, 'error');
129
+
130
+ let mountCount = 0;
131
+ let numClicks = 0;
132
+
133
+ class TestComponent extends React.Component {
134
+ componentDidMount() {
135
+ mountCount++;
136
+ }
137
+
138
+ click = () => {
139
+ numClicks++;
140
+ };
141
+
142
+ render() {
143
+ return (
144
+ <span ref="span" onClick={this.click}>
145
+ Name: {this.props.name}
146
+ </span>
147
+ );
148
+ }
149
+ }
150
+
151
+ const element = document.createElement('div');
152
+ ReactDOM.render(<TestComponent />, element);
153
+
154
+ let lastMarkup = element.innerHTML;
155
+
156
+ // Exercise the update path. Markup should not change,
157
+ // but some lifecycle methods should be run again.
158
+ ReactDOM.render(<TestComponent name="x" />, element);
159
+ expect(mountCount).toEqual(1);
160
+
161
+ // Unmount and remount. We should get another mount event and
162
+ // we should get different markup, as the IDs are unique each time.
163
+ ReactDOM.unmountComponentAtNode(element);
164
+ expect(element.innerHTML).toEqual('');
165
+ ReactDOM.render(<TestComponent name="x" />, element);
166
+ expect(mountCount).toEqual(2);
167
+ expect(element.innerHTML).not.toEqual(lastMarkup);
168
+
169
+ // Now kill the node and render it on top of server-rendered markup, as if
170
+ // we used server rendering. We should mount again, but the markup should
171
+ // be unchanged. We will append a sentinel at the end of innerHTML to be
172
+ // sure that innerHTML was not changed.
173
+ ReactDOM.unmountComponentAtNode(element);
174
+ expect(element.innerHTML).toEqual('');
175
+
176
+ lastMarkup = ReactDOMServer.renderToString(<TestComponent name="x" />);
177
+ element.innerHTML = lastMarkup;
178
+
179
+ let instance = ReactDOM.hydrate(<TestComponent name="x" />, element);
180
+ expect(mountCount).toEqual(3);
181
+ expect(element.innerHTML).toBe(lastMarkup);
182
+
183
+ // Ensure the events system works after mount into server markup
184
+ expect(numClicks).toEqual(0);
185
+ ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
186
+ expect(numClicks).toEqual(1);
187
+
188
+ ReactDOM.unmountComponentAtNode(element);
189
+ expect(element.innerHTML).toEqual('');
190
+
191
+ // Now simulate a situation where the app is not idempotent. React should
192
+ // warn but do the right thing.
193
+ element.innerHTML = lastMarkup;
194
+ instance = ReactDOM.hydrate(<TestComponent name="y" />, element);
195
+ expect(mountCount).toEqual(4);
196
+ if (__DEV__) {
197
+ expect(console.error.calls.count()).toBe(1);
198
+ }
199
+ expect(element.innerHTML.length > 0).toBe(true);
200
+ expect(element.innerHTML).not.toEqual(lastMarkup);
201
+
202
+ // Ensure the events system works after markup mismatch.
203
+ expect(numClicks).toEqual(1);
204
+ ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
205
+ expect(numClicks).toEqual(2);
206
+ });
207
+
208
+ // We have a polyfill for autoFocus on the client, but we intentionally don't
209
+ // want it to call focus() when hydrating because this can mess up existing
210
+ // focus before the JS has loaded.
211
+ it('should emit autofocus on the server but not focus() when hydrating', () => {
212
+ const element = document.createElement('div');
213
+ element.innerHTML = ReactDOMServer.renderToString(
214
+ <input autoFocus={true} />,
215
+ );
216
+ expect(element.firstChild.autofocus).toBe(true);
217
+
218
+ // It should not be called on mount.
219
+ element.firstChild.focus = jest.fn();
220
+ ReactDOM.hydrate(<input autoFocus={true} />, element);
221
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
222
+
223
+ // Or during an update.
224
+ ReactDOM.render(<input autoFocus={true} />, element);
225
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
226
+ });
227
+
228
+ it('should not focus on either server or client with autofocus={false}', () => {
229
+ const element = document.createElement('div');
230
+ element.innerHTML = ReactDOMServer.renderToString(
231
+ <input autoFocus={false} />,
232
+ );
233
+ expect(element.firstChild.autofocus).toBe(false);
234
+
235
+ element.firstChild.focus = jest.fn();
236
+ ReactDOM.hydrate(<input autoFocus={false} />, element);
237
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
238
+
239
+ ReactDOM.render(<input autoFocus={false} />, element);
240
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
241
+ });
242
+
243
+ // Regression test for https://github.com/facebook/react/issues/11726
244
+ it('should not focus on either server or client with autofocus={false} even if there is a markup mismatch', () => {
245
+ spyOnDev(console, 'error');
246
+
247
+ const element = document.createElement('div');
248
+ element.innerHTML = ReactDOMServer.renderToString(
249
+ <button autoFocus={false}>server</button>,
250
+ );
251
+ expect(element.firstChild.autofocus).toBe(false);
252
+
253
+ element.firstChild.focus = jest.fn();
254
+ ReactDOM.hydrate(<button autoFocus={false}>client</button>, element);
255
+
256
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
257
+ if (__DEV__) {
258
+ expect(console.error.calls.count()).toBe(1);
259
+ expect(console.error.calls.argsFor(0)[0]).toBe(
260
+ 'Warning: Text content did not match. Server: "server" Client: "client"',
261
+ );
262
+ }
263
+ });
264
+
265
+ it('should throw rendering portals on the server', () => {
266
+ const div = document.createElement('div');
267
+ expect(() => {
268
+ ReactDOMServer.renderToString(
269
+ <div>{ReactDOM.createPortal(<div />, div)}</div>,
270
+ );
271
+ }).toThrow(
272
+ 'Portals are not currently supported by the server renderer. ' +
273
+ 'Render them conditionally so that they only appear on the client render.',
274
+ );
275
+ });
276
+});
packages/react-native-renderer/src/__tests__/ReactNativeAttributePayload-test.js
+1
@@ -4,6 +4,7 @@
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
*
7
+ * @jest-environment node
8
*/
9
'use strict';
10
packages/react-native-renderer/src/__tests__/ReactNativeEvents-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-native-renderer/src/__tests__/createReactNativeComponentClass-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactExpiration-test.js
+2
@@ -3,6 +3,8 @@
3
*
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
*/
9
10
'use strict';
packages/react-reconciler/src/__tests__/ReactFiberHostContext-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactFragment-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
'use strict';
11
packages/react-reconciler/src/__tests__/ReactIncremental-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalTriangle-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactPersistent-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactTopLevelFragment-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-rt-renderer/src/__tests__/ReactNativeRT-test.internal.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js
+1
@@ -5,6 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @emails react-core
8
+ * @jest-environment node
9
*/
10
11
'use strict';
scripts/jest/setupEnvironment.js
+3
-1
@@ -31,4 +31,6 @@ global.cancelIdleCallback = function(callbackID) {
31
// for the few that specifically test the logging by shadowing this
32
// property. In real apps, it would usually not be defined at all.
33
Error.prototype.suppressReactErrorLogging = true;
34
-DOMException.prototype.suppressReactErrorLogging = true;
34
+if (typeof DOMException === 'function') {
35
+ DOMException.prototype.suppressReactErrorLogging = true;
36
+}