Add jest lint rules (#29760)
## Overview Updates `eslint-plugin-jest` and enables the recommended rules with some turned off that are unhelpful. The main motivations is: a) we have a few duplicated tests, which this found an I deleted b) making sure we don't accidentally commit skipped tests
Ricky committed
Jun 10, 2024 at 14:31 UTC
d172bdaf95b0be869f7d36b87c95a5f12b229195
91 files changed
+790
-812
.eslintrc.js
+39
-6
@@ -12,7 +12,7 @@ const WARNING = 1;
12
const ERROR = 2;
13
14
module.exports = {
15
- extends: ['prettier'],
15
+ extends: ['prettier', 'plugin:jest/recommended'],
16
17
// Stop ESLint from looking for a configuration file in parent folders
18
root: true,
@@ -376,16 +376,49 @@ module.exports = {
376
files: ['**/__tests__/*.js'],
377
rules: {
378
// https://github.com/jest-community/eslint-plugin-jest
379
- 'jest/no-focused-tests': ERROR,
380
- 'jest/valid-expect': ERROR,
381
- 'jest/valid-expect-in-promise': ERROR,
379
+ // Meh, who cares.
380
+ 'jest/consistent-test-it': OFF,
381
+ // Meh, we have a lot of these, who cares.
382
+ 'jest/no-alias-methods': OFF,
383
+ // We do conditions based on feature flags.
384
+ 'jest/no-conditional-expect': OFF,
385
+ // We have our own assertion helpers.
386
+ 'jest/expect-expect': OFF,
387
+ // Lame rule that fires in itRender helpers or in render methods.
388
+ 'jest/no-standalone-expect': OFF,
389
},
390
},
391
{
385
- // disable no focused tests for test setup helper files even if they are inside __tests__ directory
386
- files: ['**/setupTests.js'],
392
+ // Rules specific to test setup helper files.
393
+ files: [
394
+ '**/setupTests.js',
395
+ '**/setupEnv.js',
396
+ '**/jest/TestFlags.js',
397
+ '**/dom-event-testing-library/testHelpers.js',
398
+ '**/utils/ReactDOMServerIntegrationTestUtils.js',
399
+ '**/babel/transform-react-version-pragma.js',
400
+ '**/babel/transform-test-gate-pragma.js',
401
+ ],
402
rules: {
403
+ // Some helpers intentionally focus tests.
404
'jest/no-focused-tests': OFF,
405
+ // Test fn helpers don't use static text names.
406
+ 'jest/valid-title': OFF,
407
+ // We have our own assertion helpers.
408
+ 'jest/expect-expect': OFF,
409
+ // Some helpers intentionally disable tests.
410
+ 'jest/no-disabled-tests': OFF,
411
+ // Helpers export text function helpers.
412
+ 'jest/no-export': OFF,
413
+ // The examples in comments trigger false errors.
414
+ 'jest/no-commented-out-tests': OFF,
415
+ },
416
+ },
417
+ {
418
+ files: ['**/jest/TestFlags.js'],
419
+ rules: {
420
+ // The examples in comments trigger false errors.
421
+ 'jest/no-commented-out-tests': OFF,
422
},
423
},
424
{
package.json
+1
-1
@@ -56,7 +56,7 @@
56
"eslint-plugin-babel": "^5.3.0",
57
"eslint-plugin-eslint-plugin": "^3.5.3",
58
"eslint-plugin-ft-flow": "^2.0.3",
59
- "eslint-plugin-jest": "^22.15.0",
59
+ "eslint-plugin-jest": "28.4.0",
60
"eslint-plugin-no-for-of-loops": "^1.0.0",
61
"eslint-plugin-no-function-declare-after-return": "^1.0.0",
62
"eslint-plugin-react": "^6.7.1",
packages/dom-event-testing-library/__tests__/index-test.internal.js
+15
-15
@@ -45,7 +45,7 @@ describe('createEventTarget', () => {
45
resetActivePointers();
46
});
47
48
- test('returns expected API', () => {
48
+ it('returns expected API', () => {
49
const target = createEventTarget(node);
50
expect(target.node).toEqual(node);
51
expect(Object.keys(target)).toMatchInlineSnapshot(`
@@ -77,7 +77,7 @@ describe('createEventTarget', () => {
77
*/
78
79
describe('.blur()', () => {
80
- test('default', () => {
80
+ it('default', () => {
81
const target = createEventTarget(node);
82
node.addEventListener('blur', e => {
83
expect(e.relatedTarget).toMatchInlineSnapshot(`null`);
@@ -85,7 +85,7 @@ describe('createEventTarget', () => {
85
target.blur();
86
});
87
88
- test('custom payload', () => {
88
+ it('custom payload', () => {
89
const target = createEventTarget(node);
90
node.addEventListener('blur', e => {
91
expect(e.relatedTarget).toMatchInlineSnapshot(`null`);
@@ -95,7 +95,7 @@ describe('createEventTarget', () => {
95
});
96
97
describe('.click()', () => {
98
- test('default', () => {
98
+ it('default', () => {
99
const target = createEventTarget(node);
100
node.addEventListener('click', e => {
101
expect(e.altKey).toEqual(false);
@@ -122,7 +122,7 @@ describe('createEventTarget', () => {
122
target.click();
123
});
124
125
- test('custom payload', () => {
125
+ it('custom payload', () => {
126
const target = createEventTarget(node);
127
node.addEventListener('click', e => {
128
expect(e.altKey).toEqual(true);
@@ -162,7 +162,7 @@ describe('createEventTarget', () => {
162
});
163
164
describe('.focus()', () => {
165
- test('default', () => {
165
+ it('default', () => {
166
const target = createEventTarget(node);
167
node.addEventListener('focus', e => {
168
expect(e.relatedTarget).toMatchInlineSnapshot(`null`);
@@ -170,7 +170,7 @@ describe('createEventTarget', () => {
170
target.blur();
171
});
172
173
- test('custom payload', () => {
173
+ it('custom payload', () => {
174
const target = createEventTarget(node);
175
node.addEventListener('focus', e => {
176
expect(e.relatedTarget).toMatchInlineSnapshot(`null`);
@@ -180,7 +180,7 @@ describe('createEventTarget', () => {
180
});
181
182
describe('.keydown()', () => {
183
- test('default', () => {
183
+ it('default', () => {
184
const target = createEventTarget(node);
185
node.addEventListener('keydown', e => {
186
expect(e.altKey).toEqual(false);
@@ -195,7 +195,7 @@ describe('createEventTarget', () => {
195
target.keydown();
196
});
197
198
- test('custom payload', () => {
198
+ it('custom payload', () => {
199
const target = createEventTarget(node);
200
node.addEventListener('keydown', e => {
201
expect(e.altKey).toEqual(true);
@@ -217,7 +217,7 @@ describe('createEventTarget', () => {
217
});
218
219
describe('.keyup()', () => {
220
- test('default', () => {
220
+ it('default', () => {
221
const target = createEventTarget(node);
222
node.addEventListener('keyup', e => {
223
expect(e.altKey).toEqual(false);
@@ -232,7 +232,7 @@ describe('createEventTarget', () => {
232
target.keydown();
233
});
234
235
- test('custom payload', () => {
235
+ it('custom payload', () => {
236
const target = createEventTarget(node);
237
node.addEventListener('keyup', e => {
238
expect(e.altKey).toEqual(true);
@@ -254,7 +254,7 @@ describe('createEventTarget', () => {
254
});
255
256
describe('.scroll()', () => {
257
- test('default', () => {
257
+ it('default', () => {
258
const target = createEventTarget(node);
259
node.addEventListener('scroll', e => {
260
expect(e.type).toEqual('scroll');
@@ -264,7 +264,7 @@ describe('createEventTarget', () => {
264
});
265
266
describe('.virtualclick()', () => {
267
- test('default', () => {
267
+ it('default', () => {
268
const target = createEventTarget(node);
269
node.addEventListener('click', e => {
270
expect(e.altKey).toEqual(false);
@@ -291,7 +291,7 @@ describe('createEventTarget', () => {
291
target.virtualclick();
292
});
293
294
- test('custom payload', () => {
294
+ it('custom payload', () => {
295
const target = createEventTarget(node);
296
node.addEventListener('click', e => {
297
// expect most of the custom payload to be ignored
@@ -334,7 +334,7 @@ describe('createEventTarget', () => {
334
* Other APIs
335
*/
336
337
- test('.setBoundingClientRect()', () => {
337
+ it('.setBoundingClientRect()', () => {
338
const target = createEventTarget(node);
339
expect(node.getBoundingClientRect()).toMatchInlineSnapshot(`
340
{
packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js
+11
-11
@@ -36,7 +36,7 @@ const {
36
} = require('../ReactInternalTestUtils');
37
38
describe('ReactInternalTestUtils', () => {
39
- test('waitFor', async () => {
39
+ it('waitFor', async () => {
40
const Yield = ({id}) => {
41
Scheduler.log(id);
42
return id;
@@ -61,7 +61,7 @@ describe('ReactInternalTestUtils', () => {
61
expect(root).toMatchRenderedOutput(<div>foobarbaz</div>);
62
});
63
64
- test('waitForAll', async () => {
64
+ it('waitForAll', async () => {
65
const Yield = ({id}) => {
66
Scheduler.log(id);
67
return id;
@@ -82,7 +82,7 @@ describe('ReactInternalTestUtils', () => {
82
expect(root).toMatchRenderedOutput(<div>foobarbaz</div>);
83
});
84
85
- test('waitForThrow', async () => {
85
+ it('waitForThrow', async () => {
86
const Yield = ({id}) => {
87
Scheduler.log(id);
88
return id;
@@ -117,7 +117,7 @@ describe('ReactInternalTestUtils', () => {
117
]);
118
});
119
120
- test('waitForPaint', async () => {
120
+ it('waitForPaint', async () => {
121
function App({prop}) {
122
const deferred = useDeferredValue(prop);
123
const text = `Urgent: ${prop}, Deferred: ${deferred}`;
@@ -143,7 +143,7 @@ describe('ReactInternalTestUtils', () => {
143
expect(root).toMatchRenderedOutput('Urgent: B, Deferred: B');
144
});
145
146
- test('assertLog', async () => {
146
+ it('assertLog', async () => {
147
const Yield = ({id}) => {
148
Scheduler.log(id);
149
React.useEffect(() => {
@@ -732,7 +732,7 @@ describe('ReactInternalTestUtils console assertions', () => {
732
await waitForAll(['foo', 'bar', 'baz']);
733
});
734
735
- test('should fail if waitForThrow is called before asserting', async () => {
735
+ it('should fail if waitForThrow is called before asserting', async () => {
736
const Yield = ({id}) => {
737
Scheduler.log(id);
738
return id;
@@ -774,7 +774,7 @@ describe('ReactInternalTestUtils console assertions', () => {
774
await waitForAll(['A', 'B', 'A', 'B']);
775
});
776
777
- test('should fail if waitForPaint is called before asserting', async () => {
777
+ it('should fail if waitForPaint is called before asserting', async () => {
778
function App({prop}) {
779
const deferred = useDeferredValue(prop);
780
const text = `Urgent: ${prop}, Deferred: ${deferred}`;
@@ -1664,7 +1664,7 @@ describe('ReactInternalTestUtils console assertions', () => {
1664
await waitForAll(['foo', 'bar', 'baz']);
1665
});
1666
1667
- test('should fail if waitForThrow is called before asserting', async () => {
1667
+ it('should fail if waitForThrow is called before asserting', async () => {
1668
const Yield = ({id}) => {
1669
Scheduler.log(id);
1670
return id;
@@ -1706,7 +1706,7 @@ describe('ReactInternalTestUtils console assertions', () => {
1706
await waitForAll(['A', 'B', 'A', 'B']);
1707
});
1708
1709
- test('should fail if waitForPaint is called before asserting', async () => {
1709
+ it('should fail if waitForPaint is called before asserting', async () => {
1710
function App({prop}) {
1711
const deferred = useDeferredValue(prop);
1712
const text = `Urgent: ${prop}, Deferred: ${deferred}`;
@@ -2640,7 +2640,7 @@ describe('ReactInternalTestUtils console assertions', () => {
2640
await waitForAll(['foo', 'bar', 'baz']);
2641
});
2642
2643
- test('should fail if waitForThrow is called before asserting', async () => {
2643
+ it('should fail if waitForThrow is called before asserting', async () => {
2644
const Yield = ({id}) => {
2645
Scheduler.log(id);
2646
return id;
@@ -2682,7 +2682,7 @@ describe('ReactInternalTestUtils console assertions', () => {
2682
await waitForAll(['A', 'B', 'A', 'B']);
2683
});
2684
2685
- test('should fail if waitForPaint is called before asserting', async () => {
2685
+ it('should fail if waitForPaint is called before asserting', async () => {
2686
function App({prop}) {
2687
const deferred = useDeferredValue(prop);
2688
const text = `Urgent: ${prop}, Deferred: ${deferred}`;
packages/react-devtools-inline/__tests__/__e2e__/utils.js
+1
@@ -7,6 +7,7 @@ const config = require('../../playwright.config');
7
const {test} = require('@playwright/test');
8
9
function runOnlyForReactRange(range) {
10
+ // eslint-disable-next-line jest/no-disabled-tests
11
test.skip(
12
!semver.satisfies(config.use.react_version, range),
13
`This test requires a React version of ${range} to run. ` +
packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js
+5
-3
@@ -141,7 +141,8 @@ describe('Timeline profiler', () => {
141
// TODO(hoxyq): investigate why running this test with React 18 fails
142
// @reactVersion <= 18.2
143
// @reactVersion >= 18.0
144
- xit('should mark sync render with suspense that resolves', async () => {
144
+ // eslint-disable-next-line jest/no-disabled-tests
145
+ it.skip('should mark sync render with suspense that resolves', async () => {
146
const fakeSuspensePromise = Promise.resolve(true);
147
function Example() {
148
throw fakeSuspensePromise;
@@ -186,7 +187,8 @@ describe('Timeline profiler', () => {
187
// TODO(hoxyq): investigate why running this test with React 18 fails
188
// @reactVersion <= 18.2
189
// @reactVersion >= 18.0
189
- xit('should mark sync render with suspense that rejects', async () => {
190
+ // eslint-disable-next-line jest/no-disabled-tests
191
+ it.skip('should mark sync render with suspense that rejects', async () => {
192
const fakeSuspensePromise = Promise.reject(new Error('error'));
193
function Example() {
194
throw fakeSuspensePromise;
@@ -1528,7 +1530,7 @@ describe('Timeline profiler', () => {
1530
`);
1531
});
1532
1531
- it('should mark concurrent render without suspends or state updates', () => {
1533
+ it('should mark concurrent render without suspends with state updates', () => {
1534
let updaterFn;
1535
1536
function Example() {
packages/react-devtools-shared/src/__tests__/__serializers__/dehydratedValueSerializer.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-// test() is part of Jest's serializer API
10
+// `test` is part of Jest's serializer API
11
export function test(maybeDehydratedValue) {
12
const {meta} = require('react-devtools-shared/src/hydration');
13
packages/react-devtools-shared/src/__tests__/__serializers__/hookSerializer.js
+1
-1
@@ -34,7 +34,7 @@ function serializeHook(hook) {
34
};
35
}
36
37
-// test() is part of Jest's serializer API
37
+// `test` is part of Jest's serializer API
38
export function test(maybeHook) {
39
if (maybeHook === null || typeof maybeHook !== 'object') {
40
return false;
packages/react-devtools-shared/src/__tests__/__serializers__/inspectedElementSerializer.js
+1
-1
@@ -1,4 +1,4 @@
1
-// test() is part of Jest's serializer API
1
+// `test` is part of Jest's serializer API
2
export function test(maybeInspectedElement) {
3
if (
4
maybeInspectedElement === null ||
packages/react-devtools-shared/src/__tests__/__serializers__/numberToFixedSerializer.js
+1
-1
@@ -1,6 +1,6 @@
1
const MAX_DECIMAL_PLACES = 3;
2
3
-// test() is part of Jest's serializer API
3
+// `test` is part of Jest's serializer API
4
export function test(maybeNumber) {
5
return (
6
typeof maybeNumber === 'number' &&
packages/react-devtools-shared/src/__tests__/__serializers__/profilingSerializer.js
+1
-1
@@ -2,7 +2,7 @@ import hasOwnProperty from 'shared/hasOwnProperty';
2
3
const FILTERED_VERSION_STRING = '<filtered-version>';
4
5
-// test() is part of Jest's serializer API
5
+// `test` is part of Jest's serializer API
6
export function test(maybeProfile) {
7
if (
8
maybeProfile != null &&
packages/react-devtools-shared/src/__tests__/__serializers__/storeSerializer.js
+1
-1
@@ -1,6 +1,6 @@
1
import {printStore} from 'react-devtools-shared/src/devtools/utils';
2
3
-// test() is part of Jest's serializer API
3
+// `test` is part of Jest's serializer API
4
export function test(maybeStore) {
5
// It's important to lazy-require the Store rather than imported at the head of the module.
6
// Because we reset modules between tests, different Store implementations will be used for each test.
packages/react-devtools-shared/src/__tests__/__serializers__/timelineDataSerializer.js
+1
-1
@@ -6,7 +6,7 @@ function formatLanes(laneArray) {
6
return '0b' + lanes.toString(2).padStart(31, '0');
7
}
8
9
-// test() is part of Jest's serializer API
9
+// `test` is part of Jest's serializer API
10
export function test(maybeTimelineData) {
11
if (
12
maybeTimelineData != null &&
packages/react-devtools-shared/src/__tests__/__serializers__/treeContextStateSerializer.js
+1
-1
@@ -1,6 +1,6 @@
1
import {printStore} from 'react-devtools-shared/src/devtools/utils';
2
3
-// test() is part of Jest's serializer API
3
+// `test` is part of Jest's serializer API
4
export function test(maybeState) {
5
if (maybeState === null || typeof maybeState !== 'object') {
6
return false;
packages/react-devtools-shared/src/__tests__/componentStacks-test.js
+2
-1
@@ -65,7 +65,8 @@ describe('component stack', () => {
65
// but didn't because both DevTools and ReactDOM are running in the same memory space,
66
// so the case we're testing against (DevTools prod build and React DEV build) doesn't exist.
67
// It would be nice to figure out a way to test this combination at some point...
68
- xit('should disable the current dispatcher before shallow rendering so no effects get scheduled', () => {
68
+ // eslint-disable-next-line jest/no-disabled-tests
69
+ it.skip('should disable the current dispatcher before shallow rendering so no effects get scheduled', () => {
70
let useEffectCount = 0;
71
72
const Example = props => {
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+12
-6
@@ -181,7 +181,8 @@ describe('InspectedElement', () => {
181
182
// TODO(hoxyq): Enable this test for versions ~18, currently broken
183
// @reactVersion <= 18.2
184
- xit('should inspect the currently selected element (legacy render)', async () => {
184
+ // eslint-disable-next-line jest/no-disabled-tests
185
+ it.skip('should inspect the currently selected element (legacy render)', async () => {
186
const Example = () => {
187
const [count] = React.useState(1);
188
return count;
@@ -1653,7 +1654,8 @@ describe('InspectedElement', () => {
1654
1655
// TODO(hoxyq): Enable this test for versions ~18, currently broken
1656
// @reactVersion <= 18.2
1656
- xit('should inspect hooks for components that only use context (legacy render)', async () => {
1657
+ // eslint-disable-next-line jest/no-disabled-tests
1658
+ it.skip('should inspect hooks for components that only use context (legacy render)', async () => {
1659
const Context = React.createContext(true);
1660
const Example = () => {
1661
const value = React.useContext(Context);
@@ -2031,7 +2033,8 @@ describe('InspectedElement', () => {
2033
// TODO(hoxyq): Enable this test for versions ~18, currently broken
2034
// Regression test for github.com/facebook/react/issues/22099
2035
// @reactVersion <= 18.2
2034
- xit('should not error when an unchanged component is re-inspected after component filters changed (legacy render)', async () => {
2036
+ // eslint-disable-next-line jest/no-disabled-tests
2037
+ it.skip('should not error when an unchanged component is re-inspected after component filters changed (legacy render)', async () => {
2038
const Example = () => <div />;
2039
2040
await utils.actAsync(() => legacyRender(<Example />));
@@ -2152,7 +2155,8 @@ describe('InspectedElement', () => {
2155
2156
// TODO(hoxyq): Enable this test for versions ~18, currently broken
2157
// @reactVersion <= 18.2
2155
- xit('should display the root type for ReactDOM.hydrate', async () => {
2158
+ // eslint-disable-next-line jest/no-disabled-tests
2159
+ it.skip('should display the root type for ReactDOM.hydrate', async () => {
2160
const Example = () => <div />;
2161
2162
await utils.actAsync(() => {
@@ -2172,7 +2176,8 @@ describe('InspectedElement', () => {
2176
2177
// TODO(hoxyq): Enable this test for versions ~18, currently broken
2178
// @reactVersion <= 18.2
2175
- xit('should display the root type for ReactDOM.render', async () => {
2179
+ // eslint-disable-next-line jest/no-disabled-tests
2180
+ it.skip('should display the root type for ReactDOM.render', async () => {
2181
const Example = () => <div />;
2182
2183
await utils.actAsync(() => {
@@ -2789,7 +2794,8 @@ describe('InspectedElement', () => {
2794
2795
// TODO(hoxyq): Enable this test for versions ~18, currently broken
2796
// @reactVersion <= 18.2
2792
- xit('inspecting nested renderers should not throw (legacy render)', async () => {
2797
+ // eslint-disable-next-line jest/no-disabled-tests
2798
+ it.skip('inspecting nested renderers should not throw (legacy render)', async () => {
2799
// Ignoring react art warnings
2800
jest.spyOn(console, 'error').mockImplementation(() => {});
2801
const ReactArt = require('react-art');
packages/react-devtools-shared/src/__tests__/preprocessData-test.js
+3
@@ -1499,6 +1499,7 @@ describe('Timeline profiler', () => {
1499
1500
// This is temporarily disabled because the warning doesn't work
1501
// with useDeferredValue
1502
+ // eslint-disable-next-line jest/no-disabled-tests
1503
it.skip('should warn about long nested (state) updates during layout effects', async () => {
1504
function Component() {
1505
const [didMount, setDidMount] = React.useState(false);
@@ -1556,6 +1557,7 @@ describe('Timeline profiler', () => {
1557
1558
// This is temporarily disabled because the warning doesn't work
1559
// with useDeferredValue
1560
+ // eslint-disable-next-line jest/no-disabled-tests
1561
it.skip('should warn about long nested (forced) updates during layout effects', async () => {
1562
class Component extends React.Component {
1563
_didMount: boolean = false;
@@ -1685,6 +1687,7 @@ describe('Timeline profiler', () => {
1687
1688
// This is temporarily disabled because the warning doesn't work
1689
// with useDeferredValue
1690
+ // eslint-disable-next-line jest/no-disabled-tests
1691
it.skip('should not warn about deferred value updates scheduled during commit phase', async () => {
1692
function Component() {
1693
const [value, setValue] = React.useState(0);
packages/react-devtools-shared/src/__tests__/profilerStore-test.js
+1
-1
@@ -184,7 +184,7 @@ describe('ProfilerStore', () => {
184
});
185
186
// @reactVersion >= 16.9
187
- it('should not throw if state contains a property hasOwnProperty ', () => {
187
+ it('should not throw if state contains a property hasOwnProperty', () => {
188
let setStateCallback;
189
const ControlledInput = () => {
190
const [state, setState] = React.useState({hasOwnProperty: true});
packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js
+2
-1
@@ -226,7 +226,8 @@ describe('Store component filters', () => {
226
227
// Disabled: filtering by path was removed, source is now determined lazily, including symbolication if applicable
228
// @reactVersion >= 16.0
229
- xit('should filter by path', async () => {
229
+ // eslint-disable-next-line jest/no-disabled-tests
230
+ it.skip('should filter by path', async () => {
231
// This component should use props object in order to throw for component stack generation
232
// See ReactComponentStackFrame:155 or DevToolsComponentStackFrame:147
233
const Component = props => {
packages/react-devtools-shared/src/__tests__/transform-react-version-pragma-test.js
+16
-16
@@ -44,93 +44,93 @@ describe('transform-react-version-pragma', () => {
44
});
45
46
// @reactVersion >= 17.9
47
- test('reactVersion flag is on >=', () => {
47
+ it('reactVersion flag is on >=', () => {
48
expect(shouldPass).toBe(true);
49
});
50
51
// @reactVersion >= 18.1
52
- test('reactVersion flag is off >=', () => {
52
+ it('reactVersion flag is off >=', () => {
53
expect(shouldPass).toBe(false);
54
});
55
56
// @reactVersion <= 18.1
57
- test('reactVersion flag is on <=', () => {
57
+ it('reactVersion flag is on <=', () => {
58
expect(shouldPass).toBe(true);
59
});
60
61
// @reactVersion <= 17.9
62
- test('reactVersion flag is off <=', () => {
62
+ it('reactVersion flag is off <=', () => {
63
expect(shouldPass).toBe(false);
64
});
65
66
// @reactVersion > 17.9
67
- test('reactVersion flag is on >', () => {
67
+ it('reactVersion flag is on >', () => {
68
expect(shouldPass).toBe(true);
69
});
70
71
// @reactVersion > 18.1
72
- test('reactVersion flag is off >', () => {
72
+ it('reactVersion flag is off >', () => {
73
expect(shouldPass).toBe(false);
74
});
75
76
// @reactVersion < 18.1
77
- test('reactVersion flag is on <', () => {
77
+ it('reactVersion flag is on <', () => {
78
expect(shouldPass).toBe(true);
79
});
80
81
// @reactVersion < 17.0.0
82
- test('reactVersion flag is off <', () => {
82
+ it('reactVersion flag is off <', () => {
83
expect(shouldPass).toBe(false);
84
});
85
86
// @reactVersion = 18.0
87
- test('reactVersion flag is on =', () => {
87
+ it('reactVersion flag is on =', () => {
88
expect(shouldPass).toBe(true);
89
});
90
91
// @reactVersion = 18.1
92
- test('reactVersion flag is off =', () => {
92
+ it('reactVersion flag is off =', () => {
93
expect(shouldPass).toBe(false);
94
});
95
96
/* eslint-disable jest/no-focused-tests */
97
98
// @reactVersion >= 18.1
99
- fit('reactVersion fit', () => {
99
+ it.only('reactVersion fit', () => {
100
expect(shouldPass).toBe(false);
101
expect(isFocused).toBe(true);
102
});
103
104
// @reactVersion <= 18.1
105
- test.only('reactVersion test.only', () => {
105
+ it.only('reactVersion test.only', () => {
106
expect(shouldPass).toBe(true);
107
expect(isFocused).toBe(true);
108
});
109
110
// @reactVersion <= 18.1
111
// @reactVersion <= 17.1
112
- test('reactVersion multiple pragmas fail', () => {
112
+ it('reactVersion multiple pragmas fail', () => {
113
expect(shouldPass).toBe(false);
114
expect(isFocused).toBe(false);
115
});
116
117
// @reactVersion <= 18.1
118
// @reactVersion >= 17.1
119
- test('reactVersion multiple pragmas pass', () => {
119
+ it('reactVersion multiple pragmas pass', () => {
120
expect(shouldPass).toBe(true);
121
expect(isFocused).toBe(false);
122
});
123
124
// @reactVersion <= 18.1
125
// @reactVersion <= 17.1
126
- test.only('reactVersion focused multiple pragmas fail', () => {
126
+ it.only('reactVersion focused multiple pragmas fail', () => {
127
expect(shouldPass).toBe(false);
128
expect(isFocused).toBe(true);
129
});
130
131
// @reactVersion <= 18.1
132
// @reactVersion >= 17.1
133
- test.only('reactVersion focused multiple pragmas pass', () => {
133
+ it.only('reactVersion focused multiple pragmas pass', () => {
134
expect(shouldPass).toBe(true);
135
expect(isFocused).toBe(true);
136
});
packages/react-devtools-shared/src/__tests__/treeContext-test.js
+2
-2
@@ -2549,7 +2549,7 @@ describe('TreeListContext', () => {
2549
});
2550
2551
describe('error boundaries', () => {
2552
- it('should properly handle errors/warnings from components that dont mount because of an error', () => {
2552
+ it('should properly handle errors from components that dont mount because of an error', () => {
2553
class ErrorBoundary extends React.Component {
2554
state = {error: null};
2555
static getDerivedStateFromError(error) {
@@ -2604,7 +2604,7 @@ describe('TreeListContext', () => {
2604
expect(state).toMatchInlineSnapshot(``);
2605
});
2606
2607
- it('should properly handle errors/warnings from components that dont mount because of an error', () => {
2607
+ it('should properly handle warnings from components that dont mount because of an error', () => {
2608
class ErrorBoundary extends React.Component {
2609
state = {error: null};
2610
static getDerivedStateFromError(error) {
packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js
+165
-152
@@ -195,7 +195,7 @@ describe('parseHookNames', () => {
195
196
describe('inline, external and bundle source maps', () => {
197
it('should work for simple components', async () => {
198
- async function test(path, name = 'Component') {
198
+ async function testFor(path, name = 'Component') {
199
const Component = require(path)[name];
200
const hookNames = await getHookNamesForComponent(Component);
201
expectHookNamesToEqual(hookNames, [
@@ -203,17 +203,17 @@ describe('parseHookNames', () => {
203
]);
204
}
205
206
- await test('./__source__/Example'); // original source (uncompiled)
207
- await test('./__source__/__compiled__/inline/Example'); // inline source map
208
- await test('./__source__/__compiled__/external/Example'); // external source map
209
- await test('./__source__/__compiled__/inline/index-map/Example'); // inline index map source map
210
- await test('./__source__/__compiled__/external/index-map/Example'); // external index map source map
211
- await test('./__source__/__compiled__/bundle/index', 'Example'); // bundle source map
212
- await test('./__source__/__compiled__/no-columns/Example'); // simulated Webpack 'cheap-module-source-map'
206
+ await testFor('./__source__/Example'); // original source (uncompiled)
207
+ await testFor('./__source__/__compiled__/inline/Example'); // inline source map
208
+ await testFor('./__source__/__compiled__/external/Example'); // external source map
209
+ await testFor('./__source__/__compiled__/inline/index-map/Example'); // inline index map source map
210
+ await testFor('./__source__/__compiled__/external/index-map/Example'); // external index map source map
211
+ await testFor('./__source__/__compiled__/bundle/index', 'Example'); // bundle source map
212
+ await testFor('./__source__/__compiled__/no-columns/Example'); // simulated Webpack 'cheap-module-source-map'
213
});
214
215
it('should work with more complex files and components', async () => {
216
- async function test(path, name = undefined) {
216
+ async function testFor(path, name = undefined) {
217
const components = name != null ? require(path)[name] : require(path);
218
219
let hookNames = await getHookNamesForComponent(components.List);
@@ -237,17 +237,17 @@ describe('parseHookNames', () => {
237
]);
238
}
239
240
- await test('./__source__/ToDoList'); // original source (uncompiled)
241
- await test('./__source__/__compiled__/inline/ToDoList'); // inline source map
242
- await test('./__source__/__compiled__/external/ToDoList'); // external source map
243
- await test('./__source__/__compiled__/inline/index-map/ToDoList'); // inline index map source map
244
- await test('./__source__/__compiled__/external/index-map/ToDoList'); // external index map source map
245
- await test('./__source__/__compiled__/bundle', 'ToDoList'); // bundle source map
246
- await test('./__source__/__compiled__/no-columns/ToDoList'); // simulated Webpack 'cheap-module-source-map'
240
+ await testFor('./__source__/ToDoList'); // original source (uncompiled)
241
+ await testFor('./__source__/__compiled__/inline/ToDoList'); // inline source map
242
+ await testFor('./__source__/__compiled__/external/ToDoList'); // external source map
243
+ await testFor('./__source__/__compiled__/inline/index-map/ToDoList'); // inline index map source map
244
+ await testFor('./__source__/__compiled__/external/index-map/ToDoList'); // external index map source map
245
+ await testFor('./__source__/__compiled__/bundle', 'ToDoList'); // bundle source map
246
+ await testFor('./__source__/__compiled__/no-columns/ToDoList'); // simulated Webpack 'cheap-module-source-map'
247
});
248
249
it('should work for custom hook', async () => {
250
- async function test(path, name = 'Component') {
250
+ async function testFor(path, name = 'Component') {
251
const Component = require(path)[name];
252
const hookNames = await getHookNamesForComponent(Component);
253
expectHookNamesToEqual(hookNames, [
@@ -258,23 +258,28 @@ describe('parseHookNames', () => {
258
]);
259
}
260
261
- await test('./__source__/ComponentWithCustomHook'); // original source (uncompiled)
262
- await test('./__source__/__compiled__/inline/ComponentWithCustomHook'); // inline source map
263
- await test('./__source__/__compiled__/external/ComponentWithCustomHook'); // external source map
264
- await test(
261
+ await testFor('./__source__/ComponentWithCustomHook'); // original source (uncompiled)
262
+ await testFor('./__source__/__compiled__/inline/ComponentWithCustomHook'); // inline source map
263
+ await testFor(
264
+ './__source__/__compiled__/external/ComponentWithCustomHook',
265
+ ); // external source map
266
+ await testFor(
267
'./__source__/__compiled__/inline/index-map/ComponentWithCustomHook',
268
); // inline index map source map
267
- await test(
269
+ await testFor(
270
'./__source__/__compiled__/external/index-map/ComponentWithCustomHook',
271
); // external index map source map
270
- await test('./__source__/__compiled__/bundle', 'ComponentWithCustomHook'); // bundle source map
271
- await test(
272
+ await testFor(
273
+ './__source__/__compiled__/bundle',
274
+ 'ComponentWithCustomHook',
275
+ ); // bundle source map
276
+ await testFor(
277
'./__source__/__compiled__/no-columns/ComponentWithCustomHook',
278
); // simulated Webpack 'cheap-module-source-map'
279
});
280
281
it('should work when code is using hooks indirectly', async () => {
277
- async function test(path, name = 'Component') {
282
+ async function testFor(path, name = 'Component') {
283
const Component = require(path)[name];
284
const hookNames = await getHookNamesForComponent(Component);
285
expectHookNamesToEqual(hookNames, [
@@ -284,29 +289,29 @@ describe('parseHookNames', () => {
289
]);
290
}
291
287
- await test(
292
+ await testFor(
293
'./__source__/__compiled__/inline/ComponentUsingHooksIndirectly',
294
); // inline source map
290
- await test(
295
+ await testFor(
296
'./__source__/__compiled__/external/ComponentUsingHooksIndirectly',
297
); // external source map
293
- await test(
298
+ await testFor(
299
'./__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly',
300
); // inline index map source map
296
- await test(
301
+ await testFor(
302
'./__source__/__compiled__/external/index-map/ComponentUsingHooksIndirectly',
303
); // external index map source map
299
- await test(
304
+ await testFor(
305
'./__source__/__compiled__/bundle',
306
'ComponentUsingHooksIndirectly',
307
); // bundle source map
303
- await test(
308
+ await testFor(
309
'./__source__/__compiled__/no-columns/ComponentUsingHooksIndirectly',
310
); // simulated Webpack 'cheap-module-source-map'
311
});
312
313
it('should work when code is using nested hooks', async () => {
309
- async function test(path, name = 'Component') {
314
+ async function testFor(path, name = 'Component') {
315
const Component = require(path)[name];
316
let InnerComponent;
317
const hookNames = await getHookNamesForComponent(Component, {
@@ -323,25 +328,29 @@ describe('parseHookNames', () => {
328
]);
329
}
330
326
- await test('./__source__/__compiled__/inline/ComponentWithNestedHooks'); // inline source map
327
- await test('./__source__/__compiled__/external/ComponentWithNestedHooks'); // external source map
328
- await test(
331
+ await testFor(
332
+ './__source__/__compiled__/inline/ComponentWithNestedHooks',
333
+ ); // inline source map
334
+ await testFor(
335
+ './__source__/__compiled__/external/ComponentWithNestedHooks',
336
+ ); // external source map
337
+ await testFor(
338
'./__source__/__compiled__/inline/index-map/ComponentWithNestedHooks',
339
); // inline index map source map
331
- await test(
340
+ await testFor(
341
'./__source__/__compiled__/external/index-map/ComponentWithNestedHooks',
342
); // external index map source map
334
- await test(
343
+ await testFor(
344
'./__source__/__compiled__/bundle',
345
'ComponentWithNestedHooks',
346
); // bundle source map
338
- await test(
347
+ await testFor(
348
'./__source__/__compiled__/no-columns/ComponentWithNestedHooks',
349
); // simulated Webpack 'cheap-module-source-map'
350
});
351
352
it('should work for external hooks', async () => {
344
- async function test(path, name = 'Component') {
353
+ async function testFor(path, name = 'Component') {
354
const Component = require(path)[name];
355
const hookNames = await getHookNamesForComponent(Component);
356
expectHookNamesToEqual(hookNames, [
@@ -353,29 +362,29 @@ describe('parseHookNames', () => {
362
// We can't test the uncompiled source here, because it either needs to get transformed,
363
// which would break the source mapping, or the import statements will fail.
364
356
- await test(
365
+ await testFor(
366
'./__source__/__compiled__/inline/ComponentWithExternalCustomHooks',
367
); // inline source map
359
- await test(
368
+ await testFor(
369
'./__source__/__compiled__/external/ComponentWithExternalCustomHooks',
370
); // external source map
362
- await test(
371
+ await testFor(
372
'./__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks',
373
); // inline index map source map
365
- await test(
374
+ await testFor(
375
'./__source__/__compiled__/external/index-map/ComponentWithExternalCustomHooks',
376
); // external index map source map
368
- await test(
377
+ await testFor(
378
'./__source__/__compiled__/bundle',
379
'ComponentWithExternalCustomHooks',
380
); // bundle source map
372
- await test(
381
+ await testFor(
382
'./__source__/__compiled__/no-columns/ComponentWithExternalCustomHooks',
383
); // simulated Webpack 'cheap-module-source-map'
384
});
385
386
it('should work when multiple hooks are on a line', async () => {
378
- async function test(path, name = 'Component') {
387
+ async function testFor(path, name = 'Component') {
388
const Component = require(path)[name];
389
const hookNames = await getHookNamesForComponent(Component);
390
expectHookNamesToEqual(hookNames, [
@@ -386,24 +395,24 @@ describe('parseHookNames', () => {
395
]);
396
}
397
389
- await test(
398
+ await testFor(
399
'./__source__/__compiled__/inline/ComponentWithMultipleHooksPerLine',
400
); // inline source map
392
- await test(
401
+ await testFor(
402
'./__source__/__compiled__/external/ComponentWithMultipleHooksPerLine',
403
); // external source map
395
- await test(
404
+ await testFor(
405
'./__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine',
406
); // inline index map source map
398
- await test(
407
+ await testFor(
408
'./__source__/__compiled__/external/index-map/ComponentWithMultipleHooksPerLine',
409
); // external index map source map
401
- await test(
410
+ await testFor(
411
'./__source__/__compiled__/bundle',
412
'ComponentWithMultipleHooksPerLine',
413
); // bundle source map
414
406
- async function noColumnTest(path, name = 'Component') {
415
+ async function noColumntest(path, name = 'Component') {
416
const Component = require(path)[name];
417
const hookNames = await getHookNamesForComponent(Component);
418
expectHookNamesToEqual(hookNames, [
@@ -417,7 +426,7 @@ describe('parseHookNames', () => {
426
// Note that this test is expected to only match the first two hooks
427
// because the 3rd and 4th hook are on the same line,
428
// and this type of source map doesn't have column numbers.
420
- await noColumnTest(
429
+ await noColumntest(
430
'./__source__/__compiled__/no-columns/ComponentWithMultipleHooksPerLine',
431
); // simulated Webpack 'cheap-module-source-map'
432
});
@@ -425,8 +434,9 @@ describe('parseHookNames', () => {
434
// TODO Inline require (e.g. require("react").useState()) isn't supported yet.
435
// Maybe this isn't an important use case to support,
436
// since inline requires are most likely to exist in compiled source (if at all).
428
- xit('should work for inline requires', async () => {
429
- async function test(path, name = 'Component') {
437
+ // eslint-disable-next-line jest/no-disabled-tests
438
+ it.skip('should work for inline requires', async () => {
439
+ async function testFor(path, name = 'Component') {
440
const Component = require(path)[name];
441
const hookNames = await getHookNamesForComponent(Component);
442
expectHookNamesToEqual(hookNames, [
@@ -434,17 +444,19 @@ describe('parseHookNames', () => {
444
]);
445
}
446
437
- await test('./__source__/InlineRequire'); // original source (uncompiled)
438
- await test('./__source__/__compiled__/inline/InlineRequire'); // inline source map
439
- await test('./__source__/__compiled__/external/InlineRequire'); // external source map
440
- await test('./__source__/__compiled__/inline/index-map/InlineRequire'); // inline index map source map
441
- await test('./__source__/__compiled__/external/index-map/InlineRequire'); // external index map source map
442
- await test('./__source__/__compiled__/bundle', 'InlineRequire'); // bundle source map
443
- await test('./__source__/__compiled__/no-columns/InlineRequire'); // simulated Webpack 'cheap-module-source-map'
447
+ await testFor('./__source__/InlineRequire'); // original source (uncompiled)
448
+ await testFor('./__source__/__compiled__/inline/InlineRequire'); // inline source map
449
+ await testFor('./__source__/__compiled__/external/InlineRequire'); // external source map
450
+ await testFor('./__source__/__compiled__/inline/index-map/InlineRequire'); // inline index map source map
451
+ await testFor(
452
+ './__source__/__compiled__/external/index-map/InlineRequire',
453
+ ); // external index map source map
454
+ await testFor('./__source__/__compiled__/bundle', 'InlineRequire'); // bundle source map
455
+ await testFor('./__source__/__compiled__/no-columns/InlineRequire'); // simulated Webpack 'cheap-module-source-map'
456
});
457
458
it('should support sources that contain the string "sourceMappingURL="', async () => {
447
- async function test(path, name = 'Component') {
459
+ async function testFor(path, name = 'Component') {
460
const Component = require(path)[name];
461
const hookNames = await getHookNamesForComponent(Component);
462
expectHookNamesToEqual(hookNames, [
@@ -455,24 +467,24 @@ describe('parseHookNames', () => {
467
// We expect the inline sourceMappingURL to be invalid in this case; mute the warning.
468
console.warn = () => {};
469
458
- await test('./__source__/ContainingStringSourceMappingURL'); // original source (uncompiled)
459
- await test(
470
+ await testFor('./__source__/ContainingStringSourceMappingURL'); // original source (uncompiled)
471
+ await testFor(
472
'./__source__/__compiled__/inline/ContainingStringSourceMappingURL',
473
); // inline source map
462
- await test(
474
+ await testFor(
475
'./__source__/__compiled__/external/ContainingStringSourceMappingURL',
476
); // external source map
465
- await test(
477
+ await testFor(
478
'./__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL',
479
); // inline index map source map
468
- await test(
480
+ await testFor(
481
'./__source__/__compiled__/external/index-map/ContainingStringSourceMappingURL',
482
); // external index map source map
471
- await test(
483
+ await testFor(
484
'./__source__/__compiled__/bundle',
485
'ContainingStringSourceMappingURL',
486
); // bundle source map
475
- await test(
487
+ await testFor(
488
'./__source__/__compiled__/no-columns/ContainingStringSourceMappingURL',
489
); // simulated Webpack 'cheap-module-source-map'
490
});
@@ -487,7 +499,7 @@ describe('parseHookNames', () => {
499
});
500
501
it('should work for simple components', async () => {
490
- async function test(path, name = 'Component') {
502
+ async function testFor(path, name = 'Component') {
503
const Component = require(path)[name];
504
const hookNames = await getHookNamesForComponent(Component);
505
expectHookNamesToEqual(hookNames, [
@@ -497,30 +509,30 @@ describe('parseHookNames', () => {
509
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
510
}
511
500
- await test(
512
+ await testFor(
513
'./__source__/__compiled__/inline/fb-sources-extended/Example',
514
); // x_facebook_sources extended inline source map
503
- await test(
515
+ await testFor(
516
'./__source__/__compiled__/external/fb-sources-extended/Example',
517
); // x_facebook_sources extended external source map
506
- await test(
518
+ await testFor(
519
'./__source__/__compiled__/inline/react-sources-extended/Example',
520
); // x_react_sources extended inline source map
509
- await test(
521
+ await testFor(
522
'./__source__/__compiled__/external/react-sources-extended/Example',
523
); // x_react_sources extended external source map
524
525
// Using index map format for source maps
514
- await test(
526
+ await testFor(
527
'./__source__/__compiled__/inline/fb-sources-extended/index-map/Example',
528
); // x_facebook_sources extended inline index map source map
517
- await test(
529
+ await testFor(
530
'./__source__/__compiled__/external/fb-sources-extended/index-map/Example',
531
); // x_facebook_sources extended external index map source map
520
- await test(
532
+ await testFor(
533
'./__source__/__compiled__/inline/react-sources-extended/index-map/Example',
534
); // x_react_sources extended inline index map source map
523
- await test(
535
+ await testFor(
536
'./__source__/__compiled__/external/react-sources-extended/index-map/Example',
537
); // x_react_sources extended external index map source map
538
@@ -528,7 +540,7 @@ describe('parseHookNames', () => {
540
});
541
542
it('should work with more complex files and components', async () => {
531
- async function test(path, name = undefined) {
543
+ async function testFor(path, name = undefined) {
544
const components = name != null ? require(path)[name] : require(path);
545
546
let hookNames = await getHookNamesForComponent(components.List);
@@ -555,30 +567,30 @@ describe('parseHookNames', () => {
567
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
568
}
569
558
- await test(
570
+ await testFor(
571
'./__source__/__compiled__/inline/fb-sources-extended/ToDoList',
572
); // x_facebook_sources extended inline source map
561
- await test(
573
+ await testFor(
574
'./__source__/__compiled__/external/fb-sources-extended/ToDoList',
575
); // x_facebook_sources extended external source map
564
- await test(
576
+ await testFor(
577
'./__source__/__compiled__/inline/react-sources-extended/ToDoList',
578
); // x_react_sources extended inline source map
567
- await test(
579
+ await testFor(
580
'./__source__/__compiled__/external/react-sources-extended/ToDoList',
581
); // x_react_sources extended external source map
582
583
// Using index map format for source maps
572
- await test(
584
+ await testFor(
585
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList',
586
); // x_facebook_sources extended inline index map source map
575
- await test(
587
+ await testFor(
588
'./__source__/__compiled__/external/fb-sources-extended/index-map/ToDoList',
589
); // x_facebook_sources extended external index map source map
578
- await test(
590
+ await testFor(
591
'./__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList',
592
); // x_react_sources extended inline index map source map
581
- await test(
593
+ await testFor(
594
'./__source__/__compiled__/external/react-sources-extended/index-map/ToDoList',
595
); // x_react_sources extended external index map source map
596
@@ -586,7 +598,7 @@ describe('parseHookNames', () => {
598
});
599
600
it('should work for custom hook', async () => {
589
- async function test(path, name = 'Component') {
601
+ async function testFor(path, name = 'Component') {
602
const Component = require(path)[name];
603
const hookNames = await getHookNamesForComponent(Component);
604
expectHookNamesToEqual(hookNames, [
@@ -599,30 +611,30 @@ describe('parseHookNames', () => {
611
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
612
}
613
602
- await test(
614
+ await testFor(
615
'./__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook',
616
); // x_facebook_sources extended inline source map
605
- await test(
617
+ await testFor(
618
'./__source__/__compiled__/external/fb-sources-extended/ComponentWithCustomHook',
619
); // x_facebook_sources extended external source map
608
- await test(
620
+ await testFor(
621
'./__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook',
622
); // x_react_sources extended inline source map
611
- await test(
623
+ await testFor(
624
'./__source__/__compiled__/external/react-sources-extended/ComponentWithCustomHook',
625
); // x_react_sources extended external source map
626
627
// Using index map format for source maps
616
- await test(
628
+ await testFor(
629
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook',
630
); // x_facebook_sources extended inline index map source map
619
- await test(
631
+ await testFor(
632
'./__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithCustomHook',
633
); // x_facebook_sources extended external index map source map
622
- await test(
634
+ await testFor(
635
'./__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook',
636
); // x_react_sources extended inline index map source map
625
- await test(
637
+ await testFor(
638
'./__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithCustomHook',
639
); // x_react_sources extended external index map source map
640
@@ -630,7 +642,7 @@ describe('parseHookNames', () => {
642
});
643
644
it('should work when code is using hooks indirectly', async () => {
633
- async function test(path, name = 'Component') {
645
+ async function testFor(path, name = 'Component') {
646
const Component = require(path)[name];
647
const hookNames = await getHookNamesForComponent(Component);
648
expectHookNamesToEqual(hookNames, [
@@ -642,30 +654,30 @@ describe('parseHookNames', () => {
654
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
655
}
656
645
- await test(
657
+ await testFor(
658
'./__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly',
659
); // x_facebook_sources extended inline source map
648
- await test(
660
+ await testFor(
661
'./__source__/__compiled__/external/fb-sources-extended/ComponentUsingHooksIndirectly',
662
); // x_facebook_sources extended external source map
651
- await test(
663
+ await testFor(
664
'./__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly',
665
); // x_react_sources extended inline source map
654
- await test(
666
+ await testFor(
667
'./__source__/__compiled__/external/react-sources-extended/ComponentUsingHooksIndirectly',
668
); // x_react_sources extended external source map
669
670
// Using index map format for source maps
659
- await test(
671
+ await testFor(
672
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
673
); // x_facebook_sources extended inline index map source map
662
- await test(
674
+ await testFor(
675
'./__source__/__compiled__/external/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
676
); // x_facebook_sources extended external index map source map
665
- await test(
677
+ await testFor(
678
'./__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
679
); // x_react_sources extended inline index map source map
668
- await test(
680
+ await testFor(
681
'./__source__/__compiled__/external/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
682
); // x_react_sources extended external index map source map
683
@@ -673,7 +685,7 @@ describe('parseHookNames', () => {
685
});
686
687
it('should work when code is using nested hooks', async () => {
676
- async function test(path, name = 'Component') {
688
+ async function testFor(path, name = 'Component') {
689
const Component = require(path)[name];
690
let InnerComponent;
691
const hookNames = await getHookNamesForComponent(Component, {
@@ -692,30 +704,30 @@ describe('parseHookNames', () => {
704
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
705
}
706
695
- await test(
707
+ await testFor(
708
'./__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks',
709
); // x_facebook_sources extended inline source map
698
- await test(
710
+ await testFor(
711
'./__source__/__compiled__/external/fb-sources-extended/ComponentWithNestedHooks',
712
); // x_facebook_sources extended external source map
701
- await test(
713
+ await testFor(
714
'./__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks',
715
); // x_react_sources extended inline source map
704
- await test(
716
+ await testFor(
717
'./__source__/__compiled__/external/react-sources-extended/ComponentWithNestedHooks',
718
); // x_react_sources extended external source map
719
720
// Using index map format for source maps
709
- await test(
721
+ await testFor(
722
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks',
723
); // x_facebook_sources extended inline index map source map
712
- await test(
724
+ await testFor(
725
'./__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithNestedHooks',
726
); // x_facebook_sources extended external index map source map
715
- await test(
727
+ await testFor(
728
'./__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks',
729
); // x_react_sources extended inline index map source map
718
- await test(
730
+ await testFor(
731
'./__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithNestedHooks',
732
); // x_react_sources extended external index map source map
733
@@ -723,7 +735,7 @@ describe('parseHookNames', () => {
735
});
736
737
it('should work for external hooks', async () => {
726
- async function test(path, name = 'Component') {
738
+ async function testFor(path, name = 'Component') {
739
const Component = require(path)[name];
740
const hookNames = await getHookNamesForComponent(Component);
741
expectHookNamesToEqual(hookNames, [
@@ -737,30 +749,30 @@ describe('parseHookNames', () => {
749
// We can't test the uncompiled source here, because it either needs to get transformed,
750
// which would break the source mapping, or the import statements will fail.
751
740
- await test(
752
+ await testFor(
753
'./__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks',
754
); // x_facebook_sources extended inline source map
743
- await test(
755
+ await testFor(
756
'./__source__/__compiled__/external/fb-sources-extended/ComponentWithExternalCustomHooks',
757
); // x_facebook_sources extended external source map
746
- await test(
758
+ await testFor(
759
'./__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks',
760
); // x_react_sources extended inline source map
749
- await test(
761
+ await testFor(
762
'./__source__/__compiled__/external/react-sources-extended/ComponentWithExternalCustomHooks',
763
); // x_react_sources extended external source map
764
765
// Using index map format for source maps
754
- await test(
766
+ await testFor(
767
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
768
); // x_facebook_sources extended inline index map source map
757
- await test(
769
+ await testFor(
770
'./__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
771
); // x_facebook_sources extended external index map source map
760
- await test(
772
+ await testFor(
773
'./__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
774
); // x_react_sources extended inline index map source map
763
- await test(
775
+ await testFor(
776
'./__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
777
); // x_react_sources extended external index map source map
778
@@ -768,7 +780,7 @@ describe('parseHookNames', () => {
780
});
781
782
it('should work when multiple hooks are on a line', async () => {
771
- async function test(path, name = 'Component') {
783
+ async function testFor(path, name = 'Component') {
784
const Component = require(path)[name];
785
const hookNames = await getHookNamesForComponent(Component);
786
expectHookNamesToEqual(hookNames, [
@@ -781,30 +793,30 @@ describe('parseHookNames', () => {
793
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
794
}
795
784
- await test(
796
+ await testFor(
797
'./__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine',
798
); // x_facebook_sources extended inline source map
787
- await test(
799
+ await testFor(
800
'./__source__/__compiled__/external/fb-sources-extended/ComponentWithMultipleHooksPerLine',
801
); // x_facebook_sources extended external source map
790
- await test(
802
+ await testFor(
803
'./__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine',
804
); // x_react_sources extended inline source map
793
- await test(
805
+ await testFor(
806
'./__source__/__compiled__/external/react-sources-extended/ComponentWithMultipleHooksPerLine',
807
); // x_react_sources extended external source map
808
809
// Using index map format for source maps
798
- await test(
810
+ await testFor(
811
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
812
); // x_facebook_sources extended inline index map source map
801
- await test(
813
+ await testFor(
814
'./__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
815
); // x_facebook_sources extended external index map source map
804
- await test(
816
+ await testFor(
817
'./__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
818
); // x_react_sources extended inline index map source map
807
- await test(
819
+ await testFor(
820
'./__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
821
); // x_react_sources extended external index map source map
822
@@ -814,8 +826,9 @@ describe('parseHookNames', () => {
826
// TODO Inline require (e.g. require("react").useState()) isn't supported yet.
827
// Maybe this isn't an important use case to support,
828
// since inline requires are most likely to exist in compiled source (if at all).
817
- xit('should work for inline requires', async () => {
818
- async function test(path, name = 'Component') {
829
+ // eslint-disable-next-line jest/no-disabled-tests
830
+ it.skip('should work for inline requires', async () => {
831
+ async function testFor(path, name = 'Component') {
832
const Component = require(path)[name];
833
const hookNames = await getHookNamesForComponent(Component);
834
expectHookNamesToEqual(hookNames, [
@@ -825,30 +838,30 @@ describe('parseHookNames', () => {
838
expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
839
}
840
828
- await test(
841
+ await testFor(
842
'./__source__/__compiled__/inline/fb-sources-extended/InlineRequire',
843
); // x_facebook_sources extended inline source map
831
- await test(
844
+ await testFor(
845
'./__source__/__compiled__/external/fb-sources-extended/InlineRequire',
846
); // x_facebook_sources extended external source map
834
- await test(
847
+ await testFor(
848
'./__source__/__compiled__/inline/react-sources-extended/InlineRequire',
849
); // x_react_sources extended inline source map
837
- await test(
850
+ await testFor(
851
'./__source__/__compiled__/external/react-sources-extended/InlineRequire',
852
); // x_react_sources extended external source map
853
854
// Using index map format for source maps
842
- await test(
855
+ await testFor(
856
'./__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire',
857
); // x_facebook_sources extended inline index map source map
845
- await test(
858
+ await testFor(
859
'./__source__/__compiled__/external/fb-sources-extended/index-map/InlineRequire',
860
); // x_facebook_sources extended external index map source map
848
- await test(
861
+ await testFor(
862
'./__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire',
863
); // x_react_sources extended inline index map source map
851
- await test(
864
+ await testFor(
865
'./__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire',
866
); // x_react_sources extended external index map source map
867
@@ -856,7 +869,7 @@ describe('parseHookNames', () => {
869
});
870
871
it('should support sources that contain the string "sourceMappingURL="', async () => {
859
- async function test(path, name = 'Component') {
872
+ async function testFor(path, name = 'Component') {
873
const Component = require(path)[name];
874
const hookNames = await getHookNamesForComponent(Component);
875
expectHookNamesToEqual(hookNames, [
@@ -869,30 +882,30 @@ describe('parseHookNames', () => {
882
// We expect the inline sourceMappingURL to be invalid in this case; mute the warning.
883
console.warn = () => {};
884
872
- await test(
885
+ await testFor(
886
'./__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL',
887
); // x_facebook_sources extended inline source map
875
- await test(
888
+ await testFor(
889
'./__source__/__compiled__/external/fb-sources-extended/ContainingStringSourceMappingURL',
890
); // x_facebook_sources extended external source map
878
- await test(
891
+ await testFor(
892
'./__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL',
893
); // x_react_sources extended inline source map
881
- await test(
894
+ await testFor(
895
'./__source__/__compiled__/external/react-sources-extended/ContainingStringSourceMappingURL',
896
); // x_react_sources extended external source map
897
898
// Using index map format for source maps
886
- await test(
899
+ await testFor(
900
'./__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
901
); // x_facebook_sources extended inline index map source map
889
- await test(
902
+ await testFor(
903
'./__source__/__compiled__/external/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
904
); // x_facebook_sources extended external index map source map
892
- await test(
905
+ await testFor(
906
'./__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL',
907
); // x_react_sources extended inline index map source map
895
- await test(
908
+ await testFor(
909
'./__source__/__compiled__/external/react-sources-extended/index-map/ContainingStringSourceMappingURL',
910
); // x_react_sources extended external index map source map
911
packages/react-devtools-timeline/src/content-views/utils/__tests__/colors-test.js
+4
-4
@@ -9,7 +9,7 @@
9
10
import {hslaColorToString, dimmedColor, ColorGenerator} from '../colors';
11
12
-describe(hslaColorToString, () => {
12
+describe('hslaColorToString', () => {
13
it('should transform colors to strings', () => {
14
expect(hslaColorToString({h: 1, s: 2, l: 3, a: 4})).toEqual(
15
'hsl(1deg 2% 3% / 4)',
@@ -20,7 +20,7 @@ describe(hslaColorToString, () => {
20
});
21
});
22
23
-describe(dimmedColor, () => {
23
+describe('dimmedColor', () => {
24
it('should dim luminosity using delta', () => {
25
expect(dimmedColor({h: 1, s: 2, l: 3, a: 4}, 3)).toEqual({
26
h: 1,
@@ -37,8 +37,8 @@ describe(dimmedColor, () => {
37
});
38
});
39
40
-describe(ColorGenerator, () => {
41
- describe(ColorGenerator.prototype.colorForID, () => {
40
+describe('ColorGenerator', () => {
41
+ describe('colorForID', () => {
42
it('should generate a color for an ID', () => {
43
expect(new ColorGenerator().colorForID('123')).toMatchInlineSnapshot(`
44
{
packages/react-devtools-timeline/src/view-base/__tests__/geometry-test.js
+9
-9
@@ -19,7 +19,7 @@ import {
19
unionOfRects,
20
} from '../geometry';
21
22
-describe(pointEqualToPoint, () => {
22
+describe('pointEqualToPoint', () => {
23
it('should return true when 2 points have the same values', () => {
24
expect(pointEqualToPoint({x: 1, y: 1}, {x: 1, y: 1})).toBe(true);
25
expect(pointEqualToPoint({x: -1, y: 2}, {x: -1, y: 2})).toBe(true);
@@ -37,7 +37,7 @@ describe(pointEqualToPoint, () => {
37
});
38
});
39
40
-describe(sizeEqualToSize, () => {
40
+describe('sizeEqualToSize', () => {
41
it('should return true when 2 sizes have the same values', () => {
42
expect(sizeEqualToSize({width: 1, height: 1}, {width: 1, height: 1})).toBe(
43
true,
@@ -69,7 +69,7 @@ describe(sizeEqualToSize, () => {
69
});
70
});
71
72
-describe(rectEqualToRect, () => {
72
+describe('rectEqualToRect', () => {
73
it('should return true when 2 rects have the same values', () => {
74
expect(
75
rectEqualToRect(
@@ -101,7 +101,7 @@ describe(rectEqualToRect, () => {
101
});
102
});
103
104
-describe(sizeIsValid, () => {
104
+describe('sizeIsValid', () => {
105
it('should return true when the size has non-negative width and height', () => {
106
expect(sizeIsValid({width: 1, height: 1})).toBe(true);
107
expect(sizeIsValid({width: 0, height: 0})).toBe(true);
@@ -114,7 +114,7 @@ describe(sizeIsValid, () => {
114
});
115
});
116
117
-describe(sizeIsEmpty, () => {
117
+describe('sizeIsEmpty', () => {
118
it('should return true when the size has negative area', () => {
119
expect(sizeIsEmpty({width: 1, height: -1})).toBe(true);
120
expect(sizeIsEmpty({width: -1, height: -1})).toBe(true);
@@ -132,7 +132,7 @@ describe(sizeIsEmpty, () => {
132
});
133
});
134
135
-describe(rectIntersectsRect, () => {
135
+describe('rectIntersectsRect', () => {
136
it('should return true when 2 rects intersect', () => {
137
// Rects touch
138
expect(
@@ -175,7 +175,7 @@ describe(rectIntersectsRect, () => {
175
});
176
});
177
178
-describe(intersectionOfRects, () => {
178
+describe('intersectionOfRects', () => {
179
// NOTE: Undefined behavior if rects do not intersect
180
181
it('should return intersection when 2 rects intersect', () => {
@@ -205,7 +205,7 @@ describe(intersectionOfRects, () => {
205
});
206
});
207
208
-describe(rectContainsPoint, () => {
208
+describe('rectContainsPoint', () => {
209
it("should return true if point is on the rect's edge", () => {
210
expect(
211
rectContainsPoint(
@@ -246,7 +246,7 @@ describe(rectContainsPoint, () => {
246
});
247
});
248
249
-describe(unionOfRects, () => {
249
+describe('unionOfRects', () => {
250
it('should return zero rect if no rects are provided', () => {
251
expect(unionOfRects()).toEqual({
252
origin: {x: 0, y: 0},
packages/react-devtools-timeline/src/view-base/utils/__tests__/clamp-test.js
+1
-1
@@ -9,7 +9,7 @@
9
10
import {clamp} from '../clamp';
11
12
-describe(clamp, () => {
12
+describe('clamp', () => {
13
it('should return min if value < min', () => {
14
expect(clamp(0, 1, -1)).toBe(0);
15
expect(clamp(0.1, 1.1, 0.05)).toBe(0.1);
packages/react-devtools-timeline/src/view-base/utils/__tests__/scrollState-test.js
+5
-5
@@ -15,7 +15,7 @@ import {
15
zoomState,
16
} from '../scrollState';
17
18
-describe(clampState, () => {
18
+describe('clampState', () => {
19
it('should passthrough offset if state fits within container', () => {
20
expect(
21
clampState({
@@ -137,7 +137,7 @@ describe(clampState, () => {
137
});
138
});
139
140
-describe(translateState, () => {
140
+describe('translateState', () => {
141
it('should translate state by delta and leave length unchanged', () => {
142
expect(
143
translateState({
@@ -166,7 +166,7 @@ describe(translateState, () => {
166
});
167
});
168
169
-describe(zoomState, () => {
169
+describe('zoomState', () => {
170
it('should scale width by multiplier', () => {
171
expect(
172
zoomState({
@@ -218,7 +218,7 @@ describe(zoomState, () => {
218
});
219
});
220
221
-describe(moveStateToRange, () => {
221
+describe('moveStateToRange', () => {
222
it('should set [rangeStart, rangeEnd] = container', () => {
223
const movedState = moveStateToRange({
224
state: {offset: -20, length: 100},
@@ -240,7 +240,7 @@ describe(moveStateToRange, () => {
240
});
241
});
242
243
-describe(areScrollStatesEqual, () => {
243
+describe('areScrollStatesEqual', () => {
244
it('should return true if equal', () => {
245
expect(
246
areScrollStatesEqual({offset: 0, length: 0}, {offset: 0, length: 0}),
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
+1
-1
@@ -131,7 +131,7 @@ describe('ReactComponentLifeCycle', () => {
131
* If a state update triggers rerendering that in turn fires an onDOMReady,
132
* that second onDOMReady should not fail.
133
*/
134
- it('it should fire onDOMReady when already in onDOMReady', async () => {
134
+ it('should fire onDOMReady when already in onDOMReady', async () => {
135
const _testJournal = [];
136
137
class Child extends React.Component {
packages/react-dom/src/__tests__/ReactCompositeComponentDOMMinimalism-test.js
+2
-2
@@ -54,7 +54,7 @@ describe('ReactCompositeComponentDOMMinimalism', () => {
54
expect(instance.children.length).toBe(0);
55
});
56
57
- it('should not render extra nodes for non-interpolated text', async () => {
57
+ it('should not render extra nodes for interpolated text', async () => {
58
const container = document.createElement('div');
59
const root = ReactDOMClient.createRoot(container);
60
await act(() => {
@@ -70,7 +70,7 @@ describe('ReactCompositeComponentDOMMinimalism', () => {
70
expect(instance.children.length).toBe(0);
71
});
72
73
- it('should not render extra nodes for non-interpolated text', async () => {
73
+ it('should not render extra nodes for interpolated text children', async () => {
74
const container = document.createElement('div');
75
const root = ReactDOMClient.createRoot(container);
76
await act(() => {
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+2
-2
@@ -1838,7 +1838,7 @@ describe('ReactDOMComponent', () => {
1838
}).toErrorDev('Directly setting property `innerHTML` is not permitted. ');
1839
});
1840
1841
- it('should validate use of dangerouslySetInnerHTML', async () => {
1841
+ it('should validate use of dangerouslySetInnerHTM with JSX', async () => {
1842
await expect(async () => {
1843
await mountComponent({dangerouslySetInnerHTML: '<span>Hi Jim!</span>'});
1844
}).rejects.toThrowError(
@@ -1847,7 +1847,7 @@ describe('ReactDOMComponent', () => {
1847
);
1848
});
1849
1850
- it('should validate use of dangerouslySetInnerHTML', async () => {
1850
+ it('should validate use of dangerouslySetInnerHTML with object', async () => {
1851
await expect(async () => {
1852
await mountComponent({dangerouslySetInnerHTML: {foo: 'bar'}});
1853
}).rejects.toThrowError(
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+6
-6
@@ -5338,7 +5338,7 @@ describe('ReactDOMFizzServer', () => {
5338
});
5339
}
5340
5341
- it('it only includes separators between adjacent text nodes', async () => {
5341
+ it('only includes separators between adjacent text nodes', async () => {
5342
function App({name}) {
5343
return (
5344
<div>
@@ -5370,7 +5370,7 @@ describe('ReactDOMFizzServer', () => {
5370
);
5371
});
5372
5373
- it('it does not insert text separators even when adjacent text is in a delayed segment', async () => {
5373
+ it('does not insert text separators even when adjacent text is in a delayed segment', async () => {
5374
function App({name}) {
5375
return (
5376
<Suspense fallback={'loading...'}>
@@ -5433,7 +5433,7 @@ describe('ReactDOMFizzServer', () => {
5433
);
5434
});
5435
5436
- it('it works with multiple adjacent segments', async () => {
5436
+ it('works with multiple adjacent segments', async () => {
5437
function App() {
5438
return (
5439
<Suspense fallback={'loading...'}>
@@ -5481,7 +5481,7 @@ describe('ReactDOMFizzServer', () => {
5481
);
5482
});
5483
5484
- it('it works when some segments are flushed and others are patched', async () => {
5484
+ it('works when some segments are flushed and others are patched', async () => {
5485
function App() {
5486
return (
5487
<Suspense fallback={'loading...'}>
@@ -5529,7 +5529,7 @@ describe('ReactDOMFizzServer', () => {
5529
);
5530
});
5531
5532
- it('it does not prepend a text separators if the segment follows a non-Text Node', async () => {
5532
+ it('does not prepend a text separators if the segment follows a non-Text Node', async () => {
5533
function App() {
5534
return (
5535
<Suspense fallback={'loading...'}>
@@ -5569,7 +5569,7 @@ describe('ReactDOMFizzServer', () => {
5569
);
5570
});
5571
5572
- it('it does not prepend a text separators if the segments first emission is a non-Text Node', async () => {
5572
+ it('does not prepend a text separators if the segments first emission is a non-Text Node', async () => {
5573
function App() {
5574
return (
5575
<Suspense fallback={'loading...'}>
packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js
+7
@@ -412,7 +412,10 @@ describe('ReactDOMFizzServerBrowser', () => {
412
413
let result;
414
result = await readResult(stream);
415
+
416
expect(result).toMatchInlineSnapshot(
417
+ // TODO: remove interpolation because it prevents snapshot updates.
418
+ // eslint-disable-next-line jest/no-interpolation-in-snapshots
419
`"<div><span></span></div><div>${str492}</div><div>${str492}</div>"`,
420
);
421
@@ -428,6 +431,8 @@ describe('ReactDOMFizzServerBrowser', () => {
431
);
432
433
result = await readResult(stream);
434
+ // TODO: remove interpolation because it prevents snapshot updates.
435
+ // eslint-disable-next-line jest/no-interpolation-in-snapshots
436
expect(result).toMatchInlineSnapshot(`"<div>${str2049}</div>"`);
437
});
438
@@ -540,6 +545,8 @@ describe('ReactDOMFizzServerBrowser', () => {
545
);
546
const result = await readResult(stream);
547
expect(result).toMatchInlineSnapshot(
548
+ // TODO: remove interpolation because it prevents snapshot updates.
549
+ // eslint-disable-next-line jest/no-interpolation-in-snapshots
550
`"<link rel="preload" as="script" fetchPriority="low" nonce="R4nd0m" href="init.js"/><link rel="modulepreload" fetchPriority="low" nonce="R4nd0m" href="init.mjs"/><div>hello world</div><script nonce="${nonce}">INIT();</script><script src="init.js" nonce="${nonce}" async=""></script><script type="module" src="init.mjs" nonce="${nonce}" async=""></script>"`,
551
);
552
});
packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js
+5
-5
@@ -167,7 +167,7 @@ describe('ReactDOMFizzShellHydration', () => {
167
textCache = new Map();
168
}
169
170
- test('suspending in the shell during hydration', async () => {
170
+ it('suspending in the shell during hydration', async () => {
171
const div = React.createRef(null);
172
173
function App() {
@@ -207,7 +207,7 @@ describe('ReactDOMFizzShellHydration', () => {
207
expect(container.textContent).toBe('Shell');
208
});
209
210
- test('suspending in the shell during a normal client render', async () => {
210
+ it('suspending in the shell during a normal client render', async () => {
211
// Same as previous test but during a normal client render, no hydration
212
function App() {
213
return <AsyncText text="Shell" />;
@@ -226,7 +226,7 @@ describe('ReactDOMFizzShellHydration', () => {
226
expect(container.textContent).toBe('Shell');
227
});
228
229
- test(
229
+ it(
230
'updating the root at lower priority than initial hydration does not ' +
231
'force a client render',
232
async () => {
@@ -255,7 +255,7 @@ describe('ReactDOMFizzShellHydration', () => {
255
},
256
);
257
258
- test('updating the root while the shell is suspended forces a client render', async () => {
258
+ it('updating the root while the shell is suspended forces a client render', async () => {
259
function App() {
260
return <AsyncText text="Shell" />;
261
}
@@ -293,7 +293,7 @@ describe('ReactDOMFizzShellHydration', () => {
293
expect(container.textContent).toBe('New screen');
294
});
295
296
- test('TODO: A large component stack causes SSR to stack overflow', async () => {
296
+ it('TODO: A large component stack causes SSR to stack overflow', async () => {
297
spyOnDevAndProd(console, 'error').mockImplementation(() => {});
298
299
function NestedComponent({depth}: {depth: number}) {
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+3
-2
@@ -2951,7 +2951,8 @@ body {
2951
);
2952
});
2953
2954
- xit('can delay commit until css resources error', async () => {
2954
+ // eslint-disable-next-line jest/no-disabled-tests
2955
+ it.skip('can delay commit until css resources error', async () => {
2956
// TODO: This test fails and crashes jest. need to figure out why before unskipping.
2957
const root = ReactDOMClient.createRoot(container);
2958
expect(getMeaningfulChildren(container)).toBe(undefined);
@@ -6191,7 +6192,7 @@ body {
6192
);
6193
});
6194
6194
- it('creates a stylesheet resource in the ownerDocument when ReactDOM.preinit(..., {as: "style" }) is called outside of render on the client', async () => {
6195
+ it('creates a stylesheet resource in the ownerDocument when ReactDOM.preinit(..., {as: "style" }) is called in shadowRoot', async () => {
6196
// This is testing behavior, but it shows that it is not a good idea to preinit inside a shadowRoot. The point is we are asserting a behavior
6197
// you would want to avoid in a real app.
6198
const shadow = document.body.attachShadow({mode: 'open'});
packages/react-dom/src/__tests__/ReactDOMForm-test.js
+25
-25
@@ -989,7 +989,7 @@ describe('ReactDOMForm', () => {
989
});
990
991
// @gate enableAsyncActions
992
- test('useActionState updates state asynchronously and queues multiple actions', async () => {
992
+ it('useActionState updates state asynchronously and queues multiple actions', async () => {
993
let actionCounter = 0;
994
async function action(state, type) {
995
actionCounter++;
@@ -1049,7 +1049,7 @@ describe('ReactDOMForm', () => {
1049
});
1050
1051
// @gate enableAsyncActions
1052
- test('useActionState supports inline actions', async () => {
1052
+ it('useActionState supports inline actions', async () => {
1053
let increment;
1054
function App({stepSize}) {
1055
const [state, dispatch, isPending] = useActionState(async prevState => {
@@ -1081,7 +1081,7 @@ describe('ReactDOMForm', () => {
1081
});
1082
1083
// @gate enableAsyncActions
1084
- test('useActionState: dispatch throws if called during render', async () => {
1084
+ it('useActionState: dispatch throws if called during render', async () => {
1085
function App() {
1086
const [state, dispatch, isPending] = useActionState(async () => {}, 0);
1087
dispatch();
@@ -1097,7 +1097,7 @@ describe('ReactDOMForm', () => {
1097
});
1098
1099
// @gate enableAsyncActions
1100
- test('useActionState: queues multiple actions and runs them in order', async () => {
1100
+ it('useActionState: queues multiple actions and runs them in order', async () => {
1101
let action;
1102
function App() {
1103
const [state, dispatch, isPending] = useActionState(
@@ -1129,7 +1129,7 @@ describe('ReactDOMForm', () => {
1129
});
1130
1131
// @gate enableAsyncActions
1132
- test(
1132
+ it(
1133
'useActionState: when calling a queued action, uses the implementation ' +
1134
'that was current at the time it was dispatched, not the most recent one',
1135
async () => {
@@ -1176,7 +1176,7 @@ describe('ReactDOMForm', () => {
1176
);
1177
1178
// @gate enableAsyncActions
1179
- test('useActionState: works if action is sync', async () => {
1179
+ it('useActionState: works if action is sync', async () => {
1180
let increment;
1181
function App({stepSize}) {
1182
const [state, dispatch, isPending] = useActionState(prevState => {
@@ -1208,7 +1208,7 @@ describe('ReactDOMForm', () => {
1208
});
1209
1210
// @gate enableAsyncActions
1211
- test('useActionState: can mix sync and async actions', async () => {
1211
+ it('useActionState: can mix sync and async actions', async () => {
1212
let action;
1213
function App() {
1214
const [state, dispatch, isPending] = useActionState((s, a) => a, 'A');
@@ -1236,7 +1236,7 @@ describe('ReactDOMForm', () => {
1236
});
1237
1238
// @gate enableAsyncActions
1239
- test('useActionState: error handling (sync action)', async () => {
1239
+ it('useActionState: error handling (sync action)', async () => {
1240
class ErrorBoundary extends React.Component {
1241
state = {error: null};
1242
static getDerivedStateFromError(error) {
@@ -1285,7 +1285,7 @@ describe('ReactDOMForm', () => {
1285
});
1286
1287
// @gate enableAsyncActions
1288
- test('useActionState: error handling (async action)', async () => {
1288
+ it('useActionState: error handling (async action)', async () => {
1289
class ErrorBoundary extends React.Component {
1290
state = {error: null};
1291
static getDerivedStateFromError(error) {
@@ -1331,7 +1331,7 @@ describe('ReactDOMForm', () => {
1331
expect(container.textContent).toBe('Caught an error: Oops!');
1332
});
1333
1334
- test('useActionState: when an action errors, subsequent actions are canceled', async () => {
1334
+ it('useActionState: when an action errors, subsequent actions are canceled', async () => {
1335
class ErrorBoundary extends React.Component {
1336
state = {error: null};
1337
static getDerivedStateFromError(error) {
@@ -1391,7 +1391,7 @@ describe('ReactDOMForm', () => {
1391
});
1392
1393
// @gate enableAsyncActions
1394
- test('useActionState works in StrictMode', async () => {
1394
+ it('useActionState works in StrictMode', async () => {
1395
let actionCounter = 0;
1396
async function action(state, type) {
1397
actionCounter++;
@@ -1437,7 +1437,7 @@ describe('ReactDOMForm', () => {
1437
expect(container.textContent).toBe('1');
1438
});
1439
1440
- test('useActionState does not wrap action in a transition unless dispatch is in a transition', async () => {
1440
+ it('useActionState does not wrap action in a transition unless dispatch is in a transition', async () => {
1441
let dispatch;
1442
function App() {
1443
const [state, _dispatch] = useActionState(() => {
@@ -1479,7 +1479,7 @@ describe('ReactDOMForm', () => {
1479
expect(container.textContent).toBe('Count: 2');
1480
});
1481
1482
- test('useActionState warns if async action is dispatched outside of a transition', async () => {
1482
+ it('useActionState warns if async action is dispatched outside of a transition', async () => {
1483
let dispatch;
1484
function App() {
1485
const [state, _dispatch] = useActionState(async () => {
@@ -1508,7 +1508,7 @@ describe('ReactDOMForm', () => {
1508
expect(container.textContent).toBe('Count: 0');
1509
});
1510
1511
- test('uncontrolled form inputs are reset after the action completes', async () => {
1511
+ it('uncontrolled form inputs are reset after the action completes', async () => {
1512
const formRef = React.createRef();
1513
const inputRef = React.createRef();
1514
const divRef = React.createRef();
@@ -1586,7 +1586,7 @@ describe('ReactDOMForm', () => {
1586
expect(divRef.current.textContent).toEqual('Current username: acdlite');
1587
});
1588
1589
- test('requestFormReset schedules a form reset after transition completes', async () => {
1589
+ it('requestFormReset schedules a form reset after transition completes', async () => {
1590
// This is the same as the previous test, except the form is updated with
1591
// a userspace action instead of a built-in form action.
1592
@@ -1671,7 +1671,7 @@ describe('ReactDOMForm', () => {
1671
expect(divRef.current.textContent).toEqual('Current username: acdlite');
1672
});
1673
1674
- test(
1674
+ it(
1675
'requestFormReset works with inputs that are not descendants ' +
1676
'of the form element',
1677
async () => {
@@ -1764,7 +1764,7 @@ describe('ReactDOMForm', () => {
1764
},
1765
);
1766
1767
- test('reset multiple forms in the same transition', async () => {
1767
+ it('reset multiple forms in the same transition', async () => {
1768
const formRefA = React.createRef();
1769
const formRefB = React.createRef();
1770
@@ -1853,7 +1853,7 @@ describe('ReactDOMForm', () => {
1853
expect(formRefB.current.elements.inputName.value).toBe('B2');
1854
});
1855
1856
- test('requestFormReset throws if the form is not managed by React', async () => {
1856
+ it('requestFormReset throws if the form is not managed by React', async () => {
1857
container.innerHTML = `
1858
<form id="myform">
1859
<input id="input" type="text" name="greeting" />
@@ -1874,7 +1874,7 @@ describe('ReactDOMForm', () => {
1874
expect(input.value).toBe('');
1875
});
1876
1877
- test('requestFormReset throws on a non-form DOM element', async () => {
1877
+ it('requestFormReset throws on a non-form DOM element', async () => {
1878
const root = ReactDOMClient.createRoot(container);
1879
const ref = React.createRef();
1880
await act(() => root.render(<div ref={ref}>Hi</div>));
@@ -1884,7 +1884,7 @@ describe('ReactDOMForm', () => {
1884
expect(() => requestFormReset(div)).toThrow('Invalid form element.');
1885
});
1886
1887
- test('warns if requestFormReset is called outside of a transition', async () => {
1887
+ it('warns if requestFormReset is called outside of a transition', async () => {
1888
const formRef = React.createRef();
1889
const inputRef = React.createRef();
1890
@@ -1933,7 +1933,7 @@ describe('ReactDOMForm', () => {
1933
expect(inputRef.current.value).toBe('Initial');
1934
});
1935
1936
- test("regression: submitter's formAction prop is coerced correctly before checking if it exists", async () => {
1936
+ it("regression: submitter's formAction prop is coerced correctly before checking if it exists", async () => {
1937
function App({submitterAction}) {
1938
return (
1939
<form action={() => Scheduler.log('Form action')}>
@@ -1977,7 +1977,7 @@ describe('ReactDOMForm', () => {
1977
);
1978
});
1979
1980
- test(
1980
+ it(
1981
'useFormStatus is activated if startTransition is called ' +
1982
'inside preventDefault-ed submit event',
1983
async () => {
@@ -2045,7 +2045,7 @@ describe('ReactDOMForm', () => {
2045
},
2046
);
2047
2048
- test('useFormStatus is not activated if startTransition is not called', async () => {
2048
+ it('useFormStatus is not activated if startTransition is not called', async () => {
2049
function Output({value}) {
2050
const {pending} = useFormStatus();
2051
@@ -2116,7 +2116,7 @@ describe('ReactDOMForm', () => {
2116
expect(inputRef.current.value).toBe('Updated again after submission');
2117
});
2118
2119
- test('useFormStatus is not activated if event is not preventDefault-ed ', async () => {
2119
+ it('useFormStatus is not activated if event is not preventDefault-ed', async () => {
2120
function Output({value}) {
2121
const {pending} = useFormStatus();
2122
return <Text text={pending ? `${value} (pending...)` : value} />;
@@ -2171,7 +2171,7 @@ describe('ReactDOMForm', () => {
2171
expect(outputRef.current.textContent).toBe('Initial');
2172
});
2173
2174
- test('useFormStatus coerces the value of the "action" prop', async () => {
2174
+ it('useFormStatus coerces the value of the "action" prop', async () => {
2175
function Status() {
2176
const {pending, action} = useFormStatus();
2177
packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js
+1
-1
@@ -685,7 +685,7 @@ describe('ReactDOMServerHydration', () => {
685
});
686
687
// @gate __DEV__
688
- it('warns when client renders an extra text node in the beginning', () => {
688
+ it('warns when client renders an extra text node in the middle', () => {
689
function Mismatch({isClient}) {
690
return (
691
<div className="parent">
packages/react-dom/src/__tests__/ReactDOMImageLoad-test.internal.js
+2
-1
@@ -259,7 +259,7 @@ describe('ReactDOMImageLoad', () => {
259
expect(onLoadSpy).toHaveBeenCalledTimes(1);
260
});
261
262
- it('it replays the last load event when more than one fire before the end of the layout phase completes', async function () {
262
+ it('replays the last load event when more than one fire before the end of the layout phase completes', async function () {
263
const container = document.createElement('div');
264
const root = ReactDOMClient.createRoot(container);
265
@@ -436,6 +436,7 @@ describe('ReactDOMImageLoad', () => {
436
expect(onLoadSpy).not.toHaveBeenCalled();
437
});
438
439
+ // eslint-disable-next-line jest/no-commented-out-tests
440
// it('captures the load event if it happens in a suspended subtree and replays it between layout and passive effects on resumption', async function() {
441
// function SuspendingWithImage() {
442
// Scheduler.log('SuspendingWithImage');
packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js
+1
-1
@@ -29,7 +29,7 @@ describe('ReactDOMNestedEvents', () => {
29
assertLog = InternalTestUtils.assertLog;
30
});
31
32
- test('nested event dispatches should not cause updates to flush', async () => {
32
+ it('nested event dispatches should not cause updates to flush', async () => {
33
const buttonRef = React.createRef(null);
34
function App() {
35
const [isClicked, setIsClicked] = useState(false);
packages/react-dom/src/__tests__/ReactDOMRoot-test.js
+1
-1
@@ -59,7 +59,7 @@ describe('ReactDOMRoot', () => {
59
expect(callback).not.toHaveBeenCalled();
60
});
61
62
- it('warn if a container is passed to root.render(...)', async () => {
62
+ it('warn if a object is passed to root.render(...)', async () => {
63
function App() {
64
return 'Child';
65
}
packages/react-dom/src/__tests__/ReactDOMSelect-test.js
+1
-1
@@ -1515,7 +1515,7 @@ describe('ReactDOMSelect', () => {
1515
]);
1516
});
1517
1518
- it('throws when given a Temporal.PlainDate-like value (both)', async () => {
1518
+ it('throws when given a Temporal.PlainDate-like defaultValue (both)', async () => {
1519
const container = document.createElement('div');
1520
const root = ReactDOMClient.createRoot(container);
1521
await expect(async () => {
packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js
+1
-1
@@ -48,7 +48,7 @@ describe('ReactDOMServerIntegration', () => {
48
// The `itRenders` test abstraction doesn't work with @gate so we have
49
// to do this instead.
50
if (gate(flags => flags.disableLegacyContext)) {
51
- test('empty test to stop Jest from being a complainy complainer', () => {});
51
+ it('empty test to stop Jest from being a complainy complainer', () => {});
52
return;
53
}
54
packages/react-dom/src/__tests__/ReactDOMServerIntegrationUserInteraction-test.js
+4
-2
@@ -326,12 +326,14 @@ describe('ReactDOMServerIntegrationUserInteraction', () => {
326
327
// skipping this test because React 15 does the wrong thing. it blows
328
// away the user's typing in the textarea.
329
- xit('should not blow away user-entered text on successful reconnect to an uncontrolled textarea', () =>
329
+ // eslint-disable-next-line jest/no-disabled-tests
330
+ it.skip('should not blow away user-entered text on successful reconnect to an uncontrolled textarea', () =>
331
testUserInteractionBeforeClientRender(<textarea defaultValue="Hello" />));
332
333
// skipping this test because React 15 does the wrong thing. it blows
334
// away the user's typing in the textarea.
334
- xit('should not blow away user-entered text on successful reconnect to a controlled textarea', async () => {
335
+ // eslint-disable-next-line jest/no-disabled-tests
336
+ it.skip('should not blow away user-entered text on successful reconnect to a controlled textarea', async () => {
337
let changeCount = 0;
338
await testUserInteractionBeforeClientRender(
339
<ControlledTextArea onChange={() => changeCount++} />,
packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+1
-1
@@ -153,7 +153,7 @@ describe('ReactDOMServerSuspense', () => {
153
expect(divB).toBe(divB2);
154
});
155
156
- it('it throws when rendering a suspending component outside a Suspense node', async () => {
156
+ it('throws when rendering a suspending component outside a Suspense node', async () => {
157
expect(() => {
158
ReactDOMServer.renderToString(
159
<div>
packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js
+2
-1
@@ -590,7 +590,8 @@ describe('ReactDOM HostSingleton', () => {
590
});
591
592
// This test is not supported in this implementation. If we reintroduce insertion edge we should revisit
593
- xit('is able to maintain insertions in head and body between tree-adjacent Nodes', async () => {
593
+ // eslint-disable-next-line jest/no-disabled-tests
594
+ it.skip('is able to maintain insertions in head and body between tree-adjacent Nodes', async () => {
595
// Server render some html and hydrate on the client
596
await actIntoEmptyDocument(() => {
597
const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
-10
@@ -1010,16 +1010,6 @@ describe('ReactDOMTextarea', () => {
1010
expect(node.defaultValue).toBe('');
1011
});
1012
1013
- it('should not warn about missing onChange if value is not set', async () => {
1014
- const container = document.createElement('div');
1015
- const root = ReactDOMClient.createRoot(container);
1016
- await expect(
1017
- act(() => {
1018
- root.render(<textarea />);
1019
- }),
1020
- ).resolves.not.toThrow();
1021
- });
1022
-
1013
it('should not warn about missing onChange if value is undefined', async () => {
1014
const container = document.createElement('div');
1015
const root = ReactDOMClient.createRoot(container);
packages/react-dom/src/__tests__/ReactDOMUseId-test.js
+11
-11
@@ -121,7 +121,7 @@ describe('useId', () => {
121
return <div id={id}>{children}</div>;
122
}
123
124
- test('basic example', async () => {
124
+ it('basic example', async () => {
125
function App() {
126
return (
127
<div>
@@ -162,7 +162,7 @@ describe('useId', () => {
162
`);
163
});
164
165
- test('indirections', async () => {
165
+ it('indirections', async () => {
166
function App() {
167
// There are no forks in this tree, but the parent and the child should
168
// have different ids.
@@ -207,7 +207,7 @@ describe('useId', () => {
207
`);
208
});
209
210
- test('StrictMode double rendering', async () => {
210
+ it('StrictMode double rendering', async () => {
211
const {StrictMode} = React;
212
213
function App() {
@@ -236,7 +236,7 @@ describe('useId', () => {
236
`);
237
});
238
239
- test('empty (null) children', async () => {
239
+ it('empty (null) children', async () => {
240
// We don't treat empty children different from non-empty ones, which means
241
// they get allocated a slot when generating ids. There's no inherent reason
242
// to do this; Fiber happens to allocate a fiber for null children that
@@ -275,7 +275,7 @@ describe('useId', () => {
275
`);
276
});
277
278
- test('large ids', async () => {
278
+ it('large ids', async () => {
279
// The component in this test outputs a recursive tree of nodes with ids,
280
// where the underlying binary representation is an alternating series of 1s
281
// and 0s. In other words, they are all of the form 101010101.
@@ -325,7 +325,7 @@ describe('useId', () => {
325
}
326
});
327
328
- test('multiple ids in a single component', async () => {
328
+ it('multiple ids in a single component', async () => {
329
function App() {
330
const id1 = useId();
331
const id2 = useId();
@@ -350,7 +350,7 @@ describe('useId', () => {
350
`);
351
});
352
353
- test('local render phase updates', async () => {
353
+ it('local render phase updates', async () => {
354
function App({swap}) {
355
const [count, setCount] = useState(0);
356
if (count < 3) {
@@ -375,7 +375,7 @@ describe('useId', () => {
375
`);
376
});
377
378
- test('basic incremental hydration', async () => {
378
+ it('basic incremental hydration', async () => {
379
function App() {
380
return (
381
<div>
@@ -416,7 +416,7 @@ describe('useId', () => {
416
`);
417
});
418
419
- test('inserting/deleting siblings outside a dehydrated Suspense boundary', async () => {
419
+ it('inserting/deleting siblings outside a dehydrated Suspense boundary', async () => {
420
const span = React.createRef(null);
421
function App({swap}) {
422
// Note: Using a dynamic array so these are treated as insertions and
@@ -500,7 +500,7 @@ describe('useId', () => {
500
expect(span.current).toBe(dehydratedSpan);
501
});
502
503
- test('inserting/deleting siblings inside a dehydrated Suspense boundary', async () => {
503
+ it('inserting/deleting siblings inside a dehydrated Suspense boundary', async () => {
504
const span = React.createRef(null);
505
function App({swap}) {
506
// Note: Using a dynamic array so these are treated as insertions and
@@ -575,7 +575,7 @@ describe('useId', () => {
575
expect(span.current).toBe(dehydratedSpan);
576
});
577
578
- test('identifierPrefix option', async () => {
578
+ it('identifierPrefix option', async () => {
579
function Child() {
580
const id = useId();
581
return <div>{id}</div>;
packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js
+1
-1
@@ -14,7 +14,7 @@ describe('ReactDOMRoot', () => {
14
});
15
16
// @gate !disableLegacyMode
17
- test('deprecation warning for ReactDOM.render', () => {
17
+ it('deprecation warning for ReactDOM.render', () => {
18
spyOnDev(console, 'error');
19
20
ReactDOM.render('Hi', container);
packages/react-dom/src/__tests__/ReactStartTransitionMultipleRenderers-test.js
+1
-1
@@ -95,7 +95,7 @@ describe('ReactStartTransitionMultipleRenderers', () => {
95
// built, it only works when running tests using the actual build artifacts,
96
// not the source files.
97
// @gate !source
98
- test('React.startTransition works across multiple renderers', async () => {
98
+ it('React.startTransition works across multiple renderers', async () => {
99
const ReactNoop = require('react-noop-renderer');
100
101
const setIsPendings = new Set();
packages/react-dom/src/__tests__/ReactTestUtilsActUnmockedScheduler-test.js
+5
-5
@@ -43,7 +43,7 @@ afterEach(() => {
43
});
44
45
// @gate __DEV__
46
-it('can use act to flush effects', async () => {
46
+test('can use act to flush effects', async () => {
47
function App() {
48
React.useEffect(() => {
49
yields.push(100);
@@ -60,7 +60,7 @@ it('can use act to flush effects', async () => {
60
});
61
62
// @gate __DEV__
63
-it('flushes effects on every call', async () => {
63
+test('flushes effects on every call', async () => {
64
function App() {
65
const [ctr, setCtr] = React.useState(0);
66
React.useEffect(() => {
@@ -100,7 +100,7 @@ it('flushes effects on every call', async () => {
100
});
101
102
// @gate __DEV__
103
-it("should keep flushing effects until they're done", async () => {
103
+test("should keep flushing effects until they're done", async () => {
104
function App() {
105
const [ctr, setCtr] = React.useState(0);
106
React.useEffect(() => {
@@ -120,7 +120,7 @@ it("should keep flushing effects until they're done", async () => {
120
});
121
122
// @gate __DEV__
123
-it('should flush effects only on exiting the outermost act', async () => {
123
+test('should flush effects only on exiting the outermost act', async () => {
124
function App() {
125
React.useEffect(() => {
126
yields.push(0);
@@ -142,7 +142,7 @@ it('should flush effects only on exiting the outermost act', async () => {
142
});
143
144
// @gate __DEV__
145
-it('can handle cascading promises', async () => {
145
+test('can handle cascading promises', async () => {
146
// this component triggers an effect, that waits a tick,
147
// then sets state. repeats this 5 times.
148
function App() {
packages/react-dom/src/events/__tests__/SyntheticFocusEvent-test.js
+2
-2
@@ -28,7 +28,7 @@ describe('SyntheticFocusEvent', () => {
28
container = null;
29
});
30
31
- test('onFocus events have the focus type', async () => {
31
+ it('onFocus events have the focus type', async () => {
32
const log = [];
33
const root = ReactDOMClient.createRoot(container);
34
await act(() => {
@@ -54,7 +54,7 @@ describe('SyntheticFocusEvent', () => {
54
expect(log).toEqual(['onFocusCapture: focus', 'onFocus: focus']);
55
});
56
57
- test('onBlur events have the blur type', async () => {
57
+ it('onBlur events have the blur type', async () => {
58
const log = [];
59
const root = ReactDOMClient.createRoot(container);
60
await act(() => {
packages/react-dom/src/events/plugins/__tests__/EnterLeaveEventPlugin-test.js
+1
-1
@@ -295,7 +295,7 @@ describe('EnterLeaveEventPlugin', () => {
295
expect(onMouseLeave).toHaveBeenCalledTimes(1);
296
});
297
298
- it('should work with portals that have onMouseEnter outside of the root ', async () => {
298
+ it('should work with portals that have onMouseEnter outside of the root', async () => {
299
const divRef = React.createRef();
300
const otherDivRef = React.createRef();
301
const onMouseEnter = jest.fn();
packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js
+5
-4
@@ -139,8 +139,9 @@ describe('SimpleEventPlugin', function () {
139
expect(onClick).toHaveBeenCalledTimes(1);
140
});
141
142
- ['button', 'input', 'select', 'textarea'].forEach(function (tagName) {
143
- describe(tagName, function () {
142
+ describe.each(['button', 'input', 'select', 'textarea'])(
143
+ '%s',
144
+ function (tagName) {
145
it('should forward clicks when it starts out not disabled', async () => {
146
const element = React.createElement(tagName, {
147
onClick: onClick,
@@ -207,8 +208,8 @@ describe('SimpleEventPlugin', function () {
208
const element = container.firstChild;
209
await expectClickThru(element);
210
});
210
- });
211
- });
211
+ },
212
+ );
213
214
it('batches updates that occur as a result of a nested event dispatch', async () => {
215
container = document.createElement('div');
packages/react-native-renderer/src/__tests__/ReactNativeEvents-test.internal.js
+7
-7
@@ -80,7 +80,7 @@ beforeEach(() => {
80
});
81
82
// @gate !disableLegacyMode
83
-it('fails to register the same event name with different types', async () => {
83
+test('fails to register the same event name with different types', async () => {
84
const InvalidEvents = createReactNativeComponentClass('InvalidEvents', () => {
85
if (!__DEV__) {
86
// Simulate a registration error in prod.
@@ -124,7 +124,7 @@ it('fails to register the same event name with different types', async () => {
124
});
125
126
// @gate !disableLegacyMode
127
-it('fails if unknown/unsupported event types are dispatched', () => {
127
+test('fails if unknown/unsupported event types are dispatched', () => {
128
expect(RCTEventEmitter.register).toHaveBeenCalledTimes(1);
129
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
130
const View = fakeRequireNativeComponent('View', {});
@@ -149,7 +149,7 @@ it('fails if unknown/unsupported event types are dispatched', () => {
149
});
150
151
// @gate !disableLegacyMode
152
-it('handles events', () => {
152
+test('handles events', () => {
153
expect(RCTEventEmitter.register).toHaveBeenCalledTimes(1);
154
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
155
const View = fakeRequireNativeComponent('View', {foo: true});
@@ -211,7 +211,7 @@ it('handles events', () => {
211
212
// @gate !disableLegacyContext || !__DEV__
213
// @gate !disableLegacyMode
214
-it('handles events on text nodes', () => {
214
+test('handles events on text nodes', () => {
215
expect(RCTEventEmitter.register).toHaveBeenCalledTimes(1);
216
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
217
const Text = fakeRequireNativeComponent('RCTText', {});
@@ -295,7 +295,7 @@ it('handles events on text nodes', () => {
295
});
296
297
// @gate !disableLegacyMode
298
-it('handles when a responder is unmounted while a touch sequence is in progress', () => {
298
+test('handles when a responder is unmounted while a touch sequence is in progress', () => {
299
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
300
const View = fakeRequireNativeComponent('View', {id: true});
301
@@ -385,7 +385,7 @@ it('handles when a responder is unmounted while a touch sequence is in progress'
385
});
386
387
// @gate !disableLegacyMode
388
-it('handles events without target', () => {
388
+test('handles events without target', () => {
389
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
390
391
const View = fakeRequireNativeComponent('View', {id: true});
@@ -476,7 +476,7 @@ it('handles events without target', () => {
476
});
477
478
// @gate !disableLegacyMode
479
-it('dispatches event with target as instance', () => {
479
+test('dispatches event with target as instance', () => {
480
const EventEmitter = RCTEventEmitter.register.mock.calls[0][0];
481
482
const View = fakeRequireNativeComponent('View', {id: true});
packages/react-reconciler/src/__tests__/Activity-test.js
+1
@@ -1241,6 +1241,7 @@ describe('Activity', () => {
1241
// either an option or a heuristic to mount passive effects inside a hidden
1242
// tree after a delay.
1243
// @gate enableActivity
1244
+ // eslint-disable-next-line jest/no-disabled-tests
1245
it.skip("don't defer passive effects when prerendering in a tree whose effects are already connected", async () => {
1246
function Child({label}) {
1247
useEffect(() => {
packages/react-reconciler/src/__tests__/ActivitySuspense-test.js
+1
-1
@@ -99,7 +99,7 @@ describe('Activity Suspense', () => {
99
}
100
101
// @gate enableActivity
102
- test('basic example of suspending inside hidden tree', async () => {
102
+ it('basic example of suspending inside hidden tree', async () => {
103
const root = ReactNoop.createRoot();
104
105
function App() {
packages/react-reconciler/src/__tests__/ReactActWarnings-test.js
+7
-7
@@ -150,7 +150,7 @@ describe('act warnings', () => {
150
}
151
}
152
153
- test('warns about unwrapped updates only if environment flag is enabled', async () => {
153
+ it('warns about unwrapped updates only if environment flag is enabled', async () => {
154
let setState;
155
function App() {
156
const [state, _setState] = useState(0);
@@ -187,7 +187,7 @@ describe('act warnings', () => {
187
});
188
189
// @gate __DEV__
190
- test('act warns if the environment flag is not enabled', async () => {
190
+ it('act warns if the environment flag is not enabled', async () => {
191
let setState;
192
function App() {
193
const [state, _setState] = useState(0);
@@ -237,7 +237,7 @@ describe('act warnings', () => {
237
});
238
});
239
240
- test('warns if root update is not wrapped', async () => {
240
+ it('warns if root update is not wrapped', async () => {
241
await withActEnvironment(true, () => {
242
const root = ReactNoop.createRoot();
243
expect(() => root.render('Hi')).toErrorDev(
@@ -250,7 +250,7 @@ describe('act warnings', () => {
250
});
251
252
// @gate __DEV__
253
- test('warns if class update is not wrapped', async () => {
253
+ it('warns if class update is not wrapped', async () => {
254
let app;
255
class App extends React.Component {
256
state = {count: 0};
@@ -272,7 +272,7 @@ describe('act warnings', () => {
272
});
273
274
// @gate __DEV__
275
- test('warns even if update is synchronous', async () => {
275
+ it('warns even if update is synchronous', async () => {
276
let setState;
277
function App() {
278
const [state, _setState] = useState(0);
@@ -299,7 +299,7 @@ describe('act warnings', () => {
299
300
// @gate __DEV__
301
// @gate enableLegacyCache
302
- test('warns if Suspense retry is not wrapped', async () => {
302
+ it('warns if Suspense retry is not wrapped', async () => {
303
function App() {
304
return (
305
<Suspense fallback={<Text text="Loading..." />}>
@@ -327,7 +327,7 @@ describe('act warnings', () => {
327
328
// @gate __DEV__
329
// @gate enableLegacyCache
330
- test('warns if Suspense ping is not wrapped', async () => {
330
+ it('warns if Suspense ping is not wrapped', async () => {
331
function App({showMore}) {
332
return (
333
<Suspense fallback={<Text text="Loading..." />}>
packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js
+26
-26
@@ -122,7 +122,7 @@ describe('ReactAsyncActions', () => {
122
}
123
124
// @gate enableAsyncActions
125
- test('isPending remains true until async action finishes', async () => {
125
+ it('isPending remains true until async action finishes', async () => {
126
let startTransition;
127
function App() {
128
const [isPending, _start] = useTransition();
@@ -155,7 +155,7 @@ describe('ReactAsyncActions', () => {
155
});
156
157
// @gate enableAsyncActions
158
- test('multiple updates in an async action scope are entangled together', async () => {
158
+ it('multiple updates in an async action scope are entangled together', async () => {
159
let startTransition;
160
function App({text}) {
161
const [isPending, _start] = useTransition();
@@ -211,7 +211,7 @@ describe('ReactAsyncActions', () => {
211
});
212
213
// @gate enableAsyncActions
214
- test('multiple async action updates in the same scope are entangled together', async () => {
214
+ it('multiple async action updates in the same scope are entangled together', async () => {
215
let setStepA;
216
function A() {
217
const [step, setStep] = useState(0);
@@ -337,7 +337,7 @@ describe('ReactAsyncActions', () => {
337
});
338
339
// @gate enableAsyncActions
340
- test('urgent updates are not blocked during an async action', async () => {
340
+ it('urgent updates are not blocked during an async action', async () => {
341
let setStepA;
342
function A() {
343
const [step, setStep] = useState(0);
@@ -418,7 +418,7 @@ describe('ReactAsyncActions', () => {
418
});
419
420
// @gate enableAsyncActions
421
- test("if a sync action throws, it's rethrown from the `useTransition`", async () => {
421
+ it("if a sync action throws, it's rethrown from the `useTransition`", async () => {
422
class ErrorBoundary extends React.Component {
423
state = {error: null};
424
static getDerivedStateFromError(error) {
@@ -460,7 +460,7 @@ describe('ReactAsyncActions', () => {
460
});
461
462
// @gate enableAsyncActions
463
- test("if an async action throws, it's rethrown from the `useTransition`", async () => {
463
+ it("if an async action throws, it's rethrown from the `useTransition`", async () => {
464
class ErrorBoundary extends React.Component {
465
state = {error: null};
466
static getDerivedStateFromError(error) {
@@ -508,7 +508,7 @@ describe('ReactAsyncActions', () => {
508
});
509
510
// @gate !enableAsyncActions
511
- test('when enableAsyncActions is disabled, and a sync action throws, `isPending` is turned off', async () => {
511
+ it('when enableAsyncActions is disabled, and a sync action throws, `isPending` is turned off', async () => {
512
let startTransition;
513
function App() {
514
const [isPending, _start] = useTransition();
@@ -535,7 +535,7 @@ describe('ReactAsyncActions', () => {
535
});
536
537
// @gate enableAsyncActions
538
- test('if there are multiple entangled actions, and one of them errors, it only affects that action', async () => {
538
+ it('if there are multiple entangled actions, and one of them errors, it only affects that action', async () => {
539
class ErrorBoundary extends React.Component {
540
state = {error: null};
541
static getDerivedStateFromError(error) {
@@ -652,7 +652,7 @@ describe('ReactAsyncActions', () => {
652
});
653
654
// @gate enableAsyncActions
655
- test('useOptimistic can be used to implement a pending state', async () => {
655
+ it('useOptimistic can be used to implement a pending state', async () => {
656
const startTransition = React.startTransition;
657
658
let setIsPending;
@@ -702,7 +702,7 @@ describe('ReactAsyncActions', () => {
702
});
703
704
// @gate enableAsyncActions
705
- test('useOptimistic rebases pending updates on top of passthrough value', async () => {
705
+ it('useOptimistic rebases pending updates on top of passthrough value', async () => {
706
let serverCart = ['A'];
707
708
async function submitNewItem(item) {
@@ -823,7 +823,7 @@ describe('ReactAsyncActions', () => {
823
});
824
825
// @gate enableAsyncActions
826
- test(
826
+ it(
827
'regression: when there are no pending transitions, useOptimistic should ' +
828
'always return the passthrough value',
829
async () => {
@@ -869,7 +869,7 @@ describe('ReactAsyncActions', () => {
869
);
870
871
// @gate enableAsyncActions
872
- test('regression: useOptimistic during setState-in-render', async () => {
872
+ it('regression: useOptimistic during setState-in-render', async () => {
873
// This is a regression test for a very specific case where useOptimistic is
874
// the first hook in the component, it has a pending update, and a later
875
// hook schedules a local (setState-in-render) update. Don't sweat about
@@ -907,7 +907,7 @@ describe('ReactAsyncActions', () => {
907
});
908
909
// @gate enableAsyncActions
910
- test('useOptimistic accepts a custom reducer', async () => {
910
+ it('useOptimistic accepts a custom reducer', async () => {
911
let serverCart = ['A'];
912
913
async function submitNewItem(item) {
@@ -1039,7 +1039,7 @@ describe('ReactAsyncActions', () => {
1039
});
1040
1041
// @gate enableAsyncActions
1042
- test('useOptimistic rebases if the passthrough is updated during a render phase update', async () => {
1042
+ it('useOptimistic rebases if the passthrough is updated during a render phase update', async () => {
1043
// This is kind of an esoteric case where it's hard to come up with a
1044
// realistic real-world scenario but it should still work.
1045
let increment;
@@ -1124,7 +1124,7 @@ describe('ReactAsyncActions', () => {
1124
});
1125
1126
// @gate enableAsyncActions
1127
- test('useOptimistic rebases if the passthrough is updated during a render phase update (initial mount)', async () => {
1127
+ it('useOptimistic rebases if the passthrough is updated during a render phase update (initial mount)', async () => {
1128
// This is kind of an esoteric case where it's hard to come up with a
1129
// realistic real-world scenario but it should still work.
1130
function App() {
@@ -1164,7 +1164,7 @@ describe('ReactAsyncActions', () => {
1164
});
1165
1166
// @gate enableAsyncActions
1167
- test('useOptimistic can update repeatedly in the same async action', async () => {
1167
+ it('useOptimistic can update repeatedly in the same async action', async () => {
1168
let startTransition;
1169
let setLoadingProgress;
1170
let setText;
@@ -1228,7 +1228,7 @@ describe('ReactAsyncActions', () => {
1228
});
1229
1230
// @gate enableAsyncActions
1231
- test('useOptimistic warns if outside of a transition', async () => {
1231
+ it('useOptimistic warns if outside of a transition', async () => {
1232
let startTransition;
1233
let setLoadingProgress;
1234
let setText;
@@ -1276,7 +1276,7 @@ describe('ReactAsyncActions', () => {
1276
});
1277
1278
// @gate enableAsyncActions
1279
- test(
1279
+ it(
1280
'optimistic state is not reverted until async action finishes, even if ' +
1281
'useTransition hook is unmounted',
1282
async () => {
@@ -1379,7 +1379,7 @@ describe('ReactAsyncActions', () => {
1379
);
1380
1381
// @gate enableAsyncActions
1382
- test(
1382
+ it(
1383
'updates in an async action are entangled even if useTransition hook ' +
1384
'is unmounted before it finishes',
1385
async () => {
@@ -1467,7 +1467,7 @@ describe('ReactAsyncActions', () => {
1467
);
1468
1469
// @gate enableAsyncActions
1470
- test(
1470
+ it(
1471
'updates in an async action are entangled even if useTransition hook ' +
1472
'is unmounted before it finishes (class component)',
1473
async () => {
@@ -1562,7 +1562,7 @@ describe('ReactAsyncActions', () => {
1562
);
1563
1564
// @gate enableAsyncActions
1565
- test(
1565
+ it(
1566
'updates in an async action are entangled even if useTransition hook ' +
1567
'is unmounted before it finishes (root update)',
1568
async () => {
@@ -1647,7 +1647,7 @@ describe('ReactAsyncActions', () => {
1647
);
1648
1649
// @gate enableAsyncActions
1650
- test('React.startTransition supports async actions', async () => {
1650
+ it('React.startTransition supports async actions', async () => {
1651
const startTransition = React.startTransition;
1652
1653
function App({text}) {
@@ -1685,7 +1685,7 @@ describe('ReactAsyncActions', () => {
1685
});
1686
1687
// @gate enableAsyncActions
1688
- test('useOptimistic works with async actions passed to React.startTransition', async () => {
1688
+ it('useOptimistic works with async actions passed to React.startTransition', async () => {
1689
const startTransition = React.startTransition;
1690
1691
let setOptimisticText;
@@ -1732,7 +1732,7 @@ describe('ReactAsyncActions', () => {
1732
});
1733
1734
// @gate enableAsyncActions
1735
- test(
1735
+ it(
1736
'regression: updates in an action passed to React.startTransition are batched ' +
1737
'even if there were no updates before the first await',
1738
async () => {
@@ -1801,7 +1801,7 @@ describe('ReactAsyncActions', () => {
1801
},
1802
);
1803
1804
- test('React.startTransition captures async errors and passes them to reportError', async () => {
1804
+ it('React.startTransition captures async errors and passes them to reportError', async () => {
1805
// NOTE: This is gated here instead of using the pragma because the failure
1806
// happens asynchronously and the `gate` runtime doesn't capture it.
1807
if (gate(flags => flags.enableAsyncActions)) {
@@ -1815,7 +1815,7 @@ describe('ReactAsyncActions', () => {
1815
});
1816
1817
// @gate enableAsyncActions
1818
- test('React.startTransition captures sync errors and passes them to reportError', async () => {
1818
+ it('React.startTransition captures sync errors and passes them to reportError', async () => {
1819
await act(() => {
1820
try {
1821
React.startTransition(() => {
packages/react-reconciler/src/__tests__/ReactClassComponentPropResolution-test.js
+1
-1
@@ -31,7 +31,7 @@ describe('ReactClassComponentPropResolution', () => {
31
return text;
32
}
33
34
- test('resolves ref and default props before calling lifecycle methods', async () => {
34
+ it('resolves ref and default props before calling lifecycle methods', async () => {
35
const root = ReactNoop.createRoot();
36
37
function getPropKeys(props) {
packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js
+1
-1
@@ -22,7 +22,7 @@ describe('ReactClassSetStateCallback', () => {
22
return text;
23
}
24
25
- test('regression: setState callback (2nd arg) should only fire once, even after a rebase', async () => {
25
+ it('regression: setState callback (2nd arg) should only fire once, even after a rebase', async () => {
26
let app;
27
class App extends React.Component {
28
state = {step: 0};
packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js
+4
-4
@@ -162,7 +162,7 @@ describe('ReactConcurrentErrorRecovery', () => {
162
const rejectText = rejectMostRecentTextCache;
163
164
// @gate enableLegacyCache
165
- test('errors during a refresh transition should not force fallbacks to display (suspend then error)', async () => {
165
+ it('errors during a refresh transition should not force fallbacks to display (suspend then error)', async () => {
166
class ErrorBoundary extends React.Component {
167
state = {error: null};
168
static getDerivedStateFromError(error) {
@@ -234,7 +234,7 @@ describe('ReactConcurrentErrorRecovery', () => {
234
});
235
236
// @gate enableLegacyCache
237
- test('errors during a refresh transition should not force fallbacks to display (error then suspend)', async () => {
237
+ it('errors during a refresh transition should not force fallbacks to display (error then suspend)', async () => {
238
class ErrorBoundary extends React.Component {
239
state = {error: null};
240
static getDerivedStateFromError(error) {
@@ -306,7 +306,7 @@ describe('ReactConcurrentErrorRecovery', () => {
306
});
307
308
// @gate enableLegacyCache
309
- test('suspending in the shell (outside a Suspense boundary) should not throw, warn, or log during a transition', async () => {
309
+ it('suspending in the shell (outside a Suspense boundary) should not throw, warn, or log during a transition', async () => {
310
class ErrorBoundary extends React.Component {
311
state = {error: null};
312
static getDerivedStateFromError(error) {
@@ -356,7 +356,7 @@ describe('ReactConcurrentErrorRecovery', () => {
356
});
357
358
// @gate enableLegacyCache
359
- test(
359
+ it(
360
'errors during a suspended transition at the shell should not force ' +
361
'fallbacks to display (error then suspend)',
362
async () => {
packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js
+14
-14
@@ -169,7 +169,7 @@ describe('ReactLazyContextPropagation', () => {
169
// }
170
// }
171
172
- test(
172
+ it(
173
'context change should prevent bailout of memoized component (useMemo -> ' +
174
'no intermediate fiber)',
175
async () => {
@@ -217,7 +217,7 @@ describe('ReactLazyContextPropagation', () => {
217
},
218
);
219
220
- test('context change should prevent bailout of memoized component (memo HOC)', async () => {
220
+ it('context change should prevent bailout of memoized component (memo HOC)', async () => {
221
const root = ReactNoop.createRoot();
222
223
const Context = React.createContext(0);
@@ -258,7 +258,7 @@ describe('ReactLazyContextPropagation', () => {
258
expect(root).toMatchRenderedOutput('1');
259
});
260
261
- test('context change should prevent bailout of memoized component (PureComponent)', async () => {
261
+ it('context change should prevent bailout of memoized component (PureComponent)', async () => {
262
const root = ReactNoop.createRoot();
263
264
const Context = React.createContext(0);
@@ -301,7 +301,7 @@ describe('ReactLazyContextPropagation', () => {
301
expect(root).toMatchRenderedOutput('1');
302
});
303
304
- test("context consumer bails out if context hasn't changed", async () => {
304
+ it("context consumer bails out if context hasn't changed", async () => {
305
const root = ReactNoop.createRoot();
306
307
const Context = React.createContext(0);
@@ -349,7 +349,7 @@ describe('ReactLazyContextPropagation', () => {
349
});
350
351
// @gate enableLegacyCache
352
- test('context is propagated across retries', async () => {
352
+ it('context is propagated across retries', async () => {
353
const root = ReactNoop.createRoot();
354
355
const Context = React.createContext('A');
@@ -410,7 +410,7 @@ describe('ReactLazyContextPropagation', () => {
410
});
411
412
// @gate enableLegacyCache
413
- test('multiple contexts are propagated across retries', async () => {
413
+ it('multiple contexts are propagated across retries', async () => {
414
// Same as previous test, but with multiple context providers
415
const root = ReactNoop.createRoot();
416
@@ -490,7 +490,7 @@ describe('ReactLazyContextPropagation', () => {
490
});
491
492
// @gate enableLegacyCache && !disableLegacyMode
493
- test('context is propagated across retries (legacy)', async () => {
493
+ it('context is propagated across retries (legacy)', async () => {
494
const root = ReactNoop.createLegacyRoot();
495
496
const Context = React.createContext('A');
@@ -551,7 +551,7 @@ describe('ReactLazyContextPropagation', () => {
551
});
552
553
// @gate enableLegacyCache && enableLegacyHidden
554
- test('context is propagated through offscreen trees', async () => {
554
+ it('context is propagated through offscreen trees', async () => {
555
const LegacyHidden = React.unstable_LegacyHidden;
556
557
const root = ReactNoop.createRoot();
@@ -597,7 +597,7 @@ describe('ReactLazyContextPropagation', () => {
597
});
598
599
// @gate enableLegacyCache && enableLegacyHidden
600
- test('multiple contexts are propagated across through offscreen trees', async () => {
600
+ it('multiple contexts are propagated across through offscreen trees', async () => {
601
// Same as previous test, but with multiple context providers
602
const LegacyHidden = React.unstable_LegacyHidden;
603
@@ -658,7 +658,7 @@ describe('ReactLazyContextPropagation', () => {
658
});
659
660
// @gate enableSuspenseList
661
- test('contexts are propagated through SuspenseList', async () => {
661
+ it('contexts are propagated through SuspenseList', async () => {
662
// This kinda tests an implementation detail. SuspenseList has an early
663
// bailout that doesn't use `bailoutOnAlreadyFinishedWork`. It probably
664
// should just use that function, though.
@@ -699,7 +699,7 @@ describe('ReactLazyContextPropagation', () => {
699
expect(root).toMatchRenderedOutput('BB');
700
});
701
702
- test('nested bailouts', async () => {
702
+ it('nested bailouts', async () => {
703
// Lazy context propagation will stop propagating when it hits the first
704
// match. If we bail out again inside that tree, we must resume propagating.
705
@@ -754,7 +754,7 @@ describe('ReactLazyContextPropagation', () => {
754
});
755
756
// @gate enableLegacyCache
757
- test('nested bailouts across retries', async () => {
757
+ it('nested bailouts across retries', async () => {
758
// Lazy context propagation will stop propagating when it hits the first
759
// match. If we bail out again inside that tree, we must resume propagating.
760
@@ -823,7 +823,7 @@ describe('ReactLazyContextPropagation', () => {
823
});
824
825
// @gate enableLegacyCache && enableLegacyHidden
826
- test('nested bailouts through offscreen trees', async () => {
826
+ it('nested bailouts through offscreen trees', async () => {
827
// Lazy context propagation will stop propagating when it hits the first
828
// match. If we bail out again inside that tree, we must resume propagating.
829
@@ -877,7 +877,7 @@ describe('ReactLazyContextPropagation', () => {
877
expect(root).toMatchRenderedOutput('BB');
878
});
879
880
- test('finds context consumers in multiple sibling branches', async () => {
880
+ it('finds context consumers in multiple sibling branches', async () => {
881
// This test confirms that when we find a matching context consumer during
882
// propagation, we continue propagating to its sibling branches.
883
packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js
+2
-2
@@ -36,7 +36,7 @@ describe('ReactEffectOrdering', () => {
36
assertLog = InternalTestUtils.assertLog;
37
});
38
39
- test('layout unmounts on deletion are fired in parent -> child order', async () => {
39
+ it('layout unmounts on deletion are fired in parent -> child order', async () => {
40
const root = ReactNoop.createRoot();
41
42
function Parent() {
@@ -63,7 +63,7 @@ describe('ReactEffectOrdering', () => {
63
assertLog(['Unmount parent', 'Unmount child']);
64
});
65
66
- test('passive unmounts on deletion are fired in parent -> child order', async () => {
66
+ it('passive unmounts on deletion are fired in parent -> child order', async () => {
67
const root = ReactNoop.createRoot();
68
69
function Parent() {
packages/react-reconciler/src/__tests__/ReactFiberRefs-test.js
+6
-6
@@ -25,7 +25,7 @@ describe('ReactFiberRefs', () => {
25
assertLog = require('internal-test-utils').assertLog;
26
});
27
28
- test('ref is attached even if there are no other updates (class)', async () => {
28
+ it('ref is attached even if there are no other updates (class)', async () => {
29
let component;
30
class Component extends React.Component {
31
shouldComponentUpdate() {
@@ -61,7 +61,7 @@ describe('ReactFiberRefs', () => {
61
expect(ref2.current).toBe(component);
62
});
63
64
- test('ref is attached even if there are no other updates (host component)', async () => {
64
+ it('ref is attached even if there are no other updates (host component)', async () => {
65
// This is kind of ailly test because host components never bail out if they
66
// receive a new element, and there's no way to update a ref without also
67
// updating the props, but adding it here anyway for symmetry with the
@@ -87,7 +87,7 @@ describe('ReactFiberRefs', () => {
87
88
// @gate enableRefAsProp
89
// @gate !disableStringRefs
90
- test('string ref props are converted to function refs', async () => {
90
+ it('string ref props are converted to function refs', async () => {
91
let refProp;
92
function Child({ref}) {
93
refProp = ref;
@@ -115,7 +115,7 @@ describe('ReactFiberRefs', () => {
115
});
116
117
// @gate disableStringRefs
118
- test('throw if a string ref is passed to a ref-receiving component', async () => {
118
+ it('throw if a string ref is passed to a ref-receiving component', async () => {
119
let refProp;
120
function Child({ref}) {
121
// This component renders successfully because the ref type check does not
@@ -139,7 +139,7 @@ describe('ReactFiberRefs', () => {
139
expect(refProp).toBe('child');
140
});
141
142
- test('strings refs can be codemodded to callback refs', async () => {
142
+ it('strings refs can be codemodded to callback refs', async () => {
143
let app;
144
class App extends React.Component {
145
render() {
@@ -163,7 +163,7 @@ describe('ReactFiberRefs', () => {
163
expect(app.refs.div.prop).toBe('Hello!');
164
});
165
166
- test('class refs are initialized to a frozen shared object', async () => {
166
+ it('class refs are initialized to a frozen shared object', async () => {
167
const refsCollection = new Set();
168
class Component extends React.Component {
169
constructor(props) {
packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js
+1
-1
@@ -93,7 +93,7 @@ describe('ReactFlushSync (AggregateError not available)', () => {
93
: children;
94
}
95
96
- test('completely exhausts synchronous work queue even if something throws', async () => {
96
+ it('completely exhausts synchronous work queue even if something throws', async () => {
97
function Throws({error}) {
98
throw error;
99
}
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
-19
@@ -1244,25 +1244,6 @@ describe('ReactHooks', () => {
1244
]);
1245
});
1246
1247
- it('warns when reading context inside useMemo', async () => {
1248
- const {useMemo, createContext} = React;
1249
- const ReactSharedInternals =
1250
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
1251
-
1252
- const ThemeContext = createContext('light');
1253
- function App() {
1254
- return useMemo(() => {
1255
- return ReactSharedInternals.H.readContext(ThemeContext);
1256
- }, []);
1257
- }
1258
-
1259
- await expect(async () => {
1260
- await act(() => {
1261
- ReactTestRenderer.create(<App />, {unstable_isConcurrent: true});
1262
- });
1263
- }).toErrorDev('Context can only be read while React is rendering');
1264
- });
1265
-
1247
it('double-invokes components with Hooks in Strict Mode', async () => {
1248
ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = true;
1249
packages/react-reconciler/src/__tests__/ReactIncremental-test.js
+30
-15
@@ -325,7 +325,8 @@ describe('ReactIncremental', () => {
325
await waitForAll(['Middle', 'Middle']);
326
});
327
328
- xit('can resume work in a subtree even when a parent bails out', async () => {
328
+ // eslint-disable-next-line jest/no-disabled-tests
329
+ it.skip('can resume work in a subtree even when a parent bails out', async () => {
330
function Bar(props) {
331
Scheduler.log('Bar');
332
return <div>{props.children}</div>;
@@ -381,7 +382,8 @@ describe('ReactIncremental', () => {
382
await waitForAll(['Middle']);
383
});
384
384
- xit('can resume work in a bailed subtree within one pass', async () => {
385
+ // eslint-disable-next-line jest/no-disabled-tests
386
+ it.skip('can resume work in a bailed subtree within one pass', async () => {
387
function Bar(props) {
388
Scheduler.log('Bar');
389
return <div>{props.children}</div>;
@@ -467,7 +469,8 @@ describe('ReactIncremental', () => {
469
await waitForAll(['Foo', 'Bar', 'Bar']);
470
});
471
470
- xit('can resume mounting a class component', async () => {
472
+ // eslint-disable-next-line jest/no-disabled-tests
473
+ it.skip('can resume mounting a class component', async () => {
474
let foo;
475
class Parent extends React.Component {
476
shouldComponentUpdate() {
@@ -505,7 +508,8 @@ describe('ReactIncremental', () => {
508
await waitForAll(['Foo', 'Bar']);
509
});
510
508
- xit('reuses the same instance when resuming a class instance', async () => {
511
+ // eslint-disable-next-line jest/no-disabled-tests
512
+ it.skip('reuses the same instance when resuming a class instance', async () => {
513
let foo;
514
class Parent extends React.Component {
515
shouldComponentUpdate() {
@@ -572,7 +576,8 @@ describe('ReactIncremental', () => {
576
]);
577
});
578
575
- xit('can reuse work done after being preempted', async () => {
579
+ // eslint-disable-next-line jest/no-disabled-tests
580
+ it.skip('can reuse work done after being preempted', async () => {
581
function Bar(props) {
582
Scheduler.log('Bar');
583
return <div>{props.children}</div>;
@@ -650,7 +655,8 @@ describe('ReactIncremental', () => {
655
await waitForAll(['Middle']);
656
});
657
653
- xit('can reuse work that began but did not complete, after being preempted', async () => {
658
+ // eslint-disable-next-line jest/no-disabled-tests
659
+ it.skip('can reuse work that began but did not complete, after being preempted', async () => {
660
let child;
661
let sibling;
662
@@ -724,7 +730,8 @@ describe('ReactIncremental', () => {
730
]);
731
});
732
727
- xit('can reuse work if shouldComponentUpdate is false, after being preempted', async () => {
733
+ // eslint-disable-next-line jest/no-disabled-tests
734
+ it.skip('can reuse work if shouldComponentUpdate is false, after being preempted', async () => {
735
function Bar(props) {
736
Scheduler.log('Bar');
737
return <div>{props.children}</div>;
@@ -1048,7 +1055,8 @@ describe('ReactIncremental', () => {
1055
await waitForAll([]);
1056
});
1057
1051
- xit('can call sCU while resuming a partly mounted component', () => {
1058
+ // eslint-disable-next-line jest/no-disabled-tests
1059
+ it.skip('can call sCU while resuming a partly mounted component', () => {
1060
const instances = new Set();
1061
1062
class Bar extends React.Component {
@@ -1093,7 +1101,8 @@ describe('ReactIncremental', () => {
1101
expect(instances.size).toBe(4);
1102
});
1103
1096
- xit('gets new props when setting state on a partly updated component', async () => {
1104
+ // eslint-disable-next-line jest/no-disabled-tests
1105
+ it.skip('gets new props when setting state on a partly updated component', async () => {
1106
const instances = [];
1107
1108
class Bar extends React.Component {
@@ -1155,7 +1164,8 @@ describe('ReactIncremental', () => {
1164
await waitForAll(['Bar:A-1', 'Baz']);
1165
});
1166
1158
- xit('calls componentWillMount twice if the initial render is aborted', async () => {
1167
+ // eslint-disable-next-line jest/no-disabled-tests
1168
+ it.skip('calls componentWillMount twice if the initial render is aborted', async () => {
1169
class LifeCycle extends React.Component {
1170
state = {x: this.props.x};
1171
UNSAFE_componentWillReceiveProps(nextProps) {
@@ -1207,7 +1217,8 @@ describe('ReactIncremental', () => {
1217
]);
1218
});
1219
1210
- xit('uses state set in componentWillMount even if initial render was aborted', async () => {
1220
+ // eslint-disable-next-line jest/no-disabled-tests
1221
+ it.skip('uses state set in componentWillMount even if initial render was aborted', async () => {
1222
class LifeCycle extends React.Component {
1223
constructor(props) {
1224
super(props);
@@ -1245,7 +1256,8 @@ describe('ReactIncremental', () => {
1256
]);
1257
});
1258
1248
- xit('calls componentWill* twice if an update render is aborted', async () => {
1259
+ // eslint-disable-next-line jest/no-disabled-tests
1260
+ it.skip('calls componentWill* twice if an update render is aborted', async () => {
1261
class LifeCycle extends React.Component {
1262
UNSAFE_componentWillMount() {
1263
Scheduler.log('componentWillMount:' + this.props.x);
@@ -1390,7 +1402,8 @@ describe('ReactIncremental', () => {
1402
await waitForAll(['Child']);
1403
});
1404
1393
- xit('does not call componentWillReceiveProps for state-only updates', async () => {
1405
+ // eslint-disable-next-line jest/no-disabled-tests
1406
+ it.skip('does not call componentWillReceiveProps for state-only updates', async () => {
1407
const instances = [];
1408
1409
class LifeCycle extends React.Component {
@@ -1527,7 +1540,8 @@ describe('ReactIncremental', () => {
1540
// incomplete parents.
1541
});
1542
1530
- xit('skips will/DidUpdate when bailing unless an update was already in progress', async () => {
1543
+ // eslint-disable-next-line jest/no-disabled-tests
1544
+ it.skip('skips will/DidUpdate when bailing unless an update was already in progress', async () => {
1545
class LifeCycle extends React.Component {
1546
UNSAFE_componentWillMount() {
1547
Scheduler.log('componentWillMount');
@@ -2240,7 +2254,8 @@ describe('ReactIncremental', () => {
2254
]);
2255
});
2256
2243
- xit('should reuse memoized work if pointers are updated before calling lifecycles', async () => {
2257
+ // eslint-disable-next-line jest/no-disabled-tests
2258
+ it.skip('should reuse memoized work if pointers are updated before calling lifecycles', async () => {
2259
const cduNextProps = [];
2260
const cduPrevProps = [];
2261
const scuNextProps = [];
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js
+4
-2
@@ -752,7 +752,8 @@ describe('ReactIncrementalSideEffects', () => {
752
);
753
});
754
755
- xit('can defer side-effects and resume them later on', async () => {
755
+ // eslint-disable-next-line jest/no-disabled-tests
756
+ it.skip('can defer side-effects and resume them later on', async () => {
757
class Bar extends React.Component {
758
shouldComponentUpdate(nextProps) {
759
return this.props.idx !== nextProps.idx;
@@ -835,7 +836,8 @@ describe('ReactIncrementalSideEffects', () => {
836
expect(innerSpanA).toBe(innerSpanB);
837
});
838
838
- xit('can defer side-effects and reuse them later - complex', async function () {
839
+ // eslint-disable-next-line jest/no-disabled-tests
840
+ it.skip('can defer side-effects and reuse them later - complex', async function () {
841
let ops = [];
842
843
class Bar extends React.Component {
packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js
+3
-3
@@ -32,7 +32,7 @@ describe('ReactInterleavedUpdates', () => {
32
return text;
33
}
34
35
- test('update during an interleaved event is not processed during the current render', async () => {
35
+ it('update during an interleaved event is not processed during the current render', async () => {
36
const updaters = [];
37
38
function Child() {
@@ -87,7 +87,7 @@ describe('ReactInterleavedUpdates', () => {
87
});
88
89
// @gate forceConcurrentByDefaultForTesting
90
- test('low priority update during an interleaved event is not processed during the current render', async () => {
90
+ it('low priority update during an interleaved event is not processed during the current render', async () => {
91
// Same as previous test, but the interleaved update is lower priority than
92
// the in-progress render.
93
const updaters = [];
@@ -141,7 +141,7 @@ describe('ReactInterleavedUpdates', () => {
141
expect(root).toMatchRenderedOutput('222');
142
});
143
144
- test('regression for #24350: does not add to main update queue until interleaved update queue has been cleared', async () => {
144
+ it('regression for #24350: does not add to main update queue until interleaved update queue has been cleared', async () => {
145
let setStep;
146
function App() {
147
const [step, _setState] = useState(0);
packages/react-reconciler/src/__tests__/ReactIsomorphicAct-test.js
+12
-12
@@ -51,7 +51,7 @@ describe('isomorphic act()', () => {
51
}
52
53
// @gate __DEV__
54
- test('bypasses queueMicrotask', async () => {
54
+ it('bypasses queueMicrotask', async () => {
55
const root = ReactNoop.createRoot();
56
57
// First test what happens without wrapping in act. This update would
@@ -78,12 +78,12 @@ describe('isomorphic act()', () => {
78
});
79
80
// @gate __DEV__
81
- test('return value – sync callback', async () => {
81
+ it('return value – sync callback', async () => {
82
expect(await act(() => 'hi')).toEqual('hi');
83
});
84
85
// @gate __DEV__
86
- test('return value – sync callback, nested', async () => {
86
+ it('return value – sync callback, nested', async () => {
87
const returnValue = await act(() => {
88
return act(() => 'hi');
89
});
@@ -91,7 +91,7 @@ describe('isomorphic act()', () => {
91
});
92
93
// @gate __DEV__
94
- test('return value – async callback', async () => {
94
+ it('return value – async callback', async () => {
95
const returnValue = await act(async () => {
96
return await Promise.resolve('hi');
97
});
@@ -99,7 +99,7 @@ describe('isomorphic act()', () => {
99
});
100
101
// @gate __DEV__
102
- test('return value – async callback, nested', async () => {
102
+ it('return value – async callback, nested', async () => {
103
const returnValue = await act(async () => {
104
return await act(async () => {
105
return await Promise.resolve('hi');
@@ -109,7 +109,7 @@ describe('isomorphic act()', () => {
109
});
110
111
// @gate __DEV__ && !disableLegacyMode
112
- test('in legacy mode, updates are batched', () => {
112
+ it('in legacy mode, updates are batched', () => {
113
const root = ReactNoop.createLegacyRoot();
114
115
// Outside of `act`, legacy updates are flushed completely synchronously
@@ -137,7 +137,7 @@ describe('isomorphic act()', () => {
137
});
138
139
// @gate __DEV__ && !disableLegacyMode
140
- test('in legacy mode, in an async scope, updates are batched until the first `await`', async () => {
140
+ it('in legacy mode, in an async scope, updates are batched until the first `await`', async () => {
141
const root = ReactNoop.createLegacyRoot();
142
143
await act(async () => {
@@ -168,7 +168,7 @@ describe('isomorphic act()', () => {
168
});
169
170
// @gate __DEV__ && !disableLegacyMode
171
- test('in legacy mode, in an async scope, updates are batched until the first `await` (regression test: batchedUpdates)', async () => {
171
+ it('in legacy mode, in an async scope, updates are batched until the first `await` (regression test: batchedUpdates)', async () => {
172
const root = ReactNoop.createLegacyRoot();
173
174
await act(async () => {
@@ -206,7 +206,7 @@ describe('isomorphic act()', () => {
206
});
207
208
// @gate __DEV__
209
- test('unwraps promises by yielding to microtasks (async act scope)', async () => {
209
+ it('unwraps promises by yielding to microtasks (async act scope)', async () => {
210
const promise = Promise.resolve('Async');
211
212
function Fallback() {
@@ -231,7 +231,7 @@ describe('isomorphic act()', () => {
231
});
232
233
// @gate __DEV__
234
- test('unwraps promises by yielding to microtasks (non-async act scope)', async () => {
234
+ it('unwraps promises by yielding to microtasks (non-async act scope)', async () => {
235
const promise = Promise.resolve('Async');
236
237
function Fallback() {
@@ -258,7 +258,7 @@ describe('isomorphic act()', () => {
258
});
259
260
// @gate __DEV__
261
- test('warns if a promise is used in a non-awaited `act` scope', async () => {
261
+ it('warns if a promise is used in a non-awaited `act` scope', async () => {
262
const promise = new Promise(() => {});
263
264
function Fallback() {
@@ -298,7 +298,7 @@ describe('isomorphic act()', () => {
298
});
299
300
// @gate __DEV__
301
- test('does not warn when suspending via legacy `throw` API in non-awaited `act` scope', async () => {
301
+ it('does not warn when suspending via legacy `throw` API in non-awaited `act` scope', async () => {
302
let didResolve = false;
303
let resolvePromise;
304
const promise = new Promise(r => {
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
-88
@@ -2373,94 +2373,6 @@ describe('ReactSuspenseList', () => {
2373
expect(previousInst).toBe(setAsyncB);
2374
});
2375
2376
- // @gate enableSuspenseList
2377
- it('is able to re-suspend the last rows during an update with hidden', async () => {
2378
- const AsyncB = createAsyncText('B');
2379
-
2380
- let setAsyncB;
2381
-
2382
- function B() {
2383
- const [shouldBeAsync, setAsync] = React.useState(false);
2384
- setAsyncB = setAsync;
2385
-
2386
- return shouldBeAsync ? (
2387
- <Suspense fallback={<Text text="Loading B" />}>
2388
- <AsyncB />
2389
- </Suspense>
2390
- ) : (
2391
- <Text text="Sync B" />
2392
- );
2393
- }
2394
-
2395
- function Foo({updateList}) {
2396
- return (
2397
- <SuspenseList revealOrder="forwards" tail="hidden">
2398
- <Suspense key="A" fallback={<Text text="Loading A" />}>
2399
- <Text text="A" />
2400
- </Suspense>
2401
- <B key="B" updateList={updateList} />
2402
- </SuspenseList>
2403
- );
2404
- }
2405
-
2406
- ReactNoop.render(<Foo />);
2407
-
2408
- await waitForAll(['A', 'Sync B']);
2409
-
2410
- expect(ReactNoop).toMatchRenderedOutput(
2411
- <>
2412
- <span>A</span>
2413
- <span>Sync B</span>
2414
- </>,
2415
- );
2416
-
2417
- const previousInst = setAsyncB;
2418
-
2419
- // During an update we suspend on B.
2420
- await act(() => setAsyncB(true));
2421
-
2422
- assertLog([
2423
- 'Suspend! [B]',
2424
- 'Loading B',
2425
- // The second pass is the "force hide" pass
2426
- 'Loading B',
2427
- ]);
2428
-
2429
- expect(ReactNoop).toMatchRenderedOutput(
2430
- <>
2431
- <span>A</span>
2432
- <span>Loading B</span>
2433
- </>,
2434
- );
2435
-
2436
- // Before we resolve we'll rerender the whole list.
2437
- // This should leave the tree intact.
2438
- await act(() => ReactNoop.render(<Foo updateList={true} />));
2439
-
2440
- assertLog(['A', 'Suspend! [B]', 'Loading B']);
2441
-
2442
- expect(ReactNoop).toMatchRenderedOutput(
2443
- <>
2444
- <span>A</span>
2445
- <span>Loading B</span>
2446
- </>,
2447
- );
2448
-
2449
- await act(() => AsyncB.resolve());
2450
- assertLog(['B']);
2451
-
2452
- expect(ReactNoop).toMatchRenderedOutput(
2453
- <>
2454
- <span>A</span>
2455
- <span>B</span>
2456
- </>,
2457
- );
2458
-
2459
- // This should be the same instance. I.e. it didn't
2460
- // remount.
2461
- expect(previousInst).toBe(setAsyncB);
2462
- });
2463
-
2376
// @gate enableSuspenseList
2377
it('is able to interrupt a partially rendered tree and continue later', async () => {
2378
const AsyncA = createAsyncText('A');
packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js
+15
-15
@@ -50,7 +50,7 @@ describe('ReactSuspenseyCommitPhase', () => {
50
);
51
}
52
53
- test('suspend commit during initial mount', async () => {
53
+ it('suspend commit during initial mount', async () => {
54
const root = ReactNoop.createRoot();
55
await act(async () => {
56
startTransition(() => {
@@ -70,7 +70,7 @@ describe('ReactSuspenseyCommitPhase', () => {
70
expect(root).toMatchRenderedOutput(<suspensey-thing src="A" />);
71
});
72
73
- test('suspend commit during update', async () => {
73
+ it('suspend commit during update', async () => {
74
const root = ReactNoop.createRoot();
75
await act(() => resolveSuspenseyThing('A'));
76
await act(async () => {
@@ -105,7 +105,7 @@ describe('ReactSuspenseyCommitPhase', () => {
105
expect(root).toMatchRenderedOutput(<suspensey-thing src="B" />);
106
});
107
108
- test('suspend commit during initial mount at the root', async () => {
108
+ it('suspend commit during initial mount at the root', async () => {
109
const root = ReactNoop.createRoot();
110
await act(async () => {
111
startTransition(() => {
@@ -121,7 +121,7 @@ describe('ReactSuspenseyCommitPhase', () => {
121
expect(root).toMatchRenderedOutput(<suspensey-thing src="A" />);
122
});
123
124
- test('suspend commit during update at the root', async () => {
124
+ it('suspend commit during update at the root', async () => {
125
const root = ReactNoop.createRoot();
126
await act(() => resolveSuspenseyThing('A'));
127
expect(getSuspenseyThingStatus('A')).toBe('fulfilled');
@@ -147,7 +147,7 @@ describe('ReactSuspenseyCommitPhase', () => {
147
expect(root).toMatchRenderedOutput(<suspensey-thing src="B" />);
148
});
149
150
- test('suspend commit during urgent initial mount', async () => {
150
+ it('suspend commit during urgent initial mount', async () => {
151
const root = ReactNoop.createRoot();
152
await act(async () => {
153
root.render(
@@ -165,7 +165,7 @@ describe('ReactSuspenseyCommitPhase', () => {
165
expect(root).toMatchRenderedOutput(<suspensey-thing src="A" />);
166
});
167
168
- test('suspend commit during urgent update', async () => {
168
+ it('suspend commit during urgent update', async () => {
169
const root = ReactNoop.createRoot();
170
await act(() => resolveSuspenseyThing('A'));
171
expect(getSuspenseyThingStatus('A')).toBe('fulfilled');
@@ -203,7 +203,7 @@ describe('ReactSuspenseyCommitPhase', () => {
203
expect(root).toMatchRenderedOutput(<suspensey-thing src="B" />);
204
});
205
206
- test('suspends commit during urgent initial mount at the root', async () => {
206
+ it('suspends commit during urgent initial mount at the root', async () => {
207
const root = ReactNoop.createRoot();
208
await act(async () => {
209
root.render(<SuspenseyImage src="A" />);
@@ -217,7 +217,7 @@ describe('ReactSuspenseyCommitPhase', () => {
217
expect(root).toMatchRenderedOutput(<suspensey-thing src="A" />);
218
});
219
220
- test('suspends commit during urgent update at the root', async () => {
220
+ it('suspends commit during urgent update at the root', async () => {
221
const root = ReactNoop.createRoot();
222
await act(() => resolveSuspenseyThing('A'));
223
expect(getSuspenseyThingStatus('A')).toBe('fulfilled');
@@ -243,7 +243,7 @@ describe('ReactSuspenseyCommitPhase', () => {
243
// even if it is forced to be sync because we don't want to FOUC but refactoring the sync
244
// pathway is too risky to land right now so we just accept that we can still FOUC in this
245
// very specific case.
246
- test('does not suspend commit during urgent initial mount at the root when sync rendering', async () => {
246
+ it('does not suspend commit during urgent initial mount at the root when sync rendering', async () => {
247
const root = ReactNoop.createRoot();
248
await act(async () => {
249
ReactNoop.flushSync(() => {
@@ -264,7 +264,7 @@ describe('ReactSuspenseyCommitPhase', () => {
264
// even if it is forced to be sync because we don't want to FOUC but refactoring the sync
265
// pathway is too risky to land right now so we just accept that we can still FOUC in this
266
// very specific case.
267
- test('does not suspend commit during urgent update at the root when sync rendering', async () => {
267
+ it('does not suspend commit during urgent update at the root when sync rendering', async () => {
268
const root = ReactNoop.createRoot();
269
await act(() => resolveSuspenseyThing('A'));
270
expect(getSuspenseyThingStatus('A')).toBe('fulfilled');
@@ -291,7 +291,7 @@ describe('ReactSuspenseyCommitPhase', () => {
291
expect(root).toMatchRenderedOutput(<suspensey-thing src="B" />);
292
});
293
294
- test('an urgent update interrupts a suspended commit', async () => {
294
+ it('an urgent update interrupts a suspended commit', async () => {
295
const root = ReactNoop.createRoot();
296
297
// Mount an image. This transition will suspend because it's not inside a
@@ -313,7 +313,7 @@ describe('ReactSuspenseyCommitPhase', () => {
313
expect(root).toMatchRenderedOutput('Something else');
314
});
315
316
- test('a transition update interrupts a suspended commit', async () => {
316
+ it('a transition update interrupts a suspended commit', async () => {
317
const root = ReactNoop.createRoot();
318
319
// Mount an image. This transition will suspend because it's not inside a
@@ -338,7 +338,7 @@ describe('ReactSuspenseyCommitPhase', () => {
338
});
339
340
// @gate enableSuspenseList
341
- test('demonstrate current behavior when used with SuspenseList (not ideal)', async () => {
341
+ it('demonstrate current behavior when used with SuspenseList (not ideal)', async () => {
342
function App() {
343
return (
344
<SuspenseList revealOrder="forwards">
@@ -389,7 +389,7 @@ describe('ReactSuspenseyCommitPhase', () => {
389
);
390
});
391
392
- test('avoid triggering a fallback if resource loads immediately', async () => {
392
+ it('avoid triggering a fallback if resource loads immediately', async () => {
393
const root = ReactNoop.createRoot();
394
await act(async () => {
395
startTransition(() => {
@@ -438,7 +438,7 @@ describe('ReactSuspenseyCommitPhase', () => {
438
});
439
440
// @gate enableActivity
441
- test("host instances don't suspend during prerendering, but do suspend when they are revealed", async () => {
441
+ it("host instances don't suspend during prerendering, but do suspend when they are revealed", async () => {
442
function More() {
443
Scheduler.log('More');
444
return <SuspenseyImage src="More" />;
packages/react-reconciler/src/__tests__/ReactTransition-test.js
+7
-7
@@ -169,7 +169,7 @@ describe('ReactTransition', () => {
169
}
170
171
// @gate enableLegacyCache
172
- test('isPending works even if called from outside an input event', async () => {
172
+ it('isPending works even if called from outside an input event', async () => {
173
let start;
174
function App() {
175
const [show, setShow] = useState(false);
@@ -210,7 +210,7 @@ describe('ReactTransition', () => {
210
});
211
212
// @gate enableLegacyCache
213
- test(
213
+ it(
214
'when multiple transitions update the same queue, only the most recent ' +
215
'one is allowed to finish (no intermediate states)',
216
async () => {
@@ -329,7 +329,7 @@ describe('ReactTransition', () => {
329
330
// Same as previous test, but for class update queue.
331
// @gate enableLegacyCache
332
- test(
332
+ it(
333
'when multiple transitions update the same queue, only the most recent ' +
334
'one is allowed to finish (no intermediate states) (classes)',
335
async () => {
@@ -453,7 +453,7 @@ describe('ReactTransition', () => {
453
);
454
455
// @gate enableLegacyCache
456
- test(
456
+ it(
457
'when multiple transitions update overlapping queues, all the transitions ' +
458
'across all the queues are entangled',
459
async () => {
@@ -558,7 +558,7 @@ describe('ReactTransition', () => {
558
);
559
560
// @gate enableLegacyCache
561
- test('interrupt a refresh transition if a new transition is scheduled', async () => {
561
+ it('interrupt a refresh transition if a new transition is scheduled', async () => {
562
const root = ReactNoop.createRoot();
563
564
await act(() => {
@@ -613,7 +613,7 @@ describe('ReactTransition', () => {
613
});
614
615
// @gate enableLegacyCache
616
- test(
616
+ it(
617
"interrupt a refresh transition when something suspends and we've " +
618
'already bailed out on another transition in a parent',
619
async () => {
@@ -705,7 +705,7 @@ describe('ReactTransition', () => {
705
);
706
707
// @gate enableLegacyCache
708
- test(
708
+ it(
709
'interrupt a refresh transition when something suspends and a parent ' +
710
'component received an interleaved update after its queue was processed',
711
async () => {
packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js
+3
-2
@@ -180,7 +180,7 @@ describe('ReactInteractionTracing', () => {
180
}
181
182
// @gate enableTransitionTracing
183
- it(' should not call callbacks when transition is not defined', async () => {
183
+ it('should not call callbacks when transition is not defined', async () => {
184
const transitionCallbacks = {
185
onTransitionStart: (name, startTime) => {
186
Scheduler.log(`onTransitionStart(${name}, ${startTime})`);
@@ -1265,6 +1265,7 @@ describe('ReactInteractionTracing', () => {
1265
});
1266
1267
// @gate enableTransitionTracing
1268
+ // eslint-disable-next-line jest/no-disabled-tests
1269
it.skip('warn and calls marker incomplete if name changes before transition completes', async () => {
1270
const transitionCallbacks = {
1271
onTransitionStart: (name, startTime) => {
@@ -1820,7 +1821,7 @@ describe('ReactInteractionTracing', () => {
1821
});
1822
1823
// @gate enableTransitionTracing
1823
- it('Suspense boundary not added by the transition is deleted ', async () => {
1824
+ it('Suspense boundary not added by the transition is deleted', async () => {
1825
const transitionCallbacks = {
1826
onTransitionStart: (name, startTime) => {
1827
Scheduler.log(`onTransitionStart(${name}, ${startTime})`);
packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js
+3
-3
@@ -35,7 +35,7 @@ describe('ReactUpdatePriority', () => {
35
return text;
36
}
37
38
- test('setState inside passive effect triggered by sync update should have default priority', async () => {
38
+ it('setState inside passive effect triggered by sync update should have default priority', async () => {
39
const root = ReactNoop.createRoot();
40
41
function App() {
@@ -56,7 +56,7 @@ describe('ReactUpdatePriority', () => {
56
assertLog([2]);
57
});
58
59
- test('setState inside passive effect triggered by idle update should have idle priority', async () => {
59
+ it('setState inside passive effect triggered by idle update should have idle priority', async () => {
60
const root = ReactNoop.createRoot();
61
62
let setDefaultState;
@@ -94,7 +94,7 @@ describe('ReactUpdatePriority', () => {
94
assertLog(['Idle: 2, Default: 2']);
95
});
96
97
- test('continuous updates should interrupt transitions', async () => {
97
+ it('continuous updates should interrupt transitions', async () => {
98
const root = ReactNoop.createRoot();
99
100
let setCounter;
packages/react-reconciler/src/__tests__/ReactUse-test.js
+46
-46
@@ -89,7 +89,7 @@ describe('ReactUse', () => {
89
// add this back; however, the plan is to migrate all existing Suspense code
90
// to `use`, so the extra code probably isn't worth it.
91
// @gate TODO
92
- test('if suspended fiber is pinged in a microtask, retry immediately without unwinding the stack', async () => {
92
+ it('if suspended fiber is pinged in a microtask, retry immediately without unwinding the stack', async () => {
93
let fulfilled = false;
94
function Async() {
95
if (fulfilled) {
@@ -128,7 +128,7 @@ describe('ReactUse', () => {
128
expect(root).toMatchRenderedOutput('Async');
129
});
130
131
- test('if suspended fiber is pinged in a microtask, it does not block a transition from completing', async () => {
131
+ it('if suspended fiber is pinged in a microtask, it does not block a transition from completing', async () => {
132
let fulfilled = false;
133
function Async() {
134
if (fulfilled) {
@@ -155,7 +155,7 @@ describe('ReactUse', () => {
155
expect(root).toMatchRenderedOutput('Async');
156
});
157
158
- test('does not infinite loop if already fulfilled thenable is thrown', async () => {
158
+ it('does not infinite loop if already fulfilled thenable is thrown', async () => {
159
// An already fulfilled promise should never be thrown. Since it already
160
// fulfilled, we shouldn't bother trying to render again — doing so would
161
// likely lead to an infinite loop. This scenario should only happen if a
@@ -195,7 +195,7 @@ describe('ReactUse', () => {
195
expect(root).toMatchRenderedOutput('Loading...');
196
});
197
198
- test('basic use(promise)', async () => {
198
+ it('basic use(promise)', async () => {
199
const promiseA = Promise.resolve('A');
200
const promiseB = Promise.resolve('B');
201
const promiseC = Promise.resolve('C');
@@ -223,7 +223,7 @@ describe('ReactUse', () => {
223
expect(root).toMatchRenderedOutput('ABC');
224
});
225
226
- test("using a promise that's not cached between attempts", async () => {
226
+ it("using a promise that's not cached between attempts", async () => {
227
function Async() {
228
const text =
229
use(Promise.resolve('A')) +
@@ -256,7 +256,7 @@ describe('ReactUse', () => {
256
expect(root).toMatchRenderedOutput('ABC');
257
});
258
259
- test('using a rejected promise will throw', async () => {
259
+ it('using a rejected promise will throw', async () => {
260
class ErrorBoundary extends React.Component {
261
state = {error: null};
262
static getDerivedStateFromError(error) {
@@ -300,7 +300,7 @@ describe('ReactUse', () => {
300
assertLog(['Oops!', 'Oops!']);
301
});
302
303
- test('use(promise) in multiple components', async () => {
303
+ it('use(promise) in multiple components', async () => {
304
// This tests that the state for tracking promises is reset per component.
305
const promiseA = Promise.resolve('A');
306
const promiseB = Promise.resolve('B');
@@ -333,7 +333,7 @@ describe('ReactUse', () => {
333
expect(root).toMatchRenderedOutput('ABCD');
334
});
335
336
- test('use(promise) in multiple sibling components', async () => {
336
+ it('use(promise) in multiple sibling components', async () => {
337
// This tests that the state for tracking promises is reset per component.
338
339
const promiseA = {then: () => {}, status: 'pending', value: null};
@@ -368,7 +368,7 @@ describe('ReactUse', () => {
368
expect(root).toMatchRenderedOutput('Loading...');
369
});
370
371
- test('erroring in the same component as an uncached promise does not result in an infinite loop', async () => {
371
+ it('erroring in the same component as an uncached promise does not result in an infinite loop', async () => {
372
class ErrorBoundary extends React.Component {
373
state = {error: null};
374
static getDerivedStateFromError(error) {
@@ -454,7 +454,7 @@ describe('ReactUse', () => {
454
expect(root).toMatchRenderedOutput('Caught an error: Oops!');
455
});
456
457
- test('basic use(context)', async () => {
457
+ it('basic use(context)', async () => {
458
const ContextA = React.createContext('');
459
const ContextB = React.createContext('B');
460
@@ -477,7 +477,7 @@ describe('ReactUse', () => {
477
expect(root).toMatchRenderedOutput('AB');
478
});
479
480
- test('interrupting while yielded should reset contexts', async () => {
480
+ it('interrupting while yielded should reset contexts', async () => {
481
let resolve;
482
const promise = new Promise(r => {
483
resolve = r;
@@ -523,7 +523,7 @@ describe('ReactUse', () => {
523
expect(root).toMatchRenderedOutput(<div>Hello world!</div>);
524
});
525
526
- test('warns if use(promise) is wrapped with try/catch block', async () => {
526
+ it('warns if use(promise) is wrapped with try/catch block', async () => {
527
function Async() {
528
try {
529
return <Text text={use(Promise.resolve('Async'))} />;
@@ -558,7 +558,7 @@ describe('ReactUse', () => {
558
}
559
});
560
561
- test('during a transition, can unwrap async operations even if nothing is cached', async () => {
561
+ it('during a transition, can unwrap async operations even if nothing is cached', async () => {
562
function App() {
563
return <Text text={use(getAsyncText('Async'))} />;
564
}
@@ -593,7 +593,7 @@ describe('ReactUse', () => {
593
expect(root).toMatchRenderedOutput('Async');
594
});
595
596
- test("does not prevent a Suspense fallback from showing if it's a new boundary, even during a transition", async () => {
596
+ it("does not prevent a Suspense fallback from showing if it's a new boundary, even during a transition", async () => {
597
function App() {
598
return <Text text={use(getAsyncText('Async'))} />;
599
}
@@ -635,7 +635,7 @@ describe('ReactUse', () => {
635
expect(root).toMatchRenderedOutput('Async');
636
});
637
638
- test('when waiting for data to resolve, a fresh update will trigger a restart', async () => {
638
+ it('when waiting for data to resolve, a fresh update will trigger a restart', async () => {
639
function App() {
640
return <Text text={use(getAsyncText('Will never resolve'))} />;
641
}
@@ -666,7 +666,7 @@ describe('ReactUse', () => {
666
assertLog(['Something different']);
667
});
668
669
- test('when waiting for data to resolve, an update on a different root does not cause work to be dropped', async () => {
669
+ it('when waiting for data to resolve, an update on a different root does not cause work to be dropped', async () => {
670
const promise = getAsyncText('Hi');
671
672
function App() {
@@ -708,7 +708,7 @@ describe('ReactUse', () => {
708
expect(root1).toMatchRenderedOutput('Hi');
709
});
710
711
- test('while suspended, hooks cannot be called (i.e. current dispatcher is unset correctly)', async () => {
711
+ it('while suspended, hooks cannot be called (i.e. current dispatcher is unset correctly)', async () => {
712
function App() {
713
return <Text text={use(getAsyncText('Will never resolve'))} />;
714
}
@@ -736,7 +736,7 @@ describe('ReactUse', () => {
736
);
737
});
738
739
- test('unwraps thenable that fulfills synchronously without suspending', async () => {
739
+ it('unwraps thenable that fulfills synchronously without suspending', async () => {
740
function App() {
741
const thenable = {
742
then(resolve) {
@@ -763,7 +763,7 @@ describe('ReactUse', () => {
763
expect(root).toMatchRenderedOutput('Hi');
764
});
765
766
- test('does not suspend indefinitely if an interleaved update was skipped', async () => {
766
+ it('does not suspend indefinitely if an interleaved update was skipped', async () => {
767
function Child({childShouldSuspend}) {
768
return (
769
<Text
@@ -845,7 +845,7 @@ describe('ReactUse', () => {
845
expect(root).toMatchRenderedOutput('(empty)');
846
});
847
848
- test('when replaying a suspended component, reuses the hooks computed during the previous attempt (Memo)', async () => {
848
+ it('when replaying a suspended component, reuses the hooks computed during the previous attempt (Memo)', async () => {
849
function ExcitingText({text}) {
850
// This computes the uppercased version of some text. Pretend it's an
851
// expensive operation that we want to reuse.
@@ -894,7 +894,7 @@ describe('ReactUse', () => {
894
]);
895
});
896
897
- test('when replaying a suspended component, reuses the hooks computed during the previous attempt (State)', async () => {
897
+ it('when replaying a suspended component, reuses the hooks computed during the previous attempt (State)', async () => {
898
let _setFruit;
899
let _setVegetable;
900
function Kitchen() {
@@ -950,7 +950,7 @@ describe('ReactUse', () => {
950
expect(root).toMatchRenderedOutput('banana dill');
951
});
952
953
- test('when replaying a suspended component, reuses the hooks computed during the previous attempt (DebugValue+State)', async () => {
953
+ it('when replaying a suspended component, reuses the hooks computed during the previous attempt (DebugValue+State)', async () => {
954
// Make sure we don't get a Hook mismatch warning on updates if there were non-stateful Hooks before the use().
955
let _setLawyer;
956
function Lexicon() {
@@ -991,7 +991,7 @@ describe('ReactUse', () => {
991
expect(root).toMatchRenderedOutput('aguacate avocat');
992
});
993
994
- test(
994
+ it(
995
'wrap an async function with useMemo to skip running the function ' +
996
'twice when loading new data',
997
async () => {
@@ -1023,7 +1023,7 @@ describe('ReactUse', () => {
1023
},
1024
);
1025
1026
- test('load multiple nested Suspense boundaries', async () => {
1026
+ it('load multiple nested Suspense boundaries', async () => {
1027
const promiseA = getAsyncText('A');
1028
const promiseB = getAsyncText('B');
1029
const promiseC = getAsyncText('C');
@@ -1073,7 +1073,7 @@ describe('ReactUse', () => {
1073
expect(root).toMatchRenderedOutput('ABC');
1074
});
1075
1076
- test('load multiple nested Suspense boundaries (uncached requests)', async () => {
1076
+ it('load multiple nested Suspense boundaries (uncached requests)', async () => {
1077
// This the same as the previous test, except the requests are not cached.
1078
// The tree should still eventually resolve, despite the
1079
// duplicate requests.
@@ -1155,7 +1155,7 @@ describe('ReactUse', () => {
1155
expect(root).toMatchRenderedOutput('ABC');
1156
});
1157
1158
- test('use() combined with render phase updates', async () => {
1158
+ it('use() combined with render phase updates', async () => {
1159
function Async() {
1160
const a = use(Promise.resolve('A'));
1161
const [count, setCount] = useState(0);
@@ -1184,7 +1184,7 @@ describe('ReactUse', () => {
1184
expect(root).toMatchRenderedOutput('A1');
1185
});
1186
1187
- test('basic promise as child', async () => {
1187
+ it('basic promise as child', async () => {
1188
const promise = Promise.resolve(<Text text="Hi" />);
1189
const root = ReactNoop.createRoot();
1190
await act(() => {
@@ -1196,7 +1196,7 @@ describe('ReactUse', () => {
1196
expect(root).toMatchRenderedOutput('Hi');
1197
});
1198
1199
- test('basic async component', async () => {
1199
+ it('basic async component', async () => {
1200
async function App() {
1201
await getAsyncText('Hi');
1202
return <Text text="Hi" />;
@@ -1220,7 +1220,7 @@ describe('ReactUse', () => {
1220
expect(root).toMatchRenderedOutput('Hi');
1221
});
1222
1223
- test('async child of a non-function component (e.g. a class)', async () => {
1223
+ it('async child of a non-function component (e.g. a class)', async () => {
1224
class App extends React.Component {
1225
async render() {
1226
const text = await getAsyncText('Hi');
@@ -1248,7 +1248,7 @@ describe('ReactUse', () => {
1248
expect(root).toMatchRenderedOutput('Hi');
1249
});
1250
1251
- test('async children are recursively unwrapped', async () => {
1251
+ it('async children are recursively unwrapped', async () => {
1252
// This is a Usable of a Usable. `use` would only unwrap a single level, but
1253
// when passed as a child, the reconciler recurisvely unwraps until it
1254
// resolves to a non-Usable value.
@@ -1269,7 +1269,7 @@ describe('ReactUse', () => {
1269
expect(root).toMatchRenderedOutput('Hi');
1270
});
1271
1272
- test('async children are transparently unwrapped before being reconciled (top level)', async () => {
1272
+ it('async children are transparently unwrapped before being reconciled (top level)', async () => {
1273
function Child({text}) {
1274
useEffect(() => {
1275
Scheduler.log(`Mount: ${text}`);
@@ -1303,7 +1303,7 @@ describe('ReactUse', () => {
1303
expect(root).toMatchRenderedOutput('B');
1304
});
1305
1306
- test('async children are transparently unwrapped before being reconciled (siblings)', async () => {
1306
+ it('async children are transparently unwrapped before being reconciled (siblings)', async () => {
1307
function Child({text}) {
1308
useEffect(() => {
1309
Scheduler.log(`Mount: ${text}`);
@@ -1342,7 +1342,7 @@ describe('ReactUse', () => {
1342
expect(root).toMatchRenderedOutput('ABC');
1343
});
1344
1345
- test('async children are transparently unwrapped before being reconciled (siblings, reordered)', async () => {
1345
+ it('async children are transparently unwrapped before being reconciled (siblings, reordered)', async () => {
1346
function Child({text}) {
1347
useEffect(() => {
1348
Scheduler.log(`Mount: ${text}`);
@@ -1381,7 +1381,7 @@ describe('ReactUse', () => {
1381
expect(root).toMatchRenderedOutput('BAC');
1382
});
1383
1384
- test('basic Context as node', async () => {
1384
+ it('basic Context as node', async () => {
1385
const Context = React.createContext(null);
1386
1387
function Indirection({children}) {
@@ -1463,7 +1463,7 @@ describe('ReactUse', () => {
1463
]);
1464
});
1465
1466
- test('context as node, at the root', async () => {
1466
+ it('context as node, at the root', async () => {
1467
const Context = React.createContext(<Text text="Hi" />);
1468
const root = ReactNoop.createRoot();
1469
await act(async () => {
@@ -1475,7 +1475,7 @@ describe('ReactUse', () => {
1475
expect(root).toMatchRenderedOutput('Hi');
1476
});
1477
1478
- test('promises that resolves to a context, rendered as a node', async () => {
1478
+ it('promises that resolves to a context, rendered as a node', async () => {
1479
const Context = React.createContext(<Text text="Hi" />);
1480
const promise = Promise.resolve(Context);
1481
const root = ReactNoop.createRoot();
@@ -1488,7 +1488,7 @@ describe('ReactUse', () => {
1488
expect(root).toMatchRenderedOutput('Hi');
1489
});
1490
1491
- test('unwrap uncached promises inside forwardRef', async () => {
1491
+ it('unwrap uncached promises inside forwardRef', async () => {
1492
const asyncInstance = {};
1493
const Async = React.forwardRef((props, ref) => {
1494
React.useImperativeHandle(ref, () => asyncInstance);
@@ -1516,7 +1516,7 @@ describe('ReactUse', () => {
1516
expect(ref.current).toBe(asyncInstance);
1517
});
1518
1519
- test('unwrap uncached promises inside memo', async () => {
1519
+ it('unwrap uncached promises inside memo', async () => {
1520
const Async = React.memo(
1521
props => {
1522
const text = use(Promise.resolve(props.text));
@@ -1563,7 +1563,7 @@ describe('ReactUse', () => {
1563
});
1564
1565
// @gate !disableLegacyContext
1566
- test('unwrap uncached promises in component that accesses legacy context', async () => {
1566
+ it('unwrap uncached promises in component that accesses legacy context', async () => {
1567
class ContextProvider extends React.Component {
1568
static childContextTypes = {
1569
legacyContext() {},
@@ -1616,7 +1616,7 @@ describe('ReactUse', () => {
1616
);
1617
});
1618
1619
- test('regression test: updates while component is suspended should not be mistaken for render phase updates', async () => {
1619
+ it('regression test: updates while component is suspended should not be mistaken for render phase updates', async () => {
1620
const promiseA = getAsyncText('A');
1621
const promiseB = getAsyncText('B');
1622
const promiseC = getAsyncText('C');
@@ -1657,7 +1657,7 @@ describe('ReactUse', () => {
1657
});
1658
1659
// @gate !forceConcurrentByDefaultForTesting
1660
- test('an async component outside of a Suspense boundary crashes with an error (resolves in microtask)', async () => {
1660
+ it('an async component outside of a Suspense boundary crashes with an error (resolves in microtask)', async () => {
1661
class ErrorBoundary extends React.Component {
1662
state = {error: null};
1663
static getDerivedStateFromError(error) {
@@ -1709,7 +1709,7 @@ describe('ReactUse', () => {
1709
});
1710
1711
// @gate !forceConcurrentByDefaultForTesting
1712
- test('an async component outside of a Suspense boundary crashes with an error (resolves in macrotask)', async () => {
1712
+ it('an async component outside of a Suspense boundary crashes with an error (resolves in macrotask)', async () => {
1713
class ErrorBoundary extends React.Component {
1714
state = {error: null};
1715
static getDerivedStateFromError(error) {
@@ -1761,7 +1761,7 @@ describe('ReactUse', () => {
1761
);
1762
});
1763
1764
- test(
1764
+ it(
1765
'warn if async client component calls a hook (e.g. useState) ' +
1766
'during a non-sync update',
1767
async () => {
@@ -1794,7 +1794,7 @@ describe('ReactUse', () => {
1794
},
1795
);
1796
1797
- test('warn if async client component calls a hook (e.g. use)', async () => {
1797
+ it('warn if async client component calls a hook (e.g. use)', async () => {
1798
const promise = Promise.resolve();
1799
1800
async function AsyncClientComponent() {
@@ -1829,7 +1829,7 @@ describe('ReactUse', () => {
1829
});
1830
1831
// @gate enableAsyncIterableChildren
1832
- test('async generator component', async () => {
1832
+ it('async generator component', async () => {
1833
let hi, world;
1834
async function* App() {
1835
// Only cached promises can be awaited in async generators because
@@ -1874,7 +1874,7 @@ describe('ReactUse', () => {
1874
});
1875
1876
// @gate enableAsyncIterableChildren
1877
- test('async iterable children', async () => {
1877
+ it('async iterable children', async () => {
1878
let hi, world;
1879
const iterable = {
1880
async *[Symbol.asyncIterator]() {
packages/react-reconciler/src/__tests__/useMemoCache-test.js
+6
-6
@@ -57,7 +57,7 @@ describe('useMemoCache()', () => {
57
});
58
59
// @gate enableUseMemoCacheHook
60
- test('render component using cache', async () => {
60
+ it('render component using cache', async () => {
61
function Component(props) {
62
const cache = useMemoCache(1);
63
expect(Array.isArray(cache)).toBe(true);
@@ -74,7 +74,7 @@ describe('useMemoCache()', () => {
74
});
75
76
// @gate enableUseMemoCacheHook
77
- test('update component using cache', async () => {
77
+ it('update component using cache', async () => {
78
let setX;
79
let forceUpdate;
80
function Component(props) {
@@ -144,7 +144,7 @@ describe('useMemoCache()', () => {
144
});
145
146
// @gate enableUseMemoCacheHook
147
- test('update component using cache with setstate during render', async () => {
147
+ it('update component using cache with setstate during render', async () => {
148
let setN;
149
function Component(props) {
150
const cache = useMemoCache(5);
@@ -209,7 +209,7 @@ describe('useMemoCache()', () => {
209
});
210
211
// @gate enableUseMemoCacheHook
212
- test('update component using cache with throw during render', async () => {
212
+ it('update component using cache with throw during render', async () => {
213
let setN;
214
let shouldFail = true;
215
function Component(props) {
@@ -292,7 +292,7 @@ describe('useMemoCache()', () => {
292
});
293
294
// @gate enableUseMemoCacheHook
295
- test('update component and custom hook with caches', async () => {
295
+ it('update component and custom hook with caches', async () => {
296
let setX;
297
let forceUpdate;
298
function Component(props) {
@@ -369,7 +369,7 @@ describe('useMemoCache()', () => {
369
});
370
371
// @gate enableUseMemoCacheHook
372
- test('reuses computations from suspended/interrupted render attempts during an update', async () => {
372
+ it('reuses computations from suspended/interrupted render attempts during an update', async () => {
373
// This test demonstrates the benefit of a shared memo cache. By "shared" I
374
// mean multiple concurrent render attempts of the same component/hook use
375
// the same cache. (When the feature flag is off, we don't do this — the
packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
+3
-3
@@ -82,7 +82,7 @@ describe('useSyncExternalStore', () => {
82
};
83
}
84
85
- test(
85
+ it(
86
'detects interleaved mutations during a concurrent read before ' +
87
'layout effects fire',
88
async () => {
@@ -186,7 +186,7 @@ describe('useSyncExternalStore', () => {
186
},
187
);
188
189
- test('next value is correctly cached when state is dispatched in render phase', async () => {
189
+ it('next value is correctly cached when state is dispatched in render phase', async () => {
190
const store = createExternalStore('value:initial');
191
192
function App() {
@@ -215,7 +215,7 @@ describe('useSyncExternalStore', () => {
215
assertLog(['value:initial']);
216
});
217
218
- test(
218
+ it(
219
'regression: suspending in shell after synchronously patching ' +
220
'up store mutation',
221
async () => {
packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
+2
-2
@@ -129,7 +129,7 @@ describe('ReactFreshIntegration', () => {
129
testJavaScript,
130
],
131
['TypeScript syntax', executeTypescript, testTypeScript],
132
- ])('%s', (language, execute, test) => {
132
+ ])('%s', (language, execute, runTest) => {
133
async function render(source) {
134
const Component = execute(source);
135
await act(() => {
@@ -175,7 +175,7 @@ describe('ReactFreshIntegration', () => {
175
expect(ReactFreshRuntime._getMountedRootCount()).toBe(1);
176
}
177
178
- test(render, patch);
178
+ runTest(render, patch);
179
});
180
181
function testJavaScript(render, patch) {
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js
-35
@@ -192,41 +192,6 @@ describe('ReactFlightDOMBrowser', () => {
192
});
193
});
194
195
- it('should resolve HTML using W3C streams', async () => {
196
- function Text({children}) {
197
- return <span>{children}</span>;
198
- }
199
- function HTML() {
200
- return (
201
- <div>
202
- <Text>hello</Text>
203
- <Text>world</Text>
204
- </div>
205
- );
206
- }
207
-
208
- function App() {
209
- const model = {
210
- html: <HTML />,
211
- };
212
- return model;
213
- }
214
-
215
- const stream = await serverAct(() =>
216
- ReactServerDOMServer.renderToReadableStream(<App />),
217
- );
218
- const response = ReactServerDOMClient.createFromReadableStream(stream);
219
- const model = await response;
220
- expect(model).toEqual({
221
- html: (
222
- <div>
223
- <span>hello</span>
224
- <span>world</span>
225
- </div>
226
- ),
227
- });
228
- });
229
-
195
it('should resolve client components (with async chunks) when referenced in props', async () => {
196
let resolveClientComponentChunk;
197
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
+1
-1
@@ -50,7 +50,7 @@ describe('ReactTestRenderer', () => {
50
expect(errors[1].message.includes('indexOf is not a function')).toBe(true);
51
});
52
53
- test('find element by prop with suspended content', async () => {
53
+ it('find element by prop with suspended content', async () => {
54
const neverResolve = new Promise(() => {});
55
56
function TestComp({foo}) {
packages/react/src/__tests__/ReactChildren-test.js
+3
-3
@@ -543,7 +543,7 @@ describe('ReactChildren', () => {
543
expect(mappedChildren[0]).toBe(scopeTester);
544
});
545
546
- it('should be called for each child', () => {
546
+ it('should be called for each child in array', () => {
547
const zero = <div key="keyZero" />;
548
const one = null;
549
const two = <div key="keyTwo" />;
@@ -605,7 +605,7 @@ describe('ReactChildren', () => {
605
expect(mappedChildren[3]).toEqual(<div key=".$keyFour" />);
606
});
607
608
- it('should be called for each child in nested structure', () => {
608
+ it('should be called for each child in nested structure with mapping', () => {
609
const zero = <div key="keyZero" />;
610
const one = null;
611
const two = <div key="keyTwo" />;
@@ -678,7 +678,7 @@ describe('ReactChildren', () => {
678
expect(mappedChildren[3]).toEqual(<div key=".0:$keyFive" />);
679
});
680
681
- it('should retain key across two mappings', () => {
681
+ it('should retain key across two mappings with conditions', () => {
682
const zeroForceKey = <div key="keyZero" />;
683
const oneForceKey = <div key="keyOne" />;
684
packages/react/src/__tests__/ReactContextValidator-test.js
+1
-1
@@ -267,7 +267,7 @@ describe('ReactContextValidator', () => {
267
expect(childContext.foo).toBe('FOO');
268
});
269
270
- it('should pass next context to lifecycles', async () => {
270
+ it('should pass next context to lifecycles on update', async () => {
271
let componentDidMountContext;
272
let componentDidUpdateContext;
273
let componentWillReceivePropsContext;
packages/react/src/__tests__/ReactES6Class-test.js
+27
-27
@@ -46,7 +46,7 @@ describe('ReactES6Class', () => {
46
};
47
});
48
49
- function test(element, expectedTag, expectedClassName) {
49
+ function runTest(element, expectedTag, expectedClassName) {
50
ReactDOM.flushSync(() => root.render(element));
51
expect(container.firstChild).not.toBeNull();
52
expect(container.firstChild.tagName).toBe(expectedTag);
@@ -92,8 +92,8 @@ describe('ReactES6Class', () => {
92
return <Inner name={this.props.bar} />;
93
}
94
}
95
- test(<Foo bar="foo" />, 'DIV', 'foo');
96
- test(<Foo bar="bar" />, 'DIV', 'bar');
95
+ runTest(<Foo bar="foo" />, 'DIV', 'foo');
96
+ runTest(<Foo bar="bar" />, 'DIV', 'bar');
97
});
98
99
it('renders based on state using initial values in this.props', () => {
@@ -106,7 +106,7 @@ describe('ReactES6Class', () => {
106
return <span className={this.state.bar} />;
107
}
108
}
109
- test(<Foo initialValue="foo" />, 'SPAN', 'foo');
109
+ runTest(<Foo initialValue="foo" />, 'SPAN', 'foo');
110
});
111
112
it('renders based on state using props in the constructor', () => {
@@ -126,9 +126,9 @@ describe('ReactES6Class', () => {
126
}
127
}
128
const ref = React.createRef();
129
- test(<Foo initialValue="foo" ref={ref} />, 'DIV', 'foo');
129
+ runTest(<Foo initialValue="foo" ref={ref} />, 'DIV', 'foo');
130
ReactDOM.flushSync(() => ref.current.changeState());
131
- test(<Foo />, 'SPAN', 'bar');
131
+ runTest(<Foo />, 'SPAN', 'bar');
132
});
133
134
it('sets initial state with value returned by static getDerivedStateFromProps', () => {
@@ -144,7 +144,7 @@ describe('ReactES6Class', () => {
144
return <div className={`${this.state.foo} ${this.state.bar}`} />;
145
}
146
}
147
- test(<Foo foo="foo" />, 'DIV', 'foo bar');
147
+ runTest(<Foo foo="foo" />, 'DIV', 'foo bar');
148
});
149
150
it('warns if getDerivedStateFromProps is not static', () => {
@@ -233,7 +233,7 @@ describe('ReactES6Class', () => {
233
return <div className={`${this.state.foo} ${this.state.bar}`} />;
234
}
235
}
236
- test(<Foo />, 'DIV', 'not-foo bar');
236
+ runTest(<Foo />, 'DIV', 'not-foo bar');
237
});
238
239
it('renders updated state with values returned by static getDerivedStateFromProps', () => {
@@ -253,8 +253,8 @@ describe('ReactES6Class', () => {
253
return <div className={this.state.value} />;
254
}
255
}
256
- test(<Foo update={false} />, 'DIV', 'initial');
257
- test(<Foo update={true} />, 'DIV', 'updated');
256
+ runTest(<Foo update={false} />, 'DIV', 'initial');
257
+ runTest(<Foo update={true} />, 'DIV', 'updated');
258
});
259
260
if (!require('shared/ReactFeatureFlags').disableLegacyContext) {
@@ -286,7 +286,7 @@ describe('ReactES6Class', () => {
286
tag: PropTypes.string,
287
className: PropTypes.string,
288
};
289
- test(<Outer />, 'SPAN', 'foo');
289
+ runTest(<Outer />, 'SPAN', 'foo');
290
});
291
}
292
@@ -305,7 +305,7 @@ describe('ReactES6Class', () => {
305
return <span className={this.state.bar} />;
306
}
307
}
308
- test(<Foo initialValue="foo" />, 'SPAN', 'bar');
308
+ runTest(<Foo initialValue="foo" />, 'SPAN', 'bar');
309
expect(renderCount).toBe(1);
310
});
311
@@ -320,7 +320,7 @@ describe('ReactES6Class', () => {
320
return <span />;
321
}
322
}
323
- expect(() => test(<Foo />, 'SPAN', '')).toErrorDev(
323
+ expect(() => runTest(<Foo />, 'SPAN', '')).toErrorDev(
324
'Foo.state: must be set to an object or null',
325
);
326
});
@@ -336,7 +336,7 @@ describe('ReactES6Class', () => {
336
return <span />;
337
}
338
}
339
- test(<Foo />, 'SPAN', '');
339
+ runTest(<Foo />, 'SPAN', '');
340
});
341
342
it('setState through an event handler', () => {
@@ -354,7 +354,7 @@ describe('ReactES6Class', () => {
354
);
355
}
356
}
357
- test(<Foo initialValue="foo" />, 'DIV', 'foo');
357
+ runTest(<Foo initialValue="foo" />, 'DIV', 'foo');
358
359
ReactDOM.flushSync(() => attachedListener());
360
expect(renderedName).toBe('bar');
@@ -373,7 +373,7 @@ describe('ReactES6Class', () => {
373
return <Inner name={this.state.bar} onClick={this.handleClick} />;
374
}
375
}
376
- test(<Foo initialValue="foo" />, 'DIV', 'foo');
376
+ runTest(<Foo initialValue="foo" />, 'DIV', 'foo');
377
expect(attachedListener).toThrow();
378
});
379
@@ -396,7 +396,7 @@ describe('ReactES6Class', () => {
396
);
397
}
398
}
399
- test(<Foo initialValue="foo" />, 'DIV', 'foo');
399
+ runTest(<Foo initialValue="foo" />, 'DIV', 'foo');
400
ReactDOM.flushSync(() => attachedListener());
401
expect(renderedName).toBe('bar');
402
});
@@ -434,10 +434,10 @@ describe('ReactES6Class', () => {
434
return <span className={this.props.value} />;
435
}
436
}
437
- test(<Foo value="foo" />, 'SPAN', 'foo');
437
+ runTest(<Foo value="foo" />, 'SPAN', 'foo');
438
expect(lifeCycles).toEqual(['will-mount', 'did-mount']);
439
lifeCycles = []; // reset
440
- test(<Foo value="bar" />, 'SPAN', 'bar');
440
+ runTest(<Foo value="bar" />, 'SPAN', 'bar');
441
// prettier-ignore
442
expect(lifeCycles).toEqual([
443
'receive-props', freeze({value: 'bar'}),
@@ -474,7 +474,7 @@ describe('ReactES6Class', () => {
474
}
475
}
476
477
- expect(() => test(<Foo />, 'SPAN', 'foo')).toErrorDev([
477
+ expect(() => runTest(<Foo />, 'SPAN', 'foo')).toErrorDev([
478
'getInitialState was defined on Foo, a plain JavaScript class.',
479
'getDefaultProps was defined on Foo, a plain JavaScript class.',
480
'propTypes was defined as an instance property on Foo.',
@@ -496,7 +496,7 @@ describe('ReactES6Class', () => {
496
return <span className="foo" />;
497
}
498
}
499
- test(<Foo />, 'SPAN', 'foo');
499
+ runTest(<Foo />, 'SPAN', 'foo');
500
});
501
502
it('should warn when misspelling shouldComponentUpdate', () => {
@@ -509,7 +509,7 @@ describe('ReactES6Class', () => {
509
}
510
}
511
512
- expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
512
+ expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
513
'Warning: ' +
514
'NamedComponent has a method called componentShouldUpdate(). Did you ' +
515
'mean shouldComponentUpdate()? The name is phrased as a question ' +
@@ -527,7 +527,7 @@ describe('ReactES6Class', () => {
527
}
528
}
529
530
- expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
530
+ expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
531
'Warning: ' +
532
'NamedComponent has a method called componentWillRecieveProps(). Did ' +
533
'you mean componentWillReceiveProps()?',
@@ -544,7 +544,7 @@ describe('ReactES6Class', () => {
544
}
545
}
546
547
- expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
547
+ expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
548
'Warning: ' +
549
'NamedComponent has a method called UNSAFE_componentWillRecieveProps(). ' +
550
'Did you mean UNSAFE_componentWillReceiveProps()?',
@@ -553,7 +553,7 @@ describe('ReactES6Class', () => {
553
554
it('should throw AND warn when trying to access classic APIs', () => {
555
const ref = React.createRef();
556
- test(<Inner name="foo" ref={ref} />, 'DIV', 'foo');
556
+ runTest(<Inner name="foo" ref={ref} />, 'DIV', 'foo');
557
expect(() =>
558
expect(() => ref.current.replaceState({})).toThrow(),
559
).toWarnDev(
@@ -583,7 +583,7 @@ describe('ReactES6Class', () => {
583
}
584
}
585
Foo.childContextTypes = {bar: PropTypes.string};
586
- test(<Foo />, 'DIV', 'bar-through-context');
586
+ runTest(<Foo />, 'DIV', 'bar-through-context');
587
});
588
}
589
@@ -596,7 +596,7 @@ describe('ReactES6Class', () => {
596
}
597
const ref = React.createRef();
598
expect(() => {
599
- test(<Foo ref={ref} />, 'DIV', 'foo');
599
+ runTest(<Foo ref={ref} />, 'DIV', 'foo');
600
}).toErrorDev([
601
'Warning: Component "Foo" contains the string ref "inner". ' +
602
'Support for string refs will be removed in a future major release. ' +
packages/react/src/__tests__/ReactMismatchedVersions-test.js
+11
-11
@@ -37,7 +37,7 @@ describe('ReactMismatchedVersions-test', () => {
37
actualReactVersion = React.__actualVersion;
38
});
39
40
- test('importing "react-dom/client" throws if version does not match React version', async () => {
40
+ it('importing "react-dom/client" throws if version does not match React version', async () => {
41
expect(() => require('react-dom/client')).toThrow(
42
'Incompatible React versions: The "react" and "react-dom" packages ' +
43
'must have the exact same version. Instead got:\n' +
@@ -51,7 +51,7 @@ describe('ReactMismatchedVersions-test', () => {
51
// only errors once you call something and trigger the require. Running the
52
// test in build mode is sufficient.
53
// @gate !source
54
- test('importing "react-dom/server" throws if version does not match React version', async () => {
54
+ it('importing "react-dom/server" throws if version does not match React version', async () => {
55
expect(() => require('react-dom/server')).toThrow(
56
'Incompatible React versions: The "react" and "react-dom" packages ' +
57
'must have the exact same version. Instead got:\n' +
@@ -61,7 +61,7 @@ describe('ReactMismatchedVersions-test', () => {
61
});
62
63
// @gate !source
64
- test('importing "react-dom/server.node" throws if version does not match React version', async () => {
64
+ it('importing "react-dom/server.node" throws if version does not match React version', async () => {
65
expect(() => require('react-dom/server.node')).toThrow(
66
'Incompatible React versions: The "react" and "react-dom" packages ' +
67
'must have the exact same version. Instead got:\n' +
@@ -71,7 +71,7 @@ describe('ReactMismatchedVersions-test', () => {
71
});
72
73
// @gate !source
74
- test('importing "react-dom/server.browser" throws if version does not match React version', async () => {
74
+ it('importing "react-dom/server.browser" throws if version does not match React version', async () => {
75
expect(() => require('react-dom/server.browser')).toThrow(
76
'Incompatible React versions: The "react" and "react-dom" packages ' +
77
'must have the exact same version. Instead got:\n' +
@@ -81,7 +81,7 @@ describe('ReactMismatchedVersions-test', () => {
81
});
82
83
// @gate !source
84
- test('importing "react-dom/server.bun" throws if version does not match React version', async () => {
84
+ it('importing "react-dom/server.bun" throws if version does not match React version', async () => {
85
expect(() => require('react-dom/server.bun')).toThrow(
86
'Incompatible React versions: The "react" and "react-dom" packages ' +
87
'must have the exact same version. Instead got:\n' +
@@ -91,7 +91,7 @@ describe('ReactMismatchedVersions-test', () => {
91
});
92
93
// @gate !source
94
- test('importing "react-dom/server.edge" throws if version does not match React version', async () => {
94
+ it('importing "react-dom/server.edge" throws if version does not match React version', async () => {
95
expect(() => require('react-dom/server.edge')).toThrow(
96
'Incompatible React versions: The "react" and "react-dom" packages ' +
97
'must have the exact same version. Instead got:\n' +
@@ -100,7 +100,7 @@ describe('ReactMismatchedVersions-test', () => {
100
);
101
});
102
103
- test('importing "react-dom/static" throws if version does not match React version', async () => {
103
+ it('importing "react-dom/static" throws if version does not match React version', async () => {
104
expect(() => require('react-dom/static')).toThrow(
105
'Incompatible React versions: The "react" and "react-dom" packages ' +
106
'must have the exact same version. Instead got:\n' +
@@ -109,7 +109,7 @@ describe('ReactMismatchedVersions-test', () => {
109
);
110
});
111
112
- test('importing "react-dom/static.node" throws if version does not match React version', async () => {
112
+ it('importing "react-dom/static.node" throws if version does not match React version', async () => {
113
expect(() => require('react-dom/static.node')).toThrow(
114
'Incompatible React versions: The "react" and "react-dom" packages ' +
115
'must have the exact same version. Instead got:\n' +
@@ -118,7 +118,7 @@ describe('ReactMismatchedVersions-test', () => {
118
);
119
});
120
121
- test('importing "react-dom/static.browser" throws if version does not match React version', async () => {
121
+ it('importing "react-dom/static.browser" throws if version does not match React version', async () => {
122
expect(() => require('react-dom/static.browser')).toThrow(
123
'Incompatible React versions: The "react" and "react-dom" packages ' +
124
'must have the exact same version. Instead got:\n' +
@@ -127,7 +127,7 @@ describe('ReactMismatchedVersions-test', () => {
127
);
128
});
129
130
- test('importing "react-dom/static.edge" throws if version does not match React version', async () => {
130
+ it('importing "react-dom/static.edge" throws if version does not match React version', async () => {
131
expect(() => require('react-dom/static.edge')).toThrow(
132
'Incompatible React versions: The "react" and "react-dom" packages ' +
133
'must have the exact same version. Instead got:\n' +
@@ -137,7 +137,7 @@ describe('ReactMismatchedVersions-test', () => {
137
});
138
139
// @gate source
140
- test('importing "react-native-renderer" throws if version does not match React version', async () => {
140
+ it('importing "react-native-renderer" throws if version does not match React version', async () => {
141
expect(() => require('react-native-renderer')).toThrow(
142
'Incompatible React versions: The "react" and "react-native-renderer" packages ' +
143
'must have the exact same version. Instead got:\n' +
packages/react/src/__tests__/ReactStrictMode-test.js
+1
-40
@@ -438,7 +438,7 @@ describe('ReactStrictMode', () => {
438
});
439
440
// @gate debugRenderPhaseSideEffectsForStrictMode
441
- it('double invokes useMemo functions', async () => {
441
+ it('double invokes useMemo functions with first result', async () => {
442
let log = [];
443
function Uppercased({text}) {
444
const memoizedResult = useMemo(() => {
@@ -1008,45 +1008,6 @@ describe('string refs', () => {
1008
root.render(<OuterComponent />);
1009
});
1010
});
1011
-
1012
- // @gate !disableStringRefs
1013
- it('should warn within a strict tree', async () => {
1014
- const {StrictMode} = React;
1015
-
1016
- class OuterComponent extends React.Component {
1017
- render() {
1018
- return (
1019
- <StrictMode>
1020
- <InnerComponent ref="somestring" />
1021
- </StrictMode>
1022
- );
1023
- }
1024
- }
1025
-
1026
- class InnerComponent extends React.Component {
1027
- render() {
1028
- return null;
1029
- }
1030
- }
1031
-
1032
- const container = document.createElement('div');
1033
- const root = ReactDOMClient.createRoot(container);
1034
- await expect(async () => {
1035
- await act(() => {
1036
- root.render(<OuterComponent />);
1037
- });
1038
- }).toErrorDev(
1039
- 'Warning: Component "OuterComponent" contains the string ref "somestring". ' +
1040
- 'Support for string refs will be removed in a future major release. ' +
1041
- 'We recommend using useRef() or createRef() instead. ' +
1042
- 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
1043
- ' in InnerComponent (at **)',
1044
- );
1045
-
1046
- await act(() => {
1047
- root.render(<OuterComponent />);
1048
- });
1049
- });
1011
});
1012
1013
describe('context legacy', () => {
packages/react/src/__tests__/createReactClassIntegration-test.js
+2
-1
@@ -198,7 +198,8 @@ describe('create-react-class-integration', () => {
198
});
199
200
// TODO: Consider actually moving these to statics or drop this unit test.
201
- xit('should warn when using deprecated non-static spec keys', () => {
201
+ // eslint-disable-next-line jest/no-disabled-tests
202
+ it.skip('should warn when using deprecated non-static spec keys', () => {
203
expect(() =>
204
createReactClass({
205
mixins: [{}],
packages/scheduler/src/__tests__/SchedulerMock-test.js
+1
@@ -444,6 +444,7 @@ describe('Scheduler', () => {
444
// priority if you have sourcemaps.
445
// TODO: Feature temporarily disabled while we investigate a bug in one of
446
// our minifiers.
447
+ // eslint-disable-next-line jest/no-disabled-tests
448
it.skip('adds extra function to the JS stack whose name includes the priority level', async () => {
449
function inferPriorityFromCallstack() {
450
try {
packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js
+1
-1
@@ -288,7 +288,7 @@ describe('SchedulerDOMSetImmediate', () => {
288
});
289
});
290
291
-it('does not crash if setImmediate is undefined', () => {
291
+test('does not crash if setImmediate is undefined', () => {
292
jest.resetModules();
293
const originalSetImmediate = global.setImmediate;
294
try {
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js
+2
-2
@@ -104,7 +104,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
104
};
105
}
106
107
- test('native version', async () => {
107
+ it('native version', async () => {
108
const store = createExternalStore('client');
109
110
function App() {
@@ -124,7 +124,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
124
expect(root).toMatchRenderedOutput('client');
125
});
126
127
- test('Using isEqual to bailout', async () => {
127
+ it('Using isEqual to bailout', async () => {
128
const store = createExternalStore({a: 0, b: 0});
129
130
function A() {
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js
+1
-1
@@ -81,7 +81,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
81
};
82
}
83
84
- test('basic server render', async () => {
84
+ it('basic server render', async () => {
85
const store = createExternalStore('client');
86
87
function App() {
scripts/babel/__tests__/transform-test-gate-pragma-test.js
+33
-31
@@ -10,7 +10,8 @@ describe('transform-test-gate-pragma', () => {
10
// Fake runtime
11
// eslint-disable-next-line no-unused-vars
12
const _test_gate = (gateFn, testName, cb) => {
13
- test(testName, (...args) => {
13
+ // eslint-disable-next-line jest/no-done-callback, jest/valid-title
14
+ it(testName, (...args) => {
15
shouldPass = gateFn(context);
16
return cb(...args);
17
});
@@ -21,7 +22,8 @@ describe('transform-test-gate-pragma', () => {
22
// NOTE: Tests in this file are not actually focused because the calls to
23
// `test.only` and `fit` are compiled to `_test_gate_focus`. So if you want
24
// to focus something, swap the following `test` call for `test.only`.
24
- test(testName, (...args) => {
25
+ // eslint-disable-next-line jest/no-done-callback, jest/valid-title
26
+ it(testName, (...args) => {
27
shouldPass = gateFn(context);
28
isFocused = true;
29
return cb(...args);
@@ -43,34 +45,34 @@ describe('transform-test-gate-pragma', () => {
45
isFocused = false;
46
});
47
46
- test('no pragma', () => {
48
+ it('no pragma', () => {
49
expect(shouldPass).toBe(null);
50
});
51
52
// unrelated comment
51
- test('no pragma, unrelated comment', () => {
53
+ it('no pragma, unrelated comment', () => {
54
expect(shouldPass).toBe(null);
55
});
56
57
// @gate flagThatIsOn
56
- test('basic positive test', () => {
58
+ it('basic positive test', () => {
59
expect(shouldPass).toBe(true);
60
});
61
62
// @gate flagThatIsOff
61
- test('basic negative test', () => {
63
+ it('basic negative test', () => {
64
expect(shouldPass).toBe(false);
65
});
66
67
// @gate flagThatIsOn
66
- it('it method', () => {
68
+ it('method', () => {
69
expect(shouldPass).toBe(true);
70
});
71
72
/* eslint-disable jest/no-focused-tests */
73
74
// @gate flagThatIsOn
73
- test.only('test.only', () => {
75
+ it.only('test.only', () => {
76
expect(isFocused).toBe(true);
77
expect(shouldPass).toBe(true);
78
});
@@ -82,7 +84,7 @@ describe('transform-test-gate-pragma', () => {
84
});
85
86
// @gate flagThatIsOn
85
- fit('fit', () => {
87
+ it.only('fit', () => {
88
expect(isFocused).toBe(true);
89
expect(shouldPass).toBe(true);
90
});
@@ -90,79 +92,79 @@ describe('transform-test-gate-pragma', () => {
92
/* eslint-enable jest/no-focused-tests */
93
94
// @gate !flagThatIsOff
93
- test('flag negation', () => {
95
+ it('flag negation', () => {
96
expect(shouldPass).toBe(true);
97
});
98
99
// @gate flagThatIsOn
100
// @gate !flagThatIsOff
99
- test('multiple gates', () => {
101
+ it('multiple gates', () => {
102
expect(shouldPass).toBe(true);
103
});
104
105
// @gate flagThatIsOn
106
// @gate flagThatIsOff
105
- test('multiple gates 2', () => {
107
+ it('multiple gates 2', () => {
108
expect(shouldPass).toBe(false);
109
});
110
111
// @gate !flagThatIsOff && flagThatIsOn
110
- test('&&', () => {
112
+ it('&&', () => {
113
expect(shouldPass).toBe(true);
114
});
115
116
// @gate flagThatIsOff || flagThatIsOn
115
- test('||', () => {
117
+ it('||', () => {
118
expect(shouldPass).toBe(true);
119
});
120
121
// @gate (flagThatIsOn || flagThatIsOff) && flagThatIsOn
120
- test('groups', () => {
122
+ it('groups', () => {
123
expect(shouldPass).toBe(true);
124
});
125
126
// @gate flagThatIsOn == !flagThatIsOff
125
- test('==', () => {
127
+ it('==', () => {
128
expect(shouldPass).toBe(true);
129
});
130
131
// @gate flagThatIsOn === !flagThatIsOff
130
- test('===', () => {
132
+ it('===', () => {
133
expect(shouldPass).toBe(true);
134
});
135
136
// @gate flagThatIsOn != !flagThatIsOff
135
- test('!=', () => {
137
+ it('!=', () => {
138
expect(shouldPass).toBe(false);
139
});
140
141
// @gate flagThatIsOn != !flagThatIsOff
140
- test('!==', () => {
142
+ it('!==', () => {
143
expect(shouldPass).toBe(false);
144
});
145
146
// @gate flagThatIsOn === true
145
- test('true', () => {
147
+ it('true', () => {
148
expect(shouldPass).toBe(true);
149
});
150
151
// @gate flagThatIsOff === false
150
- test('false', () => {
152
+ it('false', () => {
153
expect(shouldPass).toBe(true);
154
});
155
156
// @gate environment === "fake-environment"
155
- test('double quoted strings', () => {
157
+ it('double quoted strings', () => {
158
expect(shouldPass).toBe(true);
159
});
160
161
// @gate environment === 'fake-environment'
160
- test('single quoted strings', () => {
162
+ it('single quoted strings', () => {
163
expect(shouldPass).toBe(true);
164
});
165
166
// @gate flagThatIsOn // This is a comment
165
- test('line comment', () => {
167
+ it('line comment', () => {
168
expect(shouldPass).toBe(true);
169
});
170
});
@@ -172,14 +174,14 @@ describe('transform test-gate-pragma: actual runtime', () => {
174
// test suite.
175
176
// @gate __DEV__
175
- test('__DEV__', () => {
177
+ it('__DEV__', () => {
178
if (!__DEV__) {
179
throw Error("Doesn't work in production!");
180
}
181
});
182
183
// @gate build === "development"
182
- test('strings', () => {
184
+ it('strings', () => {
185
if (!__DEV__) {
186
throw Error("Doesn't work in production!");
187
}
@@ -187,25 +189,25 @@ describe('transform test-gate-pragma: actual runtime', () => {
189
190
// Always should fail because of the unguarded console.error
191
// @gate false
190
- test('works with console.error tracking', () => {
192
+ it('works with console.error tracking', () => {
193
console.error('Should cause test to fail');
194
});
195
196
// Always should fail because of the unguarded console.warn
197
// @gate false
196
- test('works with console.warn tracking', () => {
198
+ it('works with console.warn tracking', () => {
199
console.warn('Should cause test to fail');
200
});
201
202
// @gate false
201
- test('works with console tracking if error is thrown before end of test', () => {
203
+ it('works with console tracking if error is thrown before end of test', () => {
204
console.warn('Please stop that!');
205
console.error('Stop that!');
206
throw Error('I told you to stop!');
207
});
208
209
// @gate false
208
- test('a global error event is treated as a test failure', () => {
210
+ it('a global error event is treated as a test failure', () => {
211
dispatchEvent(
212
new ErrorEvent('error', {
213
error: new Error('Oops!'),
@@ -216,7 +218,7 @@ describe('transform test-gate-pragma: actual runtime', () => {
218
219
describe('dynamic gate method', () => {
220
// @gate experimental && __DEV__
219
- test('returns same conditions as pragma', () => {
221
+ it('returns same conditions as pragma', () => {
222
expect(gate(ctx => ctx.experimental && ctx.__DEV__)).toBe(true);
223
});
224
});
yarn.lock
+108
-35
@@ -2206,7 +2206,7 @@
2206
opn "5.3.0"
2207
react "^16.13.1"
2208
2209
-"@eslint-community/eslint-utils@^4.2.0":
2209
+"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
2210
version "4.4.0"
2211
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
2212
integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
@@ -3222,6 +3222,11 @@
3222
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
3223
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
3224
3225
+"@types/json-schema@^7.0.12":
3226
+ version "7.0.15"
3227
+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
3228
+ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
3229
+
3230
"@types/json-schema@^7.0.3":
3231
version "7.0.3"
3232
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
@@ -3310,6 +3315,11 @@
3315
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d"
3316
integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==
3317
3318
+"@types/semver@^7.5.0":
3319
+ version "7.5.8"
3320
+ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
3321
+ integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==
3322
+
3323
"@types/send@*":
3324
version "0.17.1"
3325
resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301"
@@ -3404,15 +3414,6 @@
3414
eslint-scope "^5.0.0"
3415
eslint-utils "^2.0.0"
3416
3407
-"@typescript-eslint/experimental-utils@^1.13.0":
3408
- version "1.13.0"
3409
- resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
3410
- integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==
3411
- dependencies:
3412
- "@types/json-schema" "^7.0.3"
3413
- "@typescript-eslint/typescript-estree" "1.13.0"
3414
- eslint-scope "^4.0.0"
3415
-
3417
"@typescript-eslint/parser-v2@npm:@typescript-eslint/parser@^2.26.0":
3418
version "2.34.0"
3419
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8"
@@ -3470,6 +3471,14 @@
3471
"@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
3472
"@typescript-eslint/visitor-keys" "5.0.0-alpha.25+faf2d1d2"
3473
3474
+"@typescript-eslint/scope-manager@6.21.0":
3475
+ version "6.21.0"
3476
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1"
3477
+ integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==
3478
+ dependencies:
3479
+ "@typescript-eslint/types" "6.21.0"
3480
+ "@typescript-eslint/visitor-keys" "6.21.0"
3481
+
3482
"@typescript-eslint/types@3.10.1":
3483
version "3.10.1"
3484
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727"
@@ -3485,13 +3494,10 @@
3494
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.0.0-alpha.25.tgz#2c5aaaee8d41d08fbb91193cc6df482374700b2e"
3495
integrity sha512-M9PZ+m1vD+UaBt+9hJ1bXTA94s4fvY3fOQkwYxrtreqqdzaiNcW8F5GAO3dthzmS+6II+XAsWfCQzCoBvoiOrw==
3496
3488
-"@typescript-eslint/typescript-estree@1.13.0":
3489
- version "1.13.0"
3490
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
3491
- integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==
3492
- dependencies:
3493
- lodash.unescape "4.0.1"
3494
- semver "5.5.0"
3497
+"@typescript-eslint/types@6.21.0":
3498
+ version "6.21.0"
3499
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d"
3500
+ integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==
3501
3502
"@typescript-eslint/typescript-estree@2.34.0":
3503
version "2.34.0"
@@ -3547,6 +3553,33 @@
3553
semver "^7.3.5"
3554
tsutils "^3.21.0"
3555
3556
+"@typescript-eslint/typescript-estree@6.21.0":
3557
+ version "6.21.0"
3558
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46"
3559
+ integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==
3560
+ dependencies:
3561
+ "@typescript-eslint/types" "6.21.0"
3562
+ "@typescript-eslint/visitor-keys" "6.21.0"
3563
+ debug "^4.3.4"
3564
+ globby "^11.1.0"
3565
+ is-glob "^4.0.3"
3566
+ minimatch "9.0.3"
3567
+ semver "^7.5.4"
3568
+ ts-api-utils "^1.0.1"
3569
+
3570
+"@typescript-eslint/utils@^6.0.0":
3571
+ version "6.21.0"
3572
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134"
3573
+ integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==
3574
+ dependencies:
3575
+ "@eslint-community/eslint-utils" "^4.4.0"
3576
+ "@types/json-schema" "^7.0.12"
3577
+ "@types/semver" "^7.5.0"
3578
+ "@typescript-eslint/scope-manager" "6.21.0"
3579
+ "@typescript-eslint/types" "6.21.0"
3580
+ "@typescript-eslint/typescript-estree" "6.21.0"
3581
+ semver "^7.5.4"
3582
+
3583
"@typescript-eslint/visitor-keys@3.10.1":
3584
version "3.10.1"
3585
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931"
@@ -3570,6 +3603,14 @@
3603
"@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
3604
eslint-visitor-keys "^3.0.0"
3605
3606
+"@typescript-eslint/visitor-keys@6.21.0":
3607
+ version "6.21.0"
3608
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47"
3609
+ integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==
3610
+ dependencies:
3611
+ "@typescript-eslint/types" "6.21.0"
3612
+ eslint-visitor-keys "^3.4.1"
3613
+
3614
"@vercel/build-utils@2.5.1":
3615
version "2.5.1"
3616
resolved "https://registry.yarnpkg.com/@vercel/build-utils/-/build-utils-2.5.1.tgz#2f687c2d82464dd85e0ed8130bc01e5dac9b11a4"
@@ -6365,6 +6406,13 @@ debug@^4.3.1:
6406
dependencies:
6407
ms "2.1.2"
6408
6409
+debug@^4.3.4:
6410
+ version "4.3.5"
6411
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e"
6412
+ integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==
6413
+ dependencies:
6414
+ ms "2.1.2"
6415
+
6416
decamelize@3.2.0:
6417
version "3.2.0"
6418
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-3.2.0.tgz#84b8e8f4f8c579f938e35e2cc7024907e0090851"
@@ -7130,12 +7178,12 @@ eslint-plugin-ft-flow@^2.0.3:
7178
lodash "^4.17.21"
7179
string-natural-compare "^3.0.1"
7180
7133
-eslint-plugin-jest@^22.15.0:
7134
- version "22.15.0"
7135
- resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.0.tgz#fe70bfff7eeb47ca0ab229588a867f82bb8592c5"
7136
- integrity sha512-hgnPbSqAIcLLS9ePb12hNHTRkXnkVaCfOwCt2pzQ8KpOKPWGA4HhLMaFN38NBa/0uvLfrZpcIRjT+6tMAfr58Q==
7181
+eslint-plugin-jest@28.4.0:
7182
+ version "28.4.0"
7183
+ resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.4.0.tgz#213be88f799a35ca9d63ce1a30081bb32b8da765"
7184
+ integrity sha512-ORVHiFPC8RQxHLyQJ37MxNilK9k+cPzjHz65T8gAbpYZunGutXvKqwfM3WXBCvFDF1QBeYJJu9LB/i5cuXBs+g==
7185
dependencies:
7138
- "@typescript-eslint/experimental-utils" "^1.13.0"
7186
+ "@typescript-eslint/utils" "^6.0.0"
7187
7188
eslint-plugin-no-for-of-loops@^1.0.0:
7189
version "1.0.1"
@@ -7196,7 +7244,7 @@ eslint-scope@5.1.1, eslint-scope@^5.1.1:
7244
esrecurse "^4.3.0"
7245
estraverse "^4.1.1"
7246
7199
-eslint-scope@^4.0.0, eslint-scope@^4.0.3:
7247
+eslint-scope@^4.0.3:
7248
version "4.0.3"
7249
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
7250
integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==
@@ -7337,7 +7385,7 @@ eslint-visitor-keys@^3.0.0:
7385
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186"
7386
integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==
7387
7340
-eslint-visitor-keys@^3.3.0:
7388
+eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1:
7389
version "3.4.3"
7390
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
7391
integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
@@ -7800,6 +7848,17 @@ fast-glob@^3.1.1:
7848
micromatch "^4.0.2"
7849
picomatch "^2.2.1"
7850
7851
+fast-glob@^3.2.9:
7852
+ version "3.3.2"
7853
+ resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
7854
+ integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==
7855
+ dependencies:
7856
+ "@nodelib/fs.stat" "^2.0.2"
7857
+ "@nodelib/fs.walk" "^1.2.3"
7858
+ glob-parent "^5.1.2"
7859
+ merge2 "^1.3.0"
7860
+ micromatch "^4.0.4"
7861
+
7862
fast-json-patch@^2.0.6:
7863
version "2.2.1"
7864
resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-2.2.1.tgz#18150d36c9ab65c7209e7d4eb113f4f8eaabe6d9"
@@ -8696,6 +8755,18 @@ globby@^11.0.3:
8755
merge2 "^1.3.0"
8756
slash "^3.0.0"
8757
8758
+globby@^11.1.0:
8759
+ version "11.1.0"
8760
+ resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
8761
+ integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
8762
+ dependencies:
8763
+ array-union "^2.1.0"
8764
+ dir-glob "^3.0.1"
8765
+ fast-glob "^3.2.9"
8766
+ ignore "^5.2.0"
8767
+ merge2 "^1.4.1"
8768
+ slash "^3.0.0"
8769
+
8770
google-closure-compiler-java@^20230206.0.0:
8771
version "20230206.0.0"
8772
resolved "https://registry.yarnpkg.com/google-closure-compiler-java/-/google-closure-compiler-java-20230206.0.0.tgz#e615c1f17901b7f7906d891f132e2867e8a21019"
@@ -11216,11 +11287,6 @@ lodash.truncate@^4.4.2:
11287
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
11288
integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==
11289
11219
-lodash.unescape@4.0.1:
11220
- version "4.0.1"
11221
- resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
11222
- integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
11223
-
11290
lodash.union@^4.6.0:
11291
version "4.6.0"
11292
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
@@ -11500,7 +11566,7 @@ merge-stream@^2.0.0:
11566
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
11567
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
11568
11503
-merge2@^1.3.0:
11569
+merge2@^1.3.0, merge2@^1.4.1:
11570
version "1.4.1"
11571
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
11572
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
@@ -11631,6 +11697,13 @@ minimalistic-assert@^1.0.0:
11697
dependencies:
11698
brace-expansion "^1.1.7"
11699
11700
+minimatch@9.0.3:
11701
+ version "9.0.3"
11702
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
11703
+ integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
11704
+ dependencies:
11705
+ brace-expansion "^2.0.1"
11706
+
11707
minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
11708
version "3.1.2"
11709
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
@@ -14283,11 +14356,6 @@ semver-truncate@^1.1.2:
14356
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
14357
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
14358
14286
-semver@5.5.0:
14287
- version "5.5.0"
14288
- resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
14289
- integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==
14290
-
14359
semver@7.0.0:
14360
version "7.0.0"
14361
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
@@ -15656,6 +15724,11 @@ trim-repeated@^1.0.0:
15724
dependencies:
15725
escape-string-regexp "^1.0.2"
15726
15727
+ts-api-utils@^1.0.1:
15728
+ version "1.3.0"
15729
+ resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1"
15730
+ integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==
15731
+
15732
ts-node@8.9.1:
15733
version "8.9.1"
15734
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.1.tgz#2f857f46c47e91dcd28a14e052482eb14cfd65a5"