@samitouri / QOS-React / commits / 1214b302e1

test: Fix "couldn't locate all inline snapshots" (#21205)

Sebastian Silbermann committed Apr 8, 2021 at 17:18 UTC 1214b302e11b06f5fd11f2af20c20b2f26386827
8 files changed +68 -183
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+36 -89
@@ -136,7 +136,7 @@ describe('InspectedElement', () => {
136 return inspectedElement;
137 }
138
139 - it('should inspect the currently selected element', async done => {
139 + it('should inspect the currently selected element', async () => {
140 const Example = () => {
141 const [count] = React.useState(1);
142 return count;
@@ -170,11 +170,9 @@ describe('InspectedElement', () => {
170 "state": null,
171 }
172 `);
173 -
174 - done();
173 });
174
177 - it('should have hasLegacyContext flag set to either "true" or "false" depending on which context API is used.', async done => {
175 + it('should have hasLegacyContext flag set to either "true" or "false" depending on which context API is used.', async () => {
176 const contextData = {
177 bool: true,
178 };
@@ -270,10 +268,9 @@ describe('InspectedElement', () => {
268 expect(inspectedElement.context).not.toBe(null);
269 expect(inspectedElement.hasLegacyContext).toBe(shouldHaveLegacyContext);
270 }
273 - done();
271 });
272
276 - it('should poll for updates for the currently selected element', async done => {
273 + it('should poll for updates for the currently selected element', async () => {
274 const Example = () => null;
275
276 const container = document.createElement('div');
@@ -312,11 +309,9 @@ describe('InspectedElement', () => {
309 "b": "def",
310 }
311 `);
315 -
316 - done();
312 });
313
319 - it('should not re-render a function with hooks if it did not update since it was last inspected', async done => {
314 + it('should not re-render a function with hooks if it did not update since it was last inspected', async () => {
315 let targetRenderCount = 0;
316
317 const Wrapper = ({children}) => children;
@@ -377,11 +372,9 @@ describe('InspectedElement', () => {
372 "b": "def",
373 }
374 `);
380 -
381 - done();
375 });
376
384 - it('should temporarily disable console logging when re-running a component to inspect its hooks', async done => {
377 + it('should temporarily disable console logging when re-running a component to inspect its hooks', async () => {
378 let targetRenderCount = 0;
379
380 jest.spyOn(console, 'error').mockImplementation(() => {});
@@ -422,11 +415,9 @@ describe('InspectedElement', () => {
415 expect(console.info).toHaveBeenCalledTimes(1);
416 expect(console.log).toHaveBeenCalledTimes(1);
417 expect(console.warn).toHaveBeenCalledTimes(1);
425 -
426 - done();
418 });
419
429 - it('should support simple data types', async done => {
420 + it('should support simple data types', async () => {
421 const Example = () => null;
422
423 const container = document.createElement('div');
@@ -463,11 +454,9 @@ describe('InspectedElement', () => {
454 expect(props.nan).toBeNaN();
455 expect(props.value_null).toBeNull();
456 expect(props.value_undefined).toBeUndefined();
466 -
467 - done();
457 });
458
470 - it('should support complex data types', async done => {
459 + it('should support complex data types', async () => {
460 const Immutable = require('immutable');
461
462 const Example = () => null;
@@ -719,11 +708,9 @@ describe('InspectedElement', () => {
708 expect(typed_array[2]).toBe(0);
709 expect(typed_array[meta.preview_long]).toBe('Int8Array(3) [100, -100, 0]');
710 expect(typed_array[meta.preview_short]).toBe('Int8Array(3)');
722 -
723 - done();
711 });
712
726 - it('should not consume iterables while inspecting', async done => {
713 + it('should not consume iterables while inspecting', async () => {
714 const Example = () => null;
715
716 function* generator() {
@@ -745,11 +732,9 @@ describe('InspectedElement', () => {
732 expect(prop[meta.type]).toBe('opaque_iterator');
733 expect(prop[meta.preview_long]).toBe('Generator');
734 expect(prop[meta.preview_short]).toBe('Generator');
748 -
749 - done();
735 });
736
752 - it('should support objects with no prototype', async done => {
737 + it('should support objects with no prototype', async () => {
738 const Example = () => null;
739
740 const object = Object.create(null);
@@ -772,11 +757,9 @@ describe('InspectedElement', () => {
757 },
758 }
759 `);
775 -
776 - done();
760 });
761
779 - it('should support objects with overridden hasOwnProperty', async done => {
762 + it('should support objects with overridden hasOwnProperty', async () => {
763 const Example = () => null;
764
765 const object = {
@@ -795,11 +778,9 @@ describe('InspectedElement', () => {
778 // Our snapshot serializer relies on hasOwnProperty() for feature detection.
779 expect(inspectedElement.props.object.name).toBe('blah');
780 expect(inspectedElement.props.object.hasOwnProperty).toBe(true);
798 -
799 - done();
781 });
782
802 - it('should support custom objects with enumerable properties and getters', async done => {
783 + it('should support custom objects with enumerable properties and getters', async () => {
784 class CustomData {
785 _number = 42;
786 get number() {
@@ -833,11 +814,9 @@ describe('InspectedElement', () => {
814 },
815 }
816 `);
836 -
837 - done();
817 });
818
840 - it('should support objects with with inherited keys', async done => {
819 + it('should support objects with with inherited keys', async () => {
820 const Example = () => null;
821
822 const base = Object.create(Object.prototype, {
@@ -917,11 +896,9 @@ describe('InspectedElement', () => {
896 },
897 }
898 `);
920 -
921 - done();
899 });
900
924 - it('should allow component prop value and value`s prototype has same name params.', async done => {
901 + it('should allow component prop value and value`s prototype has same name params.', async () => {
902 const testData = Object.create(
903 {
904 a: undefined,
@@ -973,11 +950,9 @@ describe('InspectedElement', () => {
950 },
951 }
952 `);
976 -
977 - done();
953 });
954
980 - it('should not dehydrate nested values until explicitly requested', async done => {
955 + it('should not dehydrate nested values until explicitly requested', async () => {
956 const Example = () => {
957 const [state] = React.useState({
958 foo: {
@@ -1140,11 +1115,9 @@ describe('InspectedElement', () => {
1115 },
1116 ]
1117 `);
1143 -
1144 - done();
1118 });
1119
1147 - it('should dehydrate complex nested values when requested', async done => {
1120 + it('should dehydrate complex nested values when requested', async () => {
1121 const Example = () => null;
1122
1123 const container = document.createElement('div');
@@ -1208,11 +1181,9 @@ describe('InspectedElement', () => {
1181 },
1182 }
1183 `);
1211 -
1212 - done();
1184 });
1185
1215 - it('should include updates for nested values that were previously hydrated', async done => {
1186 + it('should include updates for nested values that were previously hydrated', async () => {
1187 const Example = () => null;
1188
1189 const container = document.createElement('div');
@@ -1373,11 +1344,9 @@ describe('InspectedElement', () => {
1344 },
1345 }
1346 `);
1376 -
1377 - done();
1347 });
1348
1380 - it('should return a full update if a path is inspected for an object that has other pending changes', async done => {
1349 + it('should return a full update if a path is inspected for an object that has other pending changes', async () => {
1350 const Example = () => null;
1351
1352 const container = document.createElement('div');
@@ -1510,11 +1479,9 @@ describe('InspectedElement', () => {
1479 },
1480 }
1481 `);
1513 -
1514 - done();
1482 });
1483
1517 - it('should not tear if hydration is requested after an update', async done => {
1484 + it('should not tear if hydration is requested after an update', async () => {
1485 const Example = () => null;
1486
1487 const container = document.createElement('div');
@@ -1598,11 +1565,9 @@ describe('InspectedElement', () => {
1565 },
1566 }
1567 `);
1601 -
1602 - done();
1568 });
1569
1605 - it('should inspect hooks for components that only use context', async done => {
1570 + it('should inspect hooks for components that only use context', async () => {
1571 const Context = React.createContext(true);
1572 const Example = () => {
1573 const value = React.useContext(Context);
@@ -1637,11 +1602,9 @@ describe('InspectedElement', () => {
1602 "state": null,
1603 }
1604 `);
1640 -
1641 - done();
1605 });
1606
1644 - it('should enable inspected values to be stored as global variables', async done => {
1607 + it('should enable inspected values to be stored as global variables', async () => {
1608 const Example = () => null;
1609
1610 const nestedObject = {
@@ -1698,11 +1661,9 @@ describe('InspectedElement', () => {
1661 jest.runOnlyPendingTimers();
1662 expect(console.log).toHaveBeenCalledWith('$reactTemp1');
1663 expect(global.$reactTemp1).toBe(nestedObject.a.b);
1701 -
1702 - done();
1664 });
1665
1705 - it('should enable inspected values to be copied to the clipboard', async done => {
1666 + it('should enable inspected values to be copied to the clipboard', async () => {
1667 const Example = () => null;
1668
1669 const nestedObject = {
@@ -1761,11 +1722,9 @@ describe('InspectedElement', () => {
1722 expect(global.mockClipboardCopy).toHaveBeenCalledWith(
1723 JSON.stringify(nestedObject.a.b),
1724 );
1764 -
1765 - done();
1725 });
1726
1768 - it('should enable complex values to be copied to the clipboard', async done => {
1727 + it('should enable complex values to be copied to the clipboard', async () => {
1728 const Immutable = require('immutable');
1729
1730 const Example = () => null;
@@ -1856,11 +1815,9 @@ describe('InspectedElement', () => {
1815 expect(global.mockClipboardCopy).toHaveBeenCalledWith(
1816 JSON.stringify({0: 100, 1: -100, 2: 0}),
1817 );
1859 -
1860 - done();
1818 });
1819
1863 - it('should display complex values of useDebugValue', async done => {
1820 + it('should display complex values of useDebugValue', async () => {
1821 const container = document.createElement('div');
1822
1823 function useDebuggableHook() {
@@ -1899,12 +1856,10 @@ describe('InspectedElement', () => {
1856 },
1857 ]
1858 `);
1902 -
1903 - done();
1859 });
1860
1861 describe('$r', () => {
1907 - it('should support function components', async done => {
1862 + it('should support function components', async () => {
1863 const Example = () => {
1864 const [count] = React.useState(1);
1865 return count;
@@ -1935,11 +1890,9 @@ describe('InspectedElement', () => {
1890 "type": [Function],
1891 }
1892 `);
1938 -
1939 - done();
1893 });
1894
1942 - it('should support memoized function components', async done => {
1895 + it('should support memoized function components', async () => {
1896 const Example = React.memo(function Example(props) {
1897 const [count] = React.useState(1);
1898 return count;
@@ -1970,11 +1923,9 @@ describe('InspectedElement', () => {
1923 "type": [Function],
1924 }
1925 `);
1973 -
1974 - done();
1926 });
1927
1977 - it('should support forward refs', async done => {
1928 + it('should support forward refs', async () => {
1929 const Example = React.forwardRef(function Example(props, ref) {
1930 const [count] = React.useState(1);
1931 return count;
@@ -2005,11 +1956,9 @@ describe('InspectedElement', () => {
1956 "type": [Function],
1957 }
1958 `);
2008 -
2009 - done();
1959 });
1960
2012 - it('should support class components', async done => {
1961 + it('should support class components', async () => {
1962 class Example extends React.Component {
1963 state = {
1964 count: 0,
@@ -2027,18 +1976,16 @@ describe('InspectedElement', () => {
1976 await inspectElementAtIndex(0);
1977
1978 expect(global.$r.props).toMatchInlineSnapshot(`
2030 - Object {
2031 - "a": 1,
2032 - "b": "abc",
2033 - }
2034 - `);
1979 + Object {
1980 + "a": 1,
1981 + "b": "abc",
1982 + }
1983 + `);
1984 expect(global.$r.state).toMatchInlineSnapshot(`
2036 - Object {
2037 - "count": 0,
2038 - }
2039 - `);
2040 -
2041 - done();
1985 + Object {
1986 + "count": 0,
1987 + }
1988 + `);
1989 });
1990 });
1991
packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js
+10 -29
@@ -62,7 +62,7 @@ describe('InspectedElementContext', () => {
62 ReactDOM = require('react-dom');
63 });
64
65 - it('should inspect the currently selected element', async done => {
65 + it('should inspect the currently selected element', async () => {
66 const Example = () => null;
67
68 act(() =>
@@ -86,11 +86,9 @@ describe('InspectedElementContext', () => {
86 "state": null,
87 }
88 `);
89 -
90 - done();
89 });
90
93 - it('should support simple data types', async done => {
91 + it('should support simple data types', async () => {
92 const Example = () => null;
93
94 act(() =>
@@ -138,11 +136,9 @@ describe('InspectedElementContext', () => {
136 "state": null,
137 }
138 `);
141 -
142 - done();
139 });
140
145 - it('should support complex data types', async done => {
141 + it('should support complex data types', async () => {
142 const Immutable = require('immutable');
143
144 const Example = () => null;
@@ -338,11 +334,9 @@ describe('InspectedElementContext', () => {
334 expect(typed_array[0]).toBe(100);
335 expect(typed_array[1]).toBe(-100);
336 expect(typed_array[2]).toBe(0);
341 -
342 - done();
337 });
338
345 - it('should support objects with no prototype', async done => {
339 + it('should support objects with no prototype', async () => {
340 const Example = () => null;
341
342 const object = Object.create(null);
@@ -369,11 +363,9 @@ describe('InspectedElementContext', () => {
363 },
364 }
365 `);
372 -
373 - done();
366 });
367
376 - it('should support objects with overridden hasOwnProperty', async done => {
368 + it('should support objects with overridden hasOwnProperty', async () => {
369 const Example = () => null;
370
371 const object = {
@@ -395,11 +387,9 @@ describe('InspectedElementContext', () => {
387 // Our snapshot serializer relies on hasOwnProperty() for feature detection.
388 expect(inspectedElement.props.object.name).toBe('blah');
389 expect(inspectedElement.props.object.hasOwnProperty).toBe(true);
398 -
399 - done();
390 });
391
402 - it('should not consume iterables while inspecting', async done => {
392 + it('should not consume iterables while inspecting', async () => {
393 const Example = () => null;
394
395 function* generator() {
@@ -440,11 +430,9 @@ describe('InspectedElementContext', () => {
430 expect(iteratable.next().value).toEqual(1);
431 expect(iteratable.next().value).toEqual(2);
432 expect(iteratable.next().value).toBeUndefined();
443 -
444 - done();
433 });
434
447 - it('should support custom objects with enumerable properties and getters', async done => {
435 + it('should support custom objects with enumerable properties and getters', async () => {
436 class CustomData {
437 _number = 42;
438 get number() {
@@ -490,11 +478,9 @@ describe('InspectedElementContext', () => {
478 "state": null,
479 }
480 `);
493 -
494 - done();
481 });
482
497 - it('should support objects with with inherited keys', async done => {
483 + it('should support objects with with inherited keys', async () => {
484 const Example = () => null;
485
486 const base = Object.create(Object.prototype, {
@@ -583,11 +569,9 @@ describe('InspectedElementContext', () => {
569 "state": null,
570 }
571 `);
586 -
587 - done();
572 });
573
590 - it('should allow component prop value and value`s prototype has same name params.', async done => {
574 + it('should allow component prop value and value`s prototype has same name params.', async () => {
575 const testData = Object.create(
576 {
577 a: undefined,
@@ -644,10 +628,9 @@ describe('InspectedElementContext', () => {
628 },
629 }
630 `);
647 - done();
631 });
632
650 - it('should not dehydrate nested values until explicitly requested', async done => {
633 + it('should not dehydrate nested values until explicitly requested', async () => {
634 const Example = () => null;
635
636 act(() =>
@@ -747,8 +730,6 @@ describe('InspectedElementContext', () => {
730 },
731 }
732 `);
750 -
751 - done();
733 });
734
735 it('should enable inspected values to be stored as global variables', () => {
packages/react-devtools-shared/src/__tests__/ownersListContext-test.js
+4 -11
@@ -60,7 +60,7 @@ describe('OwnersListContext', () => {
60 </BridgeContext.Provider>
61 );
62
63 - it('should fetch the owners list for the selected element', async done => {
63 + it('should fetch the owners list for the selected element', async () => {
64 const Grandparent = () => <Parent />;
65 const Parent = () => {
66 return (
@@ -115,11 +115,9 @@ describe('OwnersListContext', () => {
115 ),
116 );
117 expect(didFinish).toBe(true);
118 -
119 - done();
118 });
119
122 - it('should fetch the owners list for the selected element that includes filtered components', async done => {
120 + it('should fetch the owners list for the selected element that includes filtered components', async () => {
121 store.componentFilters = [utils.createDisplayNameFilter('^Parent$')];
122
123 const Grandparent = () => <Parent />;
@@ -163,11 +161,9 @@ describe('OwnersListContext', () => {
161 ),
162 );
163 expect(didFinish).toBe(true);
166 -
167 - done();
164 });
165
170 - it('should include the current element even if there are no other owners', async done => {
166 + it('should include the current element even if there are no other owners', async () => {
167 store.componentFilters = [utils.createDisplayNameFilter('^Parent$')];
168
169 const Grandparent = () => <Parent />;
@@ -203,11 +199,9 @@ describe('OwnersListContext', () => {
199 ),
200 );
201 expect(didFinish).toBe(true);
206 -
207 - done();
202 });
203
210 - it('should include all owners for a component wrapped in react memo', async done => {
204 + it('should include all owners for a component wrapped in react memo', async () => {
205 const InnerComponent = (props, ref) => <div ref={ref} />;
206 const ForwardRef = React.forwardRef(InnerComponent);
207 const Memo = React.memo(ForwardRef);
@@ -243,6 +237,5 @@ describe('OwnersListContext', () => {
237 ),
238 );
239 expect(didFinish).toBe(true);
246 - done();
240 });
241 });
packages/react-devtools-shared/src/__tests__/profilerContext-test.js
+6 -18
@@ -74,7 +74,7 @@ describe('ProfilerContext', () => {
74 </BridgeContext.Provider>
75 );
76
77 - it('updates updates profiling support based on the attached roots', async done => {
77 + it('updates updates profiling support based on the attached roots', async () => {
78 const Component = () => null;
79
80 let context: Context = ((null: any): Context);
@@ -105,11 +105,9 @@ describe('ProfilerContext', () => {
105
106 await utils.actAsync(() => ReactDOM.unmountComponentAtNode(containerB));
107 expect(context.supportsProfiling).toBe(false);
108 -
109 - done();
108 });
109
112 - it('should gracefully handle an empty profiling session (with no recorded commits)', async done => {
110 + it('should gracefully handle an empty profiling session (with no recorded commits)', async () => {
111 const Example = () => null;
112
113 utils.act(() =>
@@ -144,11 +142,9 @@ describe('ProfilerContext', () => {
142 expect(context.isProcessingData).toBe(false);
143 expect(context.isProfiling).toBe(false);
144 expect(context.profilingData).toBe(null);
147 -
148 - done();
145 });
146
151 - it('should auto-select the root ID matching the Components tab selection if it has profiling data', async done => {
147 + it('should auto-select the root ID matching the Components tab selection if it has profiling data', async () => {
148 const Parent = () => <Child />;
149 const Child = () => null;
150
@@ -185,11 +181,9 @@ describe('ProfilerContext', () => {
181 expect(context.rootID).toBe(
182 store.getRootIDForElement(((store.getElementIDAtIndex(3): any): number)),
183 );
188 -
189 - done();
184 });
185
192 - it('should not select the root ID matching the Components tab selection if it has no profiling data', async done => {
186 + it('should not select the root ID matching the Components tab selection if it has no profiling data', async () => {
187 const Parent = () => <Child />;
188 const Child = () => null;
189
@@ -226,11 +220,9 @@ describe('ProfilerContext', () => {
220 expect(context.rootID).toBe(
221 store.getRootIDForElement(((store.getElementIDAtIndex(0): any): number)),
222 );
229 -
230 - done();
223 });
224
233 - it('should maintain root selection between profiling sessions so long as there is data for that root', async done => {
225 + it('should maintain root selection between profiling sessions so long as there is data for that root', async () => {
226 const Parent = () => <Child />;
227 const Child = () => null;
228
@@ -284,11 +276,9 @@ describe('ProfilerContext', () => {
276 expect(selectedElementID).toBe(otherID);
277 expect(context).not.toBeNull();
278 expect(context.rootID).toBe(store.getRootIDForElement(id));
287 -
288 - done();
279 });
280
291 - it('should sync selected element in the Components tab too, provided the element is a match', async done => {
281 + it('should sync selected element in the Components tab too, provided the element is a match', async () => {
282 const GrandParent = ({includeChild}) => (
283 <Parent includeChild={includeChild} />
284 );
@@ -340,7 +330,5 @@ describe('ProfilerContext', () => {
330 // Select an unmounted element and verify no Components tab selection doesn't change.
331 await utils.actAsync(() => context.selectFiber(childID, 'Child'));
332 expect(selectedElementID).toBe(parentID);
343 -
344 - done();
333 });
334 });
packages/react-devtools-shared/src/__tests__/profilingCache-test.js
+1 -3
@@ -478,7 +478,7 @@ describe('ProfilingCache', () => {
478 expect(commitData).not.toBeNull();
479 });
480
481 - it('should calculate self duration correctly for suspended views', async done => {
481 + it('should calculate self duration correctly for suspended views', async () => {
482 let data;
483 const getData = () => {
484 if (data) {
@@ -536,8 +536,6 @@ describe('ProfilingCache', () => {
536 }
537
538 expect(allCommitData).toHaveLength(2);
539 -
540 - done();
539 });
540
541 it('should collect data for each rendered fiber', () => {
packages/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder-test.js
+4 -12
@@ -104,7 +104,7 @@ describe('commit tree', () => {
104 LazyComponent = React.lazy(() => fakeImport(LazyInnerComponent));
105 });
106
107 - it('should support Lazy components (legacy render)', async done => {
107 + it('should support Lazy components (legacy render)', async () => {
108 const container = document.createElement('div');
109
110 utils.act(() => store.profilerStore.startProfiling());
@@ -145,11 +145,9 @@ describe('commit tree', () => {
145
146 expect(renderFinished).toBe(true);
147 }
148 -
149 - done();
148 });
149
152 - it('should support Lazy components (createRoot)', async done => {
150 + it('should support Lazy components (createRoot)', async () => {
151 const container = document.createElement('div');
152 const root = ReactDOM.unstable_createRoot(container);
153
@@ -185,11 +183,9 @@ describe('commit tree', () => {
183
184 expect(renderFinished).toBe(true);
185 }
188 -
189 - done();
186 });
187
192 - it('should support Lazy components that are unmounted before resolving (legacy render)', async done => {
188 + it('should support Lazy components that are unmounted before resolving (legacy render)', async () => {
189 const container = document.createElement('div');
190
191 utils.act(() => store.profilerStore.startProfiling());
@@ -226,11 +222,9 @@ describe('commit tree', () => {
222
223 expect(renderFinished).toBe(true);
224 }
229 -
230 - done();
225 });
226
233 - it('should support Lazy components that are unmounted before resolving (createRoot)', async done => {
227 + it('should support Lazy components that are unmounted before resolving (createRoot)', async () => {
228 const container = document.createElement('div');
229 const root = ReactDOM.unstable_createRoot(container);
230
@@ -264,8 +258,6 @@ describe('commit tree', () => {
258
259 expect(renderFinished).toBe(true);
260 }
267 -
268 - done();
261 });
262 });
263 });
packages/react-devtools-shared/src/__tests__/store-test.js
+5 -15
@@ -853,7 +853,7 @@ describe('Store', () => {
853 expect(store).toMatchSnapshot('1: mount');
854 });
855
856 - it('should show the right display names for special component types', async done => {
856 + it('should show the right display names for special component types', async () => {
857 const MyComponent = (props, ref) => null;
858 const ForwardRefComponent = React.forwardRef(MyComponent);
859 const MyComponent2 = (props, ref) => null;
@@ -905,8 +905,6 @@ describe('Store', () => {
905 act(() => ReactDOM.render(<App />, container));
906
907 expect(store).toMatchSnapshot();
908 -
909 - done();
908 });
909
910 describe('Lazy', () => {
@@ -933,7 +931,7 @@ describe('Store', () => {
931 LazyComponent = React.lazy(() => fakeImport(LazyInnerComponent));
932 });
933
936 - it('should support Lazy components (legacy render)', async done => {
934 + it('should support Lazy components (legacy render)', async () => {
935 const container = document.createElement('div');
936
937 // Render once to start fetching the lazy component
@@ -952,11 +950,9 @@ describe('Store', () => {
950 act(() => ReactDOM.render(<App renderChildren={false} />, container));
951
952 expect(store).toMatchSnapshot('3: unmounted');
955 -
956 - done();
953 });
954
959 - it('should support Lazy components in (createRoot)', async done => {
955 + it('should support Lazy components in (createRoot)', async () => {
956 const container = document.createElement('div');
957 const root = ReactDOM.unstable_createRoot(container);
958
@@ -976,11 +972,9 @@ describe('Store', () => {
972 act(() => root.render(<App renderChildren={false} />));
973
974 expect(store).toMatchSnapshot('3: unmounted');
979 -
980 - done();
975 });
976
983 - it('should support Lazy components that are unmounted before they finish loading (legacy render)', async done => {
977 + it('should support Lazy components that are unmounted before they finish loading (legacy render)', async () => {
978 const container = document.createElement('div');
979
980 // Render once to start fetching the lazy component
@@ -992,11 +986,9 @@ describe('Store', () => {
986 act(() => ReactDOM.render(<App renderChildren={false} />, container));
987
988 expect(store).toMatchSnapshot('2: unmounted');
995 -
996 - done();
989 });
990
999 - it('should support Lazy components that are unmounted before they finish loading in (createRoot)', async done => {
991 + it('should support Lazy components that are unmounted before they finish loading in (createRoot)', async () => {
992 const container = document.createElement('div');
993 const root = ReactDOM.unstable_createRoot(container);
994
@@ -1009,8 +1001,6 @@ describe('Store', () => {
1001 act(() => root.render(<App renderChildren={false} />));
1002
1003 expect(store).toMatchSnapshot('2: unmounted');
1012 -
1013 - done();
1004 });
1005 });
1006
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
+2 -6
@@ -60,7 +60,7 @@ describe('ReactTestRenderer', () => {
60 };
61 });
62
63 - it('for root Suspense components', async done => {
63 + it('for root Suspense components', async () => {
64 const App = ({text}) => {
65 return (
66 <React.Suspense fallback="fallback">
@@ -82,11 +82,9 @@ describe('ReactTestRenderer', () => {
82 await Promise.resolve();
83 Scheduler.unstable_flushAll();
84 expect(root.toJSON()).toEqual('dynamic');
85 -
86 - done();
85 });
86
89 - it('for nested Suspense components', async done => {
87 + it('for nested Suspense components', async () => {
88 const App = ({text}) => {
89 return (
90 <div>
@@ -110,8 +108,6 @@ describe('ReactTestRenderer', () => {
108 await Promise.resolve();
109 Scheduler.unstable_flushAll();
110 expect(root.toJSON().children).toEqual(['dynamic']);
113 -
114 - done();
111 });
112 });
113 });