@samitouri / QOS-React-2 / commits / 62cd5af08e

Codemod redundant async act scopes (#26350)

Prior to #26347, our internal `act` API (not the public API) behaved differently depending on whether the scope function returned a promise (i.e. was an async function), for historical reasons that no longer apply. Now that this is fixed, I've codemodded all async act scopes that don't contain an await to be sync. No pressing motivation other than it looks nicer and the codemod was easy. Might help avoid confusion for new contributors who see async act scopes with nothing async inside and infer it must be like that for a reason.

Andrew Clark committed Mar 8, 2023 at 16:40 UTC 62cd5af08e2ac8b1d4691e75252487083cf7a4aa
78 files changed +1277 -1285
packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js
+1 -1
@@ -152,7 +152,7 @@ describe('ReactInternalTestUtils', () => {
152 }
153
154 const root = ReactNoop.createRoot();
155 - await act(async () => {
155 + await act(() => {
156 root.render(<App />);
157 });
158 assertLog(['A', 'B', 'C']);
packages/react-client/src/__tests__/ReactFlight-test.js
+2 -2
@@ -475,7 +475,7 @@ describe('ReactFlight', () => {
475 return use(promise);
476 }
477
478 - await act(async () => {
478 + await act(() => {
479 startTransition(() => {
480 ReactNoop.render(
481 <>
@@ -554,7 +554,7 @@ describe('ReactFlight', () => {
554 return use(promise);
555 }
556
557 - await act(async () => {
557 + await act(() => {
558 startTransition(() => {
559 ReactNoop.render(
560 <NoErrorExpected>
packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js
+7 -7
@@ -61,7 +61,7 @@ describe('ReactHooksInspectionIntegration', () => {
61 const {onMouseDown: setStateA, onMouseUp: setStateB} =
62 renderer.root.findByType('div').props;
63
64 - await act(async () => setStateA('Hi'));
64 + await act(() => setStateA('Hi'));
65
66 childFiber = renderer.root.findByType(Foo)._currentFiber();
67 tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
@@ -83,7 +83,7 @@ describe('ReactHooksInspectionIntegration', () => {
83 },
84 ]);
85
86 - await act(async () => setStateB('world!'));
86 + await act(() => setStateB('world!'));
87
88 childFiber = renderer.root.findByType(Foo)._currentFiber();
89 tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
@@ -141,7 +141,7 @@ describe('ReactHooksInspectionIntegration', () => {
141 );
142 }
143 let renderer;
144 - await act(async () => {
144 + await act(() => {
145 renderer = ReactTestRenderer.create(<Foo prop="prop" />);
146 });
147
@@ -203,7 +203,7 @@ describe('ReactHooksInspectionIntegration', () => {
203 },
204 ]);
205
206 - await act(async () => {
206 + await act(() => {
207 updateStates();
208 });
209
@@ -301,7 +301,7 @@ describe('ReactHooksInspectionIntegration', () => {
301 );
302 }
303 let renderer;
304 - await act(async () => {
304 + await act(() => {
305 renderer = ReactTestRenderer.create(<Foo prop="prop" />);
306 });
307
@@ -370,7 +370,7 @@ describe('ReactHooksInspectionIntegration', () => {
370 },
371 ]);
372
373 - await act(async () => {
373 + await act(() => {
374 updateStates();
375 });
376
@@ -984,7 +984,7 @@ describe('ReactHooksInspectionIntegration', () => {
984 children: ['count: ', '1'],
985 });
986
987 - await act(async () => incrementCount());
987 + await act(() => incrementCount());
988 expect(renderer.toJSON()).toEqual({
989 type: 'div',
990 props: {},
packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js
+24 -24
@@ -72,11 +72,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
72 }
73
74 const root = ReactDOMClient.createRoot(container);
75 - await act(async () => {
75 + await act(() => {
76 root.render(<Foo />);
77 });
78
79 - await act(async () => {
79 + await act(() => {
80 container.firstChild.dispatchEvent(
81 new MouseEvent('click', {
82 bubbles: true,
@@ -146,7 +146,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
146 // Check next render doesn't throw.
147 windowOnError.mockReset();
148 console.error.mockReset();
149 - await act(async () => {
149 + await act(() => {
150 root.render(<NoError />);
151 });
152 expect(container.textContent).toBe('OK');
@@ -229,7 +229,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
229 // Check next render doesn't throw.
230 windowOnError.mockReset();
231 console.error.mockReset();
232 - await act(async () => {
232 + await act(() => {
233 root.render(<NoError />);
234 });
235 expect(container.textContent).toBe('OK');
@@ -247,7 +247,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
247 }
248
249 const root = ReactDOMClient.createRoot(container);
250 - await act(async () => {
250 + await act(() => {
251 root.render(
252 <ErrorBoundary>
253 <Foo />
@@ -315,7 +315,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
315 // Check next render doesn't throw.
316 windowOnError.mockReset();
317 console.error.mockReset();
318 - await act(async () => {
318 + await act(() => {
319 root.render(<NoError />);
320 });
321 expect(container.textContent).toBe('OK');
@@ -384,7 +384,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
384 // Check next render doesn't throw.
385 windowOnError.mockReset();
386 console.error.mockReset();
387 - await act(async () => {
387 + await act(() => {
388 root.render(<NoError />);
389 });
390 expect(container.textContent).toBe('OK');
@@ -405,7 +405,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
405 }
406
407 const root = ReactDOMClient.createRoot(container);
408 - await act(async () => {
408 + await act(() => {
409 root.render(
410 <ErrorBoundary>
411 <Foo />
@@ -456,7 +456,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
456 // Check next render doesn't throw.
457 windowOnError.mockReset();
458 console.error.mockReset();
459 - await act(async () => {
459 + await act(() => {
460 root.render(<NoError />);
461 });
462 expect(container.textContent).toBe('OK');
@@ -525,7 +525,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
525 // Check next render doesn't throw.
526 windowOnError.mockReset();
527 console.error.mockReset();
528 - await act(async () => {
528 + await act(() => {
529 root.render(<NoError />);
530 });
531 expect(container.textContent).toBe('OK');
@@ -546,7 +546,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
546 }
547
548 const root = ReactDOMClient.createRoot(container);
549 - await act(async () => {
549 + await act(() => {
550 root.render(
551 <ErrorBoundary>
552 <Foo />
@@ -597,7 +597,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
597 // Check next render doesn't throw.
598 windowOnError.mockReset();
599 console.error.mockReset();
600 - await act(async () => {
600 + await act(() => {
601 root.render(<NoError />);
602 });
603 expect(container.textContent).toBe('OK');
@@ -623,11 +623,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
623 );
624 }
625
626 - await act(async () => {
626 + await act(() => {
627 ReactDOM.render(<Foo />, container);
628 });
629
630 - await act(async () => {
630 + await act(() => {
631 container.firstChild.dispatchEvent(
632 new MouseEvent('click', {
633 bubbles: true,
@@ -698,7 +698,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
698 // Check next render doesn't throw.
699 windowOnError.mockReset();
700 console.error.mockReset();
701 - await act(async () => {
701 + await act(() => {
702 ReactDOM.render(<NoError />, container);
703 });
704 expect(container.textContent).toBe('OK');
@@ -765,7 +765,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
765 // Check next render doesn't throw.
766 windowOnError.mockReset();
767 console.error.mockReset();
768 - await act(async () => {
768 + await act(() => {
769 ReactDOM.render(<NoError />, container);
770 });
771 expect(container.textContent).toBe('OK');
@@ -784,7 +784,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
784 throw Error('Boom');
785 }
786
787 - await act(async () => {
787 + await act(() => {
788 ReactDOM.render(
789 <ErrorBoundary>
790 <Foo />
@@ -837,7 +837,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
837 // Check next render doesn't throw.
838 windowOnError.mockReset();
839 console.error.mockReset();
840 - await act(async () => {
840 + await act(() => {
841 ReactDOM.render(<NoError />, container);
842 });
843 expect(container.textContent).toBe('OK');
@@ -907,7 +907,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
907 // Check next render doesn't throw.
908 windowOnError.mockReset();
909 console.error.mockReset();
910 - await act(async () => {
910 + await act(() => {
911 ReactDOM.render(<NoError />, container);
912 });
913 expect(container.textContent).toBe('OK');
@@ -929,7 +929,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
929 return null;
930 }
931
932 - await act(async () => {
932 + await act(() => {
933 ReactDOM.render(
934 <ErrorBoundary>
935 <Foo />
@@ -982,7 +982,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
982 // Check next render doesn't throw.
983 windowOnError.mockReset();
984 console.error.mockReset();
985 - await act(async () => {
985 + await act(() => {
986 ReactDOM.render(<NoError />, container);
987 });
988 expect(container.textContent).toBe('OK');
@@ -1053,7 +1053,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
1053 // Check next render doesn't throw.
1054 windowOnError.mockReset();
1055 console.error.mockReset();
1056 - await act(async () => {
1056 + await act(() => {
1057 ReactDOM.render(<NoError />, container);
1058 });
1059 expect(container.textContent).toBe('OK');
@@ -1075,7 +1075,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
1075 return null;
1076 }
1077
1078 - await act(async () => {
1078 + await act(() => {
1079 ReactDOM.render(
1080 <ErrorBoundary>
1081 <Foo />
@@ -1128,7 +1128,7 @@ describe('ReactDOMConsoleErrorReporting', () => {
1128 // Check next render doesn't throw.
1129 windowOnError.mockReset();
1130 console.error.mockReset();
1131 - await act(async () => {
1131 + await act(() => {
1132 ReactDOM.render(<NoError />, container);
1133 });
1134 expect(container.textContent).toBe('OK');
packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js
+8 -8
@@ -423,7 +423,7 @@ describe('ReactDOMFiberAsync', () => {
423 }
424
425 const root = ReactDOMClient.createRoot(container);
426 - await act(async () => {
426 + await act(() => {
427 root.render(<Form />);
428 });
429
@@ -474,7 +474,7 @@ describe('ReactDOMFiberAsync', () => {
474 }
475
476 const root = ReactDOMClient.createRoot(container);
477 - await act(async () => {
477 + await act(() => {
478 root.render(<Form />);
479 });
480
@@ -484,7 +484,7 @@ describe('ReactDOMFiberAsync', () => {
484 // Dispatch a click event on the Disable-button.
485 const firstEvent = document.createEvent('Event');
486 firstEvent.initEvent('click', true, true);
487 - await act(async () => {
487 + await act(() => {
488 disableButton.dispatchEvent(firstEvent);
489 });
490
@@ -498,7 +498,7 @@ describe('ReactDOMFiberAsync', () => {
498 const secondEvent = document.createEvent('Event');
499 secondEvent.initEvent('click', true, true);
500 // This should force the pending update to flush which disables the submit button before the event is invoked.
501 - await act(async () => {
501 + await act(() => {
502 submitButton.dispatchEvent(secondEvent);
503 });
504
@@ -533,7 +533,7 @@ describe('ReactDOMFiberAsync', () => {
533 }
534
535 const root = ReactDOMClient.createRoot(container);
536 - await act(async () => {
536 + await act(() => {
537 root.render(<Form />);
538 });
539
@@ -543,7 +543,7 @@ describe('ReactDOMFiberAsync', () => {
543 // Dispatch a click event on the Enable-button.
544 const firstEvent = document.createEvent('Event');
545 firstEvent.initEvent('click', true, true);
546 - await act(async () => {
546 + await act(() => {
547 enableButton.dispatchEvent(firstEvent);
548 });
549
@@ -557,7 +557,7 @@ describe('ReactDOMFiberAsync', () => {
557 const secondEvent = document.createEvent('Event');
558 secondEvent.initEvent('click', true, true);
559 // This should force the pending update to flush which enables the submit button before the event is invoked.
560 - await act(async () => {
560 + await act(() => {
561 submitButton.dispatchEvent(secondEvent);
562 });
563
@@ -643,7 +643,7 @@ describe('ReactDOMFiberAsync', () => {
643 }
644
645 const oldRoot = ReactDOMClient.createRoot(container);
646 - await act(async () => {
646 + await act(() => {
647 oldRoot.render(<OldApp />);
648 });
649
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+110 -110
@@ -349,7 +349,7 @@ describe('ReactDOMFizzServer', () => {
349 };
350
351 try {
352 - await act(async () => {
352 + await act(() => {
353 const {pipe} = renderToPipeableStream(
354 <div>
355 <div>
@@ -373,7 +373,7 @@ describe('ReactDOMFizzServer', () => {
373 <div>Loading...</div>
374 </div>,
375 );
376 - await act(async () => {
376 + await act(() => {
377 resolveA({default: Text});
378 });
379 expect(getVisibleChildren(container)).toEqual(
@@ -382,7 +382,7 @@ describe('ReactDOMFizzServer', () => {
382 <div>Loading...</div>
383 </div>,
384 );
385 - await act(async () => {
385 + await act(() => {
386 resolveB({default: TextWithPunctuation});
387 });
388 expect(getVisibleChildren(container)).toEqual(
@@ -432,7 +432,7 @@ describe('ReactDOMFizzServer', () => {
432
433 // Server-side
434 const [App, resolve] = makeApp();
435 - await act(async () => {
435 + await act(() => {
436 const {pipe} = renderToPipeableStream(<App />);
437 pipe(writable);
438 });
@@ -441,7 +441,7 @@ describe('ReactDOMFizzServer', () => {
441 <span>Loading...</span>
442 </div>,
443 );
444 - await act(async () => {
444 + await act(() => {
445 resolve();
446 });
447 expect(getVisibleChildren(container)).toEqual(
@@ -453,7 +453,7 @@ describe('ReactDOMFizzServer', () => {
453
454 // Client-side
455 const [HydrateApp, hydrateResolve] = makeApp();
456 - await act(async () => {
456 + await act(() => {
457 ReactDOMClient.hydrateRoot(container, <HydrateApp />);
458 });
459
@@ -464,7 +464,7 @@ describe('ReactDOMFizzServer', () => {
464 </div>,
465 );
466
467 - await act(async () => {
467 + await act(() => {
468 hydrateResolve();
469 });
470 expect(getVisibleChildren(container)).toEqual(
@@ -485,7 +485,7 @@ describe('ReactDOMFizzServer', () => {
485 });
486 });
487
488 - await act(async () => {
488 + await act(() => {
489 const {pipe} = renderToPipeableStream(
490 <div>
491 <Suspense fallback={<Text text="Loading..." />}>
@@ -497,7 +497,7 @@ describe('ReactDOMFizzServer', () => {
497 pipe(writable);
498 });
499 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
500 - await act(async () => {
500 + await act(() => {
501 resolve({default: Text});
502 });
503 expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);
@@ -545,7 +545,7 @@ describe('ReactDOMFizzServer', () => {
545 const expectedDigest = onError(theError);
546 loggedErrors.length = 0;
547
548 - await act(async () => {
548 + await act(() => {
549 const {pipe} = renderToPipeableStream(<App isClient={false} />, {
550 bootstrapScriptContent: '__INIT__();',
551 onError,
@@ -562,7 +562,7 @@ describe('ReactDOMFizzServer', () => {
562
563 expect(loggedErrors).toEqual([]);
564
565 - await act(async () => {
565 + await act(() => {
566 rejectComponent(theError);
567 });
568
@@ -604,7 +604,7 @@ describe('ReactDOMFizzServer', () => {
604 });
605 });
606
607 - await act(async () => {
607 + await act(() => {
608 const {pipe} = renderToPipeableStream(
609 <div>
610 <Suspense fallback={<Text text="Loading..." />}>
@@ -624,7 +624,7 @@ describe('ReactDOMFizzServer', () => {
624 renderOptions.unstable_externalRuntimeSrc,
625 ).length,
626 ).toBe(1);
627 - await act(async () => {
627 + await act(() => {
628 resolveElement({default: <Text text="Hello" />});
629 });
630 expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);
@@ -658,7 +658,7 @@ describe('ReactDOMFizzServer', () => {
658 );
659 }
660
661 - await act(async () => {
661 + await act(() => {
662 const {pipe} = renderToPipeableStream(
663 <App isClient={false} />,
664
@@ -684,7 +684,7 @@ describe('ReactDOMFizzServer', () => {
684
685 expect(loggedErrors).toEqual([]);
686
687 - await act(async () => {
687 + await act(() => {
688 rejectElement(theError);
689 });
690
@@ -754,7 +754,7 @@ describe('ReactDOMFizzServer', () => {
754 const expectedDigest = onError(theError);
755 loggedErrors.length = 0;
756
757 - await act(async () => {
757 + await act(() => {
758 const {pipe} = renderToPipeableStream(
759 <App />,
760
@@ -822,7 +822,7 @@ describe('ReactDOMFizzServer', () => {
822 const expectedDigest = onError(theError);
823 loggedErrors.length = 0;
824
825 - await act(async () => {
825 + await act(() => {
826 const {pipe} = renderToPipeableStream(
827 <App />,
828
@@ -845,7 +845,7 @@ describe('ReactDOMFizzServer', () => {
845
846 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
847
848 - await act(async () => {
848 + await act(() => {
849 rejectComponent(theError);
850 });
851
@@ -878,7 +878,7 @@ describe('ReactDOMFizzServer', () => {
878 });
879
880 it('should asynchronously load the suspense boundary', async () => {
881 - await act(async () => {
881 + await act(() => {
882 const {pipe} = renderToPipeableStream(
883 <div>
884 <Suspense fallback={<Text text="Loading..." />}>
@@ -889,7 +889,7 @@ describe('ReactDOMFizzServer', () => {
889 pipe(writable);
890 });
891 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
892 - await act(async () => {
892 + await act(() => {
893 resolveText('Hello World');
894 });
895 expect(getVisibleChildren(container)).toEqual(<div>Hello World</div>);
@@ -917,7 +917,7 @@ describe('ReactDOMFizzServer', () => {
917 ReactDOMClient.hydrateRoot(container, <App />);
918 };
919
920 - await act(async () => {
920 + await act(() => {
921 const {pipe} = renderToPipeableStream(<App />, {
922 bootstrapScriptContent: '__INIT__();',
923 });
@@ -937,7 +937,7 @@ describe('ReactDOMFizzServer', () => {
937 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
938
939 // The server now updates the content in place in the fallback.
940 - await act(async () => {
940 + await act(() => {
941 resolveText('Hello');
942 });
943
@@ -991,7 +991,7 @@ describe('ReactDOMFizzServer', () => {
991 const loggedErrors = [];
992
993 // We originally suspend the boundary and start streaming the loading state.
994 - await act(async () => {
994 + await act(() => {
995 const {pipe} = renderToPipeableStream(
996 <App />,
997
@@ -1017,7 +1017,7 @@ describe('ReactDOMFizzServer', () => {
1017 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
1018
1019 const theError = new Error('Error Message');
1020 - await act(async () => {
1020 + await act(() => {
1021 rejectText('This Errors', theError);
1022 });
1023
@@ -1073,7 +1073,7 @@ describe('ReactDOMFizzServer', () => {
1073 }
1074
1075 // We originally suspend the boundary and start streaming the loading state.
1076 - await act(async () => {
1076 + await act(() => {
1077 const {pipe} = renderToPipeableStream(<App showMore={false} />);
1078 pipe(writable);
1079 });
@@ -1146,7 +1146,7 @@ describe('ReactDOMFizzServer', () => {
1146 }
1147
1148 let controls;
1149 - await act(async () => {
1149 + await act(() => {
1150 controls = renderToPipeableStream(<App />, {onError});
1151 controls.pipe(writable);
1152 });
@@ -1166,7 +1166,7 @@ describe('ReactDOMFizzServer', () => {
1166 expect(getVisibleChildren(container)).toEqual(<div>Loading...</div>);
1167
1168 // We abort the server response.
1169 - await act(async () => {
1169 + await act(() => {
1170 controls.abort();
1171 });
1172
@@ -1216,7 +1216,7 @@ describe('ReactDOMFizzServer', () => {
1216 writable.write(chunk, encoding, next);
1217 };
1218
1219 - await act(async () => {
1219 + await act(() => {
1220 const {pipe} = renderToPipeableStream(
1221 // We use two nested boundaries to flush out coverage of an old reentrancy bug.
1222 <Suspense fallback="Loading...">
@@ -1240,7 +1240,7 @@ describe('ReactDOMFizzServer', () => {
1240 );
1241 });
1242
1243 - await act(async () => {
1243 + await act(() => {
1244 const {pipe} = renderToPipeableStream(
1245 <Suspense fallback={<Text text="Loading B..." />}>
1246 <Text text="This will show B: " />
@@ -1264,7 +1264,7 @@ describe('ReactDOMFizzServer', () => {
1264 <div id="container-B">Loading B...</div>,
1265 ]);
1266
1267 - await act(async () => {
1267 + await act(() => {
1268 resolveText('B');
1269 });
1270
@@ -1275,7 +1275,7 @@ describe('ReactDOMFizzServer', () => {
1275 </div>,
1276 ]);
1277
1278 - await act(async () => {
1278 + await act(() => {
1279 resolveText('A');
1280 });
1281
@@ -1336,7 +1336,7 @@ describe('ReactDOMFizzServer', () => {
1336 );
1337 }
1338
1339 - await act(async () => {
1339 + await act(() => {
1340 const {pipe} = renderToPipeableStream(<App />);
1341 pipe(writable);
1342 });
@@ -1347,15 +1347,15 @@ describe('ReactDOMFizzServer', () => {
1347 </div>,
1348 );
1349
1350 - await act(async () => {
1350 + await act(() => {
1351 resolveText('Hello');
1352 });
1353
1354 - await act(async () => {
1354 + await act(() => {
1355 resolveText('World');
1356 });
1357
1358 - await act(async () => {
1358 + await act(() => {
1359 resolveText('my-path');
1360 resolveText('my-mi');
1361 });
@@ -1423,7 +1423,7 @@ describe('ReactDOMFizzServer', () => {
1423 );
1424 }
1425
1426 - await act(async () => {
1426 + await act(() => {
1427 const {pipe} = renderToPipeableStream(<App />);
1428 pipe(writable);
1429 });
@@ -1438,15 +1438,15 @@ describe('ReactDOMFizzServer', () => {
1438 </table>,
1439 );
1440
1441 - await act(async () => {
1441 + await act(() => {
1442 resolveText('A');
1443 });
1444
1445 - await act(async () => {
1445 + await act(() => {
1446 resolveText('B');
1447 });
1448
1449 - await act(async () => {
1449 + await act(() => {
1450 resolveText('C');
1451 });
1452
@@ -1476,7 +1476,7 @@ describe('ReactDOMFizzServer', () => {
1476 );
1477 }
1478
1479 - await act(async () => {
1479 + await act(() => {
1480 const {pipe} = renderToPipeableStream(
1481 <App />,
1482
@@ -1499,7 +1499,7 @@ describe('ReactDOMFizzServer', () => {
1499 </svg>,
1500 );
1501
1502 - await act(async () => {
1502 + await act(() => {
1503 resolveText('my-path');
1504 });
1505
@@ -1562,7 +1562,7 @@ describe('ReactDOMFizzServer', () => {
1562 };
1563
1564 try {
1565 - await act(async () => {
1565 + await act(() => {
1566 const {pipe} = renderToPipeableStream(<A />);
1567 pipe(writable);
1568 });
@@ -1589,7 +1589,7 @@ describe('ReactDOMFizzServer', () => {
1589 expect(mockError).not.toHaveBeenCalled();
1590 }
1591
1592 - await act(async () => {
1592 + await act(() => {
1593 resolveText('Hello');
1594 resolveText('World');
1595 });
@@ -1660,7 +1660,7 @@ describe('ReactDOMFizzServer', () => {
1660 }
1661 }
1662
1663 - await act(async () => {
1663 + await act(() => {
1664 const {pipe} = renderToPipeableStream(
1665 <TestProvider ctx="A">
1666 <div>
@@ -1680,7 +1680,7 @@ describe('ReactDOMFizzServer', () => {
1680 Loading: <b>A</b>
1681 </div>,
1682 );
1683 - await act(async () => {
1683 + await act(() => {
1684 resolveText('Hello: ');
1685 });
1686 expect(getVisibleChildren(container)).toEqual(
@@ -1717,7 +1717,7 @@ describe('ReactDOMFizzServer', () => {
1717 );
1718 }
1719
1720 - await act(async () => {
1720 + await act(() => {
1721 const {pipe} = renderToPipeableStream(
1722 <div>
1723 <PrintA />
@@ -1741,7 +1741,7 @@ describe('ReactDOMFizzServer', () => {
1741 A0<div>Loading...</div>A0
1742 </div>,
1743 );
1744 - await act(async () => {
1744 + await act(() => {
1745 resolveText('Child:');
1746 });
1747 expect(getVisibleChildren(container)).toEqual(
@@ -1778,7 +1778,7 @@ describe('ReactDOMFizzServer', () => {
1778 }
1779
1780 const loggedErrors = [];
1781 - await act(async () => {
1781 + await act(() => {
1782 const {pipe} = renderToPipeableStream(
1783 <div>
1784 <PrintA />
@@ -1846,7 +1846,7 @@ describe('ReactDOMFizzServer', () => {
1846 loggedErrors.length = 0;
1847
1848 let controls;
1849 - await act(async () => {
1849 + await act(() => {
1850 controls = renderToPipeableStream(
1851 <App isClient={false} />,
1852
@@ -1874,7 +1874,7 @@ describe('ReactDOMFizzServer', () => {
1874 expect(loggedErrors).toEqual([]);
1875
1876 // Error the content, but we don't have a fallback yet.
1877 - await act(async () => {
1877 + await act(() => {
1878 rejectText('Hello', theError);
1879 });
1880
@@ -1885,7 +1885,7 @@ describe('ReactDOMFizzServer', () => {
1885 expect(getVisibleChildren(container)).toEqual('Loading root...');
1886
1887 // Unblock the loading state
1888 - await act(async () => {
1888 + await act(() => {
1889 resolveText('Loading...');
1890 });
1891
@@ -1929,7 +1929,7 @@ describe('ReactDOMFizzServer', () => {
1929 });
1930
1931 it('should be able to abort the fallback if the main content finishes first', async () => {
1932 - await act(async () => {
1932 + await act(() => {
1933 const {pipe} = renderToPipeableStream(
1934 <Suspense fallback={<Text text="Loading Outer" />}>
1935 <div>
@@ -1950,7 +1950,7 @@ describe('ReactDOMFizzServer', () => {
1950 expect(getVisibleChildren(container)).toEqual('Loading Outer');
1951 // We should have received a partial segment containing the a partial of the fallback.
1952 expect(container.innerHTML).toContain('Inner');
1953 - await act(async () => {
1953 + await act(() => {
1954 resolveText('Hello');
1955 });
1956 // We should've been able to display the content without waiting for the rest of the fallback.
@@ -2026,7 +2026,7 @@ describe('ReactDOMFizzServer', () => {
2026
2027 await jest.runAllTimers();
2028
2029 - await act(async () => {
2029 + await act(() => {
2030 const {pipe} = renderToPipeableStream(<App isClient={false} />);
2031 pipe(writable);
2032 });
@@ -2036,7 +2036,7 @@ describe('ReactDOMFizzServer', () => {
2036 expect(container.innerHTML).not.toContain('Avoided Fallback');
2037
2038 // resolve first suspense component with avoidThisFallback
2039 - await act(async () => {
2039 + await act(() => {
2040 promiseRes[0]();
2041 });
2042
@@ -2050,7 +2050,7 @@ describe('ReactDOMFizzServer', () => {
2050
2051 expect(container.innerHTML).not.toContain('Avoided Fallback2');
2052
2053 - await act(async () => {
2053 + await act(() => {
2054 promiseRes[1]();
2055 });
2056
@@ -2136,7 +2136,7 @@ describe('ReactDOMFizzServer', () => {
2136 }
2137
2138 const loggedErrors = [];
2139 - await act(async () => {
2139 + await act(() => {
2140 const {pipe} = renderToPipeableStream(
2141 <Suspense fallback="Loading...">
2142 <App />
@@ -2219,7 +2219,7 @@ describe('ReactDOMFizzServer', () => {
2219 );
2220 }
2221 const loggedErrors = [];
2222 - await act(async () => {
2222 + await act(() => {
2223 const {pipe} = renderToPipeableStream(
2224 <Suspense fallback="Loading...">
2225 <App />
@@ -2306,7 +2306,7 @@ describe('ReactDOMFizzServer', () => {
2306 );
2307 }
2308
2309 - await act(async () => {
2309 + await act(() => {
2310 const {pipe} = renderToPipeableStream(<App />);
2311 pipe(writable);
2312 });
@@ -2396,7 +2396,7 @@ describe('ReactDOMFizzServer', () => {
2396 );
2397 }
2398
2399 - await act(async () => {
2399 + await act(() => {
2400 const {pipe} = renderToPipeableStream(<App />);
2401 pipe(writable);
2402 });
@@ -2486,7 +2486,7 @@ describe('ReactDOMFizzServer', () => {
2486 );
2487 }
2488
2489 - await act(async () => {
2489 + await act(() => {
2490 const {pipe} = renderToPipeableStream(<App />);
2491 pipe(writable);
2492 });
@@ -2539,7 +2539,7 @@ describe('ReactDOMFizzServer', () => {
2539 </div>
2540 );
2541 }
2542 - await act(async () => {
2542 + await act(() => {
2543 const {pipe} = renderToPipeableStream(<App />, {
2544 onError(error) {
2545 Scheduler.log('[s!] ' + error.message);
@@ -2576,7 +2576,7 @@ describe('ReactDOMFizzServer', () => {
2576 expect(serverFallback).toBe(clientFallback);
2577
2578 // When we're able to fully hydrate, we expect a clean client render.
2579 - await act(async () => {
2579 + await act(() => {
2580 resolveText('Yay!');
2581 });
2582 await waitForAll([
@@ -2624,7 +2624,7 @@ describe('ReactDOMFizzServer', () => {
2624 </div>
2625 );
2626 }
2627 - await act(async () => {
2627 + await act(() => {
2628 const {pipe} = renderToPipeableStream(<App color="red" />, {
2629 onError(error) {
2630 Scheduler.log('[s!] ' + error.message);
@@ -2670,7 +2670,7 @@ describe('ReactDOMFizzServer', () => {
2670 expect(clientFallback2).toBe(serverFallback);
2671
2672 // When we're able to fully hydrate, we expect a clean client render.
2673 - await act(async () => {
2673 + await act(() => {
2674 resolveText('Yay!');
2675 });
2676 await waitForAll([
@@ -2722,7 +2722,7 @@ describe('ReactDOMFizzServer', () => {
2722 );
2723 }
2724
2725 - await act(async () => {
2725 + await act(() => {
2726 const {pipe} = renderToPipeableStream(
2727 <App fallbackText="Loading..." />,
2728 {
@@ -2784,7 +2784,7 @@ describe('ReactDOMFizzServer', () => {
2784 expect(clientFallback2).not.toBe(clientFallback1);
2785
2786 // Verify we can still do a clean content render after.
2787 - await act(async () => {
2787 + await act(() => {
2788 resolveText('Yay!');
2789 });
2790 await waitForAll(['Yay!']);
@@ -2851,7 +2851,7 @@ describe('ReactDOMFizzServer', () => {
2851 );
2852 }
2853
2854 - await act(async () => {
2854 + await act(() => {
2855 const {pipe} = renderToPipeableStream(<App />);
2856 pipe(writable);
2857 });
@@ -2883,7 +2883,7 @@ describe('ReactDOMFizzServer', () => {
2883 </div>,
2884 );
2885
2886 - await act(async () => {
2886 + await act(() => {
2887 resolveText('Yay!');
2888 });
2889 await waitForAll(['Yay!']);
@@ -3001,7 +3001,7 @@ describe('ReactDOMFizzServer', () => {
3001 );
3002 }
3003
3004 - await act(async () => {
3004 + await act(() => {
3005 const {pipe} = renderToPipeableStream(<App />);
3006 pipe(writable);
3007 });
@@ -3065,7 +3065,7 @@ describe('ReactDOMFizzServer', () => {
3065 return <span>{context}</span>;
3066 }
3067
3068 - await act(async () => {
3068 + await act(() => {
3069 const {pipe} = renderToPipeableStream(<Foo />);
3070 pipe(writable);
3071 });
@@ -3087,7 +3087,7 @@ describe('ReactDOMFizzServer', () => {
3087 {name: 'b', value: 'b'},
3088 ]).map(item => <li key={item.get('value')}>{item.get('name')}</li>);
3089
3090 - await act(async () => {
3090 + await act(() => {
3091 const {pipe} = renderToPipeableStream(<ul>{mappedJSX}</ul>);
3092 pipe(writable);
3093 });
@@ -3119,7 +3119,7 @@ describe('ReactDOMFizzServer', () => {
3119
3120 let abort;
3121 const loggedErrors = [];
3122 - await act(async () => {
3122 + await act(() => {
3123 const {pipe, abort: abortImpl} = renderToPipeableStream(<App />, {
3124 onError(error) {
3125 // In this test we contrive erroring with strings so we push the error whereas in most
@@ -3202,7 +3202,7 @@ describe('ReactDOMFizzServer', () => {
3202
3203 let abort;
3204 const loggedErrors = [];
3205 - await act(async () => {
3205 + await act(() => {
3206 const {pipe, abort: abortImpl} = renderToPipeableStream(<App />, {
3207 onError(error) {
3208 loggedErrors.push(error.message);
@@ -3264,7 +3264,7 @@ describe('ReactDOMFizzServer', () => {
3264 });
3265
3266 it('warns in dev if you access digest from errorInfo in onRecoverableError', async () => {
3267 - await act(async () => {
3267 + await act(() => {
3268 const {pipe} = renderToPipeableStream(
3269 <div>
3270 <Suspense fallback={'loading...'}>
@@ -3341,7 +3341,7 @@ describe('ReactDOMFizzServer', () => {
3341 )}`;
3342 }
3343
3344 - await act(async () => {
3344 + await act(() => {
3345 const {pipe} = renderToPipeableStream(<App />, {
3346 onError,
3347 });
@@ -3389,7 +3389,7 @@ describe('ReactDOMFizzServer', () => {
3389 )}`;
3390 }
3391
3392 - await act(async () => {
3392 + await act(() => {
3393 const {pipe} = renderToPipeableStream(<App />, {
3394 onError,
3395 });
@@ -3429,7 +3429,7 @@ describe('ReactDOMFizzServer', () => {
3429 const expectedDigest = onError(theError);
3430 loggedErrors.length = 0;
3431
3432 - await act(async () => {
3432 + await act(() => {
3433 const {pipe} = renderToPipeableStream(<App />, {
3434 onError,
3435 });
@@ -3529,7 +3529,7 @@ describe('ReactDOMFizzServer', () => {
3529 window.__test_outlet = '';
3530 const stringWithScriptsInIt =
3531 'prescription pre<scription pre<Scription pre</scRipTion pre</ScripTion </script><script><!-- <script> -->';
3532 - await act(async () => {
3532 + await act(() => {
3533 const {pipe} = renderToPipeableStream(<div />, {
3534 bootstrapScriptContent:
3535 'window.__test_outlet = "This should have been replaced";var x = "' +
@@ -3550,7 +3550,7 @@ describe('ReactDOMFizzServer', () => {
3550 const el = document.createElement('p');
3551 el.textContent = '{"one":1,\u2028\u2029"two":2}';
3552 const stringWithLSAndPSCharacters = el.textContent;
3553 - await act(async () => {
3553 + await act(() => {
3554 const {pipe} = renderToPipeableStream(<div />, {
3555 bootstrapScriptContent:
3556 'let x = ' +
@@ -3571,7 +3571,7 @@ describe('ReactDOMFizzServer', () => {
3571 window.__test_outlet = null;
3572 // this boolean expression will be cast to a number due to the bitwise &. we will look for a truthy value (1) below
3573 const booleanLogicString = '1 < 2 & 3 > 1';
3574 - await act(async () => {
3574 + await act(() => {
3575 const {pipe} = renderToPipeableStream(<div />, {
3576 bootstrapScriptContent:
3577 'let x = ' + booleanLogicString + '; window.__test_outlet = x;',
@@ -3635,7 +3635,7 @@ describe('ReactDOMFizzServer', () => {
3635 const {pipe} = renderToPipeableStream(<App />);
3636 pipe(writable);
3637 });
3638 - await act(async () => {
3638 + await act(() => {
3639 resolveText('Hello');
3640 });
3641
@@ -3696,7 +3696,7 @@ describe('ReactDOMFizzServer', () => {
3696 };
3697
3698 const [ServerApp, serverResolve] = makeApp();
3699 - await act(async () => {
3699 + await act(() => {
3700 const {pipe} = renderToPipeableStream(<ServerApp />);
3701 pipe(writable);
3702 });
@@ -3770,7 +3770,7 @@ describe('ReactDOMFizzServer', () => {
3770 };
3771
3772 const [ServerApp, serverResolve] = makeApp();
3773 - await act(async () => {
3773 + await act(() => {
3774 const {pipe} = renderToPipeableStream(<ServerApp text="initial" />);
3775 pipe(writable);
3776 });
@@ -3845,7 +3845,7 @@ describe('ReactDOMFizzServer', () => {
3845 };
3846
3847 try {
3848 - await act(async () => {
3848 + await act(() => {
3849 const {pipe} = renderToPipeableStream(<App text="initial" />);
3850 pipe(writable);
3851 });
@@ -3932,7 +3932,7 @@ describe('ReactDOMFizzServer', () => {
3932 );
3933 };
3934
3935 - await act(async () => {
3935 + await act(() => {
3936 const {pipe} = renderToPipeableStream(<App />);
3937 pipe(writable);
3938 });
@@ -4022,7 +4022,7 @@ describe('ReactDOMFizzServer', () => {
4022 };
4023
4024 try {
4025 - await act(async () => {
4025 + await act(() => {
4026 const {pipe} = renderToPipeableStream(<App />);
4027 pipe(writable);
4028 });
@@ -4151,7 +4151,7 @@ describe('ReactDOMFizzServer', () => {
4151 };
4152
4153 try {
4154 - await act(async () => {
4154 + await act(() => {
4155 const {pipe} = renderToPipeableStream(<App />);
4156 pipe(writable);
4157 });
@@ -4272,7 +4272,7 @@ describe('ReactDOMFizzServer', () => {
4272 };
4273
4274 try {
4275 - await act(async () => {
4275 + await act(() => {
4276 const {pipe} = renderToPipeableStream(<App />);
4277 pipe(writable);
4278 });
@@ -4341,7 +4341,7 @@ describe('ReactDOMFizzServer', () => {
4341 </Suspense>
4342 );
4343 }
4344 - await act(async () => {
4344 + await act(() => {
4345 const {pipe} = renderToPipeableStream(<App />);
4346 pipe(writable);
4347 });
@@ -4387,7 +4387,7 @@ describe('ReactDOMFizzServer', () => {
4387 </div>
4388 );
4389 }
4390 - await act(async () => {
4390 + await act(() => {
4391 const {pipe} = renderToPipeableStream(<App />);
4392 pipe(writable);
4393 });
@@ -4540,7 +4540,7 @@ describe('ReactDOMFizzServer', () => {
4540 );
4541 }
4542
4543 - await act(async () => {
4543 + await act(() => {
4544 const {pipe} = renderToPipeableStream(<App name="Foo" />);
4545 pipe(writable);
4546 });
@@ -4578,7 +4578,7 @@ describe('ReactDOMFizzServer', () => {
4578 );
4579 }
4580
4581 - await act(async () => {
4581 + await act(() => {
4582 const {pipe} = renderToPipeableStream(<App name="Foo" />);
4583 pipe(writable);
4584 });
@@ -4638,7 +4638,7 @@ describe('ReactDOMFizzServer', () => {
4638 );
4639 }
4640
4641 - await act(async () => {
4641 + await act(() => {
4642 const {pipe} = renderToPipeableStream(<App />);
4643 pipe(writable);
4644 });
@@ -4831,7 +4831,7 @@ describe('ReactDOMFizzServer', () => {
4831 '<div id="app-div">start<!--$?--><template id="B:0"></template>[loading first]<!--/$--><!--$?--><template id="B:1"></template>[loading second]<!--/$-->end</div>',
4832 );
4833
4834 - await act(async () => {
4834 + await act(() => {
4835 resolveText('first suspended');
4836 });
4837
@@ -4858,7 +4858,7 @@ describe('ReactDOMFizzServer', () => {
4858 </div>,
4859 );
4860
4861 - await act(async () => {
4861 + await act(() => {
4862 resolveText('second suspended');
4863 });
4864
@@ -4961,7 +4961,7 @@ describe('ReactDOMFizzServer', () => {
4961 }
4962
4963 prepareJSDOMForTitle();
4964 - await act(async () => {
4964 + await act(() => {
4965 const {pipe} = renderToPipeableStream(<App />);
4966 pipe(writable);
4967 });
@@ -4985,7 +4985,7 @@ describe('ReactDOMFizzServer', () => {
4985 }
4986
4987 prepareJSDOMForTitle();
4988 - await act(async () => {
4988 + await act(() => {
4989 const {pipe} = renderToPipeableStream(<App />);
4990 pipe(writable);
4991 });
@@ -5010,7 +5010,7 @@ describe('ReactDOMFizzServer', () => {
5010 prepareJSDOMForTitle();
5011
5012 await expect(async () => {
5013 - await act(async () => {
5013 + await act(() => {
5014 const {pipe} = renderToPipeableStream(<App />);
5015 pipe(writable);
5016 });
@@ -5072,7 +5072,7 @@ describe('ReactDOMFizzServer', () => {
5072
5073 if (gate(flags => flags.enableFloat)) {
5074 await expect(async () => {
5075 - await act(async () => {
5075 + await act(() => {
5076 const {pipe} = renderToPipeableStream(<App />);
5077 pipe(writable);
5078 });
@@ -5081,7 +5081,7 @@ describe('ReactDOMFizzServer', () => {
5081 ]);
5082 } else {
5083 await expect(async () => {
5084 - await act(async () => {
5084 + await act(() => {
5085 const {pipe} = renderToPipeableStream(<App />);
5086 pipe(writable);
5087 });
@@ -5135,7 +5135,7 @@ describe('ReactDOMFizzServer', () => {
5135 );
5136 }
5137
5138 - await act(async () => {
5138 + await act(() => {
5139 const {pipe} = renderToPipeableStream(<App />);
5140 pipe(writable);
5141 });
@@ -5195,7 +5195,7 @@ describe('ReactDOMFizzServer', () => {
5195 );
5196 }
5197
5198 - await act(async () => {
5198 + await act(() => {
5199 const {pipe} = renderToPipeableStream(<App />);
5200 pipe(writable);
5201 });
@@ -5234,7 +5234,7 @@ describe('ReactDOMFizzServer', () => {
5234 );
5235 }
5236
5237 - await act(async () => {
5237 + await act(() => {
5238 const {pipe} = renderToPipeableStream(<App />);
5239 pipe(writable);
5240 });
@@ -5303,7 +5303,7 @@ describe('ReactDOMFizzServer', () => {
5303 }
5304
5305 const reportedServerErrors = [];
5306 - await act(async () => {
5306 + await act(() => {
5307 const {pipe} = renderToPipeableStream(<App />, {
5308 onError(error) {
5309 reportedServerErrors.push(error);
@@ -5364,7 +5364,7 @@ describe('ReactDOMFizzServer', () => {
5364 return use(thenable);
5365 }
5366
5367 - await act(async () => {
5367 + await act(() => {
5368 const {pipe} = renderToPipeableStream(<App />);
5369 pipe(writable);
5370 });
@@ -5395,7 +5395,7 @@ describe('ReactDOMFizzServer', () => {
5395 }
5396 // Because the thenable resolves synchronously, we should be able to finish
5397 // rendering synchronously, with no fallback.
5398 - await act(async () => {
5398 + await act(() => {
5399 const {pipe} = renderToPipeableStream(<App />);
5400 pipe(writable);
5401 });
@@ -5418,7 +5418,7 @@ describe('ReactDOMFizzServer', () => {
5418 </button>
5419 );
5420 }
5421 - await act(async () => {
5421 + await act(() => {
5422 const {pipe} = renderToPipeableStream(<App />);
5423 pipe(writable);
5424 });
@@ -5449,7 +5449,7 @@ describe('ReactDOMFizzServer', () => {
5449 const reportedServerErrors = [];
5450 let caughtError;
5451 try {
5452 - await act(async () => {
5452 + await act(() => {
5453 const {pipe} = renderToPipeableStream(<App />, {
5454 onError(e) {
5455 reportedServerErrors.push(e);
@@ -5478,7 +5478,7 @@ describe('ReactDOMFizzServer', () => {
5478 return <span />;
5479 }
5480 }
5481 - await act(async () => {
5481 + await act(() => {
5482 const {pipe} = renderToPipeableStream(<App />);
5483 pipe(writable);
5484 });
packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js
+12 -12
@@ -141,7 +141,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
141 </div>
142 );
143 }
144 - await act(async () => {
144 + await act(() => {
145 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
146 <App isClient={false} />,
147 );
@@ -180,7 +180,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
180 </div>
181 );
182 }
183 - await act(async () => {
183 + await act(() => {
184 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
185 <App isClient={false} />,
186 );
@@ -220,7 +220,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
220 </div>
221 );
222 }
223 - await act(async () => {
223 + await act(() => {
224 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
225 <App isClient={false} />,
226 );
@@ -271,7 +271,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
271 </div>
272 );
273 }
274 - await act(async () => {
274 + await act(() => {
275 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
276 <App isClient={false} />,
277 );
@@ -307,7 +307,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
307 </div>
308 );
309 }
310 - await act(async () => {
310 + await act(() => {
311 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
312 <App isClient={false} />,
313 );
@@ -353,7 +353,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
353 </div>
354 );
355 }
356 - await act(async () => {
356 + await act(() => {
357 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
358 <App isClient={false} />,
359 );
@@ -404,7 +404,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
404 </div>
405 );
406 }
407 - await act(async () => {
407 + await act(() => {
408 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
409 <App isClient={false} />,
410 );
@@ -453,7 +453,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
453 </div>
454 );
455 }
456 - await act(async () => {
456 + await act(() => {
457 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
458 <App isClient={false} />,
459 );
@@ -509,7 +509,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
509 </div>
510 );
511 }
512 - await act(async () => {
512 + await act(() => {
513 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
514 <App isClient={false} />,
515 );
@@ -546,7 +546,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
546 </div>
547 );
548 }
549 - await act(async () => {
549 + await act(() => {
550 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
551 <App isClient={false} />,
552 );
@@ -579,7 +579,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
579 </div>
580 );
581 }
582 - await act(async () => {
582 + await act(() => {
583 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
584 <App isClient={false} />,
585 );
@@ -624,7 +624,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
624 </div>
625 );
626 }
627 - await act(async () => {
627 + await act(() => {
628 const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
629 <App isClient={false} />,
630 );
packages/react-dom/src/__tests__/ReactDOMHooks-test.js
+1 -1
@@ -135,7 +135,7 @@ describe('ReactDOMHooks', () => {
135 Scheduler.unstable_flushAll();
136
137 inputRef.current.value = 'abc';
138 - await act(async () => {
138 + await act(() => {
139 inputRef.current.dispatchEvent(
140 new Event('input', {
141 bubbles: true,
packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js
+8 -8
@@ -74,7 +74,7 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
74 }
75
76 const root = ReactDOMClient.createRoot(container);
77 - await act(async () => {
77 + await act(() => {
78 root.render(<Form />);
79 });
80
@@ -231,12 +231,12 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
231 return <div ref={target}>{isHover ? 'hovered' : 'not hovered'}</div>;
232 }
233
234 - await act(async () => {
234 + await act(() => {
235 root.render(<Foo />);
236 });
237 expect(container.textContent).toEqual('not hovered');
238
239 - await act(async () => {
239 + await act(() => {
240 const mouseOverEvent = document.createEvent('MouseEvents');
241 mouseOverEvent.initEvent('mouseover', true, true);
242 dispatchAndSetCurrentEvent(target.current, mouseOverEvent);
@@ -261,12 +261,12 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
261 return <div ref={target}>{isHover ? 'hovered' : 'not hovered'}</div>;
262 }
263
264 - await act(async () => {
264 + await act(() => {
265 root.render(<Foo />);
266 });
267 expect(container.textContent).toEqual('not hovered');
268
269 - await act(async () => {
269 + await act(() => {
270 // Note: React does not use native mouseenter/mouseleave events
271 // but we should still correctly determine their priority.
272 const mouseEnterEvent = document.createEvent('MouseEvents');
@@ -291,7 +291,7 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
291 return <div ref={target}>{hoverString}</div>;
292 }
293
294 - await act(async () => {
294 + await act(() => {
295 root.render(<Foo hovered={false} />);
296 });
297 expect(container.textContent).toEqual('not hovered');
@@ -337,7 +337,7 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
337 return <div ref={target}>Count: {count}</div>;
338 }
339
340 - await act(async () => {
340 + await act(() => {
341 root.render(<Foo />);
342 });
343 expect(container.textContent).toEqual('Count: 0');
@@ -378,7 +378,7 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
378 );
379 }
380
381 - await act(async () => {
381 + await act(() => {
382 root.render(<Foo />);
383 });
384 expect(container.textContent).toEqual('Count: 0');
packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js
+2 -2
@@ -59,14 +59,14 @@ describe('ReactDOMNestedEvents', () => {
59 document.body.appendChild(container);
60 const root = ReactDOMClient.createRoot(container);
61
62 - await act(async () => {
62 + await act(() => {
63 root.render(<App />);
64 });
65 expect(buttonRef.current.innerHTML).toEqual(
66 'Clicked: false, Focused: false',
67 );
68
69 - await act(async () => {
69 + await act(() => {
70 buttonRef.current.click();
71 });
72 assertLog(['Value right after focus call: Clicked: false, Focused: false']);
packages/react-dom/src/__tests__/ReactDOMRoot-test.js
+5 -5
@@ -398,7 +398,7 @@ describe('ReactDOMRoot', () => {
398 return <div>{value}</div>;
399 }
400
401 - await act(async () => {
401 + await act(() => {
402 root.render(<Foo value="a" />);
403 });
404
@@ -422,12 +422,12 @@ describe('ReactDOMRoot', () => {
422
423 it('unmount is synchronous', async () => {
424 const root = ReactDOMClient.createRoot(container);
425 - await act(async () => {
425 + await act(() => {
426 root.render('Hi');
427 });
428 expect(container.textContent).toEqual('Hi');
429
430 - await act(async () => {
430 + await act(() => {
431 root.unmount();
432 // Should have already unmounted
433 expect(container.textContent).toEqual('');
@@ -436,7 +436,7 @@ describe('ReactDOMRoot', () => {
436
437 it('throws if an unmounted root is updated', async () => {
438 const root = ReactDOMClient.createRoot(container);
439 - await act(async () => {
439 + await act(() => {
440 root.render('Hi');
441 });
442 expect(container.textContent).toEqual('Hi');
@@ -463,7 +463,7 @@ describe('ReactDOMRoot', () => {
463 return 'Hi';
464 }
465
466 - await act(async () => {
466 + await act(() => {
467 root1.render(<App step={1} />);
468 });
469 expect(container1.textContent).toEqual('Hi');
packages/react-dom/src/__tests__/ReactDOMSafariMicrotaskBug-test.js
+3 -3
@@ -66,7 +66,7 @@ describe('ReactDOMSafariMicrotaskBug-test', () => {
66 );
67 }
68 const root = ReactDOMClient.createRoot(container);
69 - await act(async () => {
69 + await act(() => {
70 root.render(<Foo />);
71 });
72 expect(container.textContent).toBe('1');
@@ -86,11 +86,11 @@ describe('ReactDOMSafariMicrotaskBug-test', () => {
86 );
87 }
88 const root = ReactDOMClient.createRoot(container);
89 - await act(async () => {
89 + await act(() => {
90 root.render(<Foo />);
91 });
92 expect(container.textContent).toBe('0');
93 - await act(async () => {
93 + await act(() => {
94 container.firstChild.dispatchEvent(
95 new MouseEvent('click', {bubbles: true}),
96 );
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
+27 -27
@@ -454,7 +454,7 @@ describe('ReactDOMServerPartialHydration', () => {
454 expect(deleted.length).toBe(0);
455
456 // Performing an update should force it to delete the boundary
457 - await act(async () => {
457 + await act(() => {
458 root.render(<App value={true} />);
459 });
460
@@ -510,7 +510,7 @@ describe('ReactDOMServerPartialHydration', () => {
510 expect(ref.current).toBe(null);
511
512 await expect(async () => {
513 - await act(async () => {
513 + await act(() => {
514 ReactDOMClient.hydrateRoot(container, <App hasB={false} />, {
515 onRecoverableError(error) {
516 Scheduler.log(error.message);
@@ -579,7 +579,7 @@ describe('ReactDOMServerPartialHydration', () => {
579 expect(ref.current).toBe(null);
580
581 shouldSuspend = true;
582 - await act(async () => {
582 + await act(() => {
583 ReactDOMClient.hydrateRoot(container, <App hasB={false} />);
584 });
585
@@ -636,7 +636,7 @@ describe('ReactDOMServerPartialHydration', () => {
636 expect(ref.current).toBe(null);
637
638 await expect(async () => {
639 - await act(async () => {
639 + await act(() => {
640 ReactDOMClient.hydrateRoot(container, <App hasB={false} />, {
641 onRecoverableError(error) {
642 Scheduler.log(error.message);
@@ -698,7 +698,7 @@ describe('ReactDOMServerPartialHydration', () => {
698
699 expect(deleted.length).toBe(0);
700
701 - await act(async () => {
701 + await act(() => {
702 root.render(<App deleted={true} />);
703 });
704
@@ -744,7 +744,7 @@ describe('ReactDOMServerPartialHydration', () => {
744 // On the client we try to hydrate.
745 suspend = true;
746 await expect(async () => {
747 - await act(async () => {
747 + await act(() => {
748 ReactDOM.hydrate(<App />, container);
749 });
750 }).toErrorDev(
@@ -829,14 +829,14 @@ describe('ReactDOMServerPartialHydration', () => {
829 // hydrating anyway.
830 suspend = true;
831
832 - await act(async () => {
832 + await act(() => {
833 ReactDOMClient.hydrateRoot(container, <App />);
834 });
835
836 expect(container.firstChild.firstChild.tagName).not.toBe('DIV');
837
838 // In this state, we can still update the siblings.
839 - await act(async () => showSibling());
839 + await act(() => showSibling());
840
841 expect(container.firstChild.firstChild.tagName).toBe('DIV');
842 expect(container.firstChild.firstChild.textContent).toBe('First');
@@ -885,14 +885,14 @@ describe('ReactDOMServerPartialHydration', () => {
885 // On the client we don't have all data yet but we want to start
886 // hydrating anyway.
887 suspend = true;
888 - await act(async () => {
888 + await act(() => {
889 ReactDOMClient.hydrateRoot(container, <App />);
890 });
891
892 expect(container.firstChild.children[1].textContent).toBe('Middle');
893
894 // In this state, we can still delete the boundary.
895 - await act(async () => hideMiddle());
895 + await act(() => hideMiddle());
896
897 expect(container.firstChild.children[1].textContent).toBe('After');
898 });
@@ -1096,7 +1096,7 @@ describe('ReactDOMServerPartialHydration', () => {
1096 expect(ref.current).toBe(null);
1097
1098 // Render an update, but leave it still suspended.
1099 - await act(async () => {
1099 + await act(() => {
1100 root.render(<App text="Hi" className="hi" />);
1101 });
1102
@@ -1177,7 +1177,7 @@ describe('ReactDOMServerPartialHydration', () => {
1177
1178 // Render an update, but leave it still suspended.
1179 // Flushing now should delete the existing content and show the fallback.
1180 - await act(async () => {
1180 + await act(() => {
1181 root.render(<App text="Hi" className="hi" />);
1182 });
1183
@@ -1253,7 +1253,7 @@ describe('ReactDOMServerPartialHydration', () => {
1253
1254 // Render an update, but leave it still suspended.
1255 // Flushing now should delete the existing content and show the fallback.
1256 - await act(async () => {
1256 + await act(() => {
1257 root.render(<App text="Hi" className="hi" />);
1258 });
1259
@@ -1570,7 +1570,7 @@ describe('ReactDOMServerPartialHydration', () => {
1570
1571 // Render an update, but leave it still suspended.
1572 // Flushing now should delete the existing content and show the fallback.
1573 - await act(async () => {
1573 + await act(() => {
1574 root.render(
1575 <Context.Provider value={{text: 'Hi', className: 'hi'}}>
1576 <App />
@@ -1880,7 +1880,7 @@ describe('ReactDOMServerPartialHydration', () => {
1880 expect(container.textContent).toBe('AB');
1881
1882 // Add more rows before we've hydrated the first two.
1883 - await act(async () => {
1883 + await act(() => {
1884 root.render(<App showMore={true} />);
1885 });
1886
@@ -2313,7 +2313,7 @@ describe('ReactDOMServerPartialHydration', () => {
2313 // The new update doesn't suspend.
2314 // Since we're still suspended on the original data, we can't hydrate.
2315 // This will force all expiration times to flush.
2316 - await act(async () => {
2316 + await act(() => {
2317 root.render(
2318 <ClassName.Provider value={'hi'}>
2319 <App text="Hi" />
@@ -2395,7 +2395,7 @@ describe('ReactDOMServerPartialHydration', () => {
2395 expect(container.textContent).toBe('Click meHello');
2396
2397 // We're now partially hydrated.
2398 - await act(async () => {
2398 + await act(() => {
2399 a.click();
2400 });
2401 expect(clicks).toBe(0);
@@ -2486,7 +2486,7 @@ describe('ReactDOMServerPartialHydration', () => {
2486 jest.runAllTimers();
2487
2488 // We're now partially hydrated.
2489 - await act(async () => {
2489 + await act(() => {
2490 a.click();
2491 });
2492 // We should not have invoked the event yet because we're not
@@ -2568,7 +2568,7 @@ describe('ReactDOMServerPartialHydration', () => {
2568 ReactDOMClient.hydrateRoot(container, <App />);
2569
2570 // We'll do one click before hydrating.
2571 - await act(async () => {
2571 + await act(() => {
2572 a.click();
2573 });
2574 // This should be delayed.
@@ -2578,7 +2578,7 @@ describe('ReactDOMServerPartialHydration', () => {
2578 jest.runAllTimers();
2579
2580 // We're now partially hydrated.
2581 - await act(async () => {
2581 + await act(() => {
2582 a.click();
2583 });
2584 expect(clicks).toBe(0);
@@ -2671,7 +2671,7 @@ describe('ReactDOMServerPartialHydration', () => {
2671 jest.runAllTimers();
2672
2673 // We're now partially hydrated.
2674 - await act(async () => {
2674 + await act(() => {
2675 a.click();
2676 });
2677 // We should not have invoked the event yet because we're not
@@ -2752,7 +2752,7 @@ describe('ReactDOMServerPartialHydration', () => {
2752 jest.runAllTimers();
2753
2754 // We're now partially hydrated.
2755 - await act(async () => {
2755 + await act(() => {
2756 span.click();
2757 });
2758 expect(clicksOnChild).toBe(0);
@@ -2840,7 +2840,7 @@ describe('ReactDOMServerPartialHydration', () => {
2840 Scheduler.unstable_flushAll();
2841
2842 // The Suspense boundary is not yet hydrated.
2843 - await act(async () => {
2843 + await act(() => {
2844 a.click();
2845 });
2846 expect(clicks).toBe(0);
@@ -3115,7 +3115,7 @@ describe('ReactDOMServerPartialHydration', () => {
3115 expect(container.textContent).toBe('Click meHello');
3116
3117 // We're now partially hydrated.
3118 - await act(async () => {
3118 + await act(() => {
3119 form.dispatchEvent(
3120 new window.Event('submit', {
3121 bubbles: true,
@@ -3415,7 +3415,7 @@ describe('ReactDOMServerPartialHydration', () => {
3415 container.innerHTML = finalHTML;
3416
3417 await expect(async () => {
3418 - await act(async () => {
3418 + await act(() => {
3419 ReactDOMClient.hydrateRoot(container, <App isClient={true} />, {
3420 onRecoverableError(error) {
3421 Scheduler.log('Log recoverable error: ' + error.message);
@@ -3462,7 +3462,7 @@ describe('ReactDOMServerPartialHydration', () => {
3462 <DirectTextChild text="good" />,
3463 );
3464 await expect(async () => {
3465 - await act(async () => {
3465 + await act(() => {
3466 ReactDOMClient.hydrateRoot(container, <DirectTextChild text="bad" />, {
3467 onRecoverableError(error) {
3468 Scheduler.log(error.message);
@@ -3503,7 +3503,7 @@ describe('ReactDOMServerPartialHydration', () => {
3503 <TextChildWithSibling text="good" />,
3504 );
3505 await expect(async () => {
3506 - await act(async () => {
3506 + await act(() => {
3507 ReactDOMClient.hydrateRoot(
3508 container2,
3509 <TextChildWithSibling text="bad" />,
packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js
+9 -9
@@ -276,7 +276,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
276 assertLog([]);
277
278 // This click target cannot be hydrated yet because it's suspended.
279 - await act(async () => {
279 + await act(() => {
280 const result = dispatchClickEvent(spanD);
281 expect(result).toBe(true);
282 });
@@ -558,7 +558,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
558 assertLog([]);
559
560 // Continuing rendering will render B next.
561 - await act(async () => {
561 + await act(() => {
562 const target = createEventTarget(spanD);
563 target.virtualclick();
564 });
@@ -1110,7 +1110,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1110
1111 dispatchClickEvent(innerDiv);
1112
1113 - await act(async () => {
1113 + await act(() => {
1114 jest.runAllTimers();
1115 Scheduler.unstable_flushAllWithoutAsserting();
1116 OuterScheduler.unstable_flushAllWithoutAsserting();
@@ -1181,7 +1181,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1181 assertLog([]);
1182
1183 // fire scheduled Replay
1184 - await act(async () => {
1184 + await act(() => {
1185 jest.runAllTimers();
1186 Scheduler.unstable_flushAllWithoutAsserting();
1187 OuterScheduler.unstable_flushAllWithoutAsserting();
@@ -1210,7 +1210,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1210 expect(InnerScheduler.unstable_clearLog()).toEqual([]);
1211
1212 // Replay outer event
1213 - await act(async () => {
1213 + await act(() => {
1214 Scheduler.unstable_flushAllWithoutAsserting();
1215 OuterScheduler.unstable_flushAllWithoutAsserting();
1216 InnerScheduler.unstable_flushAllWithoutAsserting();
@@ -1240,7 +1240,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1240 // Outer was hydrated earlier
1241 expect(OuterScheduler.unstable_clearLog()).toEqual([]);
1242
1243 - await act(async () => {
1243 + await act(() => {
1244 Scheduler.unstable_flushAllWithoutAsserting();
1245 OuterScheduler.unstable_flushAllWithoutAsserting();
1246 InnerScheduler.unstable_flushAllWithoutAsserting();
@@ -1812,7 +1812,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1812 const root = ReactDOMClient.hydrateRoot(container, <App text="A" />);
1813 await waitForPaint(['App A']);
1814
1815 - await act(async () => {
1815 + await act(() => {
1816 ReactDOM.flushSync(() => {
1817 root.render(<App text="B" />);
1818 });
@@ -1848,7 +1848,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1848 const root = ReactDOMClient.hydrateRoot(container, <App text="A" />);
1849 await waitForPaint(['App A']);
1850
1851 - await act(async () => {
1851 + await act(() => {
1852 TODO_scheduleContinuousSchedulerTask(() => {
1853 root.render(<App text="B" />);
1854 });
@@ -1883,7 +1883,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
1883 const initialSpan = container.getElementsByTagName('span')[0];
1884 const root = ReactDOMClient.hydrateRoot(container, <App text="A" />);
1885 await waitForPaint(['App A']);
1886 - await act(async () => {
1886 + await act(() => {
1887 root.render(<App text="B" />);
1888 });
1889 assertLog(['App B', 'Child A', 'App B', 'Child B']);
packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+1 -1
@@ -161,7 +161,7 @@ describe('ReactDOMServerSuspense', () => {
161 expect(divB.tagName).toBe('DIV');
162 expect(divB.textContent).toBe('B');
163
164 - await act(async () => {
164 + await act(() => {
165 ReactDOMClient.hydrateRoot(parent, example);
166 });
167
packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js
+3 -3
@@ -182,7 +182,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
182 );
183 }
184
185 - await act(async () => {
185 + await act(() => {
186 ReactDOM.render(<App />, container);
187 });
188 expect(container.innerHTML).toEqual(
@@ -192,14 +192,14 @@ describe('ReactDOMSuspensePlaceholder', () => {
192
193 // Update the inline display style. It will be overridden because it's
194 // inside a hidden fallback.
195 - await act(async () => setIsVisible(true));
195 + await act(() => setIsVisible(true));
196 expect(container.innerHTML).toEqual(
197 '<span style="display: none;">Sibling</span><span style=' +
198 '"display: none;"></span>Loading...',
199 );
200
201 // Unsuspend. The style should now match the inline prop.
202 - await act(async () => resolveText('Async'));
202 + await act(() => resolveText('Async'));
203 expect(container.innerHTML).toEqual(
204 '<span style="display: inline;">Sibling</span><span style="">Async</span>',
205 );
packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js
+1 -1
@@ -1864,7 +1864,7 @@ describe('ReactErrorBoundaries', () => {
1864
1865 it('catches errors in useEffect', async () => {
1866 const container = document.createElement('div');
1867 - await act(async () => {
1867 + await act(() => {
1868 ReactDOM.render(
1869 <ErrorBoundary>
1870 <BrokenUseEffect>Initial value</BrokenUseEffect>
packages/react-dom/src/__tests__/ReactUpdates-test.js
+3 -3
@@ -1678,11 +1678,11 @@ describe('ReactUpdates', () => {
1678 }
1679
1680 const container = document.createElement('div');
1681 - await act(async () => {
1681 + await act(() => {
1682 ReactDOM.render(<Terminating />, container);
1683 });
1684 expect(container.textContent).toBe('50');
1685 - await act(async () => {
1685 + await act(() => {
1686 _setStep(0);
1687 });
1688 expect(container.textContent).toBe('50');
@@ -1701,7 +1701,7 @@ describe('ReactUpdates', () => {
1701 }
1702
1703 const container = document.createElement('div');
1704 - await act(async () => {
1704 + await act(() => {
1705 ReactDOM.render(<Terminating />, container);
1706 });
1707
packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js
+3 -3
@@ -189,15 +189,15 @@ test('regression (#20932): return pointer is correct before entering deleted tre
189 }
190
191 const root = ReactNoop.createRoot();
192 - await act(async () => {
192 + await act(() => {
193 root.render(<App />);
194 });
195 assertLog(['Suspend! [0]', 'Loading Async...', 'Loading Tail...']);
196 - await act(async () => {
196 + await act(() => {
197 resolveText(0);
198 });
199 assertLog([0, 'Tail']);
200 - await act(async () => {
200 + await act(() => {
201 setAsyncText(x => x + 1);
202 });
203 assertLog([
packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js
+2 -2
@@ -50,11 +50,11 @@ module.exports = function (initModules) {
50 // promisified version of ReactDOM.render()
51 async function asyncReactDOMRender(reactElement, domElement, forceHydrate) {
52 if (forceHydrate) {
53 - await act(async () => {
53 + await act(() => {
54 ReactDOM.hydrate(reactElement, domElement);
55 });
56 } else {
57 - await act(async () => {
57 + await act(() => {
58 ReactDOM.render(reactElement, domElement);
59 });
60 }
packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js
+13 -13
@@ -652,7 +652,7 @@ describe('DOMPluginEventSystem', () => {
652 Scheduler.unstable_flushAll();
653
654 // The Suspense boundary is not yet hydrated.
655 - await act(async () => {
655 + await act(() => {
656 a.click();
657 });
658 expect(clicks).toBe(0);
@@ -703,14 +703,14 @@ describe('DOMPluginEventSystem', () => {
703 );
704 }
705
706 - await act(async () => {
706 + await act(() => {
707 ReactDOM.render(<Parent />, container);
708 });
709
710 const parent = container.lastChild;
711 expect(parent.id).toEqual('parent');
712
713 - await act(async () => {
713 + await act(() => {
714 dispatchClickEvent(parent);
715 });
716
@@ -719,7 +719,7 @@ describe('DOMPluginEventSystem', () => {
719 const child = parent.lastChild;
720 expect(child.id).toEqual('child');
721
722 - await act(async () => {
722 + await act(() => {
723 dispatchClickEvent(child);
724 });
725
@@ -752,14 +752,14 @@ describe('DOMPluginEventSystem', () => {
752 );
753 }
754
755 - await act(async () => {
755 + await act(() => {
756 ReactDOM.render(<Parent />, container);
757 });
758
759 const parent = container.lastChild;
760 expect(parent.id).toEqual('parent');
761
762 - await act(async () => {
762 + await act(() => {
763 dispatchClickEvent(parent);
764 });
765
@@ -768,7 +768,7 @@ describe('DOMPluginEventSystem', () => {
768 const child = parent.lastChild;
769 expect(child.id).toEqual('child');
770
771 - await act(async () => {
771 + await act(() => {
772 dispatchClickEvent(child);
773 });
774
@@ -2575,7 +2575,7 @@ describe('DOMPluginEventSystem', () => {
2575
2576 const root = ReactDOMClient.createRoot(container2);
2577
2578 - await act(async () => {
2578 + await act(() => {
2579 root.render(<Component />);
2580 });
2581 jest.runAllTimers();
@@ -2587,7 +2587,7 @@ describe('DOMPluginEventSystem', () => {
2587 expect(onAfterBlur).toHaveBeenCalledTimes(0);
2588
2589 suspend = true;
2590 - await act(async () => {
2590 + await act(() => {
2591 root.render(<Component />);
2592 });
2593 jest.runAllTimers();
@@ -2661,7 +2661,7 @@ describe('DOMPluginEventSystem', () => {
2661
2662 const root = ReactDOMClient.createRoot(container2);
2663
2664 - await act(async () => {
2664 + await act(() => {
2665 root.render(<Component />);
2666 });
2667 jest.runAllTimers();
@@ -2672,7 +2672,7 @@ describe('DOMPluginEventSystem', () => {
2672 expect(onBeforeBlur).toHaveBeenCalledTimes(0);
2673
2674 suspend = true;
2675 - await act(async () => {
2675 + await act(() => {
2676 root.render(<Component />);
2677 });
2678 jest.runAllTimers();
@@ -2726,7 +2726,7 @@ describe('DOMPluginEventSystem', () => {
2726 document.body.appendChild(container2);
2727
2728 const root = ReactDOMClient.createRoot(container2);
2729 - await act(async () => {
2729 + await act(() => {
2730 root.render(<Component />);
2731 });
2732
@@ -2737,7 +2737,7 @@ describe('DOMPluginEventSystem', () => {
2737
2738 // Suspend. This hides the input node, causing it to lose focus.
2739 suspend = true;
2740 - await act(async () => {
2740 + await act(() => {
2741 root.render(<Component />);
2742 });
2743
packages/react-dom/src/events/plugins/__tests__/ChangeEventPlugin-test.js
+2 -2
@@ -753,12 +753,12 @@ describe('ChangeEventPlugin', () => {
753 );
754 }
755
756 - await act(async () => {
756 + await act(() => {
757 root.render(<Foo />);
758 });
759 expect(container.textContent).toEqual('not hovered');
760
761 - await act(async () => {
761 + await act(() => {
762 const mouseOverEvent = document.createEvent('MouseEvents');
763 mouseOverEvent.initEvent('mouseover', true, true);
764 target.current.dispatchEvent(mouseOverEvent);
packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js
+8 -8
@@ -301,7 +301,7 @@ describe('SimpleEventPlugin', function () {
301 }
302
303 // Click the button to trigger the side-effect
304 - await act(async () => click());
304 + await act(() => click());
305 assertLog([
306 // The handler fired
307 'Side-effect',
@@ -370,17 +370,17 @@ describe('SimpleEventPlugin', function () {
370 }
371
372 // Click the button a single time
373 - await act(async () => click());
373 + await act(() => click());
374 // The counter should update synchronously, even in concurrent mode.
375 expect(button.textContent).toEqual('Count: 1');
376
377 // Click the button many more times
378 - await act(async () => click());
379 - await act(async () => click());
380 - await act(async () => click());
381 - await act(async () => click());
382 - await act(async () => click());
383 - await act(async () => click());
378 + await act(() => click());
379 + await act(() => click());
380 + await act(() => click());
381 + await act(() => click());
382 + await act(() => click());
383 + await act(() => click());
384
385 // Flush the remaining work
386 await waitForAll([]);
packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js
+7 -7
@@ -312,7 +312,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
312 </div>
313 );
314 };
315 - await act(async () => {
315 + await act(() => {
316 ReactDOM.render(<Component />, container);
317 });
318
@@ -508,7 +508,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
508
509 const root = ReactDOMClient.createRoot(container2);
510
511 - await act(async () => {
511 + await act(() => {
512 root.render(<Component />);
513 });
514 jest.runAllTimers();
@@ -522,7 +522,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
522 expect(onAfterBlurWithin).toHaveBeenCalledTimes(0);
523
524 suspend = true;
525 - await act(async () => {
525 + await act(() => {
526 root.render(<Component />);
527 });
528 jest.runAllTimers();
@@ -567,7 +567,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
567
568 const root = ReactDOMClient.createRoot(container2);
569
570 - await act(async () => {
570 + await act(() => {
571 root.render(<Component />);
572 });
573 jest.runAllTimers();
@@ -576,14 +576,14 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
576 expect(onAfterBlurWithin).toHaveBeenCalledTimes(0);
577
578 suspend = true;
579 - await act(async () => {
579 + await act(() => {
580 root.render(<Component />);
581 });
582 jest.runAllTimers();
583 expect(onBeforeBlurWithin).toHaveBeenCalledTimes(0);
584 expect(onAfterBlurWithin).toHaveBeenCalledTimes(0);
585
586 - await act(async () => {
586 + await act(() => {
587 root.render(<Component />);
588 });
589 jest.runAllTimers();
@@ -592,7 +592,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
592
593 buttonRef.current.focus();
594 suspend = false;
595 - await act(async () => {
595 + await act(() => {
596 root.render(<Component />);
597 });
598 jest.runAllTimers();
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+35 -35
@@ -50,7 +50,7 @@ describe('ReactFabric', () => {
50 uiViewClassName: 'RCTView',
51 }));
52
53 - await act(async () => {
53 + await act(() => {
54 ReactFabric.render(<View foo="test" />, 1);
55 });
56 expect(nativeFabricUIManager.createNode).toBeCalled();
@@ -68,13 +68,13 @@ describe('ReactFabric', () => {
68
69 nativeFabricUIManager.createNode.mockReturnValue(firstNode);
70
71 - await act(async () => {
71 + await act(() => {
72 ReactFabric.render(<View foo="foo" />, 11);
73 });
74
75 expect(nativeFabricUIManager.createNode).toHaveBeenCalledTimes(1);
76
77 - await act(async () => {
77 + await act(() => {
78 ReactFabric.render(<View foo="bar" />, 11);
79 });
80
@@ -98,7 +98,7 @@ describe('ReactFabric', () => {
98 uiViewClassName: 'RCTText',
99 }));
100
101 - await act(async () => {
101 + await act(() => {
102 ReactFabric.render(<Text foo="a">1</Text>, 11);
103 });
104 expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
@@ -109,7 +109,7 @@ describe('ReactFabric', () => {
109 ).not.toBeCalled();
110
111 // If no properties have changed, we shouldn't call cloneNode.
112 - await act(async () => {
112 + await act(() => {
113 ReactFabric.render(<Text foo="a">1</Text>, 11);
114 });
115 expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
@@ -120,7 +120,7 @@ describe('ReactFabric', () => {
120 ).not.toBeCalled();
121
122 // Only call cloneNode for the changed property (and not for text).
123 - await act(async () => {
123 + await act(() => {
124 ReactFabric.render(<Text foo="b">1</Text>, 11);
125 });
126 expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
@@ -133,7 +133,7 @@ describe('ReactFabric', () => {
133 ).not.toBeCalled();
134
135 // Only call cloneNode for the changed text (and no other properties).
136 - await act(async () => {
136 + await act(() => {
137 ReactFabric.render(<Text foo="b">2</Text>, 11);
138 });
139 expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
@@ -148,7 +148,7 @@ describe('ReactFabric', () => {
148 ).not.toBeCalled();
149
150 // Call cloneNode for both changed text and properties.
151 - await act(async () => {
151 + await act(() => {
152 ReactFabric.render(<Text foo="c">3</Text>, 11);
153 });
154 expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
@@ -169,7 +169,7 @@ describe('ReactFabric', () => {
169 uiViewClassName: 'RCTText',
170 }));
171
172 - await act(async () => {
172 + await act(() => {
173 ReactFabric.render(
174 <Text foo="a" bar="a">
175 1
@@ -184,7 +184,7 @@ describe('ReactFabric', () => {
184 nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
185 ).not.toBeCalled();
186
187 - await act(async () => {
187 + await act(() => {
188 ReactFabric.render(
189 <Text foo="a" bar="b">
190 1
@@ -201,7 +201,7 @@ describe('ReactFabric', () => {
201 nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
202 ).toMatchSnapshot();
203
204 - await act(async () => {
204 + await act(() => {
205 ReactFabric.render(
206 <Text foo="b" bar="b">
207 2
@@ -228,7 +228,7 @@ describe('ReactFabric', () => {
228 nativeFabricUIManager.dispatchCommand.mockClear();
229
230 let viewRef;
231 - await act(async () => {
231 + await act(() => {
232 ReactFabric.render(
233 <View
234 ref={ref => {
@@ -259,7 +259,7 @@ describe('ReactFabric', () => {
259 nativeFabricUIManager.dispatchCommand.mockReset();
260
261 let viewRef;
262 - await act(async () => {
262 + await act(() => {
263 ReactFabric.render(
264 <BasicClass
265 ref={ref => {
@@ -289,7 +289,7 @@ describe('ReactFabric', () => {
289 nativeFabricUIManager.sendAccessibilityEvent.mockClear();
290
291 let viewRef;
292 - await act(async () => {
292 + await act(() => {
293 ReactFabric.render(
294 <View
295 ref={ref => {
@@ -321,7 +321,7 @@ describe('ReactFabric', () => {
321 nativeFabricUIManager.sendAccessibilityEvent.mockReset();
322
323 let viewRef;
324 - await act(async () => {
324 + await act(() => {
325 ReactFabric.render(
326 <BasicClass
327 ref={ref => {
@@ -386,14 +386,14 @@ describe('ReactFabric', () => {
386 const before = 'abcdefghijklmnopqrst';
387 const after = 'mxhpgwfralkeoivcstzy';
388
389 - await act(async () => {
389 + await act(() => {
390 ReactFabric.render(<Component chars={before} />, 11);
391 });
392 expect(
393 nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
394 ).toMatchSnapshot();
395
396 - await act(async () => {
396 + await act(() => {
397 ReactFabric.render(<Component chars={after} />, 11);
398 });
399 expect(
@@ -428,7 +428,7 @@ describe('ReactFabric', () => {
428
429 const ref = React.createRef();
430 // Wrap in a host node.
431 - await act(async () => {
431 + await act(() => {
432 ReactFabric.render(
433 <View>
434 <Component ref={ref} />
@@ -461,7 +461,7 @@ describe('ReactFabric', () => {
461 }
462 }
463
464 - await act(async () => {
464 + await act(() => {
465 ReactFabric.render(<Component />, 11);
466 });
467 expect(mockArgs.length).toEqual(0);
@@ -483,7 +483,7 @@ describe('ReactFabric', () => {
483 );
484 });
485
486 - await act(async () => {
486 + await act(() => {
487 ReactFabric.render(
488 <View foo="a">
489 <View foo="b" />
@@ -508,7 +508,7 @@ describe('ReactFabric', () => {
508 uiViewClassName: 'RCTView',
509 }));
510
511 - await act(async () => {
511 + await act(() => {
512 ReactFabric.render(
513 <Text>
514 <View />
@@ -517,7 +517,7 @@ describe('ReactFabric', () => {
517 );
518 });
519
520 - await act(async () => {
520 + await act(() => {
521 ReactFabric.render(
522 <Text>
523 <Image />
@@ -542,13 +542,13 @@ describe('ReactFabric', () => {
542 }));
543
544 await expect(async () => {
545 - await act(async () => {
545 + await act(() => {
546 ReactFabric.render(<View>this should warn</View>, 11);
547 });
548 }).toErrorDev(['Text strings must be rendered within a <Text> component.']);
549
550 await expect(async () => {
551 - await act(async () => {
551 + await act(() => {
552 ReactFabric.render(
553 <Text>
554 <ScrollView>hi hello hi</ScrollView>
@@ -567,7 +567,7 @@ describe('ReactFabric', () => {
567
568 const Indirection = () => 'Hi';
569
570 - await act(async () => {
570 + await act(() => {
571 ReactFabric.render(
572 <Text>
573 <Indirection />
@@ -591,7 +591,7 @@ describe('ReactFabric', () => {
591 const touchStart = jest.fn();
592 const touchStart2 = jest.fn();
593
594 - await act(async () => {
594 + await act(() => {
595 ReactFabric.render(<View onTouchStart={touchStart} />, 11);
596 });
597
@@ -617,7 +617,7 @@ describe('ReactFabric', () => {
617 expect(touchStart).toBeCalled();
618 expect(touchStart2).not.toBeCalled();
619
620 - await act(async () => {
620 + await act(() => {
621 ReactFabric.render(<View onTouchStart={touchStart2} />, 11);
622 });
623
@@ -665,7 +665,7 @@ describe('ReactFabric', () => {
665
666 const event = {};
667
668 - await act(async () => {
668 + await act(() => {
669 ReactFabric.render(
670 <View
671 onSkippedBubblingEventCapture={ancestorCapture}
@@ -752,7 +752,7 @@ describe('ReactFabric', () => {
752 const ref1 = React.createRef();
753 const ref2 = React.createRef();
754
755 - await act(async () => {
755 + await act(() => {
756 ReactFabric.render(
757 <View id="parent">
758 <View
@@ -834,7 +834,7 @@ describe('ReactFabric', () => {
834 }
835 }
836
837 - await act(async () => {
837 + await act(() => {
838 ReactFabric.render(
839 <ContainsStrictModeChild ref={n => (parent = n)} />,
840 11,
@@ -871,7 +871,7 @@ describe('ReactFabric', () => {
871 }
872 }
873
874 - await act(async () => {
874 + await act(() => {
875 ReactFabric.render(
876 <StrictMode>
877 <IsInStrictMode ref={n => (parent = n)} />
@@ -914,7 +914,7 @@ describe('ReactFabric', () => {
914 }
915 }
916
917 - await act(async () => {
917 + await act(() => {
918 ReactFabric.render(
919 <ContainsStrictModeChild ref={n => (parent = n)} />,
920 11,
@@ -949,7 +949,7 @@ describe('ReactFabric', () => {
949 }
950 }
951
952 - await act(async () => {
952 + await act(() => {
953 ReactFabric.render(
954 <StrictMode>
955 <IsInStrictMode ref={n => (parent = n)} />
@@ -980,7 +980,7 @@ describe('ReactFabric', () => {
980 nativeFabricUIManager.sendAccessibilityEvent.mockReset();
981
982 let viewRef;
983 - await act(async () => {
983 + await act(() => {
984 ReactFabric.render(
985 <View
986 ref={ref => {
@@ -991,7 +991,7 @@ describe('ReactFabric', () => {
991 );
992 });
993 const dangerouslyRetainedViewRef = viewRef;
994 - await act(async () => {
994 + await act(() => {
995 ReactFabric.stopSurface(11);
996 });
997
packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js
+2 -2
@@ -48,7 +48,7 @@ async function mockRenderKeys(keyLists) {
48 const keyList = keyLists[i];
49 if (Array.isArray(keyList)) {
50 const refs = keyList.map(key => undefined);
51 - await act(async () => {
51 + await act(() => {
52 ReactFabric.render(
53 <MockView>
54 {keyList.map((key, index) => (
@@ -68,7 +68,7 @@ async function mockRenderKeys(keyLists) {
68 continue;
69 }
70 if (keyList == null) {
71 - await act(async () => {
71 + await act(() => {
72 ReactFabric.stopSurface(mockContainerTag);
73 });
74 result.push(null);
packages/react-reconciler/src/__tests__/ReactCPUSuspense-test.js
+3 -3
@@ -176,7 +176,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
176
177 // Initial mount
178 const root = ReactNoop.createRoot();
179 - await act(async () => {
179 + await act(() => {
180 root.render(<App />);
181 });
182 // Inner contents finish in separate commit from outer
@@ -189,7 +189,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
189 );
190
191 // Update
192 - await act(async () => {
192 + await act(() => {
193 setCount(1);
194 });
195 // Entire update finishes in a single commit
@@ -277,7 +277,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
277 }
278
279 const root = ReactNoop.createRoot();
280 - await act(async () => {
280 + await act(() => {
281 root.render(<App />);
282 });
283 // Each level commits separately
packages/react-reconciler/src/__tests__/ReactCache-test.js
+113 -113
@@ -185,7 +185,7 @@ describe('ReactCache', () => {
185 // @gate enableCacheElement && enableCache
186 test('render Cache component', async () => {
187 const root = ReactNoop.createRoot();
188 - await act(async () => {
188 + await act(() => {
189 root.render(<Cache>Hi</Cache>);
190 });
191 expect(root).toMatchRenderedOutput('Hi');
@@ -194,7 +194,7 @@ describe('ReactCache', () => {
194 // @gate enableCacheElement && enableCache
195 test('mount new data', async () => {
196 const root = ReactNoop.createRoot();
197 - await act(async () => {
197 + await act(() => {
198 root.render(
199 <Cache>
200 <Suspense fallback={<Text text="Loading..." />}>
@@ -206,13 +206,13 @@ describe('ReactCache', () => {
206 assertLog(['Cache miss! [A]', 'Loading...']);
207 expect(root).toMatchRenderedOutput('Loading...');
208
209 - await act(async () => {
209 + await act(() => {
210 resolveMostRecentTextCache('A');
211 });
212 assertLog(['A']);
213 expect(root).toMatchRenderedOutput('A');
214
215 - await act(async () => {
215 + await act(() => {
216 root.render('Bye');
217 });
218 // no cleanup: cache is still retained at the root
@@ -223,7 +223,7 @@ describe('ReactCache', () => {
223 // @gate enableCache
224 test('root acts as implicit cache boundary', async () => {
225 const root = ReactNoop.createRoot();
226 - await act(async () => {
226 + await act(() => {
227 root.render(
228 <Suspense fallback={<Text text="Loading..." />}>
229 <AsyncText text="A" />
@@ -233,13 +233,13 @@ describe('ReactCache', () => {
233 assertLog(['Cache miss! [A]', 'Loading...']);
234 expect(root).toMatchRenderedOutput('Loading...');
235
236 - await act(async () => {
236 + await act(() => {
237 resolveMostRecentTextCache('A');
238 });
239 assertLog(['A']);
240 expect(root).toMatchRenderedOutput('A');
241
242 - await act(async () => {
242 + await act(() => {
243 root.render('Bye');
244 });
245 // no cleanup: cache is still retained at the root
@@ -267,7 +267,7 @@ describe('ReactCache', () => {
267 }
268
269 const root = ReactNoop.createRoot();
270 - await act(async () => {
270 + await act(() => {
271 root.render(<App showMore={false} />);
272 });
273
@@ -276,13 +276,13 @@ describe('ReactCache', () => {
276 assertLog(['Cache miss! [A]', 'Loading...', 'Loading...']);
277 expect(root).toMatchRenderedOutput('Loading...Loading...');
278
279 - await act(async () => {
279 + await act(() => {
280 resolveMostRecentTextCache('A');
281 });
282 assertLog(['A', 'A']);
283 expect(root).toMatchRenderedOutput('AA');
284
285 - await act(async () => {
285 + await act(() => {
286 root.render('Bye');
287 });
288 // no cleanup: cache is still retained at the root
@@ -312,13 +312,13 @@ describe('ReactCache', () => {
312 }
313
314 const root = ReactNoop.createRoot();
315 - await act(async () => {
315 + await act(() => {
316 root.render(<App showMore={false} />);
317 });
318 assertLog([]);
319 expect(root).toMatchRenderedOutput('(empty)');
320
321 - await act(async () => {
321 + await act(() => {
322 root.render(<App showMore={true} />);
323 });
324 // Even though there are two new <Cache /> trees, they should share the same
@@ -326,13 +326,13 @@ describe('ReactCache', () => {
326 assertLog(['Cache miss! [A]', 'Loading...', 'Loading...']);
327 expect(root).toMatchRenderedOutput('Loading...Loading...');
328
329 - await act(async () => {
329 + await act(() => {
330 resolveMostRecentTextCache('A');
331 });
332 assertLog(['A', 'A']);
333 expect(root).toMatchRenderedOutput('AA');
334
335 - await act(async () => {
335 + await act(() => {
336 root.render('Bye');
337 });
338 // cleanup occurs for the cache shared by the inner cache boundaries (which
@@ -359,7 +359,7 @@ describe('ReactCache', () => {
359 }
360
361 const root = ReactNoop.createRoot();
362 - await act(async () => {
362 + await act(() => {
363 root.render(<App />);
364 });
365 // Even though there is a nested <Cache /> boundary, it should share the same
@@ -367,13 +367,13 @@ describe('ReactCache', () => {
367 assertLog(['Cache miss! [A]', 'Loading...']);
368 expect(root).toMatchRenderedOutput('Loading...');
369
370 - await act(async () => {
370 + await act(() => {
371 resolveMostRecentTextCache('A');
372 });
373 assertLog(['A', 'A']);
374 expect(root).toMatchRenderedOutput('AA');
375
376 - await act(async () => {
376 + await act(() => {
377 root.render('Bye');
378 });
379 // no cleanup: cache is still retained at the root
@@ -400,7 +400,7 @@ describe('ReactCache', () => {
400 }
401
402 const root = ReactNoop.createRoot();
403 - await act(async () => {
403 + await act(() => {
404 seedNextTextCache('A');
405 root.render(<App showMore={false} />);
406 });
@@ -408,7 +408,7 @@ describe('ReactCache', () => {
408 expect(root).toMatchRenderedOutput('A [v1]');
409
410 // Add a new cache boundary
411 - await act(async () => {
411 + await act(() => {
412 root.render(<App showMore={true} />);
413 });
414 assertLog([
@@ -418,7 +418,7 @@ describe('ReactCache', () => {
418 ]);
419 expect(root).toMatchRenderedOutput('A [v1]A [v1]');
420
421 - await act(async () => {
421 + await act(() => {
422 root.render('Bye');
423 });
424 // no cleanup: cache is still retained at the root
@@ -448,7 +448,7 @@ describe('ReactCache', () => {
448 }
449
450 const root = ReactNoop.createRoot();
451 - await act(async () => {
451 + await act(() => {
452 seedNextTextCache('A');
453 root.render(<App showMore={false} />);
454 });
@@ -456,7 +456,7 @@ describe('ReactCache', () => {
456 expect(root).toMatchRenderedOutput('A [v1]');
457
458 // Add a new cache boundary
459 - await act(async () => {
459 + await act(() => {
460 root.render(<App showMore={true} />);
461 });
462 assertLog([
@@ -466,7 +466,7 @@ describe('ReactCache', () => {
466 'Loading...',
467 ]);
468 expect(root).toMatchRenderedOutput('A [v1]Loading...');
469 - await act(async () => {
469 + await act(() => {
470 resolveMostRecentTextCache('A');
471 });
472 assertLog(['A [v2]']);
@@ -475,7 +475,7 @@ describe('ReactCache', () => {
475 // Replace all the children: this should retain the root Cache instance,
476 // but cleanup the separate cache instance created for the fresh cache
477 // boundary
478 - await act(async () => {
478 + await act(() => {
479 root.render('Bye!');
480 });
481 // Cleanup occurs for the *second* cache instance: the first is still
@@ -524,13 +524,13 @@ describe('ReactCache', () => {
524 return <Text text="Content" />;
525 }
526
527 - await act(async () => {
527 + await act(() => {
528 root.render(<App />);
529 });
530 assertLog(['Cache miss! [A]', 'Loading shell...']);
531 expect(root).toMatchRenderedOutput('Loading shell...');
532
533 - await act(async () => {
533 + await act(() => {
534 resolveMostRecentTextCache('A');
535 });
536 assertLog([
@@ -547,7 +547,7 @@ describe('ReactCache', () => {
547 </>,
548 );
549
550 - await act(async () => {
550 + await act(() => {
551 resolveMostRecentTextCache('B');
552 });
553 assertLog(['Content']);
@@ -558,7 +558,7 @@ describe('ReactCache', () => {
558 </>,
559 );
560
561 - await act(async () => {
561 + await act(() => {
562 root.render('Bye');
563 });
564 // no cleanup: cache is still retained at the root
@@ -608,19 +608,19 @@ describe('ReactCache', () => {
608 return <Text text="Content" />;
609 }
610
611 - await act(async () => {
611 + await act(() => {
612 root.render(<App showMore={false} />);
613 });
614 assertLog([]);
615 expect(root).toMatchRenderedOutput('(empty)');
616
617 - await act(async () => {
617 + await act(() => {
618 root.render(<App showMore={true} />);
619 });
620 assertLog(['Cache miss! [A]', 'Loading shell...']);
621 expect(root).toMatchRenderedOutput('Loading shell...');
622
623 - await act(async () => {
623 + await act(() => {
624 resolveMostRecentTextCache('A');
625 });
626 assertLog([
@@ -637,7 +637,7 @@ describe('ReactCache', () => {
637 </>,
638 );
639
640 - await act(async () => {
640 + await act(() => {
641 resolveMostRecentTextCache('B');
642 });
643 assertLog(['Content']);
@@ -648,7 +648,7 @@ describe('ReactCache', () => {
648 </>,
649 );
650
651 - await act(async () => {
651 + await act(() => {
652 root.render('Bye');
653 });
654 assertLog(['Cache cleanup: A [v1]', 'Cache cleanup: B [v1]']);
@@ -665,7 +665,7 @@ describe('ReactCache', () => {
665
666 // Mount initial data
667 const root = ReactNoop.createRoot();
668 - await act(async () => {
668 + await act(() => {
669 root.render(
670 <Suspense fallback={<Text text="Loading..." />}>
671 <App />
@@ -675,20 +675,20 @@ describe('ReactCache', () => {
675 assertLog(['Cache miss! [A]', 'Loading...']);
676 expect(root).toMatchRenderedOutput('Loading...');
677
678 - await act(async () => {
678 + await act(() => {
679 resolveMostRecentTextCache('A');
680 });
681 assertLog(['A [v1]']);
682 expect(root).toMatchRenderedOutput('A [v1]');
683
684 // Refresh for new data.
685 - await act(async () => {
685 + await act(() => {
686 startTransition(() => refresh());
687 });
688 assertLog(['Cache miss! [A]', 'Loading...']);
689 expect(root).toMatchRenderedOutput('A [v1]');
690
691 - await act(async () => {
691 + await act(() => {
692 resolveMostRecentTextCache('A');
693 });
694 // Note that the version has updated
@@ -699,7 +699,7 @@ describe('ReactCache', () => {
699 }
700 expect(root).toMatchRenderedOutput('A [v2]');
701
702 - await act(async () => {
702 + await act(() => {
703 root.render('Bye');
704 });
705 expect(root).toMatchRenderedOutput('Bye');
@@ -715,7 +715,7 @@ describe('ReactCache', () => {
715
716 // Mount initial data
717 const root = ReactNoop.createRoot();
718 - await act(async () => {
718 + await act(() => {
719 root.render(
720 <Suspense fallback={<Text text="Loading..." />}>
721 <App />
@@ -725,27 +725,27 @@ describe('ReactCache', () => {
725 assertLog(['Cache miss! [A]', 'Loading...']);
726 expect(root).toMatchRenderedOutput('Loading...');
727
728 - await act(async () => {
728 + await act(() => {
729 resolveMostRecentTextCache('A');
730 });
731 assertLog(['A [v1]']);
732 expect(root).toMatchRenderedOutput('A [v1]');
733
734 // Refresh for new data.
735 - await act(async () => {
735 + await act(() => {
736 startTransition(() => refresh());
737 });
738 assertLog(['Cache miss! [A]', 'Loading...']);
739 expect(root).toMatchRenderedOutput('A [v1]');
740
741 - await act(async () => {
741 + await act(() => {
742 resolveMostRecentTextCache('A');
743 });
744 // Note that the version has updated, and the previous cache is cleared
745 assertLog(['A [v2]', 'Cache cleanup: A [v1]']);
746 expect(root).toMatchRenderedOutput('A [v2]');
747
748 - await act(async () => {
748 + await act(() => {
749 root.render('Bye');
750 });
751 // the original root cache already cleaned up when the refresh completed
@@ -763,7 +763,7 @@ describe('ReactCache', () => {
763
764 // Mount initial data
765 const root = ReactNoop.createRoot();
766 - await act(async () => {
766 + await act(() => {
767 root.render(
768 <Suspense fallback={<Text text="Loading..." />}>
769 <App />
@@ -773,14 +773,14 @@ describe('ReactCache', () => {
773 assertLog(['Cache miss! [A]', 'Loading...']);
774 expect(root).toMatchRenderedOutput('Loading...');
775
776 - await act(async () => {
776 + await act(() => {
777 resolveMostRecentTextCache('A');
778 });
779 assertLog(['A [v1]']);
780 expect(root).toMatchRenderedOutput('A [v1]');
781
782 // Refresh for new data.
783 - await act(async () => {
783 + await act(() => {
784 refresh();
785 });
786 assertLog([
@@ -793,14 +793,14 @@ describe('ReactCache', () => {
793 ]);
794 expect(root).toMatchRenderedOutput('Loading...');
795
796 - await act(async () => {
796 + await act(() => {
797 resolveMostRecentTextCache('A');
798 });
799 // Note that the version has updated, and the previous cache is cleared
800 assertLog(['A [v2]']);
801 expect(root).toMatchRenderedOutput('A [v2]');
802
803 - await act(async () => {
803 + await act(() => {
804 root.render('Bye');
805 });
806 // the original root cache already cleaned up when the refresh completed
@@ -827,7 +827,7 @@ describe('ReactCache', () => {
827
828 // Mount initial data
829 const root = ReactNoop.createRoot();
830 - await act(async () => {
830 + await act(() => {
831 root.render(
832 <Cache>
833 <Suspense fallback={<Text text="Loading..." />}>
@@ -839,14 +839,14 @@ describe('ReactCache', () => {
839 assertLog(['Cache miss! [A]', 'Loading...']);
840 expect(root).toMatchRenderedOutput('Loading...');
841
842 - await act(async () => {
842 + await act(() => {
843 resolveMostRecentTextCache('A');
844 });
845 assertLog(['A [v1]']);
846 expect(root).toMatchRenderedOutput('A [v1]');
847
848 // Refresh for new data.
849 - await act(async () => {
849 + await act(() => {
850 // Refresh the cache with seeded data, like you would receive from a
851 // server mutation.
852 // TODO: Seeding multiple typed textCaches. Should work by calling `refresh`
@@ -863,7 +863,7 @@ describe('ReactCache', () => {
863 assertLog(['A [v2]']);
864 expect(root).toMatchRenderedOutput('A [v2]');
865
866 - await act(async () => {
866 + await act(() => {
867 root.render('Bye');
868 });
869 // the refreshed cache boundary is unmounted and cleans up
@@ -898,7 +898,7 @@ describe('ReactCache', () => {
898 }
899
900 const root = ReactNoop.createRoot();
901 - await act(async () => {
901 + await act(() => {
902 seedNextTextCache('A');
903 root.render(<App showMore={false} />);
904 });
@@ -906,7 +906,7 @@ describe('ReactCache', () => {
906 expect(root).toMatchRenderedOutput('A [v1]');
907
908 // Add a new cache boundary
909 - await act(async () => {
909 + await act(() => {
910 seedNextTextCache('A');
911 root.render(<App showMore={true} />);
912 });
@@ -919,13 +919,13 @@ describe('ReactCache', () => {
919
920 // Now refresh the shell. This should also cause the "Show More" contents to
921 // refresh, since its cache is nested inside the outer one.
922 - await act(async () => {
922 + await act(() => {
923 startTransition(() => refreshShell());
924 });
925 assertLog(['Cache miss! [A]', 'Loading...', 'Loading...']);
926 expect(root).toMatchRenderedOutput('A [v1]A [v2]');
927
928 - await act(async () => {
928 + await act(() => {
929 resolveMostRecentTextCache('A');
930 });
931 assertLog([
@@ -937,7 +937,7 @@ describe('ReactCache', () => {
937 ]);
938 expect(root).toMatchRenderedOutput('A [v3]A [v3]');
939
940 - await act(async () => {
940 + await act(() => {
941 root.render('Bye!');
942 });
943 // Unmounting children releases the refreshed cache instance only; the root
@@ -980,12 +980,12 @@ describe('ReactCache', () => {
980 // treated like sibling providers that happen to share an underlying
981 // cache, as opposed to consumers of the root-level cache.
982 const root = ReactNoop.createRoot();
983 - await act(async () => {
983 + await act(() => {
984 root.render(<App showMore={false} />);
985 });
986
987 // Now reveal the boundaries. In a real app this would be a navigation.
988 - await act(async () => {
988 + await act(() => {
989 root.render(<App showMore={true} />);
990 });
991
@@ -994,7 +994,7 @@ describe('ReactCache', () => {
994 assertLog(['Cache miss! [A]', 'Loading...', 'Loading...']);
995 expect(root).toMatchRenderedOutput('Loading...Loading...');
996
997 - await act(async () => {
997 + await act(() => {
998 resolveMostRecentTextCache('A');
999 });
1000 assertLog(['A [v1]', 'A [v1]']);
@@ -1007,7 +1007,7 @@ describe('ReactCache', () => {
1007 });
1008 assertLog(['Cache miss! [A]', 'Loading...']);
1009
1010 - await act(async () => {
1010 + await act(() => {
1011 resolveMostRecentTextCache('A');
1012 });
1013 assertLog(['A [v2]']);
@@ -1019,7 +1019,7 @@ describe('ReactCache', () => {
1019 // a fresh boundary). Therefore this causes cleanup for both the fresh cache
1020 // instance in the refreshed first boundary and cleanup for the non-refreshed
1021 // sibling boundary.
1022 - await act(async () => {
1022 + await act(() => {
1023 root.render('Bye!');
1024 });
1025 assertLog(['Cache cleanup: A [v2]', 'Cache cleanup: A [v1]']);
@@ -1054,13 +1054,13 @@ describe('ReactCache', () => {
1054 }
1055
1056 const root = ReactNoop.createRoot();
1057 - await act(async () => {
1057 + await act(() => {
1058 root.render(<App showMore={false} />);
1059 });
1060 assertLog(['Cache miss! [A]', 'Cache miss! [B]', 'Loading...']);
1061 expect(root).toMatchRenderedOutput('Loading...');
1062
1063 - await act(async () => {
1063 + await act(() => {
1064 // This will resolve the content in the first cache
1065 resolveMostRecentTextCache('A');
1066 resolveMostRecentTextCache('B');
@@ -1079,13 +1079,13 @@ describe('ReactCache', () => {
1079 expect(root).toMatchRenderedOutput('Loading... A [v1] B [v1]');
1080
1081 // Now resolve the second tree
1082 - await act(async () => {
1082 + await act(() => {
1083 resolveMostRecentTextCache('A');
1084 });
1085 assertLog(['A [v2]']);
1086 expect(root).toMatchRenderedOutput('A [v2] A [v1] B [v1]');
1087
1088 - await act(async () => {
1088 + await act(() => {
1089 root.render('Bye!');
1090 });
1091 // Unmounting children releases both cache boundaries, but the original
@@ -1107,7 +1107,7 @@ describe('ReactCache', () => {
1107 }
1108
1109 const root = ReactNoop.createRoot();
1110 - await act(async () => {
1110 + await act(() => {
1111 root.render(
1112 <Suspense fallback={<Text text="Loading..." />}>(empty)</Suspense>,
1113 );
@@ -1115,7 +1115,7 @@ describe('ReactCache', () => {
1115 assertLog([]);
1116 expect(root).toMatchRenderedOutput('(empty)');
1117
1118 - await act(async () => {
1118 + await act(() => {
1119 startTransition(() => {
1120 root.render(
1121 <Suspense fallback={<Text text="Loading..." />}>
@@ -1127,7 +1127,7 @@ describe('ReactCache', () => {
1127 assertLog(['Cache miss! [A]', 'Loading...']);
1128 expect(root).toMatchRenderedOutput('(empty)');
1129
1130 - await act(async () => {
1130 + await act(() => {
1131 startTransition(() => {
1132 root.render(
1133 <Suspense fallback={<Text text="Loading..." />}>
@@ -1144,14 +1144,14 @@ describe('ReactCache', () => {
1144 expect(root).toMatchRenderedOutput('(empty)');
1145
1146 // Resolve the request
1147 - await act(async () => {
1147 + await act(() => {
1148 resolveMostRecentTextCache('A');
1149 });
1150 assertLog(['A [v1]', 'A [v1]']);
1151 expect(root).toMatchRenderedOutput('A [v1]A [v1]');
1152
1153 // Now do another transition
1154 - await act(async () => {
1154 + await act(() => {
1155 startTransition(() => {
1156 root.render(
1157 <Suspense fallback={<Text text="Loading..." />}>
@@ -1172,7 +1172,7 @@ describe('ReactCache', () => {
1172 ]);
1173 expect(root).toMatchRenderedOutput('A [v1]A [v1]');
1174
1175 - await act(async () => {
1175 + await act(() => {
1176 resolveMostRecentTextCache('A');
1177 });
1178 assertLog(['A [v1]', 'A [v1]', 'A [v2]']);
@@ -1182,7 +1182,7 @@ describe('ReactCache', () => {
1182 // commits, so both fresh cache instances are released by their cache boundaries,
1183 // cleaning up v1 (used for the first two children which render together) and
1184 // v2 (used for the third boundary added later).
1185 - await act(async () => {
1185 + await act(() => {
1186 root.render('Bye!');
1187 });
1188 assertLog(['Cache cleanup: A [v1]', 'Cache cleanup: A [v2]']);
@@ -1225,13 +1225,13 @@ describe('ReactCache', () => {
1225 }
1226
1227 const root = ReactNoop.createRoot();
1228 - await act(async () => {
1228 + await act(() => {
1229 root.render(<App />);
1230 });
1231 assertLog(['0']);
1232 expect(root).toMatchRenderedOutput('0');
1233
1234 - await act(async () => {
1234 + await act(() => {
1235 startTransition(() => {
1236 showMore();
1237 });
@@ -1239,7 +1239,7 @@ describe('ReactCache', () => {
1239 assertLog(['Cache miss! [A]', 'Loading...']);
1240 expect(root).toMatchRenderedOutput('0');
1241
1242 - await act(async () => {
1242 + await act(() => {
1243 updateUnrelated(1);
1244 });
1245 assertLog([
@@ -1251,7 +1251,7 @@ describe('ReactCache', () => {
1251 ]);
1252 expect(root).toMatchRenderedOutput('1');
1253
1254 - await act(async () => {
1254 + await act(() => {
1255 resolveMostRecentTextCache('A');
1256 });
1257 assertLog(['A [v1]']);
@@ -1261,7 +1261,7 @@ describe('ReactCache', () => {
1261 // render after calling showMore(). This instance is cleaned up when that boundary
1262 // is unmounted. Bc root cache instance is never accessed, the inner cache
1263 // boundary ends up at v1.
1264 - await act(async () => {
1264 + await act(() => {
1265 root.render('Bye!');
1266 });
1267 assertLog(['Cache cleanup: A [v1]']);
@@ -1272,7 +1272,7 @@ describe('ReactCache', () => {
1272 test('cache boundary uses a fresh cache when its key changes', async () => {
1273 const root = ReactNoop.createRoot();
1274 seedNextTextCache('A');
1275 - await act(async () => {
1275 + await act(() => {
1276 root.render(
1277 <Suspense fallback="Loading...">
1278 <Cache key="A">
@@ -1285,7 +1285,7 @@ describe('ReactCache', () => {
1285 expect(root).toMatchRenderedOutput('A [v1]');
1286
1287 seedNextTextCache('B');
1288 - await act(async () => {
1288 + await act(() => {
1289 root.render(
1290 <Suspense fallback="Loading...">
1291 <Cache key="B">
@@ -1300,7 +1300,7 @@ describe('ReactCache', () => {
1300 // Unmount children: the fresh cache instance for B cleans up since the cache boundary
1301 // is the only owner, while the original cache instance (for A) is still retained by
1302 // the root.
1303 - await act(async () => {
1303 + await act(() => {
1304 root.render('Bye!');
1305 });
1306 assertLog(['Cache cleanup: B [v2]']);
@@ -1310,7 +1310,7 @@ describe('ReactCache', () => {
1310 // @gate enableCacheElement && enableCache
1311 test('overlapping transitions after an initial mount use the same fresh cache', async () => {
1312 const root = ReactNoop.createRoot();
1313 - await act(async () => {
1313 + await act(() => {
1314 root.render(
1315 <Suspense fallback="Loading...">
1316 <Cache key="A">
@@ -1322,14 +1322,14 @@ describe('ReactCache', () => {
1322 assertLog(['Cache miss! [A]']);
1323 expect(root).toMatchRenderedOutput('Loading...');
1324
1325 - await act(async () => {
1325 + await act(() => {
1326 resolveMostRecentTextCache('A');
1327 });
1328 assertLog(['A [v1]']);
1329 expect(root).toMatchRenderedOutput('A [v1]');
1330
1331 // After a mount, subsequent transitions use a fresh cache
1332 - await act(async () => {
1332 + await act(() => {
1333 startTransition(() => {
1334 root.render(
1335 <Suspense fallback="Loading...">
@@ -1346,7 +1346,7 @@ describe('ReactCache', () => {
1346 // Update to a different text and with a different key for the cache
1347 // boundary: this should still use the fresh cache instance created
1348 // for the earlier transition
1349 - await act(async () => {
1349 + await act(() => {
1350 startTransition(() => {
1351 root.render(
1352 <Suspense fallback="Loading...">
@@ -1360,7 +1360,7 @@ describe('ReactCache', () => {
1360 assertLog(['Cache miss! [C]']);
1361 expect(root).toMatchRenderedOutput('A [v1]');
1362
1363 - await act(async () => {
1363 + await act(() => {
1364 resolveMostRecentTextCache('C');
1365 });
1366 assertLog(['C [v2]']);
@@ -1368,7 +1368,7 @@ describe('ReactCache', () => {
1368
1369 // Unmount children: the fresh cache used for the updates is freed, while the
1370 // original cache (with A) is still retained at the root.
1371 - await act(async () => {
1371 + await act(() => {
1372 root.render('Bye!');
1373 });
1374 assertLog(['Cache cleanup: B [v2]', 'Cache cleanup: C [v2]']);
@@ -1378,7 +1378,7 @@ describe('ReactCache', () => {
1378 // @gate enableCacheElement && enableCache
1379 test('overlapping updates after an initial mount use the same fresh cache', async () => {
1380 const root = ReactNoop.createRoot();
1381 - await act(async () => {
1381 + await act(() => {
1382 root.render(
1383 <Suspense fallback="Loading...">
1384 <Cache key="A">
@@ -1390,14 +1390,14 @@ describe('ReactCache', () => {
1390 assertLog(['Cache miss! [A]']);
1391 expect(root).toMatchRenderedOutput('Loading...');
1392
1393 - await act(async () => {
1393 + await act(() => {
1394 resolveMostRecentTextCache('A');
1395 });
1396 assertLog(['A [v1]']);
1397 expect(root).toMatchRenderedOutput('A [v1]');
1398
1399 // After a mount, subsequent updates use a fresh cache
1400 - await act(async () => {
1400 + await act(() => {
1401 root.render(
1402 <Suspense fallback="Loading...">
1403 <Cache key="B">
@@ -1411,7 +1411,7 @@ describe('ReactCache', () => {
1411
1412 // A second update uses the same fresh cache: even though this is a new
1413 // Cache boundary, the render uses the fresh cache from the pending update.
1414 - await act(async () => {
1414 + await act(() => {
1415 root.render(
1416 <Suspense fallback="Loading...">
1417 <Cache key="C">
@@ -1423,7 +1423,7 @@ describe('ReactCache', () => {
1423 assertLog(['Cache miss! [C]']);
1424 expect(root).toMatchRenderedOutput('Loading...');
1425
1426 - await act(async () => {
1426 + await act(() => {
1427 resolveMostRecentTextCache('C');
1428 });
1429 assertLog(['C [v2]']);
@@ -1431,7 +1431,7 @@ describe('ReactCache', () => {
1431
1432 // Unmount children: the fresh cache used for the updates is freed, while the
1433 // original cache (with A) is still retained at the root.
1434 - await act(async () => {
1434 + await act(() => {
1435 root.render('Bye!');
1436 });
1437 assertLog(['Cache cleanup: B [v2]', 'Cache cleanup: C [v2]']);
@@ -1442,7 +1442,7 @@ describe('ReactCache', () => {
1442 test('cleans up cache only used in an aborted transition', async () => {
1443 const root = ReactNoop.createRoot();
1444 seedNextTextCache('A');
1445 - await act(async () => {
1445 + await act(() => {
1446 root.render(
1447 <Suspense fallback="Loading...">
1448 <Cache key="A">
@@ -1456,7 +1456,7 @@ describe('ReactCache', () => {
1456
1457 // Start a transition from A -> B..., which should create a fresh cache
1458 // for the new cache boundary (bc of the different key)
1459 - await act(async () => {
1459 + await act(() => {
1460 startTransition(() => {
1461 root.render(
1462 <Suspense fallback="Loading...">
@@ -1471,7 +1471,7 @@ describe('ReactCache', () => {
1471 expect(root).toMatchRenderedOutput('A [v1]');
1472
1473 // ...but cancel by transitioning "back" to A (which we never really left)
1474 - await act(async () => {
1474 + await act(() => {
1475 startTransition(() => {
1476 root.render(
1477 <Suspense fallback="Loading...">
@@ -1486,7 +1486,7 @@ describe('ReactCache', () => {
1486 expect(root).toMatchRenderedOutput('A [v1]');
1487
1488 // Unmount children: ...
1489 - await act(async () => {
1489 + await act(() => {
1490 root.render('Bye!');
1491 });
1492 assertLog([]);
@@ -1502,7 +1502,7 @@ describe('ReactCache', () => {
1502 return <AsyncText showVersion={true} text={text} />;
1503 }
1504 seedNextTextCache('A');
1505 - await act(async () => {
1505 + await act(() => {
1506 root.render(
1507 <Suspense fallback="Loading...">
1508 <Example text="A" />
@@ -1512,7 +1512,7 @@ describe('ReactCache', () => {
1512 assertLog(['A [v1]']);
1513 expect(root).toMatchRenderedOutput('A [v1]');
1514
1515 - await act(async () => {
1515 + await act(() => {
1516 startTransition(() => {
1517 refresh();
1518 });
@@ -1520,7 +1520,7 @@ describe('ReactCache', () => {
1520 assertLog(['Cache miss! [A]']);
1521 expect(root).toMatchRenderedOutput('A [v1]');
1522
1523 - await act(async () => {
1523 + await act(() => {
1524 root.render('Bye!');
1525 });
1526 assertLog([
@@ -1544,7 +1544,7 @@ describe('ReactCache', () => {
1544 return <AsyncText showVersion={true} text={text} />;
1545 }
1546 seedNextTextCache('A');
1547 - await act(async () => {
1547 + await act(() => {
1548 root.render(
1549 <Suspense fallback="Loading...">
1550 <Cache>
@@ -1556,7 +1556,7 @@ describe('ReactCache', () => {
1556 assertLog(['A [v1]']);
1557 expect(root).toMatchRenderedOutput('A [v1]');
1558
1559 - await act(async () => {
1559 + await act(() => {
1560 startTransition(() => {
1561 refresh();
1562 });
@@ -1565,7 +1565,7 @@ describe('ReactCache', () => {
1565 expect(root).toMatchRenderedOutput('A [v1]');
1566
1567 // Unmount the boundary before the refresh can complete
1568 - await act(async () => {
1568 + await act(() => {
1569 root.render('Bye!');
1570 });
1571 assertLog([
@@ -1594,14 +1594,14 @@ describe('ReactCache', () => {
1594 }
1595
1596 const root = ReactNoop.createRoot();
1597 - await act(async () => {
1597 + await act(() => {
1598 root.render(<App prerenderMore={false} />);
1599 });
1600 assertLog([]);
1601 expect(root).toMatchRenderedOutput(<div hidden={true} />);
1602
1603 seedNextTextCache('More');
1604 - await act(async () => {
1604 + await act(() => {
1605 root.render(<App prerenderMore={true} />);
1606 });
1607 assertLog(['More']);
@@ -1629,7 +1629,7 @@ describe('ReactCache', () => {
1629 function MoreArgs({a, b}) {
1630 return (types(a) === types(a, b)).toString() + ' ';
1631 }
1632 - await act(async () => {
1632 + await act(() => {
1633 root.render(
1634 <>
1635 <Print a="e" b="f" />
@@ -1641,7 +1641,7 @@ describe('ReactCache', () => {
1641 );
1642 });
1643 expect(root).toMatchRenderedOutput('string string true false false false ');
1644 - await act(async () => {
1644 + await act(() => {
1645 root.render(
1646 <>
1647 <Print a="e" b={null} />
@@ -1654,7 +1654,7 @@ describe('ReactCache', () => {
1654 });
1655 expect(root).toMatchRenderedOutput('string object true false false false ');
1656 const obj = {};
1657 - await act(async () => {
1657 + await act(() => {
1658 root.render(
1659 <>
1660 <Print a="e" b={obj} />
@@ -1667,7 +1667,7 @@ describe('ReactCache', () => {
1667 });
1668 expect(root).toMatchRenderedOutput('string object true false false false ');
1669 const sameObj = {};
1670 - await act(async () => {
1670 + await act(() => {
1671 root.render(
1672 <>
1673 <Print a={sameObj} b={sameObj} />
@@ -1681,7 +1681,7 @@ describe('ReactCache', () => {
1681 expect(root).toMatchRenderedOutput('object object true true false false ');
1682 const objA = {};
1683 const objB = {};
1684 - await act(async () => {
1684 + await act(() => {
1685 root.render(
1686 <>
1687 <Print a={objA} b={objB} />
@@ -1694,7 +1694,7 @@ describe('ReactCache', () => {
1694 });
1695 expect(root).toMatchRenderedOutput('object object true false false false ');
1696 const sameSymbol = Symbol();
1697 - await act(async () => {
1697 + await act(() => {
1698 root.render(
1699 <>
1700 <Print a={sameSymbol} b={sameSymbol} />
@@ -1707,7 +1707,7 @@ describe('ReactCache', () => {
1707 });
1708 expect(root).toMatchRenderedOutput('symbol symbol true true false false ');
1709 const notANumber = +'nan';
1710 - await act(async () => {
1710 + await act(() => {
1711 root.render(
1712 <>
1713 <Print a={1} b={notANumber} />
@@ -1749,7 +1749,7 @@ describe('ReactCache', () => {
1749
1750 return 'Blank';
1751 }
1752 - await act(async () => {
1752 + await act(() => {
1753 root.render(<Test />);
1754 });
1755 expect(x).toBe(y);
packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js
+2 -2
@@ -33,12 +33,12 @@ describe('ReactClassSetStateCallback', () => {
33 }
34
35 const root = ReactNoop.createRoot();
36 - await act(async () => {
36 + await act(() => {
37 root.render(<App />);
38 });
39 assertLog([0]);
40
41 - await act(async () => {
41 + await act(() => {
42 if (gate(flags => flags.enableUnifiedSyncLane)) {
43 React.startTransition(() => {
44 app.setState({step: 1}, () => Scheduler.log('Callback 1'));
packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js
+13 -13
@@ -197,14 +197,14 @@ describe('ReactConcurrentErrorRecovery', () => {
197 const root = ReactNoop.createRoot();
198 seedNextTextCache('A1');
199 seedNextTextCache('B1');
200 - await act(async () => {
200 + await act(() => {
201 root.render(<App step={1} />);
202 });
203 assertLog(['A1', 'B1']);
204 expect(root).toMatchRenderedOutput('A1B1');
205
206 // Start a refresh transition
207 - await act(async () => {
207 + await act(() => {
208 startTransition(() => {
209 root.render(<App step={2} />);
210 });
@@ -214,7 +214,7 @@ describe('ReactConcurrentErrorRecovery', () => {
214 expect(root).toMatchRenderedOutput('A1B1');
215
216 // B fails to load.
217 - await act(async () => {
217 + await act(() => {
218 rejectText('B2', new Error('Oops!'));
219 });
220
@@ -238,7 +238,7 @@ describe('ReactConcurrentErrorRecovery', () => {
238 expect(root).toMatchRenderedOutput('A1B1');
239
240 // A finishes loading.
241 - await act(async () => {
241 + await act(() => {
242 resolveText('A2');
243 });
244 if (gate(flags => flags.replayFailedUnitOfWorkWithInvokeGuardedCallback)) {
@@ -300,14 +300,14 @@ describe('ReactConcurrentErrorRecovery', () => {
300 const root = ReactNoop.createRoot();
301 seedNextTextCache('A1');
302 seedNextTextCache('B1');
303 - await act(async () => {
303 + await act(() => {
304 root.render(<App step={1} />);
305 });
306 assertLog(['A1', 'B1']);
307 expect(root).toMatchRenderedOutput('A1B1');
308
309 // Start a refresh transition
310 - await act(async () => {
310 + await act(() => {
311 startTransition(() => {
312 root.render(<App step={2} />);
313 });
@@ -317,7 +317,7 @@ describe('ReactConcurrentErrorRecovery', () => {
317 expect(root).toMatchRenderedOutput('A1B1');
318
319 // A fails to load.
320 - await act(async () => {
320 + await act(() => {
321 rejectText('A2', new Error('Oops!'));
322 });
323
@@ -341,7 +341,7 @@ describe('ReactConcurrentErrorRecovery', () => {
341 expect(root).toMatchRenderedOutput('A1B1');
342
343 // B finishes loading.
344 - await act(async () => {
344 + await act(() => {
345 resolveText('B2');
346 });
347 if (gate(flags => flags.replayFailedUnitOfWorkWithInvokeGuardedCallback)) {
@@ -385,7 +385,7 @@ describe('ReactConcurrentErrorRecovery', () => {
385 // The initial render suspends without a Suspense boundary. Since it's
386 // wrapped in startTransition, it suspends instead of erroring.
387 const root = ReactNoop.createRoot();
388 - await act(async () => {
388 + await act(() => {
389 startTransition(() => {
390 root.render(<AsyncText text="Async" />);
391 });
@@ -397,7 +397,7 @@ describe('ReactConcurrentErrorRecovery', () => {
397 // boundary. (This is only interesting because when a component suspends
398 // outside of a transition, we throw an error, which can be captured by
399 // an error boundary.
400 - await act(async () => {
400 + await act(() => {
401 startTransition(() => {
402 root.render(
403 <ErrorBoundary>
@@ -410,7 +410,7 @@ describe('ReactConcurrentErrorRecovery', () => {
410 expect(root).toMatchRenderedOutput(null);
411
412 // Continues rendering once data resolves
413 - await act(async () => {
413 + await act(() => {
414 resolveText('Async');
415 });
416 assertLog(['Async']);
@@ -447,7 +447,7 @@ describe('ReactConcurrentErrorRecovery', () => {
447
448 // Suspend and throw in the same transition
449 const root = ReactNoop.createRoot();
450 - await act(async () => {
450 + await act(() => {
451 startTransition(() => {
452 root.render(
453 <ErrorBoundary>
@@ -468,7 +468,7 @@ describe('ReactConcurrentErrorRecovery', () => {
468 expect(root).toMatchRenderedOutput(null);
469
470 // Try the reverse order, too: throw then suspend
471 - await act(async () => {
471 + await act(() => {
472 startTransition(() => {
473 root.render(
474 <ErrorBoundary>
packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js
+28 -28
@@ -203,13 +203,13 @@ describe('ReactLazyContextPropagation', () => {
203 return <Text text={value} />;
204 }
205
206 - await act(async () => {
206 + await act(() => {
207 root.render(<App />);
208 });
209 assertLog([0]);
210 expect(root).toMatchRenderedOutput('0');
211
212 - await act(async () => {
212 + await act(() => {
213 setValue(1);
214 });
215 assertLog([1]);
@@ -245,13 +245,13 @@ describe('ReactLazyContextPropagation', () => {
245 return <Text text={value} />;
246 }
247
248 - await act(async () => {
248 + await act(() => {
249 root.render(<App />);
250 });
251 assertLog([0]);
252 expect(root).toMatchRenderedOutput('0');
253
254 - await act(async () => {
254 + await act(() => {
255 setValue(1);
256 });
257 assertLog([1]);
@@ -288,13 +288,13 @@ describe('ReactLazyContextPropagation', () => {
288 return <Text text={value} />;
289 }
290
291 - await act(async () => {
291 + await act(() => {
292 root.render(<App />);
293 });
294 assertLog([0]);
295 expect(root).toMatchRenderedOutput('0');
296
297 - await act(async () => {
297 + await act(() => {
298 setValue(1);
299 });
300 assertLog([1]);
@@ -326,13 +326,13 @@ describe('ReactLazyContextPropagation', () => {
326 return <Text text={value} />;
327 });
328
329 - await act(async () => {
329 + await act(() => {
330 root.render(<App />);
331 });
332 assertLog(['Consumer', 0]);
333 expect(root).toMatchRenderedOutput('0');
334
335 - await act(async () => {
335 + await act(() => {
336 // Intentionally calling setState to some other arbitrary value before
337 // setting it back to the current one. That way an update is scheduled,
338 // but we'll bail out during render when nothing has changed.
@@ -388,13 +388,13 @@ describe('ReactLazyContextPropagation', () => {
388 }
389
390 await seedNextTextCache('A');
391 - await act(async () => {
391 + await act(() => {
392 root.render(<App />);
393 });
394 assertLog(['A', 'A']);
395 expect(root).toMatchRenderedOutput('AA');
396
397 - await act(async () => {
397 + await act(() => {
398 // Intentionally not wrapping in startTransition, so that the fallback
399 // the fallback displays despite this being a refresh.
400 setContext('B');
@@ -468,13 +468,13 @@ describe('ReactLazyContextPropagation', () => {
468 }
469
470 await seedNextTextCache('A');
471 - await act(async () => {
471 + await act(() => {
472 root.render(<App />);
473 });
474 assertLog(['A', 'A', 'A']);
475 expect(root).toMatchRenderedOutput('AAA');
476
477 - await act(async () => {
477 + await act(() => {
478 // Intentionally not wrapping in startTransition, so that the fallback
479 // the fallback displays despite this being a refresh.
480 setContext('B');
@@ -529,13 +529,13 @@ describe('ReactLazyContextPropagation', () => {
529 }
530
531 await seedNextTextCache('A');
532 - await act(async () => {
532 + await act(() => {
533 root.render(<App />);
534 });
535 assertLog(['A', 'A']);
536 expect(root).toMatchRenderedOutput('AA');
537
538 - await act(async () => {
538 + await act(() => {
539 // Intentionally not wrapping in startTransition, so that the fallback
540 // the fallback displays despite this being a refresh.
541 setContext('B');
@@ -583,13 +583,13 @@ describe('ReactLazyContextPropagation', () => {
583 }
584
585 await seedNextTextCache('A');
586 - await act(async () => {
586 + await act(() => {
587 root.render(<App />);
588 });
589 assertLog(['A', 'A']);
590 expect(root).toMatchRenderedOutput('AA');
591
592 - await act(async () => {
592 + await act(() => {
593 setContext('B');
594 });
595 assertLog(['B', 'B']);
@@ -644,13 +644,13 @@ describe('ReactLazyContextPropagation', () => {
644 }
645
646 await seedNextTextCache('A');
647 - await act(async () => {
647 + await act(() => {
648 root.render(<App />);
649 });
650 assertLog(['A', 'A', 'A']);
651 expect(root).toMatchRenderedOutput('AAA');
652
653 - await act(async () => {
653 + await act(() => {
654 setContext('B');
655 });
656 assertLog(['B', 'B', 'B']);
@@ -686,13 +686,13 @@ describe('ReactLazyContextPropagation', () => {
686 }
687
688 const root = ReactNoop.createRoot();
689 - await act(async () => {
689 + await act(() => {
690 root.render(<App />);
691 });
692 assertLog(['A', 'A']);
693 expect(root).toMatchRenderedOutput('AA');
694
695 - await act(async () => {
695 + await act(() => {
696 setContext('B');
697 });
698 assertLog(['B', 'B']);
@@ -740,13 +740,13 @@ describe('ReactLazyContextPropagation', () => {
740 }
741
742 const root = ReactNoop.createRoot();
743 - await act(async () => {
743 + await act(() => {
744 root.render(<App />);
745 });
746 assertLog(['A', 'A']);
747 expect(root).toMatchRenderedOutput('AA');
748
749 - await act(async () => {
749 + await act(() => {
750 setContext('B');
751 });
752 assertLog(['B', 'B']);
@@ -803,13 +803,13 @@ describe('ReactLazyContextPropagation', () => {
803
804 const root = ReactNoop.createRoot();
805 await seedNextTextCache('A');
806 - await act(async () => {
806 + await act(() => {
807 root.render(<App />);
808 });
809 assertLog(['A', 'A']);
810 expect(root).toMatchRenderedOutput('AA');
811
812 - await act(async () => {
812 + await act(() => {
813 setContext('B');
814 });
815 assertLog(['Suspend! [B]', 'Loading...']);
@@ -864,13 +864,13 @@ describe('ReactLazyContextPropagation', () => {
864 }
865
866 const root = ReactNoop.createRoot();
867 - await act(async () => {
867 + await act(() => {
868 root.render(<App />);
869 });
870 assertLog(['A', 'A']);
871 expect(root).toMatchRenderedOutput('AA');
872
873 - await act(async () => {
873 + await act(() => {
874 setContext('B');
875 });
876 assertLog(['B', 'B']);
@@ -913,13 +913,13 @@ describe('ReactLazyContextPropagation', () => {
913 }
914
915 const root = ReactNoop.createRoot();
916 - await act(async () => {
916 + await act(() => {
917 root.render(<App />);
918 });
919 assertLog(['A', 'A']);
920 expect(root).toMatchRenderedOutput('AA');
921
922 - await act(async () => {
922 + await act(() => {
923 setContext('B');
924 });
925 assertLog(['B', 'B']);
packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js
+3 -3
@@ -68,7 +68,7 @@ describe('ReactDeferredValue', () => {
68 const root = ReactNoop.createRoot();
69
70 // Initial render
71 - await act(async () => {
71 + await act(() => {
72 root.render(<App value={1} />);
73 });
74 assertLog(['Original: 1', 'Deferred: 1']);
@@ -129,7 +129,7 @@ describe('ReactDeferredValue', () => {
129 const root = ReactNoop.createRoot();
130
131 // Initial render
132 - await act(async () => {
132 + await act(() => {
133 root.render(<App value={1} />);
134 });
135 assertLog(['Original: 1', 'Deferred: 1']);
@@ -195,7 +195,7 @@ describe('ReactDeferredValue', () => {
195 const root = ReactNoop.createRoot();
196
197 // Initial render
198 - await act(async () => {
198 + await act(() => {
199 root.render(<App value={1} />);
200 });
201 assertLog(['Original: 1', 'Deferred: 1']);
packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js
+4 -4
@@ -53,11 +53,11 @@ describe('ReactEffectOrdering', () => {
53 return 'Child';
54 }
55
56 - await act(async () => {
56 + await act(() => {
57 root.render(<Parent />);
58 });
59 expect(root).toMatchRenderedOutput('Child');
60 - await act(async () => {
60 + await act(() => {
61 root.render(null);
62 });
63 assertLog(['Unmount parent', 'Unmount child']);
@@ -80,11 +80,11 @@ describe('ReactEffectOrdering', () => {
80 return 'Child';
81 }
82
83 - await act(async () => {
83 + await act(() => {
84 root.render(<Parent />);
85 });
86 expect(root).toMatchRenderedOutput('Child');
87 - await act(async () => {
87 + await act(() => {
88 root.render(null);
89 });
90 assertLog(['Unmount parent', 'Unmount child']);
packages/react-reconciler/src/__tests__/ReactExpiration-test.js
+6 -6
@@ -456,7 +456,7 @@ describe('ReactExpiration', () => {
456 }
457
458 const root = ReactNoop.createRoot();
459 - await act(async () => {
459 + await act(() => {
460 root.render(<App />);
461 });
462 assertLog(['Sync pri: 0', 'Normal pri: 0']);
@@ -527,7 +527,7 @@ describe('ReactExpiration', () => {
527 }
528
529 const root = ReactNoop.createRoot();
530 - await act(async () => {
530 + await act(() => {
531 root.render(<App />);
532 });
533 assertLog(['Sync pri: 0', 'Idle pri: 0']);
@@ -590,7 +590,7 @@ describe('ReactExpiration', () => {
590 }
591
592 const root = ReactNoop.createRoot();
593 - await act(async () => {
593 + await act(() => {
594 root.render(<App />);
595 });
596 assertLog(['A0', 'B0', 'C']);
@@ -682,7 +682,7 @@ describe('ReactExpiration', () => {
682 }
683
684 const root = ReactNoop.createRoot();
685 - await act(async () => {
685 + await act(() => {
686 root.render(<App />);
687 });
688 assertLog(['A0', 'B0']);
@@ -723,13 +723,13 @@ describe('ReactExpiration', () => {
723 }
724
725 const root = ReactNoop.createRoot();
726 - await act(async () => {
726 + await act(() => {
727 root.render(<App step={0} />);
728 });
729 assertLog(['A0', 'B0', 'C0', 'Effect: 0']);
730 expect(root).toMatchRenderedOutput('A0B0C0');
731
732 - await act(async () => {
732 + await act(() => {
733 startTransition(() => {
734 root.render(<App step={1} />);
735 });
packages/react-reconciler/src/__tests__/ReactFlushSync-test.js
+5 -5
@@ -95,13 +95,13 @@ describe('ReactFlushSync', () => {
95 }
96
97 const root = ReactNoop.createRoot();
98 - await act(async () => {
98 + await act(() => {
99 root.render(<App />);
100 });
101 assertLog(['0, 0']);
102 expect(root).toMatchRenderedOutput('0, 0');
103
104 - await act(async () => {
104 + await act(() => {
105 ReactNoop.flushSync(() => {
106 startTransition(() => {
107 // This should be async even though flushSync is on the stack, because
@@ -132,7 +132,7 @@ describe('ReactFlushSync', () => {
132 }
133
134 const root = ReactNoop.createRoot();
135 - await act(async () => {
135 + await act(() => {
136 ReactNoop.flushSync(() => {
137 root.render(<App />);
138 });
@@ -155,7 +155,7 @@ describe('ReactFlushSync', () => {
155 }
156
157 const root = ReactNoop.createLegacyRoot();
158 - await act(async () => {
158 + await act(() => {
159 ReactNoop.flushSync(() => {
160 root.render(<App />);
161 });
@@ -182,7 +182,7 @@ describe('ReactFlushSync', () => {
182 }
183
184 const root = ReactNoop.createLegacyRoot();
185 - await act(async () => {
185 + await act(() => {
186 ReactNoop.flushSync(() => {
187 root.render(<App step={1} />);
188 });
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
+45 -45
@@ -92,7 +92,7 @@ describe('ReactHooks', () => {
92 expect(root).toMatchRenderedOutput('0, 0');
93
94 // Normal update
95 - await act(async () => {
95 + await act(() => {
96 setCounter1(1);
97 setCounter2(1);
98 });
@@ -100,12 +100,12 @@ describe('ReactHooks', () => {
100 assertLog(['Parent: 1, 1', 'Child: 1, 1', 'Effect: 1, 1']);
101
102 // Update that bails out.
103 - await act(async () => setCounter1(1));
103 + await act(() => setCounter1(1));
104 assertLog(['Parent: 1, 1']);
105
106 // This time, one of the state updates but the other one doesn't. So we
107 // can't bail out.
108 - await act(async () => {
108 + await act(() => {
109 setCounter1(1);
110 setCounter2(2);
111 });
@@ -113,7 +113,7 @@ describe('ReactHooks', () => {
113 assertLog(['Parent: 1, 2', 'Child: 1, 2', 'Effect: 1, 2']);
114
115 // Lots of updates that eventually resolve to the current values.
116 - await act(async () => {
116 + await act(() => {
117 setCounter1(9);
118 setCounter2(3);
119 setCounter1(4);
@@ -127,7 +127,7 @@ describe('ReactHooks', () => {
127 assertLog(['Parent: 1, 2']);
128
129 // prepare to check SameValue
130 - await act(async () => {
130 + await act(() => {
131 setCounter1(0 / -1);
132 setCounter2(NaN);
133 });
@@ -135,7 +135,7 @@ describe('ReactHooks', () => {
135 assertLog(['Parent: 0, NaN', 'Child: 0, NaN', 'Effect: 0, NaN']);
136
137 // check if re-setting to negative 0 / NaN still bails out
138 - await act(async () => {
138 + await act(() => {
139 setCounter1(0 / -1);
140 setCounter2(NaN);
141 setCounter2(Infinity);
@@ -145,7 +145,7 @@ describe('ReactHooks', () => {
145 assertLog(['Parent: 0, NaN']);
146
147 // check if changing negative 0 to positive 0 does not bail out
148 - await act(async () => {
148 + await act(() => {
149 setCounter1(0);
150 });
151 assertLog(['Parent: 0, NaN', 'Child: 0, NaN', 'Effect: 0, NaN']);
@@ -180,7 +180,7 @@ describe('ReactHooks', () => {
180 expect(root).toMatchRenderedOutput('0, 0 (light)');
181
182 // Normal update
183 - await act(async () => {
183 + await act(() => {
184 setCounter1(1);
185 setCounter2(1);
186 });
@@ -188,12 +188,12 @@ describe('ReactHooks', () => {
188 assertLog(['Parent: 1, 1 (light)', 'Child: 1, 1 (light)']);
189
190 // Update that bails out.
191 - await act(async () => setCounter1(1));
191 + await act(() => setCounter1(1));
192 assertLog(['Parent: 1, 1 (light)']);
193
194 // This time, one of the state updates but the other one doesn't. So we
195 // can't bail out.
196 - await act(async () => {
196 + await act(() => {
197 setCounter1(1);
198 setCounter2(2);
199 });
@@ -202,7 +202,7 @@ describe('ReactHooks', () => {
202
203 // Updates bail out, but component still renders because props
204 // have changed
205 - await act(async () => {
205 + await act(() => {
206 setCounter1(1);
207 setCounter2(2);
208 root.update(<Parent theme="dark" />);
@@ -211,7 +211,7 @@ describe('ReactHooks', () => {
211 assertLog(['Parent: 1, 2 (dark)', 'Child: 1, 2 (dark)']);
212
213 // Both props and state bail out
214 - await act(async () => {
214 + await act(() => {
215 setCounter1(1);
216 setCounter2(2);
217 root.update(<Parent theme="dark" />);
@@ -238,7 +238,7 @@ describe('ReactHooks', () => {
238 expect(root).toMatchRenderedOutput('0');
239
240 await expect(async () => {
241 - await act(async () =>
241 + await act(() =>
242 setCounter(1, () => {
243 throw new Error('Expected to ignore the callback.');
244 }),
@@ -272,7 +272,7 @@ describe('ReactHooks', () => {
272 expect(root).toMatchRenderedOutput('0');
273
274 await expect(async () => {
275 - await act(async () =>
275 + await act(() =>
276 dispatch(1, () => {
277 throw new Error('Expected to ignore the callback.');
278 }),
@@ -323,7 +323,7 @@ describe('ReactHooks', () => {
323 return <Child text={text} />;
324 }
325 const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
326 - await act(async () => {
326 + await act(() => {
327 root.update(
328 <ThemeProvider>
329 <Parent />
@@ -346,18 +346,18 @@ describe('ReactHooks', () => {
346 expect(root).toMatchRenderedOutput('0 (light)');
347
348 // Normal update
349 - await act(async () => setCounter(1));
349 + await act(() => setCounter(1));
350 assertLog(['Parent: 1 (light)', 'Child: 1 (light)', 'Effect: 1 (light)']);
351 expect(root).toMatchRenderedOutput('1 (light)');
352
353 // Update that doesn't change state, so it bails out
354 - await act(async () => setCounter(1));
354 + await act(() => setCounter(1));
355 assertLog(['Parent: 1 (light)']);
356 expect(root).toMatchRenderedOutput('1 (light)');
357
358 // Update that doesn't change state, but the context changes, too, so it
359 // can't bail out
360 - await act(async () => {
360 + await act(() => {
361 setCounter(1);
362 setTheme('dark');
363 });
@@ -396,7 +396,7 @@ describe('ReactHooks', () => {
396 expect(root).toMatchRenderedOutput('0');
397
398 // Normal update
399 - await act(async () => setCounter(1));
399 + await act(() => setCounter(1));
400 assertLog(['Parent: 1', 'Child: 1', 'Effect: 1']);
401 expect(root).toMatchRenderedOutput('1');
402
@@ -404,30 +404,30 @@ describe('ReactHooks', () => {
404 // because the alternate fiber has pending update priority, so we have to
405 // enter the render phase before we can bail out. But we bail out before
406 // rendering the child, and we don't fire any effects.
407 - await act(async () => setCounter(1));
407 + await act(() => setCounter(1));
408 assertLog(['Parent: 1']);
409 expect(root).toMatchRenderedOutput('1');
410
411 // Update to the same state again. This times, neither fiber has pending
412 // update priority, so we can bail out before even entering the render phase.
413 - await act(async () => setCounter(1));
413 + await act(() => setCounter(1));
414 await waitForAll([]);
415 expect(root).toMatchRenderedOutput('1');
416
417 // This changes the state to something different so it renders normally.
418 - await act(async () => setCounter(2));
418 + await act(() => setCounter(2));
419 assertLog(['Parent: 2', 'Child: 2', 'Effect: 2']);
420 expect(root).toMatchRenderedOutput('2');
421
422 // prepare to check SameValue
423 - await act(async () => {
423 + await act(() => {
424 setCounter(0);
425 });
426 assertLog(['Parent: 0', 'Child: 0', 'Effect: 0']);
427 expect(root).toMatchRenderedOutput('0');
428
429 // Update to the same state for the first time to flush the queue
430 - await act(async () => {
430 + await act(() => {
431 setCounter(0);
432 });
433
@@ -435,14 +435,14 @@ describe('ReactHooks', () => {
435 expect(root).toMatchRenderedOutput('0');
436
437 // Update again to the same state. Should bail out.
438 - await act(async () => {
438 + await act(() => {
439 setCounter(0);
440 });
441 await waitForAll([]);
442 expect(root).toMatchRenderedOutput('0');
443
444 // Update to a different state (positive 0 to negative 0)
445 - await act(async () => {
445 + await act(() => {
446 setCounter(0 / -1);
447 });
448 assertLog(['Parent: 0', 'Child: 0', 'Effect: 0']);
@@ -629,7 +629,7 @@ describe('ReactHooks', () => {
629 }
630
631 await expect(async () => {
632 - await act(async () => {
632 + await act(() => {
633 ReactTestRenderer.create(<App deps={'hello'} />);
634 });
635 }).toErrorDev([
@@ -643,7 +643,7 @@ describe('ReactHooks', () => {
643 'When specified, the final argument must be an array.',
644 ]);
645 await expect(async () => {
646 - await act(async () => {
646 + await act(() => {
647 ReactTestRenderer.create(<App deps={100500} />);
648 });
649 }).toErrorDev([
@@ -657,7 +657,7 @@ describe('ReactHooks', () => {
657 'When specified, the final argument must be an array.',
658 ]);
659 await expect(async () => {
660 - await act(async () => {
660 + await act(() => {
661 ReactTestRenderer.create(<App deps={{}} />);
662 });
663 }).toErrorDev([
@@ -671,7 +671,7 @@ describe('ReactHooks', () => {
671 'When specified, the final argument must be an array.',
672 ]);
673
674 - await act(async () => {
674 + await act(() => {
675 ReactTestRenderer.create(<App deps={[]} />);
676 ReactTestRenderer.create(<App deps={null} />);
677 ReactTestRenderer.create(<App deps={undefined} />);
@@ -714,7 +714,7 @@ describe('ReactHooks', () => {
714 }
715
716 const root = ReactTestRenderer.create(null);
717 - await act(async () => {
717 + await act(() => {
718 root.update(<Counter />);
719 });
720 expect(root).toMatchRenderedOutput('4');
@@ -738,7 +738,7 @@ describe('ReactHooks', () => {
738 }
739
740 const root = ReactTestRenderer.create(null);
741 - await act(async () => {
741 + await act(() => {
742 root.update(<Counter />);
743 });
744 expect(root).toMatchRenderedOutput('4');
@@ -761,7 +761,7 @@ describe('ReactHooks', () => {
761 }
762
763 const root = ReactTestRenderer.create(null);
764 - await act(async () => {
764 + await act(() => {
765 root.update(<Counter />);
766 });
767 expect(root).toMatchRenderedOutput('4');
@@ -1131,7 +1131,7 @@ describe('ReactHooks', () => {
1131 }
1132 // Verify it doesn't think we're still inside a Hook.
1133 // Should have no warnings.
1134 - await act(async () => {
1134 + await act(() => {
1135 ReactTestRenderer.create(<Valid />);
1136 });
1137
@@ -1488,12 +1488,12 @@ describe('ReactHooks', () => {
1488 /* eslint-enable no-unused-vars */
1489 }
1490 let root;
1491 - await act(async () => {
1491 + await act(() => {
1492 root = ReactTestRenderer.create(<App update={false} />);
1493 });
1494 await expect(async () => {
1495 try {
1496 - await act(async () => {
1496 + await act(() => {
1497 root.update(<App update={true} />);
1498 });
1499 } catch (error) {
@@ -1514,7 +1514,7 @@ describe('ReactHooks', () => {
1514
1515 // further warnings for this component are silenced
1516 try {
1517 - await act(async () => {
1517 + await act(() => {
1518 root.update(<App update={false} />);
1519 });
1520 } catch (error) {
@@ -1537,13 +1537,13 @@ describe('ReactHooks', () => {
1537 /* eslint-enable no-unused-vars */
1538 }
1539 let root;
1540 - await act(async () => {
1540 + await act(() => {
1541 root = ReactTestRenderer.create(<App update={false} />);
1542 });
1543
1544 await expect(async () => {
1545 try {
1546 - await act(async () => {
1546 + await act(() => {
1547 root.update(<App update={true} />);
1548 });
1549 } catch (error) {
@@ -1591,11 +1591,11 @@ describe('ReactHooks', () => {
1591 /* eslint-enable no-unused-vars */
1592 }
1593 let root;
1594 - await act(async () => {
1594 + await act(() => {
1595 root = ReactTestRenderer.create(<App update={false} />);
1596 });
1597
1598 - await act(async () => {
1598 + await act(() => {
1599 expect(() => {
1600 root.update(<App update={true} />);
1601 }).toThrow('Rendered fewer hooks than expected. ');
@@ -1703,7 +1703,7 @@ describe('ReactHooks', () => {
1703 return null;
1704 }
1705
1706 - await act(async () => {
1706 + await act(() => {
1707 ReactTestRenderer.unstable_batchedUpdates(() => {
1708 ReactTestRenderer.create(
1709 <>
@@ -1761,7 +1761,7 @@ describe('ReactHooks', () => {
1761 return null;
1762 }
1763
1764 - await act(async () => {
1764 + await act(() => {
1765 ReactTestRenderer.create(<A />);
1766 });
1767
@@ -1911,7 +1911,7 @@ describe('ReactHooks', () => {
1911 }
1912
1913 let root;
1914 - await act(async () => {
1914 + await act(() => {
1915 root = ReactTestRenderer.create(
1916 <ErrorBoundary>
1917 <Thrower />
@@ -1920,7 +1920,7 @@ describe('ReactHooks', () => {
1920 });
1921
1922 expect(root).toMatchRenderedOutput('Throw!');
1923 - await act(async () => setShouldThrow(true));
1923 + await act(() => setShouldThrow(true));
1924 expect(root).toMatchRenderedOutput('Error!');
1925 });
1926 });
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
+81 -81
@@ -294,11 +294,11 @@ describe('ReactHooksWithNoopRenderer', () => {
294 await waitForAll(['Count: 0']);
295 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
296
297 - await act(async () => counter.current.updateCount(1));
297 + await act(() => counter.current.updateCount(1));
298 assertLog(['Count: 1']);
299 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 1" />);
300
301 - await act(async () => counter.current.updateCount(count => count + 10));
301 + await act(() => counter.current.updateCount(count => count + 10));
302 assertLog(['Count: 11']);
303 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 11" />);
304 });
@@ -318,7 +318,7 @@ describe('ReactHooksWithNoopRenderer', () => {
318 await waitForAll(['getInitialState', 'Count: 42']);
319 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 42" />);
320
321 - await act(async () => counter.current.updateCount(7));
321 + await act(() => counter.current.updateCount(7));
322 assertLog(['Count: 7']);
323 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 7" />);
324 });
@@ -336,10 +336,10 @@ describe('ReactHooksWithNoopRenderer', () => {
336 await waitForAll(['Count: 0']);
337 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
338
339 - await act(async () => counter.current.updateCount(7));
339 + await act(() => counter.current.updateCount(7));
340 assertLog(['Count: 7']);
341
342 - await act(async () => counter.current.updateLabel('Total'));
342 + await act(() => counter.current.updateLabel('Total'));
343 assertLog(['Total: 7']);
344 });
345
@@ -356,13 +356,13 @@ describe('ReactHooksWithNoopRenderer', () => {
356
357 const firstUpdater = updater;
358
359 - await act(async () => firstUpdater(1));
359 + await act(() => firstUpdater(1));
360 assertLog(['Count: 1']);
361 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 1" />);
362
363 const secondUpdater = updater;
364
365 - await act(async () => firstUpdater(count => count + 10));
365 + await act(() => firstUpdater(count => count + 10));
366 assertLog(['Count: 11']);
367 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 11" />);
368
@@ -381,7 +381,7 @@ describe('ReactHooksWithNoopRenderer', () => {
381 await waitForAll([]);
382 ReactNoop.render(null);
383 await waitForAll([]);
384 - await act(async () => _updateCount(1));
384 + await act(() => _updateCount(1));
385 });
386
387 it('works with memo', async () => {
@@ -401,7 +401,7 @@ describe('ReactHooksWithNoopRenderer', () => {
401 await waitForAll([]);
402 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
403
404 - await act(async () => _updateCount(1));
404 + await act(() => _updateCount(1));
405 assertLog(['Count: 1']);
406 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 1" />);
407 });
@@ -476,7 +476,7 @@ describe('ReactHooksWithNoopRenderer', () => {
476
477 const root = ReactNoop.createRoot();
478
479 - await act(async () => {
479 + await act(() => {
480 root.render(
481 <>
482 <Foo />
@@ -637,7 +637,7 @@ describe('ReactHooksWithNoopRenderer', () => {
637
638 // Test that it works on update, too. This time the log is a bit different
639 // because we started with reducerB instead of reducerA.
640 - await act(async () => {
640 + await act(() => {
641 counter.current.dispatch('reset');
642 });
643 ReactNoop.render(<Counter ref={counter} />);
@@ -785,13 +785,13 @@ describe('ReactHooksWithNoopRenderer', () => {
785
786 const root = ReactNoop.createRoot();
787
788 - await act(async () => {
788 + await act(() => {
789 root.render(<ScrollView row={10} />);
790 });
791 assertLog(['Up']);
792 expect(root).toMatchRenderedOutput(<span prop="Up" />);
793
794 - await act(async () => {
794 + await act(() => {
795 ReactNoop.discreteUpdates(() => {
796 setRow(5);
797 });
@@ -851,10 +851,10 @@ describe('ReactHooksWithNoopRenderer', () => {
851 await waitForAll(['Count: 0']);
852 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
853
854 - await act(async () => counter.current.dispatch(INCREMENT));
854 + await act(() => counter.current.dispatch(INCREMENT));
855 assertLog(['Count: 1']);
856 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 1" />);
857 - await act(async () => {
857 + await act(() => {
858 counter.current.dispatch(DECREMENT);
859 counter.current.dispatch(DECREMENT);
860 counter.current.dispatch(DECREMENT);
@@ -893,11 +893,11 @@ describe('ReactHooksWithNoopRenderer', () => {
893 await waitForAll(['Init', 'Count: 10']);
894 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 10" />);
895
896 - await act(async () => counter.current.dispatch(INCREMENT));
896 + await act(() => counter.current.dispatch(INCREMENT));
897 assertLog(['Count: 11']);
898 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 11" />);
899
900 - await act(async () => {
900 + await act(() => {
901 counter.current.dispatch(DECREMENT);
902 counter.current.dispatch(DECREMENT);
903 counter.current.dispatch(DECREMENT);
@@ -1427,7 +1427,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1427 return state;
1428 }
1429
1430 - await act(async () => {
1430 + await act(() => {
1431 ReactNoop.renderToRootWithID(<Component />, 'root', () =>
1432 Scheduler.log('Sync effect'),
1433 );
@@ -1437,7 +1437,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1437 ReactNoop.unmountRootWithID('root');
1438 await waitForAll(['passive destroy']);
1439
1440 - await act(async () => {
1440 + await act(() => {
1441 updaterFunction(true);
1442 });
1443 });
@@ -1624,7 +1624,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1624 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
1625 // A flush sync doesn't cause the passive effects to fire.
1626 // So we haven't added the other update yet.
1627 - await act(async () => {
1627 + await act(() => {
1628 ReactNoop.flushSync(() => {
1629 _updateCount(2);
1630 });
@@ -1660,7 +1660,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1660 }, [props.count]);
1661 return <Text text={'Count: ' + count} />;
1662 }
1663 - await act(async () => {
1663 + await act(() => {
1664 ReactNoop.flushSync(() => {
1665 ReactNoop.renderLegacySyncRoot(<Counter count={0} />);
1666 });
@@ -2256,7 +2256,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2256
2257 // @gate skipUnmountedBoundaries
2258 it('should use the nearest still-mounted boundary if there are no unmounted boundaries', async () => {
2259 - await act(async () => {
2259 + await act(() => {
2260 ReactNoop.render(
2261 <LogOnlyErrorBoundary>
2262 <BrokenUseEffectCleanup />
@@ -2269,7 +2269,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2269 'BrokenUseEffectCleanup useEffect',
2270 ]);
2271
2272 - await act(async () => {
2272 + await act(() => {
2273 ReactNoop.render(<LogOnlyErrorBoundary />);
2274 });
2275
@@ -2294,7 +2294,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2294 }
2295 }
2296
2297 - await act(async () => {
2297 + await act(() => {
2298 ReactNoop.render(
2299 <LogOnlyErrorBoundary>
2300 <Conditional showChildren={true} />
@@ -2308,7 +2308,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2308 'BrokenUseEffectCleanup useEffect',
2309 ]);
2310
2311 - await act(async () => {
2311 + await act(() => {
2312 ReactNoop.render(
2313 <LogOnlyErrorBoundary>
2314 <Conditional showChildren={false} />
@@ -2333,7 +2333,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2333 }
2334 }
2335
2336 - await act(async () => {
2336 + await act(() => {
2337 ReactNoop.render(
2338 <ErrorBoundary>
2339 <Conditional showChildren={true} />
@@ -2346,7 +2346,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2346 'BrokenUseEffectCleanup useEffect',
2347 ]);
2348
2349 - await act(async () => {
2349 + await act(() => {
2350 ReactNoop.render(
2351 <ErrorBoundary>
2352 <Conditional showChildren={false} />
@@ -2381,7 +2381,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2381 }
2382 }
2383
2384 - await act(async () => {
2384 + await act(() => {
2385 ReactNoop.render(<Conditional showChildren={true} />);
2386 });
2387
@@ -2424,7 +2424,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2424 prevProps.prop === nextProps.prop;
2425 const MemoizedChild = React.memo(Child, isEqual);
2426
2427 - await act(async () => {
2427 + await act(() => {
2428 ReactNoop.render(
2429 <Wrapper>
2430 <MemoizedChild key={1} />
@@ -2434,7 +2434,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2434 assertLog(['render', 'layout create', 'passive create']);
2435
2436 // Include at least one no-op (memoized) update to trigger original bug.
2437 - await act(async () => {
2437 + await act(() => {
2438 ReactNoop.render(
2439 <Wrapper>
2440 <MemoizedChild key={1} />
@@ -2443,7 +2443,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2443 });
2444 assertLog([]);
2445
2446 - await act(async () => {
2446 + await act(() => {
2447 ReactNoop.render(
2448 <Wrapper>
2449 <MemoizedChild key={2} />
@@ -2458,7 +2458,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2458 'passive create',
2459 ]);
2460
2461 - await act(async () => {
2461 + await act(() => {
2462 ReactNoop.render(null);
2463 });
2464 assertLog(['layout destroy', 'passive destroy']);
@@ -2491,7 +2491,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2491 prevProps.prop === nextProps.prop;
2492 const MemoizedChild = React.memo(Child, isEqual);
2493
2494 - await act(async () => {
2494 + await act(() => {
2495 ReactNoop.render(
2496 <Wrapper>
2497 <MemoizedChild key={1} />
@@ -2501,7 +2501,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2501 assertLog(['render', 'layout create', 'passive create']);
2502
2503 // Include at least one no-op (memoized) update to trigger original bug.
2504 - await act(async () => {
2504 + await act(() => {
2505 ReactNoop.render(
2506 <Wrapper>
2507 <MemoizedChild key={1} />
@@ -2510,7 +2510,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2510 });
2511 assertLog([]);
2512
2513 - await act(async () => {
2513 + await act(() => {
2514 ReactNoop.render(
2515 <Wrapper>
2516 <MemoizedChild key={2} />
@@ -2525,7 +2525,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2525 'passive create',
2526 ]);
2527
2528 - await act(async () => {
2528 + await act(() => {
2529 ReactNoop.render(null);
2530 });
2531 assertLog(['layout destroy', 'passive destroy']);
@@ -2545,7 +2545,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2545
2546 const root1 = ReactNoop.createRoot();
2547 await expect(async () => {
2548 - await act(async () => {
2548 + await act(() => {
2549 root1.render(<App return={17} />);
2550 });
2551 }).toErrorDev([
@@ -2555,7 +2555,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2555
2556 const root2 = ReactNoop.createRoot();
2557 await expect(async () => {
2558 - await act(async () => {
2558 + await act(() => {
2559 root2.render(<App return={null} />);
2560 });
2561 }).toErrorDev([
@@ -2566,7 +2566,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2566
2567 const root3 = ReactNoop.createRoot();
2568 await expect(async () => {
2569 - await act(async () => {
2569 + await act(() => {
2570 root3.render(<App return={Promise.resolve()} />);
2571 });
2572 }).toErrorDev([
@@ -2924,7 +2924,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2924
2925 const root1 = ReactNoop.createRoot();
2926 await expect(async () => {
2927 - await act(async () => {
2927 + await act(() => {
2928 root1.render(<App return={17} />);
2929 });
2930 }).toErrorDev([
@@ -2934,7 +2934,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2934
2935 const root2 = ReactNoop.createRoot();
2936 await expect(async () => {
2937 - await act(async () => {
2937 + await act(() => {
2938 root2.render(<App return={null} />);
2939 });
2940 }).toErrorDev([
@@ -2945,7 +2945,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2945
2946 const root3 = ReactNoop.createRoot();
2947 await expect(async () => {
2948 - await act(async () => {
2948 + await act(() => {
2949 root3.render(<App return={Promise.resolve()} />);
2950 });
2951 }).toErrorDev([
@@ -2975,7 +2975,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2975
2976 const root = ReactNoop.createRoot();
2977 await expect(async () => {
2978 - await act(async () => {
2978 + await act(() => {
2979 root.render(<App />);
2980 });
2981 }).toErrorDev(['Warning: useInsertionEffect must not schedule updates.']);
@@ -2993,7 +2993,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2993 }, []);
2994 return null;
2995 }
2996 - await act(async () => {
2996 + await act(() => {
2997 root.render(<NotInsertion />);
2998 });
2999 });
@@ -3013,11 +3013,11 @@ describe('ReactHooksWithNoopRenderer', () => {
3013 }
3014
3015 const root = ReactNoop.createRoot();
3016 - await act(async () => {
3016 + await act(() => {
3017 root.render(<App foo="hello" />);
3018 });
3019 await expect(async () => {
3020 - await act(async () => {
3020 + await act(() => {
3021 root.render(<App foo="goodbye" />);
3022 });
3023 }).toErrorDev(['Warning: useInsertionEffect must not schedule updates.']);
@@ -3035,7 +3035,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3035 }, []);
3036 return null;
3037 }
3038 - await act(async () => {
3038 + await act(() => {
3039 root.render(<NotInsertion />);
3040 });
3041 });
@@ -3204,7 +3204,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3204
3205 const root1 = ReactNoop.createRoot();
3206 await expect(async () => {
3207 - await act(async () => {
3207 + await act(() => {
3208 root1.render(<App return={17} />);
3209 });
3210 }).toErrorDev([
@@ -3214,7 +3214,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3214
3215 const root2 = ReactNoop.createRoot();
3216 await expect(async () => {
3217 - await act(async () => {
3217 + await act(() => {
3218 root2.render(<App return={null} />);
3219 });
3220 }).toErrorDev([
@@ -3225,7 +3225,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3225
3226 const root3 = ReactNoop.createRoot();
3227 await expect(async () => {
3228 - await act(async () => {
3228 + await act(() => {
3229 root3.render(<App return={Promise.resolve()} />);
3230 });
3231 }).toErrorDev([
@@ -3277,7 +3277,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3277 </>,
3278 );
3279
3280 - await act(async () => button.current.increment());
3280 + await act(() => button.current.increment());
3281 assertLog([
3282 // Button should not re-render, because its props haven't changed
3283 // 'Increment',
@@ -3305,7 +3305,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3305 );
3306
3307 // Callback should have updated
3308 - await act(async () => button.current.increment());
3308 + await act(() => button.current.increment());
3309 assertLog(['Count: 11']);
3310 expect(ReactNoop).toMatchRenderedOutput(
3311 <>
@@ -3423,7 +3423,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3423 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
3424 expect(counter.current.count).toBe(0);
3425
3426 - await act(async () => {
3426 + await act(() => {
3427 counter.current.dispatch(INCREMENT);
3428 });
3429 assertLog(['Count: 1']);
@@ -3453,7 +3453,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3453 expect(ReactNoop).toMatchRenderedOutput(<span prop="Count: 0" />);
3454 expect(counter.current.count).toBe(0);
3455
3456 - await act(async () => {
3456 + await act(() => {
3457 counter.current.dispatch(INCREMENT);
3458 });
3459 assertLog(['Count: 1']);
@@ -3490,7 +3490,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3490 expect(counter.current.count).toBe(0);
3491 expect(totalRefUpdates).toBe(1);
3492
3493 - await act(async () => {
3493 + await act(() => {
3494 counter.current.dispatch(INCREMENT);
3495 });
3496 assertLog(['Count: 1']);
@@ -3589,7 +3589,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3589 );
3590 }
3591
3592 - await act(async () => {
3592 + await act(() => {
3593 ReactNoop.render(<App />);
3594 });
3595
@@ -3687,7 +3687,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3687 <span prop="A: 0, B: 0, C: [not loaded]" />,
3688 );
3689
3690 - await act(async () => {
3690 + await act(() => {
3691 updateA(2);
3692 updateB(3);
3693 });
@@ -3749,7 +3749,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3749 ReactNoop.render(<App loadC={true} />);
3750 await waitForAll(['A: 0, B: 0, C: 0']);
3751 expect(ReactNoop).toMatchRenderedOutput(<span prop="A: 0, B: 0, C: 0" />);
3752 - await act(async () => {
3752 + await act(() => {
3753 updateA(2);
3754 updateB(3);
3755 updateC(4);
@@ -3855,7 +3855,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3855 expect(ReactNoop).toMatchRenderedOutput('1');
3856 });
3857
3858 - await act(async () => {
3858 + await act(() => {
3859 setCounter(2);
3860 });
3861 assertLog(['Render: 1', 'Effect: 2', 'Reducer: 2', 'Render: 2']);
@@ -3890,7 +3890,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3890 await waitForAll(['Render disabled: true', 'Render count: 0']);
3891 expect(ReactNoop).toMatchRenderedOutput('0');
3892
3893 - await act(async () => {
3893 + await act(() => {
3894 // These increments should have no effect, since disabled=true
3895 increment();
3896 increment();
@@ -3899,7 +3899,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3899 assertLog(['Render disabled: true', 'Render count: 0']);
3900 expect(ReactNoop).toMatchRenderedOutput('0');
3901
3902 - await act(async () => {
3902 + await act(() => {
3903 // Enabling the updater should *not* replay the previous increment() actions
3904 setDisabled(false);
3905 });
@@ -3939,7 +3939,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3939 await waitForAll(['Render disabled: true', 'Render count: 0']);
3940 expect(ReactNoop).toMatchRenderedOutput('0');
3941
3942 - await act(async () => {
3942 + await act(() => {
3943 // These increments should have no effect, since disabled=true
3944 increment();
3945 increment();
@@ -3948,7 +3948,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3948 assertLog(['Render count: 0']);
3949 expect(ReactNoop).toMatchRenderedOutput('0');
3950
3951 - await act(async () => {
3951 + await act(() => {
3952 // Enabling the updater should *not* replay the previous increment() actions
3953 setDisabled(false);
3954 });
@@ -3988,7 +3988,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3988 await waitForAll(['Render disabled: true', 'Render count: 0']);
3989 expect(ReactNoop).toMatchRenderedOutput('0');
3990
3991 - await act(async () => {
3991 + await act(() => {
3992 // Although the increment happens first (and would seem to do nothing since disabled=true),
3993 // because these calls are in a batch the parent updates first. This should cause the child
3994 // to re-render with disabled=false and *then* process the increment action, which now
@@ -4027,7 +4027,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4027 }
4028
4029 const root = ReactNoop.createRoot(null);
4030 - await act(async () => {
4030 + await act(() => {
4031 root.render(
4032 <>
4033 <CounterA />
@@ -4037,7 +4037,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4037 });
4038 assertLog(['Render A: 0', 'Render B: 0', 'Commit A: 0', 'Commit B: 0']);
4039
4040 - await act(async () => {
4040 + await act(() => {
4041 setCounterA(1);
4042
4043 // In the same batch, update B twice. To trigger the condition we're
@@ -4083,7 +4083,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4083 ]);
4084 expect(ReactNoop).toMatchRenderedOutput('0');
4085
4086 - await act(async () => dispatch());
4086 + await act(() => dispatch());
4087 assertLog(['Step: 5, Shadow: 5']);
4088 expect(ReactNoop).toMatchRenderedOutput('5');
4089 });
@@ -4108,10 +4108,10 @@ describe('ReactHooksWithNoopRenderer', () => {
4108 return `${a ? 'A' : 'a'}${b ? 'B' : 'b'}${c ? 'C' : 'c'}`;
4109 }
4110
4111 - await act(async () => ReactNoop.render(<App />));
4111 + await act(() => ReactNoop.render(<App />));
4112 expect(ReactNoop).toMatchRenderedOutput('abc');
4113
4114 - await act(async () => {
4114 + await act(() => {
4115 updateA(true);
4116 // This update should not get dropped.
4117 updateC(true);
@@ -4138,7 +4138,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4138 return label;
4139 }
4140
4141 - await act(async () => {
4141 + await act(() => {
4142 root.render(
4143 <>
4144 <Child key="A" label="A" />
@@ -4155,7 +4155,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4155
4156 // Delete A. This should only unmount the effect on A. In the regression,
4157 // B's effect would also unmount.
4158 - await act(async () => {
4158 + await act(() => {
4159 root.render(
4160 <>
4161 <Child key="B" label="B" />
@@ -4165,7 +4165,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4165 assertLog(['Unmount layout A', 'Unmount passive A']);
4166
4167 // Now delete and unmount B.
4168 - await act(async () => {
4168 + await act(() => {
4169 root.render(null);
4170 });
4171 assertLog(['Unmount layout B', 'Unmount passive B']);
@@ -4184,7 +4184,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4184 return label;
4185 }
4186
4187 - await act(async () => {
4187 + await act(() => {
4188 root.render(
4189 <>
4190 <Child key="A" label="A" />
@@ -4194,7 +4194,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4194 });
4195 assertLog(['Mount A', 'Mount B']);
4196
4197 - await act(async () => {
4197 + await act(() => {
4198 root.render(
4199 <>
4200 <Child key="B" label="B" />
@@ -4204,7 +4204,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4204 });
4205 assertLog([]);
4206
4207 - await act(async () => {
4207 + await act(() => {
4208 root.render(null);
4209 });
4210
@@ -4243,7 +4243,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4243 }
4244
4245 const root = ReactNoop.createRoot();
4246 - await act(async () => {
4246 + await act(() => {
4247 root.render(<App />);
4248 });
4249 assertLog(['Suspend! [A]', 'Suspend! [B]', 'Mount A', 'Mount B']);
@@ -4253,7 +4253,7 @@ describe('ReactHooksWithNoopRenderer', () => {
4253 });
4254 assertLog(['Promise resolved [A]', 'A', 'Suspend! [B]']);
4255
4256 - await act(async () => {
4256 + await act(() => {
4257 root.render(null);
4258 });
4259 // In the regression, SuspenseList would cause the children to "forget" that
@@ -4280,25 +4280,25 @@ describe('ReactHooksWithNoopRenderer', () => {
4280 return <Text text={`Render: ${count}`} />;
4281 }
4282
4283 - await act(async () => {
4283 + await act(() => {
4284 ReactNoop.render(<Test />);
4285 });
4286
4287 assertLog(['Render: 0', 'Effect: 0']);
4288
4289 - await act(async () => {
4289 + await act(() => {
4290 handleClick();
4291 });
4292
4293 assertLog(['Render: 0']);
4294
4295 - await act(async () => {
4295 + await act(() => {
4296 handleClick();
4297 });
4298
4299 assertLog(['Render: 0']);
4300
4301 - await act(async () => {
4301 + await act(() => {
4302 handleClick();
4303 });
4304
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
+3 -3
@@ -1832,7 +1832,7 @@ describe('ReactIncrementalErrorHandling', () => {
1832 return 'Everything is fine.';
1833 }
1834
1835 - await act(async () => {
1835 + await act(() => {
1836 root.render(<Oops />);
1837 });
1838
@@ -1890,14 +1890,14 @@ describe('ReactIncrementalErrorHandling', () => {
1890 }
1891
1892 const root = ReactNoop.createRoot();
1893 - await act(async () => {
1893 + await act(() => {
1894 root.render(<App shouldThrow={false} />);
1895 });
1896 expect(root).toMatchRenderedOutput('All good');
1897
1898 let error;
1899 try {
1900 - await act(async () => {
1900 + await act(() => {
1901 root.render(<App shouldThrow={true} />);
1902 });
1903 } catch (e) {
packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js
+1 -1
@@ -102,7 +102,7 @@ describe('ReactIncrementalScheduling', () => {
102 return text;
103 }
104
105 - await act(async () => {
105 + await act(() => {
106 ReactNoop.renderToRootWithID(<Text text="a:1" />, 'a');
107 ReactNoop.renderToRootWithID(<Text text="b:1" />, 'b');
108 ReactNoop.renderToRootWithID(<Text text="c:1" />, 'c');
packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js
+7 -7
@@ -618,13 +618,13 @@ describe('ReactIncrementalUpdates', () => {
618 }
619
620 const root = ReactNoop.createRoot();
621 - await act(async () => {
621 + await act(() => {
622 root.render(<App />);
623 });
624 assertLog(['Committed: ']);
625 expect(root).toMatchRenderedOutput(null);
626
627 - await act(async () => {
627 + await act(() => {
628 React.startTransition(() => {
629 pushToLog('A');
630 });
@@ -679,13 +679,13 @@ describe('ReactIncrementalUpdates', () => {
679 }
680
681 const root = ReactNoop.createRoot();
682 - await act(async () => {
682 + await act(() => {
683 root.render(<App />);
684 });
685 assertLog([]);
686 expect(root).toMatchRenderedOutput(null);
687
688 - await act(async () => {
688 + await act(() => {
689 React.startTransition(() => {
690 pushToLog('A');
691 });
@@ -742,20 +742,20 @@ describe('ReactIncrementalUpdates', () => {
742 }
743
744 const root = ReactNoop.createRoot();
745 - await act(async () => {
745 + await act(() => {
746 root.render(<App prop="A" />);
747 });
748 expect(root).toMatchRenderedOutput('0');
749
750 // Changing the prop causes the count to increase by 100
751 - await act(async () => {
751 + await act(() => {
752 root.render(<App prop="B" />);
753 });
754 expect(root).toMatchRenderedOutput('100');
755
756 // Now increment the count by 1 with a state update. And, in the same
757 // batch, change the prop back to its original value.
758 - await act(async () => {
758 + await act(() => {
759 root.render(<App prop="A" />);
760 app.setState(state => ({count: state.count + 1}));
761 });
packages/react-reconciler/src/__tests__/ReactInterleavedUpdates-test.js
+2 -2
@@ -52,7 +52,7 @@ describe('ReactInterleavedUpdates', () => {
52
53 const root = ReactNoop.createRoot();
54
55 - await act(async () => {
55 + await act(() => {
56 root.render(
57 <>
58 <Child />
@@ -101,7 +101,7 @@ describe('ReactInterleavedUpdates', () => {
101 }
102
103 const root = ReactNoop.createRoot();
104 - await act(async () => {
104 + await act(() => {
105 root.render(<App />);
106 });
107 assertLog(['A0', 'B0', 'C0']);
packages/react-reconciler/src/__tests__/ReactMemo-test.js
+9 -9
@@ -270,7 +270,7 @@ describe('memo', () => {
270 }
271
272 const root = ReactNoop.createRoot();
273 - await act(async () => {
273 + await act(() => {
274 root.render(<App prop="A" />);
275 });
276 assertLog([
@@ -280,7 +280,7 @@ describe('memo', () => {
280 ]);
281
282 // Demonstrate what happens when the props change
283 - await act(async () => {
283 + await act(() => {
284 root.render(<App prop="B" />);
285 });
286 assertLog([
@@ -294,7 +294,7 @@ describe('memo', () => {
294
295 // Demonstrate what happens when the prop object changes but there's a
296 // bailout because all the individual props are the same.
297 - await act(async () => {
297 + await act(() => {
298 root.render(<App prop="B" />);
299 });
300 // Nothing re-renders
@@ -303,7 +303,7 @@ describe('memo', () => {
303 // Demonstrate what happens when the prop object changes, it bails out
304 // because all the props are the same, but we still render the
305 // children because there's a local update in the same batch.
306 - await act(async () => {
306 + await act(() => {
307 root.render(<App prop="B" />);
308 setLocalUpdateOnChildren(1);
309 });
@@ -316,7 +316,7 @@ describe('memo', () => {
316 ]);
317
318 // Do the same thing again. We should still reuse the props object.
319 - await act(async () => {
319 + await act(() => {
320 root.render(<App prop="B" />);
321 setLocalUpdateOnChildren(2);
322 });
@@ -597,12 +597,12 @@ describe('memo', () => {
597 }
598
599 const root = ReactNoop.createRoot();
600 - await act(async () => {
600 + await act(() => {
601 root.render(<App />);
602 });
603 expect(root).toMatchRenderedOutput('0');
604
605 - await act(async () => {
605 + await act(() => {
606 setCounter(1);
607 ReactNoop.discreteUpdates(() => {
608 root.render(<App />);
@@ -633,12 +633,12 @@ describe('memo', () => {
633 }
634
635 const root = ReactNoop.createRoot();
636 - await act(async () => {
636 + await act(() => {
637 root.render(<App />);
638 });
639 expect(root).toMatchRenderedOutput('0');
640
641 - await act(async () => {
641 + await act(() => {
642 setCounter(1);
643 ReactNoop.discreteUpdates(() => {
644 root.render(<App />);
packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js
+2 -2
@@ -26,7 +26,7 @@ describe('internal act()', () => {
26 }
27
28 const calledLog = [];
29 - await act(async () => {
29 + await act(() => {
30 ReactNoop.render(
31 <App
32 callback={() => {
@@ -54,7 +54,7 @@ describe('internal act()', () => {
54 }, []);
55 return ctr;
56 }
57 - await act(async () => {
57 + await act(() => {
58 ReactNoop.render(<App />);
59 });
60 assertLog(['stage 1', 'stage 2']);
packages/react-reconciler/src/__tests__/ReactOffscreen-test.js
+95 -95
@@ -88,7 +88,7 @@ describe('ReactOffscreen', () => {
88 );
89
90 // Now try after an update
91 - await act(async () => {
91 + await act(() => {
92 root.render(<App mode="visible" />);
93 });
94 assertLog(['Normal', 'Deferred']);
@@ -128,7 +128,7 @@ describe('ReactOffscreen', () => {
128 }
129
130 const root = ReactNoop.createLegacyRoot();
131 - await act(async () => {
131 + await act(() => {
132 root.render(
133 <>
134 <LegacyHidden mode="hidden">
@@ -151,7 +151,7 @@ describe('ReactOffscreen', () => {
151 );
152
153 // Test that the children can be updated
154 - await act(async () => {
154 + await act(() => {
155 setState('B');
156 });
157 assertLog(['B']);
@@ -197,7 +197,7 @@ describe('ReactOffscreen', () => {
197 );
198
199 // Test that the children can be updated
200 - await act(async () => {
200 + await act(() => {
201 setState('B');
202 });
203 assertLog(['B']);
@@ -224,7 +224,7 @@ describe('ReactOffscreen', () => {
224 const root = ReactNoop.createRoot();
225
226 // Mount hidden tree.
227 - await act(async () => {
227 + await act(() => {
228 root.render(
229 <Offscreen mode="hidden">
230 <Child />
@@ -236,7 +236,7 @@ describe('ReactOffscreen', () => {
236 expect(root).toMatchRenderedOutput(<span hidden={true} prop="Child" />);
237
238 // Unhide the tree. The layout effect is mounted.
239 - await act(async () => {
239 + await act(() => {
240 root.render(
241 <Offscreen mode="visible">
242 <Child />
@@ -260,7 +260,7 @@ describe('ReactOffscreen', () => {
260 }
261
262 const root = ReactNoop.createRoot();
263 - await act(async () => {
263 + await act(() => {
264 root.render(
265 <Offscreen mode="visible">
266 <Child />
@@ -271,7 +271,7 @@ describe('ReactOffscreen', () => {
271 expect(root).toMatchRenderedOutput(<span prop="Child" />);
272
273 // Hide the tree. The layout effect is unmounted.
274 - await act(async () => {
274 + await act(() => {
275 root.render(
276 <Offscreen mode="hidden">
277 <Child />
@@ -282,7 +282,7 @@ describe('ReactOffscreen', () => {
282 expect(root).toMatchRenderedOutput(<span hidden={true} prop="Child" />);
283
284 // Unhide the tree. The layout effect is re-mounted.
285 - await act(async () => {
285 + await act(() => {
286 root.render(
287 <Offscreen mode="visible">
288 <Child />
@@ -313,7 +313,7 @@ describe('ReactOffscreen', () => {
313 }
314
315 const root = ReactNoop.createRoot();
316 - await act(async () => {
316 + await act(() => {
317 // Outer and inner offscreen are hidden.
318 root.render(
319 <Offscreen mode={'hidden'}>
@@ -327,7 +327,7 @@ describe('ReactOffscreen', () => {
327 assertLog(['child']);
328 expect(root).toMatchRenderedOutput(<span hidden={true} prop="child" />);
329
330 - await act(async () => {
330 + await act(() => {
331 // Inner offscreen is visible.
332 root.render(
333 <Offscreen mode={'hidden'}>
@@ -341,7 +341,7 @@ describe('ReactOffscreen', () => {
341 assertLog(['child']);
342 expect(root).toMatchRenderedOutput(<span hidden={true} prop="child" />);
343
344 - await act(async () => {
344 + await act(() => {
345 // Inner offscreen is hidden.
346 root.render(
347 <Offscreen mode={'hidden'}>
@@ -355,7 +355,7 @@ describe('ReactOffscreen', () => {
355 assertLog(['child']);
356 expect(root).toMatchRenderedOutput(<span hidden={true} prop="child" />);
357
358 - await act(async () => {
358 + await act(() => {
359 // Inner offscreen is visible.
360 root.render(
361 <Offscreen mode={'hidden'}>
@@ -368,7 +368,7 @@ describe('ReactOffscreen', () => {
368
369 Scheduler.unstable_clearLog();
370
371 - await act(async () => {
371 + await act(() => {
372 // Outer offscreen is visible.
373 // Inner offscreen is hidden.
374 root.render(
@@ -382,7 +382,7 @@ describe('ReactOffscreen', () => {
382
383 assertLog(['child']);
384
385 - await act(async () => {
385 + await act(() => {
386 // Outer offscreen is hidden.
387 // Inner offscreen is visible.
388 root.render(
@@ -410,7 +410,7 @@ describe('ReactOffscreen', () => {
410 }
411
412 const root = ReactNoop.createRoot();
413 - await act(async () => {
413 + await act(() => {
414 // Start the tree hidden. The layout effect is not mounted.
415 root.render(
416 <Offscreen mode="hidden">
@@ -422,7 +422,7 @@ describe('ReactOffscreen', () => {
422 expect(root).toMatchRenderedOutput(<span hidden={true} prop="Child" />);
423
424 // Show the tree. The layout effect is mounted.
425 - await act(async () => {
425 + await act(() => {
426 root.render(
427 <Offscreen mode="visible">
428 <Child />
@@ -433,7 +433,7 @@ describe('ReactOffscreen', () => {
433 expect(root).toMatchRenderedOutput(<span prop="Child" />);
434
435 // Hide the tree again. The layout effect is un-mounted.
436 - await act(async () => {
436 + await act(() => {
437 root.render(
438 <Offscreen mode="hidden">
439 <Child />
@@ -459,7 +459,7 @@ describe('ReactOffscreen', () => {
459 return <Text text="Child" />;
460 }
461
462 - await act(async () => {
462 + await act(() => {
463 root.render(
464 <Offscreen mode="visible">
465 <Child />
@@ -470,7 +470,7 @@ describe('ReactOffscreen', () => {
470 expect(root).toMatchRenderedOutput(<span prop="Child" />);
471
472 // Hide the tree. The layout effect is unmounted.
473 - await act(async () => {
473 + await act(() => {
474 root.render(
475 <Offscreen mode="hidden">
476 <Child />
@@ -498,7 +498,7 @@ describe('ReactOffscreen', () => {
498 }
499
500 const root = ReactNoop.createRoot();
501 - await act(async () => {
501 + await act(() => {
502 root.render(
503 <LegacyHidden mode="visible">
504 <Child />
@@ -507,7 +507,7 @@ describe('ReactOffscreen', () => {
507 });
508 assertLog(['Child', 'Mount layout']);
509
510 - await act(async () => {
510 + await act(() => {
511 root.render(
512 <LegacyHidden mode="hidden">
513 <Child />
@@ -516,7 +516,7 @@ describe('ReactOffscreen', () => {
516 });
517 assertLog(['Child']);
518
519 - await act(async () => {
519 + await act(() => {
520 root.render(
521 <LegacyHidden mode="visible">
522 <Child />
@@ -525,7 +525,7 @@ describe('ReactOffscreen', () => {
525 });
526 assertLog(['Child']);
527
528 - await act(async () => {
528 + await act(() => {
529 root.render(null);
530 });
531 assertLog(['Unmount layout']);
@@ -534,7 +534,7 @@ describe('ReactOffscreen', () => {
534 // @gate enableOffscreen
535 it('hides new insertions into an already hidden tree', async () => {
536 const root = ReactNoop.createRoot();
537 - await act(async () => {
537 + await act(() => {
538 root.render(
539 <Offscreen mode="hidden">
540 <span>Hi</span>
@@ -544,7 +544,7 @@ describe('ReactOffscreen', () => {
544 expect(root).toMatchRenderedOutput(<span hidden={true}>Hi</span>);
545
546 // Insert a new node into the hidden tree
547 - await act(async () => {
547 + await act(() => {
548 root.render(
549 <Offscreen mode="hidden">
550 <span>Hi</span>
@@ -564,7 +564,7 @@ describe('ReactOffscreen', () => {
564 // @gate enableOffscreen
565 it('hides updated nodes inside an already hidden tree', async () => {
566 const root = ReactNoop.createRoot();
567 - await act(async () => {
567 + await act(() => {
568 root.render(
569 <Offscreen mode="hidden">
570 <span>Hi</span>
@@ -574,7 +574,7 @@ describe('ReactOffscreen', () => {
574 expect(root).toMatchRenderedOutput(<span hidden={true}>Hi</span>);
575
576 // Set the `hidden` prop to on an already hidden node
577 - await act(async () => {
577 + await act(() => {
578 root.render(
579 <Offscreen mode="hidden">
580 <span hidden={false}>Hi</span>
@@ -585,7 +585,7 @@ describe('ReactOffscreen', () => {
585 expect(root).toMatchRenderedOutput(<span hidden={true}>Hi</span>);
586
587 // Unhide the boundary
588 - await act(async () => {
588 + await act(() => {
589 root.render(
590 <Offscreen mode="visible">
591 <span hidden={true}>Hi</span>
@@ -596,7 +596,7 @@ describe('ReactOffscreen', () => {
596 expect(root).toMatchRenderedOutput(<span hidden={true}>Hi</span>);
597
598 // Remove the `hidden` prop
599 - await act(async () => {
599 + await act(() => {
600 root.render(
601 <Offscreen mode="visible">
602 <span>Hi</span>
@@ -670,7 +670,7 @@ describe('ReactOffscreen', () => {
670
671 // Render a hidden tree
672 const root = ReactNoop.createRoot();
673 - await act(async () => {
673 + await act(() => {
674 root.render(<App show={false} />);
675 });
676 assertLog(['Outer: 0', 'Inner: 0']);
@@ -751,7 +751,7 @@ describe('ReactOffscreen', () => {
751 }
752
753 const root = ReactNoop.createRoot();
754 - await act(async () => {
754 + await act(() => {
755 root.render(<Offscreen hidden={false} />);
756 });
757 assertLog([]);
@@ -803,7 +803,7 @@ describe('ReactOffscreen', () => {
803 }
804
805 // Initial render
806 - await act(async () => {
806 + await act(() => {
807 root.render(
808 <Offscreen mode="hidden">
809 <Child />
@@ -816,7 +816,7 @@ describe('ReactOffscreen', () => {
816 // Schedule an update to a hidden class component. The update will finish
817 // rendering in the background, but the callback shouldn't fire yet, because
818 // the component isn't visible.
819 - await act(async () => {
819 + await act(() => {
820 child.setState({text: 'B'}, () => {
821 Scheduler.log('B update finished');
822 });
@@ -827,7 +827,7 @@ describe('ReactOffscreen', () => {
827 // Now reveal the hidden component. Simultaneously, schedule another
828 // update with a callback to the same component. When the component is
829 // revealed, both the B callback and C callback should fire, in that order.
830 - await act(async () => {
830 + await act(() => {
831 root.render(
832 <Offscreen mode="visible">
833 <Child />
@@ -860,7 +860,7 @@ describe('ReactOffscreen', () => {
860
861 // Initial mount
862 const root = ReactNoop.createRoot();
863 - await act(async () => {
863 + await act(() => {
864 root.render(
865 <Offscreen mode="visible">
866 <Child />
@@ -870,7 +870,7 @@ describe('ReactOffscreen', () => {
870 assertLog(['componentDidMount']);
871
872 // Hide the class component
873 - await act(async () => {
873 + await act(() => {
874 root.render(
875 <Offscreen mode="hidden">
876 <Child />
@@ -881,7 +881,7 @@ describe('ReactOffscreen', () => {
881
882 // Reappear the class component. componentDidMount should fire, not
883 // componentDidUpdate.
884 - await act(async () => {
884 + await act(() => {
885 root.render(
886 <Offscreen mode="visible">
887 <Child />
@@ -908,7 +908,7 @@ describe('ReactOffscreen', () => {
908
909 // Initial mount
910 const root = ReactNoop.createRoot();
911 - await act(async () => {
911 + await act(() => {
912 root.render(
913 <Offscreen mode="visible">
914 <Child key="B" label="B" />
@@ -918,7 +918,7 @@ describe('ReactOffscreen', () => {
918 assertLog(['Mount B']);
919
920 // Hide the component
921 - await act(async () => {
921 + await act(() => {
922 root.render(
923 <Offscreen mode="hidden">
924 <Child key="B" label="B" />
@@ -928,7 +928,7 @@ describe('ReactOffscreen', () => {
928 assertLog(['Unmount B']);
929
930 // Reappear the component and also add some new siblings.
931 - await act(async () => {
931 + await act(() => {
932 root.render(
933 <Offscreen mode="visible">
934 <Child key="A" label="A" />
@@ -964,7 +964,7 @@ describe('ReactOffscreen', () => {
964 // Initial mount
965 const bRef = React.createRef();
966 const root = ReactNoop.createRoot();
967 - await act(async () => {
967 + await act(() => {
968 root.render(
969 <Offscreen mode="visible">
970 <Child key="B" ref={bRef} label="B" />
@@ -978,7 +978,7 @@ describe('ReactOffscreen', () => {
978 const setStateB = bRef.current.setState.bind(bRef.current);
979
980 // Hide the component
981 - await act(async () => {
981 + await act(() => {
982 root.render(
983 <Offscreen mode="hidden">
984 <Child key="B" ref={bRef} label="B" />
@@ -988,7 +988,7 @@ describe('ReactOffscreen', () => {
988 assertLog(['Unmount B']);
989
990 // Reappear the component and also add some new siblings.
991 - await act(async () => {
991 + await act(() => {
992 setStateB(null, () => {
993 Scheduler.log('setState callback B');
994 });
@@ -1033,7 +1033,7 @@ describe('ReactOffscreen', () => {
1033 const root = ReactNoop.createRoot();
1034
1035 // Mount the app without showing the extra content
1036 - await act(async () => {
1036 + await act(() => {
1037 root.render(<App showMore={false} />);
1038 });
1039 assertLog([
@@ -1056,7 +1056,7 @@ describe('ReactOffscreen', () => {
1056 );
1057
1058 // Reveal the prerendered tree
1059 - await act(async () => {
1059 + await act(() => {
1060 root.render(<App showMore={true} />);
1061 });
1062 assertLog([
@@ -1096,7 +1096,7 @@ describe('ReactOffscreen', () => {
1096 const root = ReactNoop.createRoot();
1097
1098 // Mount the app without showing the extra content
1099 - await act(async () => {
1099 + await act(() => {
1100 root.render(<App showMore={false} />);
1101 });
1102 assertLog([
@@ -1119,7 +1119,7 @@ describe('ReactOffscreen', () => {
1119 );
1120
1121 // Reveal the prerendered tree
1122 - await act(async () => {
1122 + await act(() => {
1123 root.render(<App showMore={true} />);
1124 });
1125 assertLog(['Shell', 'More']);
@@ -1151,21 +1151,21 @@ describe('ReactOffscreen', () => {
1151 }
1152
1153 const root = ReactNoop.createRoot();
1154 - await act(async () => {
1154 + await act(() => {
1155 root.render(<App show={true} step={1} />);
1156 });
1157 assertLog([1, 'Commit mount [1]']);
1158 expect(root).toMatchRenderedOutput(<span prop={1} />);
1159
1160 // Hide the tree. This will unmount the effect.
1161 - await act(async () => {
1161 + await act(() => {
1162 root.render(<App show={false} step={1} />);
1163 });
1164 assertLog(['Commit unmount [1]']);
1165 expect(root).toMatchRenderedOutput(<span hidden={true} prop={1} />);
1166
1167 // Update.
1168 - await act(async () => {
1168 + await act(() => {
1169 root.render(<App show={false} step={2} />);
1170 });
1171 // The update is prerendered but no effects are fired
@@ -1173,7 +1173,7 @@ describe('ReactOffscreen', () => {
1173 expect(root).toMatchRenderedOutput(<span hidden={true} prop={2} />);
1174
1175 // Reveal the tree.
1176 - await act(async () => {
1176 + await act(() => {
1177 root.render(<App show={true} step={2} />);
1178 });
1179 // The update doesn't render because it was already prerendered, but we do
@@ -1212,23 +1212,23 @@ describe('ReactOffscreen', () => {
1212 }
1213
1214 const root = ReactNoop.createRoot();
1215 - await act(async () => {
1215 + await act(() => {
1216 root.render(<App show={true} />);
1217 });
1218 assertLog(['Mount Child', 'Mount Parent']);
1219
1220 // First demonstrate what happens during a normal deletion
1221 - await act(async () => {
1221 + await act(() => {
1222 root.render(null);
1223 });
1224 assertLog(['Unmount Parent', 'Unmount Child']);
1225
1226 // Now redo the same thing but hide instead of deleting
1227 - await act(async () => {
1227 + await act(() => {
1228 root.render(<App show={true} />);
1229 });
1230 assertLog(['Mount Child', 'Mount Parent']);
1231 - await act(async () => {
1231 + await act(() => {
1232 root.render(<App show={false} />);
1233 });
1234 // The order is the same as during a deletion: parent before child
@@ -1266,7 +1266,7 @@ describe('ReactOffscreen', () => {
1266 const root = ReactNoop.createRoot();
1267
1268 // Mount the app, including the extra content
1269 - await act(async () => {
1269 + await act(() => {
1270 root.render(<App showMore={true} step={1} />);
1271 });
1272 assertLog(['Shell 1', 'More 1', 'Mount Shell 1', 'Mount More 1']);
@@ -1278,7 +1278,7 @@ describe('ReactOffscreen', () => {
1278 );
1279
1280 // Hide the extra content. while also updating one of its props
1281 - await act(async () => {
1281 + await act(() => {
1282 root.render(<App showMore={false} step={2} />);
1283 });
1284 assertLog([
@@ -1333,7 +1333,7 @@ describe('ReactOffscreen', () => {
1333 const root = ReactNoop.createRoot();
1334
1335 // Prerender the outer contents. No effects should mount.
1336 - await act(async () => {
1336 + await act(() => {
1337 root.render(<App showOuter={false} showInner={false} />);
1338 });
1339 assertLog(['Outer']);
@@ -1344,7 +1344,7 @@ describe('ReactOffscreen', () => {
1344 );
1345
1346 // Prerender the inner contents. No effects should mount.
1347 - await act(async () => {
1347 + await act(() => {
1348 root.render(<App showOuter={false} showInner={true} />);
1349 });
1350 assertLog(['Outer', 'Inner']);
@@ -1358,7 +1358,7 @@ describe('ReactOffscreen', () => {
1358 );
1359
1360 // Reveal the prerendered tree
1361 - await act(async () => {
1361 + await act(() => {
1362 root.render(<App showOuter={true} showInner={true} />);
1363 });
1364 // The effects fire, but the tree is not re-rendered because it already
@@ -1409,7 +1409,7 @@ describe('ReactOffscreen', () => {
1409 const root = ReactNoop.createRoot();
1410
1411 // Prerender the whole tree.
1412 - await act(async () => {
1412 + await act(() => {
1413 root.render(<App showOuter={false} showInner={false} />);
1414 });
1415 assertLog(['Outer', 'Inner']);
@@ -1426,7 +1426,7 @@ describe('ReactOffscreen', () => {
1426 );
1427
1428 // Reveal the outer contents. The inner tree remains hidden.
1429 - await act(async () => {
1429 + await act(() => {
1430 root.render(<App showOuter={true} showInner={false} />);
1431 });
1432 assertLog(['Mount Outer']);
@@ -1460,25 +1460,25 @@ describe('ReactOffscreen', () => {
1460
1461 const root = ReactNoop.createRoot();
1462
1463 - await act(async () => {
1463 + await act(() => {
1464 root.render(<App mode={'manual'} />);
1465 });
1466
1467 expect(offscreenRef.current).not.toBeNull();
1468
1469 - await act(async () => {
1469 + await act(() => {
1470 root.render(<App mode={'visible'} />);
1471 });
1472
1473 expect(offscreenRef.current).toBeNull();
1474
1475 - await act(async () => {
1475 + await act(() => {
1476 root.render(<App mode={'hidden'} />);
1477 });
1478
1479 expect(offscreenRef.current).toBeNull();
1480
1481 - await act(async () => {
1481 + await act(() => {
1482 root.render(<App mode={'manual'} />);
1483 });
1484
@@ -1525,7 +1525,7 @@ describe('ReactOffscreen', () => {
1525
1526 const root = ReactNoop.createRoot();
1527
1528 - await act(async () => {
1528 + await act(() => {
1529 root.render(<App />);
1530 });
1531
@@ -1552,7 +1552,7 @@ describe('ReactOffscreen', () => {
1552 );
1553 });
1554
1555 - await act(async () => {
1555 + await act(() => {
1556 offscreenRef.current.detach();
1557 });
1558
@@ -1577,7 +1577,7 @@ describe('ReactOffscreen', () => {
1577 </>,
1578 );
1579
1580 - await act(async () => {
1580 + await act(() => {
1581 offscreenRef.current.attach();
1582 });
1583
@@ -1650,7 +1650,7 @@ describe('ReactOffscreen', () => {
1650
1651 const root = ReactNoop.createRoot();
1652
1653 - await act(async () => {
1653 + await act(() => {
1654 root.render(<App />);
1655 });
1656
@@ -1721,19 +1721,19 @@ describe('ReactOffscreen', () => {
1721
1722 const root = ReactNoop.createRoot();
1723
1724 - await act(async () => {
1724 + await act(() => {
1725 root.render(<App showOffscreen={true} />);
1726 });
1727
1728 expect(offscreenRef.current).not.toBeNull();
1729
1730 - await act(async () => {
1730 + await act(() => {
1731 root.render(<App showOffscreen={false} />);
1732 });
1733
1734 expect(offscreenRef.current).toBeNull();
1735
1736 - await act(async () => {
1736 + await act(() => {
1737 root.render(<App showOffscreen={true} />);
1738 });
1739
@@ -1757,18 +1757,18 @@ describe('ReactOffscreen', () => {
1757
1758 const root = ReactNoop.createRoot();
1759
1760 - await act(async () => {
1760 + await act(() => {
1761 root.render(<App mode={'hidden'} />);
1762 });
1763
1764 expect(offscreenRef.current).toBeNull();
1765
1766 - await act(async () => {
1766 + await act(() => {
1767 root.render(<App mode={'visible'} />);
1768 });
1769
1770 expect(offscreenRef.current).not.toBeNull();
1771 - await act(async () => {
1771 + await act(() => {
1772 root.render(<App mode={'hidden'} />);
1773 });
1774
@@ -1789,7 +1789,7 @@ describe('ReactOffscreen', () => {
1789 );
1790 }
1791
1792 - await act(async () => {
1792 + await act(() => {
1793 root.render(
1794 <App>
1795 <div />
@@ -1800,7 +1800,7 @@ describe('ReactOffscreen', () => {
1800 expect(offscreenRef.current).not.toBeNull();
1801 const firstFiber = offscreenRef.current._current;
1802
1803 - await act(async () => {
1803 + await act(() => {
1804 root.render(
1805 <App>
1806 <span />
@@ -1844,7 +1844,7 @@ describe('ReactOffscreen', () => {
1844
1845 const root = ReactNoop.createRoot();
1846
1847 - await act(async () => {
1847 + await act(() => {
1848 root.render(<App />);
1849 });
1850
@@ -1852,7 +1852,7 @@ describe('ReactOffscreen', () => {
1852 expect(spanRef.current).not.toBeNull();
1853 assertLog(['Mount Layout Child', 'Mount Child']);
1854
1855 - await act(async () => {
1855 + await act(() => {
1856 offscreenRef.detach();
1857 });
1858
@@ -1860,13 +1860,13 @@ describe('ReactOffscreen', () => {
1860 assertLog(['Unmount Layout Child', 'Unmount Child']);
1861
1862 // Calling attach on already attached Offscreen.
1863 - await act(async () => {
1863 + await act(() => {
1864 offscreenRef.detach();
1865 });
1866
1867 assertLog([]);
1868
1869 - await act(async () => {
1869 + await act(() => {
1870 offscreenRef.attach();
1871 });
1872
@@ -1900,7 +1900,7 @@ describe('ReactOffscreen', () => {
1900
1901 const root = ReactNoop.createRoot();
1902
1903 - await act(async () => {
1903 + await act(() => {
1904 root.render(<App />);
1905 });
1906
@@ -1919,7 +1919,7 @@ describe('ReactOffscreen', () => {
1919 expect(outerOffscreen).not.toBeNull();
1920 expect(innerOffscreen).not.toBeNull();
1921
1922 - await act(async () => {
1922 + await act(() => {
1923 outerOffscreen.detach();
1924 });
1925
@@ -1932,7 +1932,7 @@ describe('ReactOffscreen', () => {
1932 'unmount inner',
1933 ]);
1934
1935 - await act(async () => {
1935 + await act(() => {
1936 outerOffscreen.attach();
1937 });
1938
@@ -1943,26 +1943,26 @@ describe('ReactOffscreen', () => {
1943 'mount middle',
1944 ]);
1945
1946 - await act(async () => {
1946 + await act(() => {
1947 innerOffscreen.detach();
1948 });
1949
1950 assertLog(['unmount layout inner', 'unmount inner']);
1951
1952 // Calling detach on already detached Offscreen.
1953 - await act(async () => {
1953 + await act(() => {
1954 innerOffscreen.detach();
1955 });
1956
1957 assertLog([]);
1958
1959 - await act(async () => {
1959 + await act(() => {
1960 innerOffscreen.attach();
1961 });
1962
1963 assertLog(['mount layout inner', 'mount inner']);
1964
1965 - await act(async () => {
1965 + await act(() => {
1966 innerOffscreen.detach();
1967 outerOffscreen.attach();
1968 });
@@ -1992,13 +1992,13 @@ describe('ReactOffscreen', () => {
1992 }
1993
1994 const root = ReactNoop.createRoot();
1995 - await act(async () => {
1995 + await act(() => {
1996 root.render(<App />);
1997 });
1998
1999 assertLog(['attach child']);
2000
2001 - await act(async () => {
2001 + await act(() => {
2002 const instance = offscreen.current;
2003 // Detach then immediately attach the instance.
2004 instance.detach();
@@ -2007,14 +2007,14 @@ describe('ReactOffscreen', () => {
2007
2008 assertLog([]);
2009
2010 - await act(async () => {
2010 + await act(() => {
2011 const instance = offscreen.current;
2012 instance.detach();
2013 });
2014
2015 assertLog(['detach child']);
2016
2017 - await act(async () => {
2017 + await act(() => {
2018 const instance = offscreen.current;
2019 // Attach then immediately detach.
2020 instance.attach();
@@ -2052,7 +2052,7 @@ describe('ReactOffscreen', () => {
2052 }
2053
2054 const root = ReactNoop.createRoot();
2055 - await act(async () => {
2055 + await act(() => {
2056 root.render(<App />);
2057 });
2058 assertLog(['attach child']);
packages/react-reconciler/src/__tests__/ReactOffscreenStrictMode-test.js
+8 -8
@@ -33,7 +33,7 @@ describe('ReactOffscreenStrictMode', () => {
33
34 // @gate __DEV__ && enableOffscreen
35 it('should trigger strict effects when offscreen is visible', async () => {
36 - await act(async () => {
36 + await act(() => {
37 ReactNoop.render(
38 <React.StrictMode>
39 <Offscreen mode="visible">
@@ -57,7 +57,7 @@ describe('ReactOffscreenStrictMode', () => {
57
58 // @gate __DEV__ && enableOffscreen && useModernStrictMode
59 it('should not trigger strict effects when offscreen is hidden', async () => {
60 - await act(async () => {
60 + await act(() => {
61 ReactNoop.render(
62 <React.StrictMode>
63 <Offscreen mode="hidden">
@@ -71,7 +71,7 @@ describe('ReactOffscreenStrictMode', () => {
71
72 log = [];
73
74 - await act(async () => {
74 + await act(() => {
75 ReactNoop.render(
76 <React.StrictMode>
77 <Offscreen mode="hidden">
@@ -86,7 +86,7 @@ describe('ReactOffscreenStrictMode', () => {
86
87 log = [];
88
89 - await act(async () => {
89 + await act(() => {
90 ReactNoop.render(
91 <React.StrictMode>
92 <Offscreen mode="visible">
@@ -109,7 +109,7 @@ describe('ReactOffscreenStrictMode', () => {
109
110 log = [];
111
112 - await act(async () => {
112 + await act(() => {
113 ReactNoop.render(
114 <React.StrictMode>
115 <Offscreen mode="hidden">
@@ -143,7 +143,7 @@ describe('ReactOffscreenStrictMode', () => {
143 return state;
144 }
145
146 - await act(async () => {
146 + await act(() => {
147 ReactNoop.render(
148 <React.StrictMode>
149 <React.Suspense>
@@ -193,7 +193,7 @@ describe('ReactOffscreenStrictMode', () => {
193 return null;
194 }
195
196 - await act(async () => {
196 + await act(() => {
197 ReactNoop.render(
198 <React.StrictMode>
199 <Offscreen mode="visible">
@@ -205,7 +205,7 @@ describe('ReactOffscreenStrictMode', () => {
205
206 log.push('------------------------------');
207
208 - await act(async () => {
208 + await act(() => {
209 resolve();
210 shouldSuspend = false;
211 });
packages/react-reconciler/src/__tests__/ReactOffscreenSuspense-test.js
+13 -13
@@ -118,7 +118,7 @@ describe('ReactOffscreen', () => {
118 // The hidden tree hasn't finished loading, but we should still be able to
119 // show the surrounding contents. The outer Suspense boundary
120 // isn't affected.
121 - await act(async () => {
121 + await act(() => {
122 root.render(<App />);
123 });
124 assertLog(['Visible', 'Suspend! [Hidden]']);
@@ -158,7 +158,7 @@ describe('ReactOffscreen', () => {
158 }
159
160 // Unlike Offscreen, LegacyHidden never captures if something suspends
161 - await act(async () => {
161 + await act(() => {
162 root.render(<App />);
163 });
164 assertLog(['Visible', 'Suspend! [Hidden]', 'Loading...']);
@@ -192,7 +192,7 @@ describe('ReactOffscreen', () => {
192 // The hidden tree hasn't finished loading, but we should still be able to
193 // show the surrounding contents. It doesn't matter that there's no
194 // Suspense boundary because the unfinished content isn't visible.
195 - await act(async () => {
195 + await act(() => {
196 root.render(
197 <Details open={false}>
198 <AsyncText text="Async" />
@@ -204,7 +204,7 @@ describe('ReactOffscreen', () => {
204
205 // But when we switch the boundary from hidden to visible, it should
206 // now bubble to the nearest Suspense boundary.
207 - await act(async () => {
207 + await act(() => {
208 startTransition(() => {
209 root.render(
210 <Details open={true}>
@@ -249,7 +249,7 @@ describe('ReactOffscreen', () => {
249 }
250
251 // Initial mount. Nothing suspends
252 - await act(async () => {
252 + await act(() => {
253 root.render(
254 <Details open={true}>
255 <Text text="(empty)" />
@@ -265,7 +265,7 @@ describe('ReactOffscreen', () => {
265 );
266
267 // Update that suspends inside the currently visible tree
268 - await act(async () => {
268 + await act(() => {
269 startTransition(() => {
270 root.render(
271 <Details open={true}>
@@ -285,7 +285,7 @@ describe('ReactOffscreen', () => {
285 );
286
287 // Update that hides the suspended tree
288 - await act(async () => {
288 + await act(() => {
289 startTransition(() => {
290 root.render(
291 <Details open={false}>
@@ -338,12 +338,12 @@ describe('ReactOffscreen', () => {
338
339 const root = ReactNoop.createRoot();
340 resolveText('A');
341 - await act(async () => {
341 + await act(() => {
342 root.render(<App show={false} />);
343 });
344 assertLog(['A']);
345
346 - await act(async () => {
346 + await act(() => {
347 startTransition(() => {
348 setText('B');
349 });
@@ -376,13 +376,13 @@ describe('ReactOffscreen', () => {
376
377 const root = ReactNoop.createRoot();
378 resolveText('A0');
379 - await act(async () => {
379 + await act(() => {
380 root.render(<App show={false} />);
381 });
382 assertLog(['A0']);
383 expect(root).toMatchRenderedOutput(<span hidden={true}>A0</span>);
384
385 - await act(async () => {
385 + await act(() => {
386 React.startTransition(() => {
387 setStep(1);
388 });
@@ -400,7 +400,7 @@ describe('ReactOffscreen', () => {
400 expect(root).toMatchRenderedOutput(<span hidden={true}>A0</span>);
401
402 // Resolve the data and finish rendering
403 - await act(async () => {
403 + await act(() => {
404 resolveText('B1');
405 });
406 assertLog(['B1']);
@@ -462,7 +462,7 @@ describe('ReactOffscreen', () => {
462 // Render a hidden tree
463 const root = ReactNoop.createRoot();
464 resolveText('Async: 0');
465 - await act(async () => {
465 + await act(() => {
466 root.render(<App show={true} />);
467 });
468 assertLog([
packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js
+2 -2
@@ -79,11 +79,11 @@ describe('ReactSchedulerIntegration', () => {
79 });
80 return null;
81 }
82 - await act(async () => {
82 + await act(() => {
83 ReactNoop.render(<CleanupEffect />);
84 });
85 assertLog([]);
86 - await act(async () => {
86 + await act(() => {
87 ReactNoop.render(<Effects />);
88 });
89 assertLog([
packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js
+2 -2
@@ -161,7 +161,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
161
162 // On initial mount, the suspended component is committed in an incomplete
163 // state, without a passive static effect flag.
164 - await act(async () => {
164 + await act(() => {
165 root.render(<App />);
166 });
167 assertLog(['Suspend! [Async]']);
@@ -170,7 +170,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
170 // When the promise resolves, a passive static effect flag is added. In the
171 // regression, the "missing expected static flag" would fire, because the
172 // previous fiber did not have one.
173 - await act(async () => {
173 + await act(() => {
174 resolveText('Async');
175 });
176 assertLog(['Async', 'Effect']);
packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
+17 -17
@@ -410,7 +410,7 @@ describe('ReactSuspense', () => {
410 await waitForAll(['default']);
411 expect(root).toMatchRenderedOutput('default');
412
413 - await act(async () => setValue('new value'));
413 + await act(() => setValue('new value'));
414 assertLog(['Suspend! [new value]', 'Loading...']);
415
416 await resolveText('new value');
@@ -456,7 +456,7 @@ describe('ReactSuspense', () => {
456 await waitForAll(['default']);
457 expect(root).toMatchRenderedOutput('default');
458
459 - await act(async () => setValue('new value'));
459 + await act(() => setValue('new value'));
460 assertLog(['Suspend! [new value]', 'Loading...']);
461
462 await resolveText('new value');
@@ -500,7 +500,7 @@ describe('ReactSuspense', () => {
500 await waitForAll(['default']);
501 expect(root).toMatchRenderedOutput('default');
502
503 - await act(async () => setValue('new value'));
503 + await act(() => setValue('new value'));
504 assertLog(['Suspend! [new value]', 'Loading...']);
505
506 await resolveText('new value');
@@ -544,7 +544,7 @@ describe('ReactSuspense', () => {
544 await waitForAll(['default']);
545 expect(root).toMatchRenderedOutput('default');
546
547 - await act(async () => setValue('new value'));
547 + await act(() => setValue('new value'));
548 assertLog(['Suspend! [new value]', 'Loading...']);
549
550 await resolveText('new value');
@@ -583,7 +583,7 @@ describe('ReactSuspense', () => {
583 await waitForAll(['Child 1', 'create layout']);
584 expect(root).toMatchRenderedOutput('Child 1');
585
586 - await act(async () => {
586 + await act(() => {
587 _setShow(true);
588 });
589 assertLog([
@@ -856,7 +856,7 @@ describe('ReactSuspense', () => {
856 expect(root).toMatchRenderedOutput('Step: 1');
857
858 // Update that suspends
859 - await act(async () => {
859 + await act(() => {
860 instance.setState({step: 2});
861 });
862 assertLog(['Suspend! [Step: 2]', 'Loading...']);
@@ -976,7 +976,7 @@ describe('ReactSuspense', () => {
976 await waitForPaint(['Tab: 0']);
977 expect(root).toMatchRenderedOutput('Tab: 0 + sibling');
978
979 - await act(async () => setTab(1));
979 + await act(() => setTab(1));
980 assertLog(['Suspend! [Tab: 1]', ' + sibling', 'Loading...']);
981 expect(root).toMatchRenderedOutput('Loading...');
982
@@ -984,7 +984,7 @@ describe('ReactSuspense', () => {
984 await waitForPaint(['Tab: 1']);
985 expect(root).toMatchRenderedOutput('Tab: 1 + sibling');
986
987 - await act(async () => setTab(2));
987 + await act(() => setTab(2));
988 assertLog(['Suspend! [Tab: 2]', ' + sibling', 'Loading...']);
989 expect(root).toMatchRenderedOutput('Loading...');
990
@@ -1018,11 +1018,11 @@ describe('ReactSuspense', () => {
1018 await waitForPaint(['A:0']);
1019 expect(root).toMatchRenderedOutput('A:0');
1020
1021 - await act(async () => setStep(1));
1021 + await act(() => setStep(1));
1022 assertLog(['Suspend! [A:1]', 'Loading...']);
1023 expect(root).toMatchRenderedOutput('Loading...');
1024
1025 - await act(async () => {
1025 + await act(() => {
1026 root.update(null);
1027 });
1028 });
@@ -1103,7 +1103,7 @@ describe('ReactSuspense', () => {
1103
1104 const root = ReactTestRenderer.create(null);
1105
1106 - await act(async () => {
1106 + await act(() => {
1107 root.update(<App name="world" />);
1108 });
1109 });
@@ -1139,7 +1139,7 @@ describe('ReactSuspense', () => {
1139 await waitForPaint(['default']);
1140 expect(root).toMatchRenderedOutput('default');
1141
1142 - await act(async () => setValue('new value'));
1142 + await act(() => setValue('new value'));
1143 assertLog(['Suspend! [new value]', 'Loading...']);
1144
1145 await resolveText('new value');
@@ -1183,7 +1183,7 @@ describe('ReactSuspense', () => {
1183 await waitForPaint(['default']);
1184 expect(root).toMatchRenderedOutput('default');
1185
1186 - await act(async () => setValue('new value'));
1186 + await act(() => setValue('new value'));
1187 assertLog(['Suspend! [new value]', 'Loading...']);
1188
1189 await resolveText('new value');
@@ -1226,7 +1226,7 @@ describe('ReactSuspense', () => {
1226 await waitForPaint(['default']);
1227 expect(root).toMatchRenderedOutput('default');
1228
1229 - await act(async () => setValue('new value'));
1229 + await act(() => setValue('new value'));
1230 assertLog(['Suspend! [new value]', 'Loading...']);
1231
1232 await resolveText('new value');
@@ -1265,7 +1265,7 @@ describe('ReactSuspense', () => {
1265 await waitForPaint(['default']);
1266 expect(root).toMatchRenderedOutput('default');
1267
1268 - await act(async () => setValue('new value'));
1268 + await act(() => setValue('new value'));
1269 assertLog(['Suspend! [new value]', 'Loading...']);
1270
1271 await resolveText('new value');
@@ -1316,11 +1316,11 @@ describe('ReactSuspense', () => {
1316 assertLog(['Received context value [default]', 'default']);
1317 expect(root).toMatchRenderedOutput('default');
1318
1319 - await act(async () => setValue('new value'));
1319 + await act(() => setValue('new value'));
1320 assertLog(['Received context value [new value]', 'Loading...']);
1321 expect(root).toMatchRenderedOutput('Loading...');
1322
1323 - await act(async () => setValue('default'));
1323 + await act(() => setValue('default'));
1324 assertLog(['Received context value [default]', 'default']);
1325 expect(root).toMatchRenderedOutput('default');
1326 });
packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js
+56 -56
@@ -255,7 +255,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
255 }
256
257 // Mount and suspend.
258 - await act(async () => {
258 + await act(() => {
259 ReactNoop.render(
260 <App>
261 <AsyncText text="Async" ms={1000} />
@@ -308,7 +308,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
308 </>,
309 );
310
311 - await act(async () => {
311 + await act(() => {
312 ReactNoop.render(null);
313 });
314 assertLog([
@@ -374,7 +374,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
374 }
375
376 // Mount and suspend.
377 - await act(async () => {
377 + await act(() => {
378 ReactNoop.renderLegacySyncRoot(
379 <App>
380 <AsyncText text="Async" ms={1000} />
@@ -427,7 +427,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
427 </>,
428 );
429
430 - await act(async () => {
430 + await act(() => {
431 ReactNoop.renderLegacySyncRoot(null);
432 });
433 assertLog([
@@ -475,7 +475,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
475 }
476
477 // Mount
478 - await act(async () => {
478 + await act(() => {
479 ReactNoop.renderLegacySyncRoot(<App />);
480 });
481 assertLog([
@@ -501,7 +501,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
501 );
502
503 // Schedule an update that causes React to suspend.
504 - await act(async () => {
504 + await act(() => {
505 ReactNoop.renderLegacySyncRoot(
506 <App>
507 <AsyncText text="Async" ms={1000} />
@@ -560,7 +560,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
560 </>,
561 );
562
563 - await act(async () => {
563 + await act(() => {
564 ReactNoop.renderLegacySyncRoot(null);
565 });
566 assertLog([
@@ -605,7 +605,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
605 );
606 }
607
608 - await act(async () => {
608 + await act(() => {
609 ReactNoop.render(<App />);
610 });
611 assertLog([
@@ -696,7 +696,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
696 </>,
697 );
698
699 - await act(async () => {
699 + await act(() => {
700 ReactNoop.render(null);
701 });
702 assertLog([
@@ -762,7 +762,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
762 }
763
764 // Mount
765 - await act(async () => {
765 + await act(() => {
766 ReactNoop.render(<App />);
767 });
768 assertLog([
@@ -849,7 +849,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
849 <span prop="Outside" />
850 </>,
851 );
852 - await act(async () => {
852 + await act(() => {
853 ReactNoop.render(null);
854 });
855 assertLog([
@@ -890,7 +890,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
890 }
891
892 // Mount
893 - await act(async () => {
893 + await act(() => {
894 ReactNoop.render(<App />);
895 });
896 assertLog([
@@ -973,7 +973,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
973 </>,
974 );
975
976 - await act(async () => {
976 + await act(() => {
977 ReactNoop.render(null);
978 });
979 assertLog([
@@ -1017,7 +1017,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1017 }
1018
1019 // Mount
1020 - await act(async () => {
1020 + await act(() => {
1021 ReactNoop.render(<App />);
1022 });
1023 assertLog([
@@ -1100,7 +1100,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1100 </>,
1101 );
1102
1103 - await act(async () => {
1103 + await act(() => {
1104 ReactNoop.render(null);
1105 });
1106 assertLog([
@@ -1131,7 +1131,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1131 }
1132
1133 // Mount
1134 - await act(async () => {
1134 + await act(() => {
1135 ReactNoop.render(<App />);
1136 });
1137 assertLog([
@@ -1150,7 +1150,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1150 );
1151
1152 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
1153 - await act(async () => {
1153 + await act(() => {
1154 ReactNoop.render(
1155 <App innerChildren={<AsyncText text="InnerAsync_1" ms={1000} />} />,
1156 );
@@ -1174,7 +1174,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1174
1175 // Suspend the outer Suspense subtree (outer effects and inner fallback effects should be destroyed)
1176 // (This check also ensures we don't destroy effects for mounted inner fallback.)
1177 - await act(async () => {
1177 + await act(() => {
1178 ReactNoop.render(
1179 <App
1180 outerChildren={<AsyncText text="OuterAsync_1" ms={1000} />}
@@ -1224,7 +1224,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1224 );
1225
1226 // Suspend the inner Suspense subtree (no effects should be destroyed)
1227 - await act(async () => {
1227 + await act(() => {
1228 ReactNoop.render(
1229 <App
1230 outerChildren={<AsyncText text="OuterAsync_1" ms={1000} />}
@@ -1299,7 +1299,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1299 );
1300
1301 // Suspend the outer Suspense subtree (all effects should be destroyed)
1302 - await act(async () => {
1302 + await act(() => {
1303 ReactNoop.render(
1304 <App
1305 outerChildren={<AsyncText text="OuterAsync_2" ms={1000} />}
@@ -1372,7 +1372,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1372 }
1373
1374 // Mount
1375 - await act(async () => {
1375 + await act(() => {
1376 ReactNoop.render(<App />);
1377 });
1378 assertLog([
@@ -1391,7 +1391,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1391 );
1392
1393 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
1394 - await act(async () => {
1394 + await act(() => {
1395 ReactNoop.render(
1396 <App innerChildren={<AsyncText text="InnerAsync_1" ms={1000} />} />,
1397 );
@@ -1415,7 +1415,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1415
1416 // Suspend the outer Suspense subtree (outer effects and inner fallback effects should be destroyed)
1417 // (This check also ensures we don't destroy effects for mounted inner fallback.)
1418 - await act(async () => {
1418 + await act(() => {
1419 ReactNoop.render(
1420 <App
1421 outerChildren={<AsyncText text="OuterAsync_1" ms={1000} />}
@@ -1498,7 +1498,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1498 }
1499
1500 // Mount
1501 - await act(async () => {
1501 + await act(() => {
1502 ReactNoop.render(<App />);
1503 });
1504 assertLog([
@@ -1650,7 +1650,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1650 }
1651
1652 // Mount
1653 - await act(async () => {
1653 + await act(() => {
1654 ReactNoop.render(<App />);
1655 });
1656 assertLog([
@@ -1669,7 +1669,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1669 );
1670
1671 // Suspend both the outer boundary and the fallback
1672 - await act(async () => {
1672 + await act(() => {
1673 ReactNoop.render(
1674 <App
1675 outerChildren={<AsyncText text="OutsideAsync" ms={1000} />}
@@ -1771,7 +1771,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1771 }
1772
1773 // Mount
1774 - await act(async () => {
1774 + await act(() => {
1775 ReactNoop.render(<App shouldSuspend={false} />);
1776 });
1777 assertLog([
@@ -1880,7 +1880,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1880 );
1881 }
1882
1883 - await act(async () => {
1883 + await act(() => {
1884 ReactNoop.render(
1885 <ErrorBoundary fallback={<Text text="Error" />}>
1886 <App />
@@ -1909,7 +1909,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
1909 );
1910
1911 // Schedule an update that causes React to suspend.
1912 - await act(async () => {
1912 + await act(() => {
1913 ReactNoop.render(
1914 <ErrorBoundary fallback={<Text text="Error" />}>
1915 <App>
@@ -2016,7 +2016,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2016 );
2017 }
2018
2019 - await act(async () => {
2019 + await act(() => {
2020 ReactNoop.render(
2021 <ErrorBoundary fallback={<Text text="Error" />}>
2022 <App />
@@ -2045,7 +2045,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2045 );
2046
2047 // Schedule an update that suspends and triggers our error code.
2048 - await act(async () => {
2048 + await act(() => {
2049 ReactNoop.render(
2050 <ErrorBoundary fallback={<Text text="Error" />}>
2051 <App>
@@ -2128,7 +2128,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2128 );
2129 }
2130
2131 - await act(async () => {
2131 + await act(() => {
2132 ReactNoop.render(
2133 <ErrorBoundary fallback={<Text text="Error" />}>
2134 <App />
@@ -2157,7 +2157,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2157 );
2158
2159 // Schedule an update that causes React to suspend.
2160 - await act(async () => {
2160 + await act(() => {
2161 ReactNoop.render(
2162 <ErrorBoundary fallback={<Text text="Error" />}>
2163 <App>
@@ -2265,7 +2265,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2265 );
2266 }
2267
2268 - await act(async () => {
2268 + await act(() => {
2269 ReactNoop.render(
2270 <ErrorBoundary fallback={<Text text="Error" />}>
2271 <App />
@@ -2294,7 +2294,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2294 );
2295
2296 // Schedule an update that suspends and triggers our error code.
2297 - await act(async () => {
2297 + await act(() => {
2298 ReactNoop.render(
2299 <ErrorBoundary fallback={<Text text="Error" />}>
2300 <App>
@@ -2371,7 +2371,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2371 );
2372 }
2373
2374 - await act(async () => {
2374 + await act(() => {
2375 ReactNoop.render(<App />);
2376 });
2377 assertLog([
@@ -2471,7 +2471,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2471 </>,
2472 );
2473
2474 - await act(async () => {
2474 + await act(() => {
2475 ReactNoop.render(null);
2476 });
2477 assertLog([
@@ -2527,7 +2527,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2527 );
2528 }
2529
2530 - await act(async () => {
2530 + await act(() => {
2531 ReactNoop.render(<App />);
2532 });
2533 assertLog([
@@ -2623,7 +2623,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2623 </>,
2624 );
2625
2626 - await act(async () => {
2626 + await act(() => {
2627 ReactNoop.render(null);
2628 });
2629 assertLog([
@@ -2711,7 +2711,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2711 );
2712 }
2713
2714 - await act(async () => {
2714 + await act(() => {
2715 ReactNoop.renderLegacySyncRoot(<App />);
2716 });
2717 assertLog([
@@ -2729,7 +2729,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2729 expect(ReactNoop).toMatchRenderedOutput(null);
2730
2731 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
2732 - await act(async () => {
2732 + await act(() => {
2733 ReactNoop.renderLegacySyncRoot(
2734 <App children={<AsyncText text="Async" ms={1000} />} />,
2735 );
@@ -2762,7 +2762,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2762 ]);
2763 expect(ReactNoop).toMatchRenderedOutput(<span prop="Async" />);
2764
2765 - await act(async () => {
2765 + await act(() => {
2766 ReactNoop.renderLegacySyncRoot(null);
2767 });
2768 assertLog([
@@ -2789,7 +2789,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2789 }
2790
2791 // Mount
2792 - await act(async () => {
2792 + await act(() => {
2793 ReactNoop.render(<App />);
2794 });
2795 assertLog([
@@ -2810,7 +2810,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2810 );
2811
2812 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
2813 - await act(async () => {
2813 + await act(() => {
2814 ReactNoop.render(
2815 <App children={<AsyncText text="Async" ms={1000} />} />,
2816 );
@@ -2864,7 +2864,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2864 </>,
2865 );
2866
2867 - await act(async () => {
2867 + await act(() => {
2868 ReactNoop.render(null);
2869 });
2870 assertLog([
@@ -2898,7 +2898,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2898 }
2899
2900 // Mount
2901 - await act(async () => {
2901 + await act(() => {
2902 ReactNoop.render(<App />);
2903 });
2904 assertLog([
@@ -2916,7 +2916,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2916 expect(ReactNoop).toMatchRenderedOutput(null);
2917
2918 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
2919 - await act(async () => {
2919 + await act(() => {
2920 ReactNoop.render(
2921 <App children={<AsyncText text="Async" ms={1000} />} />,
2922 );
@@ -2962,7 +2962,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
2962 ]);
2963 expect(ReactNoop).toMatchRenderedOutput(<span prop="Async" />);
2964
2965 - await act(async () => {
2965 + await act(() => {
2966 ReactNoop.render(null);
2967 });
2968 assertLog([
@@ -3002,7 +3002,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3002 }
3003
3004 // Mount
3005 - await act(async () => {
3005 + await act(() => {
3006 ReactNoop.render(<App />);
3007 });
3008 assertLog([
@@ -3020,7 +3020,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3020 expect(ReactNoop).toMatchRenderedOutput(null);
3021
3022 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
3023 - await act(async () => {
3023 + await act(() => {
3024 ReactNoop.render(
3025 <App children={<AsyncText text="Async" ms={1000} />} />,
3026 );
@@ -3066,7 +3066,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3066 ]);
3067 expect(ReactNoop).toMatchRenderedOutput(<span prop="Async" />);
3068
3069 - await act(async () => {
3069 + await act(() => {
3070 ReactNoop.render(null);
3071 });
3072 assertLog([
@@ -3117,7 +3117,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3117 }
3118
3119 // Mount
3120 - await act(async () => {
3120 + await act(() => {
3121 ReactNoop.render(<App />);
3122 });
3123 assertLog([
@@ -3129,7 +3129,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3129 expect(ReactNoop).toMatchRenderedOutput(null);
3130
3131 // Suspend the inner Suspense subtree (only inner effects should be destroyed)
3132 - await act(async () => {
3132 + await act(() => {
3133 ReactNoop.render(
3134 <App children={<AsyncText text="Async" ms={1000} />} />,
3135 );
@@ -3161,7 +3161,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3161 ]);
3162 expect(ReactNoop).toMatchRenderedOutput(<span prop="Async" />);
3163
3164 - await act(async () => {
3164 + await act(() => {
3165 ReactNoop.render(null);
3166 });
3167 assertLog([
@@ -3210,7 +3210,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3210 );
3211 }
3212
3213 - await act(async () => {
3213 + await act(() => {
3214 ReactNoop.render(
3215 <ErrorBoundary fallback={<Text text="Error" />}>
3216 <App />
@@ -3239,7 +3239,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
3239 );
3240
3241 // Schedule an update that causes React to suspend.
3242 - await act(async () => {
3242 + await act(() => {
3243 ReactNoop.render(
3244 <ErrorBoundary fallback={<Text text="Error" />}>
3245 <App>
packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemanticsDOM-test.js
+7 -7
@@ -129,12 +129,12 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
129 return null;
130 }
131
132 - await act(async () => {
132 + await act(() => {
133 const root = ReactDOMClient.createRoot(container);
134 root.render(<App />);
135 });
136
137 - await act(async () => {
137 + await act(() => {
138 scheduleSuspendingUpdate();
139 });
140 });
@@ -182,7 +182,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
182 }
183
184 const root = ReactDOMClient.createRoot(container);
185 - await act(async () => {
185 + await act(() => {
186 root.render(<Parent swap={false} />);
187 });
188 assertLog(['Loading...']);
@@ -242,7 +242,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
242 }
243
244 const root = ReactDOMClient.createRoot(container);
245 - await act(async () => {
245 + await act(() => {
246 root.render(<Parent swap={false} />);
247 });
248 assertLog(['Loading...']);
@@ -294,7 +294,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
294 }
295
296 const root = ReactDOMClient.createRoot(container);
297 - await act(async () => {
297 + await act(() => {
298 root.render(<Parent swap={false} />);
299 });
300 assertLog(['Loading...']);
@@ -361,7 +361,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
361 }
362
363 const root = ReactDOMClient.createRoot(container);
364 - await act(async () => {
364 + await act(() => {
365 root.render(<Parent swap={false} />);
366 });
367 assertLog(['Loading...']);
@@ -424,7 +424,7 @@ describe('ReactSuspenseEffectsSemanticsDOM', () => {
424 }
425
426 const root = ReactDOMClient.createRoot(container);
427 - await act(async () => {
427 + await act(() => {
428 root.render(<Parent swap={false} />);
429 });
430 assertLog(['Loading...']);
packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js
+1 -1
@@ -145,7 +145,7 @@ describe('ReactSuspenseFuzz', () => {
145 if ((elapsedTime += 1000) > 1000000) {
146 throw new Error('Something did not resolve properly.');
147 }
148 - await act(async () => {
148 + await act(() => {
149 ReactNoop.batchedUpdates(() => {
150 jest.advanceTimersByTime(1000);
151 });
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
+7 -7
@@ -298,7 +298,7 @@ describe('ReactSuspenseList', () => {
298 </>,
299 );
300
301 - await act(async () => {
301 + await act(() => {
302 C.resolve();
303 });
304
@@ -312,7 +312,7 @@ describe('ReactSuspenseList', () => {
312 </>,
313 );
314
315 - await act(async () => {
315 + await act(() => {
316 B.resolve();
317 });
318
@@ -2275,7 +2275,7 @@ describe('ReactSuspenseList', () => {
2275 );
2276
2277 // Update the row adjacent to the list
2278 - await act(async () => updateAdjacent('C'));
2278 + await act(() => updateAdjacent('C'));
2279
2280 assertLog(['C']);
2281
@@ -2332,7 +2332,7 @@ describe('ReactSuspenseList', () => {
2332 const previousInst = setAsyncB;
2333
2334 // During an update we suspend on B.
2335 - await act(async () => setAsyncB(true));
2335 + await act(() => setAsyncB(true));
2336
2337 assertLog([
2338 'Suspend! [B]',
@@ -2350,7 +2350,7 @@ describe('ReactSuspenseList', () => {
2350
2351 // Before we resolve we'll rerender the whole list.
2352 // This should leave the tree intact.
2353 - await act(async () => ReactNoop.render(<Foo updateList={true} />));
2353 + await act(() => ReactNoop.render(<Foo updateList={true} />));
2354
2355 assertLog(['A', 'Suspend! [B]', 'Loading B']);
2356
@@ -2421,7 +2421,7 @@ describe('ReactSuspenseList', () => {
2421 const previousInst = setAsyncB;
2422
2423 // During an update we suspend on B.
2424 - await act(async () => setAsyncB(true));
2424 + await act(() => setAsyncB(true));
2425
2426 assertLog([
2427 'Suspend! [B]',
@@ -2439,7 +2439,7 @@ describe('ReactSuspenseList', () => {
2439
2440 // Before we resolve we'll rerender the whole list.
2441 // This should leave the tree intact.
2442 - await act(async () => ReactNoop.render(<Foo updateList={true} />));
2442 + await act(() => ReactNoop.render(<Foo updateList={true} />));
2443
2444 assertLog(['A', 'Suspend! [B]', 'Loading B']);
2445
packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
+54 -54
@@ -665,7 +665,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
665
666 // Mount the Suspense boundary without suspending, so that the subsequent
667 // updates suspend with a delay.
668 - await act(async () => {
668 + await act(() => {
669 root.render(<App step={0} shouldSuspend={false} />);
670 });
671 await advanceTimers(1000);
@@ -1242,7 +1242,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1242 assertLog(['Suspend! [Result]', 'Loading...']);
1243 expect(ReactNoop).toMatchRenderedOutput(<span prop="Loading..." />);
1244
1245 - await act(async () => {
1245 + await act(() => {
1246 resolveText('Result');
1247 });
1248
@@ -1312,7 +1312,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1312 </>,
1313 );
1314
1315 - await act(async () => {
1315 + await act(() => {
1316 resolveText('Step: 2');
1317 });
1318 assertLog(['Step: 2']);
@@ -1385,7 +1385,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1385 </>,
1386 );
1387
1388 - await act(async () => {
1388 + await act(() => {
1389 resolveText('B');
1390 });
1391
@@ -1427,7 +1427,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1427 assertLog(['constructor', 'Suspend! [Hi]', 'Loading...']);
1428 expect(ReactNoop).toMatchRenderedOutput(<span prop="Loading..." />);
1429
1430 - await act(async () => {
1430 + await act(() => {
1431 resolveText('Hi');
1432 });
1433
@@ -1470,7 +1470,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1470 'Loading...',
1471 ]);
1472 expect(ReactNoop).toMatchRenderedOutput(<span prop="Loading..." />);
1473 - await act(async () => {
1473 + await act(() => {
1474 resolveText('Hi');
1475 });
1476 assertLog(['Hi']);
@@ -1516,7 +1516,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1516 </>,
1517 ]);
1518
1519 - await act(async () => {
1519 + await act(() => {
1520 resolveText('Hi');
1521 });
1522 assertLog(['Hi']);
@@ -1557,7 +1557,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1557 'Child is hidden: true',
1558 ]);
1559
1560 - await act(async () => {
1560 + await act(() => {
1561 resolveText('Hi');
1562 });
1563
@@ -1630,20 +1630,20 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1630 }
1631
1632 const root = ReactNoop.createLegacyRoot(null);
1633 - await act(async () => {
1633 + await act(() => {
1634 root.render(<App />);
1635 });
1636 assertLog(['Mount']);
1637 expect(root).toMatchRenderedOutput('Child');
1638
1639 // Suspend the child. This puts it into an inconsistent state.
1640 - await act(async () => {
1640 + await act(() => {
1641 setShouldSuspend(true);
1642 });
1643 expect(root).toMatchRenderedOutput('Loading...');
1644
1645 // Unmount everything
1646 - await act(async () => {
1646 + await act(() => {
1647 root.render(null);
1648 });
1649 assertLog(['Unmount']);
@@ -1799,7 +1799,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1799 </>,
1800 );
1801
1802 - await act(async () => {
1802 + await act(() => {
1803 resolveText('B');
1804 });
1805
@@ -1835,7 +1835,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1835 'Effect [Loading...]',
1836 ]);
1837
1838 - await act(async () => {
1838 + await act(() => {
1839 resolveText('B2');
1840 });
1841
@@ -2081,12 +2081,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2081 );
2082 }
2083
2084 - await act(async () => {
2084 + await act(() => {
2085 ReactNoop.render(<App />);
2086 });
2087
2088 // TODO: assert toErrorDev() when the warning is implemented again.
2089 - await act(async () => {
2089 + await act(() => {
2090 ReactNoop.flushSync(() => _setShow(true));
2091 });
2092 });
@@ -2108,12 +2108,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2108 }
2109 }
2110
2111 - await act(async () => {
2111 + await act(() => {
2112 ReactNoop.render(<App />);
2113 });
2114
2115 // TODO: assert toErrorDev() when the warning is implemented again.
2116 - await act(async () => {
2116 + await act(() => {
2117 ReactNoop.flushSync(() => show());
2118 });
2119 });
@@ -2135,14 +2135,14 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2135 }
2136 }
2137
2138 - await act(async () => {
2138 + await act(() => {
2139 ReactNoop.render(<App />);
2140 });
2141
2142 assertLog(['Suspend! [A]']);
2143 expect(ReactNoop).toMatchRenderedOutput('Loading...');
2144
2145 - await act(async () => {
2145 + await act(() => {
2146 ReactNoop.flushSync(() => showB());
2147 });
2148
@@ -2168,12 +2168,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2168 </Suspense>
2169 );
2170 }
2171 - await act(async () => {
2171 + await act(() => {
2172 ReactNoop.render(<App />);
2173 });
2174
2175 // TODO: assert toErrorDev() when the warning is implemented again.
2176 - await act(async () => {
2176 + await act(() => {
2177 ReactNoop.flushSync(() => _setShow(true));
2178 });
2179 },
@@ -2195,12 +2195,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2195 }
2196 }
2197
2198 - await act(async () => {
2198 + await act(() => {
2199 ReactNoop.render(<App />);
2200 });
2201
2202 // also make sure lowpriority is okay
2203 - await act(async () => show(true));
2203 + await act(() => show(true));
2204
2205 assertLog(['Suspend! [A]']);
2206 await resolveText('A');
@@ -2221,12 +2221,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2221 );
2222 }
2223
2224 - await act(async () => {
2224 + await act(() => {
2225 ReactNoop.render(<App />);
2226 });
2227
2228 // also make sure lowpriority is okay
2229 - await act(async () => _setShow(true));
2229 + await act(() => _setShow(true));
2230
2231 assertLog(['Suspend! [A]']);
2232 await resolveText('A');
@@ -2993,7 +2993,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2993 }
2994
2995 const root = ReactNoop.createRoot();
2996 - await act(async () => {
2996 + await act(() => {
2997 root.render(<App text="Initial" />);
2998 });
2999 assertLog(['Suspend! [Initial]']);
@@ -3054,7 +3054,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3054 }
3055
3056 const root = ReactNoop.createRoot();
3057 - await act(async () => {
3057 + await act(() => {
3058 root.render(<App />);
3059 });
3060
@@ -3211,7 +3211,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3211 }
3212
3213 await seedNextTextCache('A');
3214 - await act(async () => {
3214 + await act(() => {
3215 root.render(<Parent />);
3216 });
3217 assertLog(['A']);
@@ -3265,7 +3265,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3265 }
3266
3267 await seedNextTextCache('A');
3268 - await act(async () => {
3268 + await act(() => {
3269 root.render(<Parent />);
3270 });
3271 assertLog(['A']);
@@ -3334,7 +3334,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3334
3335 // Resolve the initial tree
3336 await seedNextTextCache('A');
3337 - await act(async () => {
3337 + await act(() => {
3338 root.render(<App />);
3339 });
3340 assertLog(['A']);
@@ -3356,7 +3356,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3356 // Schedule a default pri update on the boundary, and a lower pri update
3357 // on the fallback. We're testing to make sure the fallback can still
3358 // update even though the primary tree is suspended.
3359 - await act(async () => {
3359 + await act(() => {
3360 setAppText('C');
3361 React.startTransition(() => {
3362 setFallbackText('Still loading...');
@@ -3419,7 +3419,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3419
3420 // Mount an initial tree. Resolve A so that it doesn't suspend.
3421 await seedNextTextCache('A');
3422 - await act(async () => {
3422 + await act(() => {
3423 root.render(<Parent />);
3424 });
3425 assertLog(['A']);
@@ -3428,7 +3428,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3428
3429 // Schedule another update. This will "flip" the alternate pairs.
3430 await resolveText('B');
3431 - await act(async () => {
3431 + await act(() => {
3432 setText('B');
3433 });
3434 assertLog(['B']);
@@ -3436,7 +3436,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3436 expect(root).toMatchRenderedOutput(<span prop="B" />);
3437
3438 // Schedule another update. This time, we'll suspend.
3439 - await act(async () => {
3439 + await act(() => {
3440 setText('C');
3441 });
3442 assertLog(['Suspend! [C]', 'Loading...']);
@@ -3458,7 +3458,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3458
3459 // Update again. This should unsuspend the tree.
3460 await resolveText('D');
3461 - await act(async () => {
3461 + await act(() => {
3462 setText('D');
3463 });
3464 // Even though the fragment fiber is not part of the return path, we should
@@ -3496,7 +3496,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3496
3497 // Mount an initial tree. Resolve A so that it doesn't suspend.
3498 await seedNextTextCache('A');
3499 - await act(async () => {
3499 + await act(() => {
3500 root.render(<Parent />);
3501 });
3502 assertLog(['A']);
@@ -3505,7 +3505,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3505
3506 // Schedule another update. This will "flip" the alternate pairs.
3507 await resolveText('B');
3508 - await act(async () => {
3508 + await act(() => {
3509 setText('B');
3510 });
3511 assertLog(['B']);
@@ -3513,7 +3513,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3513 expect(root).toMatchRenderedOutput(<span prop="B" />);
3514
3515 // Schedule another update. This time, we'll suspend.
3516 - await act(async () => {
3516 + await act(() => {
3517 setText('C');
3518 });
3519 assertLog(['Suspend! [C]', 'Loading...']);
@@ -3603,7 +3603,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3603
3604 // Mount an initial tree. Resolve A so that it doesn't suspend.
3605 await seedNextTextCache('Inner text: A');
3606 - await act(async () => {
3606 + await act(() => {
3607 root.render(<Parent step={0} />);
3608 });
3609 assertLog([
@@ -3623,7 +3623,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3623 );
3624
3625 // Update. This causes the inner component to suspend.
3626 - await act(async () => {
3626 + await act(() => {
3627 setText('B');
3628 });
3629 assertLog([
@@ -3646,7 +3646,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3646 );
3647
3648 // Schedule a high pri update on the parent.
3649 - await act(async () => {
3649 + await act(() => {
3650 ReactNoop.discreteUpdates(() => {
3651 root.render(<Parent step={1} />);
3652 });
@@ -3736,7 +3736,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3736
3737 // Mount an initial tree. Resolve A so that it doesn't suspend.
3738 await seedNextTextCache('Inner: A0');
3739 - await act(async () => {
3739 + await act(() => {
3740 root.render(<Parent step={0} />);
3741 });
3742 assertLog(['Outer: A0', 'Inner: A0', 'Commit Child']);
@@ -3748,7 +3748,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3748 );
3749
3750 // Update. This causes the inner component to suspend.
3751 - await act(async () => {
3751 + await act(() => {
3752 setText('B');
3753 });
3754 assertLog(['Outer: B0', 'Suspend! [Inner: B0]', 'Loading...']);
@@ -3764,7 +3764,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3764
3765 // Schedule a high pri update on the parent. This will unblock the content.
3766 await resolveText('Inner: B1');
3767 - await act(async () => {
3767 + await act(() => {
3768 ReactNoop.discreteUpdates(() => {
3769 root.render(<Parent step={1} />);
3770 });
@@ -3825,7 +3825,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3825 }
3826
3827 const root = ReactNoop.createRoot();
3828 - await act(async () => {
3828 + await act(() => {
3829 root.render(<Root />);
3830 });
3831 assertLog(['']);
@@ -3944,7 +3944,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3944 }
3945
3946 const root = ReactNoop.createRoot();
3947 - await act(async () => {
3947 + await act(() => {
3948 root.render(
3949 <>
3950 <UpdatingText />
@@ -4012,13 +4012,13 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4012
4013 const root = ReactNoop.createRoot();
4014
4015 - await act(async () => {
4015 + await act(() => {
4016 root.render(<App show={false} />);
4017 });
4018 assertLog(['Mount Child']);
4019 expect(root).toMatchRenderedOutput(<span prop="Child" />);
4020
4021 - await act(async () => {
4021 + await act(() => {
4022 root.render(<App show={true} />);
4023 });
4024 assertLog(['Suspend! [Async]', 'Loading...']);
@@ -4029,7 +4029,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4029 </>,
4030 );
4031
4032 - await act(async () => {
4032 + await act(() => {
4033 root.render(null);
4034 });
4035 assertLog(['Unmount Child']);
@@ -4060,13 +4060,13 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4060
4061 const root = ReactNoop.createLegacyRoot();
4062
4063 - await act(async () => {
4063 + await act(() => {
4064 root.render(<App show={false} />);
4065 });
4066 assertLog(['Mount Child']);
4067 expect(root).toMatchRenderedOutput(<span prop="Child" />);
4068
4069 - await act(async () => {
4069 + await act(() => {
4070 root.render(<App show={true} />);
4071 });
4072 assertLog(['Suspend! [Async]', 'Loading...']);
@@ -4077,7 +4077,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4077 </>,
4078 );
4079
4080 - await act(async () => {
4080 + await act(() => {
4081 root.render(null);
4082 });
4083 assertLog(['Unmount Child']);
@@ -4127,7 +4127,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4127 // Initial render. This mounts a Suspense boundary, so that in the next
4128 // update we can trigger a "suspend with delay" scenario.
4129 const root = ReactNoop.createRoot();
4130 - await act(async () => {
4130 + await act(() => {
4131 root.render(<App showMore={false} />);
4132 });
4133 assertLog([]);
@@ -4146,7 +4146,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
4146 //
4147 // The fix was to check if we're in the render phase before calling
4148 // `prepareFreshStack`.
4149 - await act(async () => {
4149 + await act(() => {
4150 root.render(<App showMore={true} />);
4151 });
4152 assertLog(['Suspend! [Async]', 'Loading...', 'Hi']);
packages/react-reconciler/src/__tests__/ReactThenable-test.js
+51 -51
@@ -98,7 +98,7 @@ describe('ReactThenable', () => {
98 }
99
100 const root = ReactNoop.createRoot();
101 - await act(async () => {
101 + await act(() => {
102 startTransition(() => {
103 root.render(<App />);
104 });
@@ -133,7 +133,7 @@ describe('ReactThenable', () => {
133 }
134
135 const root = ReactNoop.createRoot();
136 - await act(async () => {
136 + await act(() => {
137 startTransition(() => {
138 root.render(<App />);
139 });
@@ -175,7 +175,7 @@ describe('ReactThenable', () => {
175 }
176
177 const root = ReactNoop.createRoot();
178 - await act(async () => {
178 + await act(() => {
179 root.render(<App />);
180 });
181 assertLog(['Suspend!', 'Loading...']);
@@ -202,7 +202,7 @@ describe('ReactThenable', () => {
202 }
203
204 const root = ReactNoop.createRoot();
205 - await act(async () => {
205 + await act(() => {
206 startTransition(() => {
207 root.render(<App />);
208 });
@@ -230,7 +230,7 @@ describe('ReactThenable', () => {
230 }
231
232 const root = ReactNoop.createRoot();
233 - await act(async () => {
233 + await act(() => {
234 startTransition(() => {
235 root.render(<App />);
236 });
@@ -276,7 +276,7 @@ describe('ReactThenable', () => {
276 }
277
278 const root = ReactNoop.createRoot();
279 - await act(async () => {
279 + await act(() => {
280 startTransition(() => {
281 root.render(<App />);
282 });
@@ -309,7 +309,7 @@ describe('ReactThenable', () => {
309 }
310
311 const root = ReactNoop.createRoot();
312 - await act(async () => {
312 + await act(() => {
313 startTransition(() => {
314 root.render(<App />);
315 });
@@ -345,7 +345,7 @@ describe('ReactThenable', () => {
345 }
346
347 const root = ReactNoop.createRoot();
348 - await act(async () => {
348 + await act(() => {
349 startTransition(() => {
350 root.render(<App />);
351 });
@@ -398,7 +398,7 @@ describe('ReactThenable', () => {
398 }
399
400 const root = ReactNoop.createRoot();
401 - await act(async () => {
401 + await act(() => {
402 startTransition(() => {
403 root.render(<App />);
404 });
@@ -523,7 +523,7 @@ describe('ReactThenable', () => {
523 }
524
525 const root = ReactNoop.createRoot();
526 - await act(async () => {
526 + await act(() => {
527 startTransition(() => {
528 root.render(<App />);
529 });
@@ -546,7 +546,7 @@ describe('ReactThenable', () => {
546 }
547
548 const root = ReactNoop.createRoot();
549 - await act(async () => {
549 + await act(() => {
550 root.render(
551 <Suspense fallback={<Text text="Loading..." />}>
552 <Text text="(empty)" />
@@ -556,7 +556,7 @@ describe('ReactThenable', () => {
556 assertLog(['(empty)']);
557 expect(root).toMatchRenderedOutput('(empty)');
558
559 - await act(async () => {
559 + await act(() => {
560 startTransition(() => {
561 root.render(
562 <Suspense fallback={<Text text="Loading..." />}>
@@ -568,7 +568,7 @@ describe('ReactThenable', () => {
568 assertLog(['Async text requested [Async]']);
569 expect(root).toMatchRenderedOutput('(empty)');
570
571 - await act(async () => {
571 + await act(() => {
572 resolveTextRequests('Async');
573 });
574 assertLog(['Async text requested [Async]', 'Async']);
@@ -582,7 +582,7 @@ describe('ReactThenable', () => {
582 }
583
584 const root = ReactNoop.createRoot();
585 - await act(async () => {
585 + await act(() => {
586 startTransition(() => {
587 root.render(
588 <Suspense fallback={<Text text="Loading..." />}>
@@ -596,7 +596,7 @@ describe('ReactThenable', () => {
596 expect(root).toMatchRenderedOutput('Loading...');
597
598 // Resolve the original data
599 - await act(async () => {
599 + await act(() => {
600 resolveTextRequests('Async');
601 });
602 // During the retry, a fresh request is initiated. Now we must wait for this
@@ -610,7 +610,7 @@ describe('ReactThenable', () => {
610 expect(root).toMatchRenderedOutput('Loading...');
611
612 // Flush the second request.
613 - await act(async () => {
613 + await act(() => {
614 resolveTextRequests('Async');
615 });
616 // This time it finishes because it was during a retry.
@@ -625,11 +625,11 @@ describe('ReactThenable', () => {
625 }
626
627 const root = ReactNoop.createRoot();
628 - await act(async () => {
628 + await act(() => {
629 root.render(<Suspense fallback={<Text text="Loading..." />} />);
630 });
631
632 - await act(async () => {
632 + await act(() => {
633 startTransition(() => {
634 root.render(
635 <Suspense fallback={<Text text="Loading..." />}>
@@ -640,7 +640,7 @@ describe('ReactThenable', () => {
640 });
641 assertLog(['Async text requested [Will never resolve]']);
642
643 - await act(async () => {
643 + await act(() => {
644 root.render(
645 <Suspense fallback={<Text text="Loading..." />}>
646 <Text text="Something different" />
@@ -659,12 +659,12 @@ describe('ReactThenable', () => {
659 }
660
661 const root1 = ReactNoop.createRoot();
662 - await act(async () => {
662 + await act(() => {
663 root1.render(<Suspense fallback={<Text text="Loading..." />} />);
664 });
665
666 // Start a transition on one root. It will suspend.
667 - await act(async () => {
667 + await act(() => {
668 startTransition(() => {
669 root1.render(
670 <Suspense fallback={<Text text="Loading..." />}>
@@ -678,7 +678,7 @@ describe('ReactThenable', () => {
678 // While we're waiting for the first root's data to resolve, a second
679 // root renders.
680 const root2 = ReactNoop.createRoot();
681 - await act(async () => {
681 + await act(() => {
682 root2.render('Do re mi');
683 });
684 expect(root2).toMatchRenderedOutput('Do re mi');
@@ -698,11 +698,11 @@ describe('ReactThenable', () => {
698 }
699
700 const root = ReactNoop.createRoot();
701 - await act(async () => {
701 + await act(() => {
702 root.render(<Suspense fallback={<Text text="Loading..." />} />);
703 });
704
705 - await act(async () => {
705 + await act(() => {
706 startTransition(() => {
707 root.render(
708 <Suspense fallback={<Text text="Loading..." />}>
@@ -782,7 +782,7 @@ describe('ReactThenable', () => {
782 }
783
784 const root = ReactNoop.createRoot();
785 - await act(async () => {
785 + await act(() => {
786 root.render(<Parent />);
787 });
788 assertLog(['childShouldSuspend: false, showChild: true', 'Child']);
@@ -856,7 +856,7 @@ describe('ReactThenable', () => {
856 }
857
858 const root = ReactNoop.createRoot();
859 - await act(async () => {
859 + await act(() => {
860 startTransition(() => {
861 root.render(<ExcitingText text="Hello" />);
862 });
@@ -866,7 +866,7 @@ describe('ReactThenable', () => {
866 expect(root).toMatchRenderedOutput(null);
867
868 // The data is received.
869 - await act(async () => {
869 + await act(() => {
870 resolveTextRequests('HELLO!');
871 });
872 assertLog([
@@ -894,42 +894,42 @@ describe('ReactThenable', () => {
894
895 // Initial render.
896 const root = ReactNoop.createRoot();
897 - await act(async () => {
897 + await act(() => {
898 startTransition(() => {
899 root.render(<Kitchen />);
900 });
901 });
902 assertLog(['Async text requested [apple]']);
903 expect(root).toMatchRenderedOutput(null);
904 - await act(async () => {
904 + await act(() => {
905 resolveTextRequests('apple');
906 });
907 assertLog(['Async text requested [apple]', 'apple carrot']);
908 expect(root).toMatchRenderedOutput('apple carrot');
909
910 // Update the state variable after the use().
911 - await act(async () => {
911 + await act(() => {
912 startTransition(() => {
913 _setVegetable('dill');
914 });
915 });
916 assertLog(['Async text requested [apple]']);
917 expect(root).toMatchRenderedOutput('apple carrot');
918 - await act(async () => {
918 + await act(() => {
919 resolveTextRequests('apple');
920 });
921 assertLog(['Async text requested [apple]', 'apple dill']);
922 expect(root).toMatchRenderedOutput('apple dill');
923
924 // Update the state variable before the use(). The second state is maintained.
925 - await act(async () => {
925 + await act(() => {
926 startTransition(() => {
927 _setFruit('banana');
928 });
929 });
930 assertLog(['Async text requested [banana]']);
931 expect(root).toMatchRenderedOutput('apple dill');
932 - await act(async () => {
932 + await act(() => {
933 resolveTextRequests('banana');
934 });
935 assertLog(['Async text requested [banana]', 'banana dill']);
@@ -949,28 +949,28 @@ describe('ReactThenable', () => {
949
950 // Initial render.
951 const root = ReactNoop.createRoot();
952 - await act(async () => {
952 + await act(() => {
953 startTransition(() => {
954 root.render(<Lexicon />);
955 });
956 });
957 assertLog(['Async text requested [aguacate]']);
958 expect(root).toMatchRenderedOutput(null);
959 - await act(async () => {
959 + await act(() => {
960 resolveTextRequests('aguacate');
961 });
962 assertLog(['Async text requested [aguacate]', 'aguacate abogado']);
963 expect(root).toMatchRenderedOutput('aguacate abogado');
964
965 // Now update the state.
966 - await act(async () => {
966 + await act(() => {
967 startTransition(() => {
968 _setLawyer('avocat');
969 });
970 });
971 assertLog(['Async text requested [aguacate]']);
972 expect(root).toMatchRenderedOutput('aguacate abogado');
973 - await act(async () => {
973 + await act(() => {
974 resolveTextRequests('aguacate');
975 });
976 assertLog(['Async text requested [aguacate]', 'aguacate avocat']);
@@ -989,7 +989,7 @@ describe('ReactThenable', () => {
989 }
990
991 const root = ReactNoop.createRoot();
992 - await act(async () => {
992 + await act(() => {
993 startTransition(() => {
994 root.render(<App text="Hello" />);
995 });
@@ -997,7 +997,7 @@ describe('ReactThenable', () => {
997 assertLog(['Async text requested [Hello]']);
998 expect(root).toMatchRenderedOutput(null);
999
1000 - await act(async () => {
1000 + await act(() => {
1001 resolveTextRequests('Hello');
1002 });
1003 assertLog([
@@ -1019,7 +1019,7 @@ describe('ReactThenable', () => {
1019 }
1020
1021 const root = ReactNoop.createRoot();
1022 - await act(async () => {
1022 + await act(() => {
1023 root.render(
1024 <Suspense fallback={<Text text="(Loading A...)" />}>
1025 <AsyncText text="A" />
@@ -1042,19 +1042,19 @@ describe('ReactThenable', () => {
1042 ]);
1043 expect(root).toMatchRenderedOutput('(Loading A...)');
1044
1045 - await act(async () => {
1045 + await act(() => {
1046 resolveTextRequests('A');
1047 });
1048 assertLog(['A', '(Loading C...)', '(Loading B...)']);
1049 expect(root).toMatchRenderedOutput('A(Loading B...)');
1050
1051 - await act(async () => {
1051 + await act(() => {
1052 resolveTextRequests('B');
1053 });
1054 assertLog(['B', '(Loading C...)']);
1055 expect(root).toMatchRenderedOutput('AB(Loading C...)');
1056
1057 - await act(async () => {
1057 + await act(() => {
1058 resolveTextRequests('C');
1059 });
1060 assertLog(['C']);
@@ -1072,7 +1072,7 @@ describe('ReactThenable', () => {
1072 }
1073
1074 const root = ReactNoop.createRoot();
1075 - await act(async () => {
1075 + await act(() => {
1076 root.render(
1077 <Suspense fallback={<Text text="(Loading A...)" />}>
1078 <AsyncText text="A" />
@@ -1095,13 +1095,13 @@ describe('ReactThenable', () => {
1095 ]);
1096 expect(root).toMatchRenderedOutput('(Loading A...)');
1097
1098 - await act(async () => {
1098 + await act(() => {
1099 resolveTextRequests('A');
1100 });
1101 assertLog(['Async text requested [A]']);
1102 expect(root).toMatchRenderedOutput('(Loading A...)');
1103
1104 - await act(async () => {
1104 + await act(() => {
1105 resolveTextRequests('A');
1106 });
1107 assertLog([
@@ -1120,13 +1120,13 @@ describe('ReactThenable', () => {
1120 ]);
1121 expect(root).toMatchRenderedOutput('A(Loading B...)');
1122
1123 - await act(async () => {
1123 + await act(() => {
1124 resolveTextRequests('B');
1125 });
1126 assertLog(['Async text requested [B]']);
1127 expect(root).toMatchRenderedOutput('A(Loading B...)');
1128
1129 - await act(async () => {
1129 + await act(() => {
1130 resolveTextRequests('B');
1131 });
1132 assertLog([
@@ -1140,13 +1140,13 @@ describe('ReactThenable', () => {
1140 ]);
1141 expect(root).toMatchRenderedOutput('AB(Loading C...)');
1142
1143 - await act(async () => {
1143 + await act(() => {
1144 resolveTextRequests('C');
1145 });
1146 assertLog(['Async text requested [C]']);
1147 expect(root).toMatchRenderedOutput('AB(Loading C...)');
1148
1149 - await act(async () => {
1149 + await act(() => {
1150 resolveTextRequests('C');
1151 });
1152 assertLog(['Async text requested [C]', 'C']);
@@ -1174,7 +1174,7 @@ describe('ReactThenable', () => {
1174 }
1175
1176 const root = ReactNoop.createRoot();
1177 - await act(async () => {
1177 + await act(() => {
1178 startTransition(() => {
1179 root.render(<App />);
1180 });
packages/react-reconciler/src/__tests__/ReactTransition-test.js
+25 -25
@@ -185,7 +185,7 @@ describe('ReactTransition', () => {
185
186 const root = ReactNoop.createRoot();
187
188 - await act(async () => {
188 + await act(() => {
189 root.render(<App />);
190 });
191 assertLog(['(empty)']);
@@ -245,7 +245,7 @@ describe('ReactTransition', () => {
245
246 // Initial render
247 const root = ReactNoop.createRoot();
248 - await act(async () => {
248 + await act(() => {
249 seedNextTextCache('A content');
250 root.render(<App />);
251 });
@@ -257,7 +257,7 @@ describe('ReactTransition', () => {
257 );
258
259 // Switch to B
260 - await act(async () => {
260 + await act(() => {
261 update('B');
262 });
263 assertLog([
@@ -278,7 +278,7 @@ describe('ReactTransition', () => {
278 );
279
280 // Before B finishes loading, switch to C
281 - await act(async () => {
281 + await act(() => {
282 update('C');
283 });
284 assertLog([
@@ -299,7 +299,7 @@ describe('ReactTransition', () => {
299
300 // Finish loading B. But we're not allowed to render B because it's
301 // entangled with C. So we're still pending.
302 - await act(async () => {
302 + await act(() => {
303 resolveText('B content');
304 });
305 assertLog([
@@ -315,7 +315,7 @@ describe('ReactTransition', () => {
315 );
316
317 // Now finish loading C. This is the terminal update, so it can finish.
318 - await act(async () => {
318 + await act(() => {
319 resolveText('C content');
320 });
321 assertLog(['C label', 'C content']);
@@ -370,7 +370,7 @@ describe('ReactTransition', () => {
370
371 // Initial render
372 const root = ReactNoop.createRoot();
373 - await act(async () => {
373 + await act(() => {
374 seedNextTextCache('A content');
375 root.render(<App />);
376 });
@@ -382,7 +382,7 @@ describe('ReactTransition', () => {
382 );
383
384 // Switch to B
385 - await act(async () => {
385 + await act(() => {
386 update('B');
387 });
388 assertLog([
@@ -403,7 +403,7 @@ describe('ReactTransition', () => {
403 );
404
405 // Before B finishes loading, switch to C
406 - await act(async () => {
406 + await act(() => {
407 update('C');
408 });
409 assertLog([
@@ -424,7 +424,7 @@ describe('ReactTransition', () => {
424
425 // Finish loading B. But we're not allowed to render B because it's
426 // entangled with C. So we're still pending.
427 - await act(async () => {
427 + await act(() => {
428 resolveText('B content');
429 });
430 assertLog([
@@ -440,7 +440,7 @@ describe('ReactTransition', () => {
440 );
441
442 // Now finish loading C. This is the terminal update, so it can finish.
443 - await act(async () => {
443 + await act(() => {
444 resolveText('C content');
445 });
446 assertLog(['C label', 'C content']);
@@ -488,14 +488,14 @@ describe('ReactTransition', () => {
488
489 // Initial render. Start with all children hidden.
490 const root = ReactNoop.createRoot();
491 - await act(async () => {
491 + await act(() => {
492 root.render(<App />);
493 });
494 assertLog([]);
495 expect(root).toMatchRenderedOutput(null);
496
497 // Switch to A.
498 - await act(async () => {
498 + await act(() => {
499 startTransition(() => {
500 setShowA(true);
501 });
@@ -504,7 +504,7 @@ describe('ReactTransition', () => {
504 expect(root).toMatchRenderedOutput(null);
505
506 // Before A loads, switch to B. This should entangle A with B.
507 - await act(async () => {
507 + await act(() => {
508 startTransition(() => {
509 setShowA(false);
510 setShowB(true);
@@ -515,7 +515,7 @@ describe('ReactTransition', () => {
515
516 // Before A or B loads, switch to C. This should entangle C with B, and
517 // transitively entangle C with A.
518 - await act(async () => {
518 + await act(() => {
519 startTransition(() => {
520 setShowB(false);
521 setShowC(true);
@@ -528,7 +528,7 @@ describe('ReactTransition', () => {
528
529 // First resolve B. This will attempt to render C, since everything is
530 // entangled.
531 - await act(async () => {
531 + await act(() => {
532 startTransition(() => {
533 resolveText('B');
534 });
@@ -538,7 +538,7 @@ describe('ReactTransition', () => {
538
539 // Now resolve A. Again, this will attempt to render C, since everything
540 // is entangled.
541 - await act(async () => {
541 + await act(() => {
542 startTransition(() => {
543 resolveText('A');
544 });
@@ -547,7 +547,7 @@ describe('ReactTransition', () => {
547 expect(root).toMatchRenderedOutput(null);
548
549 // Finally, resolve C. This time we can finish.
550 - await act(async () => {
550 + await act(() => {
551 startTransition(() => {
552 resolveText('C');
553 });
@@ -561,7 +561,7 @@ describe('ReactTransition', () => {
561 test('interrupt a refresh transition if a new transition is scheduled', async () => {
562 const root = ReactNoop.createRoot();
563
564 - await act(async () => {
564 + await act(() => {
565 root.render(
566 <>
567 <Suspense fallback={<Text text="Loading..." />} />
@@ -729,7 +729,7 @@ describe('ReactTransition', () => {
729
730 const root = ReactNoop.createRoot();
731
732 - await act(async () => {
732 + await act(() => {
733 root.render(<App shouldSuspend={false} step={0} />);
734 });
735 assertLog(['A0', 'B0', 'C0']);
@@ -793,7 +793,7 @@ describe('ReactTransition', () => {
793 }
794
795 const root = ReactNoop.createRoot();
796 - await act(async () => {
796 + await act(() => {
797 root.render(<App />);
798 });
799
@@ -801,7 +801,7 @@ describe('ReactTransition', () => {
801 assertLog(['Transition pri: 0', 'Normal pri: 0', 'Commit']);
802 expect(root).toMatchRenderedOutput('Transition pri: 0, Normal pri: 0');
803
804 - await act(async () => {
804 + await act(() => {
805 updateTransitionPri();
806 updateNormalPri();
807 });
@@ -845,7 +845,7 @@ describe('ReactTransition', () => {
845 }
846
847 const root = ReactNoop.createRoot();
848 - await act(async () => {
848 + await act(() => {
849 root.render(<App />);
850 });
851
@@ -853,7 +853,7 @@ describe('ReactTransition', () => {
853 assertLog(['(empty)', 'Normal pri: 0', 'Commit']);
854 expect(root).toMatchRenderedOutput('(empty), Normal pri: 0');
855
856 - await act(async () => {
856 + await act(() => {
857 updateTransitionPri();
858 });
859
@@ -907,7 +907,7 @@ describe('ReactTransition', () => {
907 }
908
909 const root = ReactNoop.createRoot();
910 - await act(async () => {
910 + await act(() => {
911 root.render(<App />);
912 });
913 assertLog(['Transition pri: 0', 'Normal pri: 0', 'Commit']);
packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js
+8 -8
@@ -2208,7 +2208,7 @@ describe('ReactInteractionTracing', () => {
2208 const root = ReactNoop.createRoot({
2209 unstable_transitionCallbacks: transitionCallbacks,
2210 });
2211 - await act(async () => {
2211 + await act(() => {
2212 startTransition(() => root.render(<App />), {name: 'transition'});
2213 ReactNoop.expire(1000);
2214 advanceTimers(1000);
@@ -2221,7 +2221,7 @@ describe('ReactInteractionTracing', () => {
2221 'onTransitionStart(transition, 0)',
2222 ]);
2223
2224 - await act(async () => {
2224 + await act(() => {
2225 resolveText('Text');
2226 ReactNoop.expire(1000);
2227 advanceTimers(1000);
@@ -2232,7 +2232,7 @@ describe('ReactInteractionTracing', () => {
2232 'onTransitionComplete(transition, 0, 2000)',
2233 ]);
2234
2235 - await act(async () => {
2235 + await act(() => {
2236 resolveText('Hidden Text');
2237 ReactNoop.expire(1000);
2238 advanceTimers(1000);
@@ -2343,7 +2343,7 @@ describe('ReactInteractionTracing', () => {
2343 unstable_transitionCallbacks: transitionCallbacks,
2344 });
2345
2346 - await act(async () => {
2346 + await act(() => {
2347 startTransition(() => root.render(<App />), {name: 'transition'});
2348 ReactNoop.expire(1000);
2349 advanceTimers(1000);
@@ -2361,7 +2361,7 @@ describe('ReactInteractionTracing', () => {
2361 'onTransitionProgress(transition, 0, 1000, [two])',
2362 ]);
2363
2364 - await act(async () => {
2364 + await act(() => {
2365 resolveText('Text Two');
2366 ReactNoop.expire(1000);
2367 advanceTimers(1000);
@@ -2416,7 +2416,7 @@ describe('ReactInteractionTracing', () => {
2416 unstable_transitionCallbacks: getTransitionCallbacks('root two'),
2417 });
2418
2419 - await act(async () => {
2419 + await act(() => {
2420 startTransition(() => rootOne.render(<App name="one" />), {
2421 name: 'transition one',
2422 });
@@ -2438,7 +2438,7 @@ describe('ReactInteractionTracing', () => {
2438 'onTransitionProgress(transition two, 0, 1000, [two]) /root two/',
2439 ]);
2440
2441 - await act(async () => {
2441 + await act(() => {
2442 caches[0].resolve('Text one');
2443 ReactNoop.expire(1000);
2444 advanceTimers(1000);
@@ -2450,7 +2450,7 @@ describe('ReactInteractionTracing', () => {
2450 'onTransitionComplete(transition one, 0, 2000) /root one/',
2451 ]);
2452
2453 - await act(async () => {
2453 + await act(() => {
2454 resolveText('Text two');
2455 ReactNoop.expire(1000);
2456 advanceTimers(1000);
packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js
+2 -2
@@ -46,7 +46,7 @@ describe('ReactUpdatePriority', () => {
46 return <Text text={state} />;
47 }
48
49 - await act(async () => {
49 + await act(() => {
50 ReactNoop.flushSync(() => {
51 root.render(<App />);
52 });
@@ -116,7 +116,7 @@ describe('ReactUpdatePriority', () => {
116 );
117 }
118
119 - await act(async () => {
119 + await act(() => {
120 root.render(<App />);
121 });
122 assertLog(['A1', 'B1', 'C1']);
packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js
+12 -12
@@ -108,12 +108,12 @@ describe('updaters', () => {
108 const Child = () => null;
109 const container = document.createElement('div');
110
111 - await act(async () => {
111 + await act(() => {
112 ReactDOM.render(<Parent />, container);
113 });
114 expect(allSchedulerTags).toEqual([[HostRoot]]);
115
116 - await act(async () => {
116 + await act(() => {
117 ReactDOM.render(<Parent />, container);
118 });
119 expect(allSchedulerTags).toEqual([[HostRoot], [HostRoot]]);
@@ -141,19 +141,19 @@ describe('updaters', () => {
141 };
142 const Child = () => null;
143
144 - await act(async () => {
144 + await act(() => {
145 ReactDOM.render(<Parent />, document.createElement('div'));
146 });
147 expect(scheduleForA).not.toBeNull();
148 expect(scheduleForB).not.toBeNull();
149 expect(allSchedulerTypes).toEqual([[null]]);
150
151 - await act(async () => {
151 + await act(() => {
152 scheduleForA();
153 });
154 expect(allSchedulerTypes).toEqual([[null], [SchedulingComponentA]]);
155
156 - await act(async () => {
156 + await act(() => {
157 scheduleForB();
158 });
159 expect(allSchedulerTypes).toEqual([
@@ -174,13 +174,13 @@ describe('updaters', () => {
174 }
175 const Child = () => null;
176 let instance;
177 - await act(async () => {
177 + await act(() => {
178 ReactDOM.render(<Parent />, document.createElement('div'));
179 });
180 expect(allSchedulerTypes).toEqual([[null]]);
181
182 expect(instance).not.toBeNull();
183 - await act(async () => {
183 + await act(() => {
184 instance.setState({});
185 });
186 expect(allSchedulerTypes).toEqual([[null], [SchedulingComponent]]);
@@ -294,21 +294,21 @@ describe('updaters', () => {
294 }
295 };
296
297 - await act(async () => {
297 + await act(() => {
298 ReactDOM.render(<Parent />, document.createElement('div'));
299 assertLog(['onCommitRoot']);
300 });
301 expect(setShouldSuspend).not.toBeNull();
302 expect(allSchedulerTypes).toEqual([[null]]);
303
304 - await act(async () => {
304 + await act(() => {
305 setShouldSuspend(true);
306 });
307 assertLog(['onCommitRoot']);
308 expect(allSchedulerTypes).toEqual([[null], [Suspender]]);
309
310 expect(resolver).not.toBeNull();
311 - await act(async () => {
311 + await act(() => {
312 resolver('abc');
313 return promise;
314 });
@@ -356,7 +356,7 @@ describe('updaters', () => {
356 };
357
358 const root = ReactDOMClient.createRoot(document.createElement('div'));
359 - await act(async () => {
359 + await act(() => {
360 root.render(<Parent shouldError={false} />);
361 });
362 assertLog(['initial', 'onCommitRoot']);
@@ -365,7 +365,7 @@ describe('updaters', () => {
365 allSchedulerTypes.splice(0);
366 onCommitRootShouldYield = true;
367
368 - await act(async () => {
368 + await act(() => {
369 triggerError();
370 });
371 assertLog(['onCommitRoot', 'error', 'onCommitRoot']);
packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js
+24 -24
@@ -51,7 +51,7 @@ describe('StrictEffectsMode', () => {
51 return text;
52 }
53
54 - await act(async () => {
54 + await act(() => {
55 ReactTestRenderer.create(<App text={'mount'} />);
56 });
57
@@ -74,7 +74,7 @@ describe('StrictEffectsMode', () => {
74 }
75
76 let renderer;
77 - await act(async () => {
77 + await act(() => {
78 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
79 unstable_isConcurrent: true,
80 });
@@ -93,7 +93,7 @@ describe('StrictEffectsMode', () => {
93 assertLog(['useLayoutEffect mount', 'useEffect mount']);
94 }
95
96 - await act(async () => {
96 + await act(() => {
97 renderer.update(<App text={'update'} />);
98 });
99
@@ -104,7 +104,7 @@ describe('StrictEffectsMode', () => {
104 'useEffect mount',
105 ]);
106
107 - await act(async () => {
107 + await act(() => {
108 renderer.unmount();
109 });
110
@@ -127,7 +127,7 @@ describe('StrictEffectsMode', () => {
127 }
128
129 let renderer;
130 - await act(async () => {
130 + await act(() => {
131 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
132 unstable_isConcurrent: true,
133 });
@@ -146,7 +146,7 @@ describe('StrictEffectsMode', () => {
146 assertLog(['useEffect One mount', 'useEffect Two mount']);
147 }
148
149 - await act(async () => {
149 + await act(() => {
150 renderer.update(<App text={'update'} />);
151 });
152
@@ -157,7 +157,7 @@ describe('StrictEffectsMode', () => {
157 'useEffect Two mount',
158 ]);
159
160 - await act(async () => {
160 + await act(() => {
161 renderer.unmount(null);
162 });
163
@@ -180,7 +180,7 @@ describe('StrictEffectsMode', () => {
180 }
181
182 let renderer;
183 - await act(async () => {
183 + await act(() => {
184 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
185 unstable_isConcurrent: true,
186 });
@@ -199,7 +199,7 @@ describe('StrictEffectsMode', () => {
199 assertLog(['useLayoutEffect One mount', 'useLayoutEffect Two mount']);
200 }
201
202 - await act(async () => {
202 + await act(() => {
203 renderer.update(<App text={'update'} />);
204 });
205
@@ -210,7 +210,7 @@ describe('StrictEffectsMode', () => {
210 'useLayoutEffect Two mount',
211 ]);
212
213 - await act(async () => {
213 + await act(() => {
214 renderer.unmount();
215 });
216
@@ -231,7 +231,7 @@ describe('StrictEffectsMode', () => {
231 }
232
233 let renderer;
234 - await act(async () => {
234 + await act(() => {
235 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
236 unstable_isConcurrent: true,
237 });
@@ -248,13 +248,13 @@ describe('StrictEffectsMode', () => {
248 assertLog(['useLayoutEffect mount', 'useEffect mount']);
249 }
250
251 - await act(async () => {
251 + await act(() => {
252 renderer.update(<App text={'update'} />);
253 });
254
255 assertLog(['useLayoutEffect mount', 'useEffect mount']);
256
257 - await act(async () => {
257 + await act(() => {
258 renderer.unmount();
259 });
260
@@ -285,7 +285,7 @@ describe('StrictEffectsMode', () => {
285 }
286 }
287
288 - await act(async () => {
288 + await act(() => {
289 ReactTestRenderer.create(<App />, {unstable_isConcurrent: true});
290 });
291
@@ -320,7 +320,7 @@ describe('StrictEffectsMode', () => {
320 }
321
322 let renderer;
323 - await act(async () => {
323 + await act(() => {
324 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
325 unstable_isConcurrent: true,
326 });
@@ -336,13 +336,13 @@ describe('StrictEffectsMode', () => {
336 assertLog(['componentDidMount']);
337 }
338
339 - await act(async () => {
339 + await act(() => {
340 renderer.update(<App text={'update'} />);
341 });
342
343 assertLog(['componentDidUpdate']);
344
345 - await act(async () => {
345 + await act(() => {
346 renderer.unmount();
347 });
348
@@ -368,7 +368,7 @@ describe('StrictEffectsMode', () => {
368 }
369 }
370
371 - await act(async () => {
371 + await act(() => {
372 ReactTestRenderer.create(<App text={'mount'} />);
373 });
374
@@ -395,7 +395,7 @@ describe('StrictEffectsMode', () => {
395 return text;
396 }
397
398 - await act(async () => {
398 + await act(() => {
399 ReactTestRenderer.create(<App text={'mount'} />, {
400 unstable_isConcurrent: true,
401 });
@@ -460,7 +460,7 @@ describe('StrictEffectsMode', () => {
460 return showChild && <Child />;
461 }
462
463 - await act(async () => {
463 + await act(() => {
464 ReactTestRenderer.create(<App />, {unstable_isConcurrent: true});
465 });
466
@@ -477,7 +477,7 @@ describe('StrictEffectsMode', () => {
477 assertLog(['App useLayoutEffect mount', 'App useEffect mount']);
478 }
479
480 - await act(async () => {
480 + await act(() => {
481 _setShowChild(true);
482 });
483
@@ -543,7 +543,7 @@ describe('StrictEffectsMode', () => {
543 }
544
545 let renderer;
546 - await act(async () => {
546 + await act(() => {
547 renderer = ReactTestRenderer.create(<App text={'mount'} />, {
548 unstable_isConcurrent: true,
549 });
@@ -569,7 +569,7 @@ describe('StrictEffectsMode', () => {
569 ]);
570 }
571
572 - await act(async () => {
572 + await act(() => {
573 renderer.update(<App text={'mount'} />);
574 });
575
@@ -580,7 +580,7 @@ describe('StrictEffectsMode', () => {
580 'useEffect mount',
581 ]);
582
583 - await act(async () => {
583 + await act(() => {
584 renderer.unmount();
585 });
586
packages/react-reconciler/src/__tests__/StrictEffectsModeDefaults-test.internal.js
+25 -25
@@ -52,7 +52,7 @@ describe('StrictEffectsMode defaults', () => {
52 return text;
53 }
54
55 - await act(async () => {
55 + await act(() => {
56 ReactNoop.renderLegacySyncRoot(<App text={'mount'} />);
57 });
58
@@ -78,7 +78,7 @@ describe('StrictEffectsMode defaults', () => {
78 }
79 }
80
81 - await act(async () => {
81 + await act(() => {
82 ReactNoop.renderLegacySyncRoot(<App text={'mount'} />);
83 });
84
@@ -208,7 +208,7 @@ describe('StrictEffectsMode defaults', () => {
208
209 return text;
210 }
211 - await act(async () => {
211 + await act(() => {
212 ReactNoop.render(<App text={'mount'} />);
213 });
214
@@ -221,7 +221,7 @@ describe('StrictEffectsMode defaults', () => {
221 'useEffect mount',
222 ]);
223
224 - await act(async () => {
224 + await act(() => {
225 ReactNoop.render(<App text={'update'} />);
226 });
227
@@ -232,7 +232,7 @@ describe('StrictEffectsMode defaults', () => {
232 'useEffect mount',
233 ]);
234
235 - await act(async () => {
235 + await act(() => {
236 ReactNoop.render(null);
237 });
238
@@ -254,7 +254,7 @@ describe('StrictEffectsMode defaults', () => {
254 return text;
255 }
256
257 - await act(async () => {
257 + await act(() => {
258 ReactNoop.render(<App text={'mount'} />);
259 });
260
@@ -267,7 +267,7 @@ describe('StrictEffectsMode defaults', () => {
267 'useEffect Two mount',
268 ]);
269
270 - await act(async () => {
270 + await act(() => {
271 ReactNoop.render(<App text={'update'} />);
272 });
273
@@ -278,7 +278,7 @@ describe('StrictEffectsMode defaults', () => {
278 'useEffect Two mount',
279 ]);
280
281 - await act(async () => {
281 + await act(() => {
282 ReactNoop.render(null);
283 });
284
@@ -300,7 +300,7 @@ describe('StrictEffectsMode defaults', () => {
300 return text;
301 }
302
303 - await act(async () => {
303 + await act(() => {
304 ReactNoop.render(<App text={'mount'} />);
305 });
306
@@ -313,7 +313,7 @@ describe('StrictEffectsMode defaults', () => {
313 'useLayoutEffect Two mount',
314 ]);
315
316 - await act(async () => {
316 + await act(() => {
317 ReactNoop.render(<App text={'update'} />);
318 });
319
@@ -324,7 +324,7 @@ describe('StrictEffectsMode defaults', () => {
324 'useLayoutEffect Two mount',
325 ]);
326
327 - await act(async () => {
327 + await act(() => {
328 ReactNoop.render(null);
329 });
330
@@ -344,7 +344,7 @@ describe('StrictEffectsMode defaults', () => {
344 return text;
345 }
346
347 - await act(async () => {
347 + await act(() => {
348 ReactNoop.render(<App text={'mount'} />);
349 });
350
@@ -355,13 +355,13 @@ describe('StrictEffectsMode defaults', () => {
355 'useEffect mount',
356 ]);
357
358 - await act(async () => {
358 + await act(() => {
359 ReactNoop.render(<App text={'update'} />);
360 });
361
362 assertLog(['useLayoutEffect mount', 'useEffect mount']);
363
364 - await act(async () => {
364 + await act(() => {
365 ReactNoop.render(null);
366 });
367
@@ -382,7 +382,7 @@ describe('StrictEffectsMode defaults', () => {
382 );
383 }
384
385 - await act(async () => {
385 + await act(() => {
386 ReactNoop.render(<App text={'mount'} />);
387 });
388
@@ -416,7 +416,7 @@ describe('StrictEffectsMode defaults', () => {
416 }
417 }
418
419 - await act(async () => {
419 + await act(() => {
420 ReactNoop.render(<App />);
421 });
422
@@ -446,7 +446,7 @@ describe('StrictEffectsMode defaults', () => {
446 }
447 }
448
449 - await act(async () => {
449 + await act(() => {
450 ReactNoop.render(<App text={'mount'} />);
451 });
452
@@ -456,13 +456,13 @@ describe('StrictEffectsMode defaults', () => {
456 'componentDidMount',
457 ]);
458
459 - await act(async () => {
459 + await act(() => {
460 ReactNoop.render(<App text={'update'} />);
461 });
462
463 assertLog(['componentDidUpdate']);
464
465 - await act(async () => {
465 + await act(() => {
466 ReactNoop.render(null);
467 });
468
@@ -489,7 +489,7 @@ describe('StrictEffectsMode defaults', () => {
489 return text;
490 }
491
492 - await act(async () => {
492 + await act(() => {
493 ReactNoop.render(<App text={'mount'} />);
494 });
495
@@ -539,7 +539,7 @@ describe('StrictEffectsMode defaults', () => {
539 return showChild && <Child />;
540 }
541
542 - await act(async () => {
542 + await act(() => {
543 ReactNoop.render(<App />);
544 });
545
@@ -552,7 +552,7 @@ describe('StrictEffectsMode defaults', () => {
552 'App useEffect mount',
553 ]);
554
555 - await act(async () => {
555 + await act(() => {
556 _setShowChild(true);
557 });
558
@@ -606,7 +606,7 @@ describe('StrictEffectsMode defaults', () => {
606 );
607 }
608
609 - await act(async () => {
609 + await act(() => {
610 ReactNoop.render(<App text={'mount'} />);
611 });
612
@@ -622,7 +622,7 @@ describe('StrictEffectsMode defaults', () => {
622 'useEffect mount',
623 ]);
624
625 - await act(async () => {
625 + await act(() => {
626 ReactNoop.render(<App text={'mount'} />);
627 });
628
@@ -633,7 +633,7 @@ describe('StrictEffectsMode defaults', () => {
633 'useEffect mount',
634 ]);
635
636 - await act(async () => {
636 + await act(() => {
637 ReactNoop.render(null);
638 });
639
packages/react-reconciler/src/__tests__/useEffectEvent-test.js
+29 -31
@@ -88,7 +88,7 @@ describe('useEffectEvent', () => {
88 </>,
89 );
90
91 - await act(async () => button.current.increment());
91 + await act(() => button.current.increment());
92 assertLog(['Increment', 'Count: 1']);
93 expect(ReactNoop).toMatchRenderedOutput(
94 <>
@@ -97,7 +97,7 @@ describe('useEffectEvent', () => {
97 </>,
98 );
99
100 - await act(async () => button.current.increment());
100 + await act(() => button.current.increment());
101 assertLog([
102 'Increment',
103 // Event should use the updated callback function closed over the new value.
@@ -121,7 +121,7 @@ describe('useEffectEvent', () => {
121 );
122
123 // Event uses the new prop
124 - await act(async () => button.current.increment());
124 + await act(() => button.current.increment());
125 assertLog(['Increment', 'Count: 12']);
126 expect(ReactNoop).toMatchRenderedOutput(
127 <>
@@ -174,7 +174,7 @@ describe('useEffectEvent', () => {
174 </>,
175 );
176
177 - await act(async () => button.current.increment());
177 + await act(() => button.current.increment());
178 assertLog(['Increment', 'Count: 5']);
179 expect(ReactNoop).toMatchRenderedOutput(
180 <>
@@ -183,7 +183,7 @@ describe('useEffectEvent', () => {
183 </>,
184 );
185
186 - await act(async () => button.current.multiply());
186 + await act(() => button.current.multiply());
187 assertLog(['Increment', 'Count: 25']);
188 expect(ReactNoop).toMatchRenderedOutput(
189 <>
@@ -233,7 +233,7 @@ describe('useEffectEvent', () => {
233 </>,
234 );
235
236 - await act(async () => button.current.greet());
236 + await act(() => button.current.greet());
237 assertLog(['Say hej', 'Greeting: undefined says hej']);
238 expect(ReactNoop).toMatchRenderedOutput(
239 <>
@@ -327,7 +327,7 @@ describe('useEffectEvent', () => {
327 </>,
328 );
329
330 - await act(async () => button.current.increment());
330 + await act(() => button.current.increment());
331 assertLog([
332 'Increment',
333 // Effect should not re-run because the dependency hasn't changed.
@@ -340,7 +340,7 @@ describe('useEffectEvent', () => {
340 </>,
341 );
342
343 - await act(async () => button.current.increment());
343 + await act(() => button.current.increment());
344 assertLog([
345 'Increment',
346 // Event should use the updated callback function closed over the new value.
@@ -370,7 +370,7 @@ describe('useEffectEvent', () => {
370 );
371
372 // Event uses the new prop
373 - await act(async () => button.current.increment());
373 + await act(() => button.current.increment());
374 assertLog(['Increment', 'Count: 34']);
375 expect(ReactNoop).toMatchRenderedOutput(
376 <>
@@ -426,7 +426,7 @@ describe('useEffectEvent', () => {
426 </>,
427 );
428
429 - await act(async () => button.current.increment());
429 + await act(() => button.current.increment());
430 assertLog([
431 'Increment',
432 // Effect should not re-run because the dependency hasn't changed.
@@ -439,7 +439,7 @@ describe('useEffectEvent', () => {
439 </>,
440 );
441
442 - await act(async () => button.current.increment());
442 + await act(() => button.current.increment());
443 assertLog([
444 'Increment',
445 // Event should use the updated callback function closed over the new value.
@@ -469,7 +469,7 @@ describe('useEffectEvent', () => {
469 );
470
471 // Event uses the new prop
472 - await act(async () => button.current.increment());
472 + await act(() => button.current.increment());
473 assertLog(['Increment', 'Count: 34']);
474 expect(ReactNoop).toMatchRenderedOutput(
475 <>
@@ -531,7 +531,7 @@ describe('useEffectEvent', () => {
531 </>,
532 );
533
534 - await act(async () => button.current.increment());
534 + await act(() => button.current.increment());
535 assertLog([
536 'Increment',
537 // Effect should not re-run because the dependency hasn't changed.
@@ -544,7 +544,7 @@ describe('useEffectEvent', () => {
544 </>,
545 );
546
547 - await act(async () => button.current.increment());
547 + await act(() => button.current.increment());
548 assertLog([
549 'Increment',
550 // Event should use the updated callback function closed over the new value.
@@ -574,7 +574,7 @@ describe('useEffectEvent', () => {
574 );
575
576 // Event uses the new prop
577 - await act(async () => button.current.increment());
577 + await act(() => button.current.increment());
578 assertLog(['Increment', 'Count: 34']);
579 expect(ReactNoop).toMatchRenderedOutput(
580 <>
@@ -604,7 +604,7 @@ describe('useEffectEvent', () => {
604 ReactNoop.render(<Counter value={1} />);
605 await waitForAll(['Effect value: 1', 'Event value: 1']);
606
607 - await act(async () => ReactNoop.render(<Counter value={2} />));
607 + await act(() => ReactNoop.render(<Counter value={2} />));
608 assertLog(['Effect value: 2', 'Event value: 2']);
609 });
610
@@ -678,7 +678,7 @@ describe('useEffectEvent', () => {
678
679 // Initial render
680 const root = ReactNoop.createRoot();
681 - await act(async () => {
681 + await act(() => {
682 root.render(<App value={1} />);
683 });
684 assertLog(['Commit new event handler']);
@@ -686,7 +686,7 @@ describe('useEffectEvent', () => {
686 expect(committedEventHandler()).toBe('Value seen by useEffectEvent: 1');
687
688 // Update
689 - await act(async () => {
689 + await act(() => {
690 root.render(<App value={2} />);
691 });
692 // No new event handler should be committed, because it was omitted from
@@ -742,20 +742,20 @@ describe('useEffectEvent', () => {
742 return <Text text={`Welcome to the ${roomId} room!`} />;
743 }
744
745 - await act(async () =>
745 + await act(() =>
746 ReactNoop.render(<ChatRoom roomId="general" theme="light" />),
747 );
748 - await act(async () => jest.runAllTimers());
748 + await act(() => jest.runAllTimers());
749 assertLog(['Welcome to the general room!', 'Connected! theme: light']);
750 expect(ReactNoop).toMatchRenderedOutput(
751 <span prop="Welcome to the general room!" />,
752 );
753
754 // change roomId only
755 - await act(async () =>
755 + await act(() =>
756 ReactNoop.render(<ChatRoom roomId="music" theme="light" />),
757 );
758 - await act(async () => jest.runAllTimers());
758 + await act(() => jest.runAllTimers());
759 assertLog([
760 'Welcome to the music room!',
761 // should trigger a reconnect
@@ -767,10 +767,8 @@ describe('useEffectEvent', () => {
767 );
768
769 // change theme only
770 - await act(async () =>
771 - ReactNoop.render(<ChatRoom roomId="music" theme="dark" />),
772 - );
773 - await act(async () => jest.runAllTimers());
770 + await act(() => ReactNoop.render(<ChatRoom roomId="music" theme="dark" />));
771 + await act(() => jest.runAllTimers());
772 // should not trigger a reconnect
773 assertLog(['Welcome to the music room!']);
774 expect(ReactNoop).toMatchRenderedOutput(
@@ -778,10 +776,10 @@ describe('useEffectEvent', () => {
776 );
777
778 // change roomId only
781 - await act(async () =>
779 + await act(() =>
780 ReactNoop.render(<ChatRoom roomId="travel" theme="dark" />),
781 );
784 - await act(async () => jest.runAllTimers());
782 + await act(() => jest.runAllTimers());
783 assertLog([
784 'Welcome to the travel room!',
785 // should trigger a reconnect
@@ -841,7 +839,7 @@ describe('useEffectEvent', () => {
839 }
840
841 const button = React.createRef(null);
844 - await act(async () =>
842 + await act(() =>
843 ReactNoop.render(
844 <AppShell>
845 <Page url="/shop/1" />
@@ -849,10 +847,10 @@ describe('useEffectEvent', () => {
847 ),
848 );
849 assertLog(['Add to cart', 'url: /shop/1, numberOfItems: 0']);
852 - await act(async () => button.current.addToCart());
850 + await act(() => button.current.addToCart());
851 assertLog(['Add to cart']);
852
855 - await act(async () =>
853 + await act(() =>
854 ReactNoop.render(
855 <AppShell>
856 <Page url="/shop/2" />
packages/react-reconciler/src/__tests__/useMemoCache-test.js
+13 -13
@@ -63,7 +63,7 @@ describe('useMemoCache()', () => {
63 return 'Ok';
64 }
65 const root = ReactNoop.createRoot();
66 - await act(async () => {
66 + await act(() => {
67 root.render(<Component />);
68 });
69 expect(root).toMatchRenderedOutput('Ok');
@@ -107,7 +107,7 @@ describe('useMemoCache()', () => {
107 });
108
109 const root = ReactNoop.createRoot();
110 - await act(async () => {
110 + await act(() => {
111 root.render(<Component />);
112 });
113 expect(root).toMatchRenderedOutput('Count 0');
@@ -115,7 +115,7 @@ describe('useMemoCache()', () => {
115 const data0 = data;
116
117 // Changing x should reset the data object
118 - await act(async () => {
118 + await act(() => {
119 setX(1);
120 });
121 expect(root).toMatchRenderedOutput('Count 1');
@@ -125,7 +125,7 @@ describe('useMemoCache()', () => {
125
126 // Forcing an unrelated update shouldn't recreate the
127 // data object.
128 - await act(async () => {
128 + await act(() => {
129 forceUpdate();
130 });
131 expect(root).toMatchRenderedOutput('Count 1');
@@ -183,7 +183,7 @@ describe('useMemoCache()', () => {
183 });
184
185 const root = ReactNoop.createRoot();
186 - await act(async () => {
186 + await act(() => {
187 root.render(<Component />);
188 });
189 expect(root).toMatchRenderedOutput('Count 0');
@@ -193,7 +193,7 @@ describe('useMemoCache()', () => {
193 // Simultaneously trigger an update to x (should create a new data value)
194 // and trigger the setState+early return. The runtime should reset the cache
195 // to avoid an inconsistency
196 - await act(async () => {
196 + await act(() => {
197 setX(1);
198 setN(1);
199 });
@@ -204,7 +204,7 @@ describe('useMemoCache()', () => {
204
205 // Forcing an unrelated update shouldn't recreate the
206 // data object.
207 - await act(async () => {
207 + await act(() => {
208 setN(3);
209 });
210 expect(root).toMatchRenderedOutput('Count 1');
@@ -266,7 +266,7 @@ describe('useMemoCache()', () => {
266 spyOnDev(console, 'error');
267
268 const root = ReactNoop.createRoot();
269 - await act(async () => {
269 + await act(() => {
270 root.render(
271 <ErrorBoundary>
272 <Component />
@@ -280,7 +280,7 @@ describe('useMemoCache()', () => {
280 // Simultaneously trigger an update to x (should create a new data value)
281 // and trigger the setState+early return. The runtime should reset the cache
282 // to avoid an inconsistency
283 - await act(async () => {
283 + await act(() => {
284 // this update bumps the count
285 setX(1);
286 // this triggers a throw.
@@ -293,7 +293,7 @@ describe('useMemoCache()', () => {
293
294 // Forcing an unrelated update shouldn't recreate the
295 // data object.
296 - await act(async () => {
296 + await act(() => {
297 setN(3);
298 });
299 expect(root).toMatchRenderedOutput('Count 1');
@@ -352,7 +352,7 @@ describe('useMemoCache()', () => {
352 });
353
354 const root = ReactNoop.createRoot();
355 - await act(async () => {
355 + await act(() => {
356 root.render(<Component />);
357 });
358 expect(root).toMatchRenderedOutput('count 0');
@@ -360,7 +360,7 @@ describe('useMemoCache()', () => {
360 const data0 = data;
361
362 // Changing x should reset the data object
363 - await act(async () => {
363 + await act(() => {
364 setX(1);
365 });
366 expect(root).toMatchRenderedOutput('count 1');
@@ -370,7 +370,7 @@ describe('useMemoCache()', () => {
370
371 // Forcing an unrelated update shouldn't recreate the
372 // data object.
373 - await act(async () => {
373 + await act(() => {
374 forceUpdate();
375 });
376 expect(root).toMatchRenderedOutput('count 1');
packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js
+16 -16
@@ -1060,18 +1060,18 @@ describe('useMutableSource', () => {
1060 }
1061
1062 const root = ReactNoop.createRoot();
1063 - await act(async () => {
1063 + await act(() => {
1064 root.render(<App getSnapshot={getSnapshotA} />);
1065 });
1066 expect(root).toMatchRenderedOutput('initial');
1067
1068 - await act(async () => {
1068 + await act(() => {
1069 mutateB('Updated B');
1070 root.render(<App getSnapshot={getSnapshotB} />);
1071 });
1072 expect(root).toMatchRenderedOutput('Updated B');
1073
1074 - await act(async () => {
1074 + await act(() => {
1075 mutateB('Another update');
1076 });
1077 expect(root).toMatchRenderedOutput('Another update');
@@ -1113,12 +1113,12 @@ describe('useMutableSource', () => {
1113 }
1114
1115 const root = ReactNoop.createRoot();
1116 - await act(async () => {
1116 + await act(() => {
1117 root.render(<App toggle={false} />);
1118 });
1119 expect(root).toMatchRenderedOutput('A: initial');
1120
1121 - await act(async () => {
1121 + await act(() => {
1122 ReactNoop.discreteUpdates(() => {
1123 // Update both A and B to the same value
1124 mutateA('Update');
@@ -1158,12 +1158,12 @@ describe('useMutableSource', () => {
1158 }
1159
1160 const root = ReactNoop.createRoot();
1161 - await act(async () => {
1161 + await act(() => {
1162 root.render(<App toggle={false} />);
1163 });
1164 expect(root).toMatchRenderedOutput('A: initial');
1165
1166 - await act(async () => {
1166 + await act(() => {
1167 ReactNoop.discreteUpdates(() => {
1168 // Update both A and B to the same value
1169 sourceA.value = 'Update';
@@ -1227,7 +1227,7 @@ describe('useMutableSource', () => {
1227 }
1228
1229 const root = ReactNoop.createRoot();
1230 - await act(async () => {
1230 + await act(() => {
1231 root.render(
1232 <App
1233 getSnapshotFirst={getSnapshotA}
@@ -1238,7 +1238,7 @@ describe('useMutableSource', () => {
1238 // x and y start out reading from different parts of the store.
1239 assertLog(['x: foo, y: bar']);
1240
1241 - await act(async () => {
1241 + await act(() => {
1242 ReactNoop.discreteUpdates(() => {
1243 // At high priority, toggle y so that it reads from A instead of B.
1244 // Simultaneously, mutate A.
@@ -1303,7 +1303,7 @@ describe('useMutableSource', () => {
1303 }
1304
1305 const root = ReactNoop.createRoot();
1306 - await act(async () => {
1306 + await act(() => {
1307 root.render(<App getSnapshot={getSnapshotA} />);
1308 });
1309 assertLog(['Render: foo', 'Commit: foo']);
@@ -1362,7 +1362,7 @@ describe('useMutableSource', () => {
1362 }
1363
1364 const root = ReactNoop.createRoot();
1365 - await act(async () => {
1365 + await act(() => {
1366 root.render(
1367 <App
1368 getSnapshotFirst={getSnapshotA}
@@ -1387,7 +1387,7 @@ describe('useMutableSource', () => {
1387 // Now mutate A. Both hooks should update.
1388 // This is at high priority so that it doesn't get batched with default
1389 // priority updates that might fire during the passive effect
1390 - await act(async () => {
1390 + await act(() => {
1391 ReactNoop.discreteUpdates(() => {
1392 mutateA('a1');
1393 });
@@ -1444,7 +1444,7 @@ describe('useMutableSource', () => {
1444 }
1445
1446 const root = ReactNoop.createRoot();
1447 - await act(async () => {
1447 + await act(() => {
1448 root.render(
1449 <>
1450 <Read getSnapshot={getSnapshotA} />
@@ -1590,7 +1590,7 @@ describe('useMutableSource', () => {
1590 }
1591
1592 const root = ReactNoop.createRoot();
1593 - await act(async () => {
1593 + await act(() => {
1594 root.render(<App parentConfig={configA} childConfig={configB} />);
1595 });
1596 assertLog(['Parent: 1', 'Child: 2', 'Commit: 1, 2']);
@@ -1666,7 +1666,7 @@ describe('useMutableSource', () => {
1666 }
1667
1668 // Mount ComponentA with data version 1
1669 - await act(async () => {
1669 + await act(() => {
1670 ReactNoop.render(
1671 <React.Profiler id="root" onRender={onRender}>
1672 <ComponentA />
@@ -1713,7 +1713,7 @@ describe('useMutableSource', () => {
1713 const brokenSubscribe = () => {};
1714
1715 await expect(async () => {
1716 - await act(async () => {
1716 + await act(() => {
1717 ReactNoop.render(
1718 <Component
1719 label="only"
packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js
+2 -2
@@ -165,7 +165,7 @@ describe('useMutableSourceHydration', () => {
165 assertLog(['only:one']);
166 expect(source.listenerCount).toBe(0);
167
168 - await act(async () => {
168 + await act(() => {
169 ReactDOMClient.hydrateRoot(container, <TestComponent />, {
170 mutableSources: [mutableSource],
171 });
@@ -200,7 +200,7 @@ describe('useMutableSourceHydration', () => {
200 expect(source.listenerCount).toBe(0);
201
202 await expect(async () => {
203 - await act(async () => {
203 + await act(() => {
204 ReactDOMClient.hydrateRoot(container, <TestComponent />, {
205 mutableSources: [mutableSource],
206 onRecoverableError(error) {
packages/react-reconciler/src/__tests__/useRef-test.internal.js
+13 -13
@@ -82,7 +82,7 @@ describe('useRef', () => {
82 return null;
83 }
84
85 - await act(async () => {
85 + await act(() => {
86 ReactNoop.render(<App />);
87 });
88 assertLog([]);
@@ -152,10 +152,10 @@ describe('useRef', () => {
152 );
153 }
154
155 - await act(async () => {
155 + await act(() => {
156 ReactNoop.render(<Example phase="mount" />);
157 });
158 - await act(async () => {
158 + await act(() => {
159 ReactNoop.render(<Example phase="update" />);
160 });
161 });
@@ -173,7 +173,7 @@ describe('useRef', () => {
173 return value;
174 }
175
176 - await act(async () => {
176 + await act(() => {
177 ReactNoop.render(<Example />);
178 });
179 });
@@ -192,12 +192,12 @@ describe('useRef', () => {
192 return null;
193 }
194
195 - await act(async () => {
195 + await act(() => {
196 ReactNoop.render(<Example />);
197 });
198
199 // Should not warn after an update either.
200 - await act(async () => {
200 + await act(() => {
201 ReactNoop.render(<Example />);
202 });
203 });
@@ -216,7 +216,7 @@ describe('useRef', () => {
216 return null;
217 }
218
219 - await act(async () => {
219 + await act(() => {
220 ReactNoop.render(<Example />);
221 });
222 });
@@ -251,13 +251,13 @@ describe('useRef', () => {
251 }
252
253 let shouldExpectWarning = true;
254 - await act(async () => {
254 + await act(() => {
255 ReactNoop.render(<Example />);
256 });
257
258 // Should not warn again on update.
259 shouldExpectWarning = false;
260 - await act(async () => {
260 + await act(() => {
261 ReactNoop.render(<Example />);
262 });
263 });
@@ -291,7 +291,7 @@ describe('useRef', () => {
291 return value;
292 }
293
294 - await act(async () => {
294 + await act(() => {
295 ReactNoop.render(<Example />);
296 });
297 });
@@ -323,7 +323,7 @@ describe('useRef', () => {
323 return null;
324 }
325
326 - await act(async () => {
326 + await act(() => {
327 ReactNoop.render(<Example />);
328 });
329 });
@@ -344,7 +344,7 @@ describe('useRef', () => {
344 return null;
345 }
346
347 - await act(async () => {
347 + await act(() => {
348 ReactNoop.render(<Example />);
349 });
350
@@ -358,7 +358,7 @@ describe('useRef', () => {
358 return null;
359 }
360
361 - await act(async () => {
361 + await act(() => {
362 ReactNoop.render(<Example />);
363 });
364
packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
+3 -3
@@ -195,19 +195,19 @@ describe('useSyncExternalStore', () => {
195 }
196
197 const root = ReactNoop.createRoot();
198 - await act(async () => {
198 + await act(() => {
199 // Start a render that reads from the store and yields value
200 root.render(<App />);
201 });
202 assertLog(['value:initial']);
203
204 - await act(async () => {
204 + await act(() => {
205 store.set('value:changed');
206 });
207 assertLog(['value:changed']);
208
209 // If cached value was updated, we expect a re-render
210 - await act(async () => {
210 + await act(() => {
211 store.set('value:initial');
212 });
213 assertLog(['value:initial']);
packages/react-refresh/src/__tests__/ReactFresh-test.js
+6 -6
@@ -864,7 +864,7 @@ describe('ReactFresh', () => {
864 });
865
866 expect(container.textContent).toBe('Loading');
867 - await act(async () => {
867 + await act(() => {
868 jest.runAllTimers();
869 });
870 expect(container.textContent).toBe('0');
@@ -1013,7 +1013,7 @@ describe('ReactFresh', () => {
1013 $RefreshReg$(Hello, 'Hello');
1014 });
1015
1016 - await act(async () => {
1016 + await act(() => {
1017 jest.runAllTimers();
1018 });
1019
@@ -1097,7 +1097,7 @@ describe('ReactFresh', () => {
1097 $RefreshReg$(Hello, 'Hello');
1098 });
1099
1100 - await act(async () => {
1100 + await act(() => {
1101 jest.runAllTimers();
1102 });
1103
@@ -1182,7 +1182,7 @@ describe('ReactFresh', () => {
1182 $RefreshReg$(Hello, 'Hello');
1183 });
1184
1185 - await act(async () => {
1185 + await act(() => {
1186 jest.runAllTimers();
1187 });
1188
@@ -1267,7 +1267,7 @@ describe('ReactFresh', () => {
1267 $RefreshReg$(Hello, 'Hello');
1268 });
1269
1270 - await act(async () => {
1270 + await act(() => {
1271 jest.runAllTimers();
1272 });
1273
@@ -2482,7 +2482,7 @@ describe('ReactFresh', () => {
2482 expect(el.firstChild.textContent).toBe('0');
2483 expect(el.firstChild.style.color).toBe('red');
2484
2485 - await internalAct(async () => {
2485 + await internalAct(() => {
2486 el.firstChild.dispatchEvent(
2487 new MouseEvent('click', {
2488 bubbles: true,
packages/react-server-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js
+1 -1
@@ -110,7 +110,7 @@ describe('ReactFlightDOMRelay', () => {
110
111 const container = document.createElement('div');
112 const root = ReactDOMClient.createRoot(container);
113 - await act(async () => {
113 + await act(() => {
114 root.render(modelClient.greeting);
115 });
116
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js
+22 -22
@@ -168,7 +168,7 @@ describe('ReactFlightDOM', () => {
168
169 const container = document.createElement('div');
170 const root = ReactDOMClient.createRoot(container);
171 - await act(async () => {
171 + await act(() => {
172 root.render(<App response={response} />);
173 });
174 expect(container.innerHTML).toBe(
@@ -205,7 +205,7 @@ describe('ReactFlightDOM', () => {
205
206 const container = document.createElement('div');
207 const root = ReactDOMClient.createRoot(container);
208 - await act(async () => {
208 + await act(() => {
209 root.render(<App response={response} />);
210 });
211 expect(container.innerHTML).toBe('<p>$1</p>');
@@ -240,7 +240,7 @@ describe('ReactFlightDOM', () => {
240
241 const container = document.createElement('div');
242 const root = ReactDOMClient.createRoot(container);
243 - await act(async () => {
243 + await act(() => {
244 root.render(<App response={response} />);
245 });
246 expect(container.innerHTML).toBe('<p>@div</p>');
@@ -290,7 +290,7 @@ describe('ReactFlightDOM', () => {
290
291 const container = document.createElement('div');
292 const root = ReactDOMClient.createRoot(container);
293 - await act(async () => {
293 + await act(() => {
294 root.render(<App response={response} />);
295 });
296 expect(container.innerHTML).toBe('<p>Hello World</p>');
@@ -328,7 +328,7 @@ describe('ReactFlightDOM', () => {
328
329 const container = document.createElement('div');
330 const root = ReactDOMClient.createRoot(container);
331 - await act(async () => {
331 + await act(() => {
332 root.render(<App response={response} />);
333 });
334 expect(container.innerHTML).toBe('<p>Hello World</p>');
@@ -369,7 +369,7 @@ describe('ReactFlightDOM', () => {
369
370 const container = document.createElement('div');
371 const root = ReactDOMClient.createRoot(container);
372 - await act(async () => {
372 + await act(() => {
373 root.render(<App response={response} />);
374 });
375 expect(container.innerHTML).toBe('<p>Async: Module</p>');
@@ -408,7 +408,7 @@ describe('ReactFlightDOM', () => {
408
409 const container = document.createElement('div');
410 const root = ReactDOMClient.createRoot(container);
411 - await act(async () => {
411 + await act(() => {
412 root.render(<App response={response} />);
413 });
414 expect(container.innerHTML).toBe('<p>Async Text</p>');
@@ -446,7 +446,7 @@ describe('ReactFlightDOM', () => {
446
447 const container = document.createElement('div');
448 const root = ReactDOMClient.createRoot(container);
449 - await act(async () => {
449 + await act(() => {
450 root.render(<App response={response} />);
451 });
452 expect(container.innerHTML).toBe('<p>and then</p>');
@@ -607,7 +607,7 @@ describe('ReactFlightDOM', () => {
607
608 const container = document.createElement('div');
609 const root = ReactDOMClient.createRoot(container);
610 - await act(async () => {
610 + await act(() => {
611 root.render(
612 <Suspense fallback={<p>(loading)</p>}>
613 <ProfilePage response={response} />
@@ -617,17 +617,17 @@ describe('ReactFlightDOM', () => {
617 expect(container.innerHTML).toBe('<p>(loading)</p>');
618
619 // This isn't enough to show anything.
620 - await act(async () => {
620 + await act(() => {
621 resolveFriends();
622 });
623 expect(container.innerHTML).toBe('<p>(loading)</p>');
624
625 // We can now show the details. Sidebar and posts are still loading.
626 - await act(async () => {
626 + await act(() => {
627 resolveName();
628 });
629 // Advance time enough to trigger a nested fallback.
630 - await act(async () => {
630 + await act(() => {
631 jest.advanceTimersByTime(500);
632 });
633 expect(container.innerHTML).toBe(
@@ -723,7 +723,7 @@ describe('ReactFlightDOM', () => {
723 const response1 = ReactServerDOMReader.createFromReadableStream(
724 stream1.readable,
725 );
726 - await act(async () => {
726 + await act(() => {
727 root.render(
728 <Suspense fallback={<p>(loading)</p>}>
729 <Page response={response1} />
@@ -751,7 +751,7 @@ describe('ReactFlightDOM', () => {
751 const response2 = ReactServerDOMReader.createFromReadableStream(
752 stream2.readable,
753 );
754 - await act(async () => {
754 + await act(() => {
755 root.render(
756 <Suspense fallback={<p>(loading)</p>}>
757 <Page response={response2} />
@@ -799,7 +799,7 @@ describe('ReactFlightDOM', () => {
799 return use(res);
800 }
801
802 - await act(async () => {
802 + await act(() => {
803 root.render(
804 <ErrorBoundary
805 fallback={e => (
@@ -816,7 +816,7 @@ describe('ReactFlightDOM', () => {
816 });
817 expect(container.innerHTML).toBe('<p>(loading)</p>');
818
819 - await act(async () => {
819 + await act(() => {
820 abort('for reasons');
821 });
822 if (__DEV__) {
@@ -862,7 +862,7 @@ describe('ReactFlightDOM', () => {
862 return use(res);
863 }
864
865 - await act(async () => {
865 + await act(() => {
866 root.render(
867 <ErrorBoundary fallback={e => <p>{e.message}</p>}>
868 <Suspense fallback={<p>(loading)</p>}>
@@ -913,7 +913,7 @@ describe('ReactFlightDOM', () => {
913 return use(res);
914 }
915
916 - await act(async () => {
916 + await act(() => {
917 root.render(
918 <ErrorBoundary fallback={e => <p>{e.message}</p>}>
919 <Suspense fallback={<p>(loading)</p>}>
@@ -925,7 +925,7 @@ describe('ReactFlightDOM', () => {
925
926 expect(container.innerHTML).toBe('<p>(loading)</p>');
927
928 - await act(async () => {
928 + await act(() => {
929 rejectPromise(new Error('async module init error'));
930 });
931
@@ -975,7 +975,7 @@ describe('ReactFlightDOM', () => {
975 return use(res);
976 }
977
978 - await act(async () => {
978 + await act(() => {
979 root.render(
980 <ErrorBoundary
981 fallback={e => (
@@ -1041,7 +1041,7 @@ describe('ReactFlightDOM', () => {
1041
1042 const container = document.createElement('div');
1043 const root = ReactDOMClient.createRoot(container);
1044 - await act(async () => {
1044 + await act(() => {
1045 root.render(<App response={response} />);
1046 });
1047 expect(container.innerHTML).toBe('<p>async hello</p>');
@@ -1104,7 +1104,7 @@ describe('ReactFlightDOM', () => {
1104
1105 const container = document.createElement('div');
1106 const root = ReactDOMClient.createRoot(container);
1107 - await act(async () => {
1107 + await act(() => {
1108 root.render(<App response={response} />);
1109 });
1110 expect(container.innerHTML).toBe(
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js
+22 -22
@@ -264,7 +264,7 @@ describe('ReactFlightDOMBrowser', () => {
264
265 const container = document.createElement('div');
266 const root = ReactDOMClient.createRoot(container);
267 - await act(async () => {
267 + await act(() => {
268 root.render(
269 <Suspense fallback={<p>(loading)</p>}>
270 <ProfilePage response={response} />
@@ -274,13 +274,13 @@ describe('ReactFlightDOMBrowser', () => {
274 expect(container.innerHTML).toBe('<p>(loading)</p>');
275
276 // This isn't enough to show anything.
277 - await act(async () => {
277 + await act(() => {
278 resolveFriends();
279 });
280 expect(container.innerHTML).toBe('<p>(loading)</p>');
281
282 // We can now show the details. Sidebar and posts are still loading.
283 - await act(async () => {
283 + await act(() => {
284 resolveName();
285 });
286 // Advance time enough to trigger a nested fallback.
@@ -296,7 +296,7 @@ describe('ReactFlightDOMBrowser', () => {
296
297 const theError = new Error('Game over');
298 // Let's *fail* loading games.
299 - await act(async () => {
299 + await act(() => {
300 rejectGames(theError);
301 });
302
@@ -315,7 +315,7 @@ describe('ReactFlightDOMBrowser', () => {
315 reportedErrors = [];
316
317 // We can now show the sidebar.
318 - await act(async () => {
318 + await act(() => {
319 resolvePhotos();
320 });
321 expect(container.innerHTML).toBe(
@@ -326,7 +326,7 @@ describe('ReactFlightDOMBrowser', () => {
326 );
327
328 // Show everything.
329 - await act(async () => {
329 + await act(() => {
330 resolvePosts();
331 });
332 expect(container.innerHTML).toBe(
@@ -414,7 +414,7 @@ describe('ReactFlightDOMBrowser', () => {
414 // Advance time enough to trigger a nested fallback.
415 jest.advanceTimersByTime(500);
416
417 - await act(async () => {});
417 + await act(() => {});
418
419 expect(flightResponse).toContain('(loading everything)');
420 expect(flightResponse).toContain('(loading sidebar)');
@@ -422,25 +422,25 @@ describe('ReactFlightDOMBrowser', () => {
422 expect(flightResponse).not.toContain(':friends:');
423 expect(flightResponse).not.toContain(':name:');
424
425 - await act(async () => {
425 + await act(() => {
426 resolveFriends();
427 });
428
429 expect(flightResponse).toContain(':friends:');
430
431 - await act(async () => {
431 + await act(() => {
432 resolveName();
433 });
434
435 expect(flightResponse).toContain(':name:');
436
437 - await act(async () => {
437 + await act(() => {
438 resolvePhotos();
439 });
440
441 expect(flightResponse).toContain(':photos:');
442
443 - await act(async () => {
443 + await act(() => {
444 resolvePosts();
445 });
446
@@ -512,7 +512,7 @@ describe('ReactFlightDOMBrowser', () => {
512 return use(res);
513 }
514
515 - await act(async () => {
515 + await act(() => {
516 root.render(
517 <ErrorBoundary fallback={errorBoundaryFn}>
518 <Suspense fallback={<p>(loading)</p>}>
@@ -523,7 +523,7 @@ describe('ReactFlightDOMBrowser', () => {
523 });
524 expect(container.innerHTML).toBe('<p>(loading)</p>');
525
526 - await act(async () => {
526 + await act(() => {
527 controller.abort('for reasons');
528 });
529 const expectedValue = __DEV__
@@ -553,7 +553,7 @@ describe('ReactFlightDOMBrowser', () => {
553
554 const container = document.createElement('div');
555 const root = ReactDOMClient.createRoot(container);
556 - await act(async () => {
556 + await act(() => {
557 root.render(
558 <Suspense fallback="Loading...">
559 <Client />
@@ -587,7 +587,7 @@ describe('ReactFlightDOMBrowser', () => {
587
588 const container = document.createElement('div');
589 const root = ReactDOMClient.createRoot(container);
590 - await act(async () => {
590 + await act(() => {
591 // Client uses a different renderer.
592 // We reset _currentRenderer here to not trigger a warning about multiple
593 // renderers concurrently using this context
@@ -618,7 +618,7 @@ describe('ReactFlightDOMBrowser', () => {
618
619 const container = document.createElement('div');
620 const root = ReactDOMClient.createRoot(container);
621 - await act(async () => {
621 + await act(() => {
622 root.render(
623 <Suspense fallback="Loading...">
624 <Client />
@@ -676,7 +676,7 @@ describe('ReactFlightDOMBrowser', () => {
676
677 const container = document.createElement('div');
678 const root = ReactDOMClient.createRoot(container);
679 - await act(async () => {
679 + await act(() => {
680 root.render(
681 <ErrorBoundary>
682 <Client />
@@ -712,7 +712,7 @@ describe('ReactFlightDOMBrowser', () => {
712
713 const container = document.createElement('div');
714 const root = ReactDOMClient.createRoot(container);
715 - await act(async () => {
715 + await act(() => {
716 root.render(<Client />);
717 });
718 expect(container.innerHTML).toBe('Hi');
@@ -748,7 +748,7 @@ describe('ReactFlightDOMBrowser', () => {
748
749 const container = document.createElement('div');
750 const root = ReactDOMClient.createRoot(container);
751 - await act(async () => {
751 + await act(() => {
752 root.render(<Client />);
753 });
754 expect(container.innerHTML).toBe('Hi');
@@ -798,7 +798,7 @@ describe('ReactFlightDOMBrowser', () => {
798
799 const container = document.createElement('div');
800 const root = ReactDOMClient.createRoot(container);
801 - await act(async () => {
801 + await act(() => {
802 root.render(<App />);
803 });
804 expect(container.innerHTML).toBe('Click Me');
@@ -840,7 +840,7 @@ describe('ReactFlightDOMBrowser', () => {
840
841 const container = document.createElement('div');
842 const root = ReactDOMClient.createRoot(container);
843 - await act(async () => {
843 + await act(() => {
844 root.render(<App />);
845 });
846 expect(container.innerHTML).toBe('Click Me');
@@ -890,7 +890,7 @@ describe('ReactFlightDOMBrowser', () => {
890
891 const container = document.createElement('div');
892 const root = ReactDOMClient.createRoot(container);
893 - await act(async () => {
893 + await act(() => {
894 root.render(<App />);
895 });
896
packages/react/src/__tests__/ReactProfiler-test.internal.js
+32 -32
@@ -346,7 +346,7 @@ describe(`onRender`, () => {
346 Scheduler.unstable_advanceTime(20); // 30 -> 50
347
348 // Updating a sibling should not report a re-render.
349 - await act(async () => updateProfilerSibling());
349 + await act(() => updateProfilerSibling());
350
351 expect(callback).not.toHaveBeenCalled();
352 });
@@ -672,7 +672,7 @@ describe(`onRender`, () => {
672
673 const onRender = jest.fn();
674
675 - await act(async () => {
675 + await act(() => {
676 ReactNoop.render(
677 <React.Profiler id="root" onRender={onRender}>
678 <Component />
@@ -1590,7 +1590,7 @@ describe(`onCommit`, () => {
1590 const setCountRef = React.createRef(null);
1591
1592 let renderer = null;
1593 - await act(async () => {
1593 + await act(() => {
1594 renderer = ReactTestRenderer.create(
1595 <React.Profiler id="root-mount" onCommit={callback}>
1596 <React.Profiler id="a">
@@ -1617,7 +1617,7 @@ describe(`onCommit`, () => {
1617 expect(call[2]).toBe(1010); // durations
1618 expect(call[3]).toBe(2); // commit start time (before mutations or effects)
1619
1620 - await act(async () => setCountRef.current(count => count + 1));
1620 + await act(() => setCountRef.current(count => count + 1));
1621
1622 expect(callback).toHaveBeenCalledTimes(2);
1623
@@ -1629,7 +1629,7 @@ describe(`onCommit`, () => {
1629 expect(call[2]).toBe(110); // durations
1630 expect(call[3]).toBe(1013); // commit start time (before mutations or effects)
1631
1632 - await act(async () => {
1632 + await act(() => {
1633 renderer.update(
1634 <React.Profiler id="root-update" onCommit={callback}>
1635 <React.Profiler id="b">
@@ -1688,7 +1688,7 @@ describe(`onCommit`, () => {
1688
1689 // Test an error that happens during an effect
1690
1691 - await act(async () => {
1691 + await act(() => {
1692 ReactTestRenderer.create(
1693 <React.Profiler id="root" onCommit={callback}>
1694 <ErrorBoundary
@@ -1774,7 +1774,7 @@ describe(`onCommit`, () => {
1774
1775 let renderer = null;
1776
1777 - await act(async () => {
1777 + await act(() => {
1778 renderer = ReactTestRenderer.create(
1779 <React.Profiler id="root" onCommit={callback}>
1780 <ErrorBoundary
@@ -1816,7 +1816,7 @@ describe(`onCommit`, () => {
1816
1817 // Test an error that happens during an cleanup function
1818
1819 - await act(async () => {
1819 + await act(() => {
1820 renderer.update(
1821 <React.Profiler id="root" onCommit={callback}>
1822 <ErrorBoundary
@@ -1901,7 +1901,7 @@ describe(`onPostCommit`, () => {
1901 Scheduler.unstable_advanceTime(1);
1902
1903 let renderer;
1904 - await act(async () => {
1904 + await act(() => {
1905 renderer = ReactTestRenderer.create(
1906 <React.Profiler id="mount-test" onPostCommit={callback}>
1907 <ComponentWithEffects />
@@ -1922,7 +1922,7 @@ describe(`onPostCommit`, () => {
1922
1923 Scheduler.unstable_advanceTime(1);
1924
1925 - await act(async () => {
1925 + await act(() => {
1926 renderer.update(
1927 <React.Profiler id="update-test" onPostCommit={callback}>
1928 <ComponentWithEffects />
@@ -1943,7 +1943,7 @@ describe(`onPostCommit`, () => {
1943
1944 Scheduler.unstable_advanceTime(1);
1945
1946 - await act(async () => {
1946 + await act(() => {
1947 renderer.update(
1948 <React.Profiler id="unmount-test" onPostCommit={callback} />,
1949 );
@@ -1985,7 +1985,7 @@ describe(`onPostCommit`, () => {
1985
1986 Scheduler.unstable_advanceTime(1);
1987
1988 - await act(async () => {
1988 + await act(() => {
1989 ReactTestRenderer.create(
1990 <React.Profiler id="mount-test" onPostCommit={callback}>
1991 <ComponentWithEffects />
@@ -2033,7 +2033,7 @@ describe(`onPostCommit`, () => {
2033 const setCountRef = React.createRef(null);
2034
2035 let renderer = null;
2036 - await act(async () => {
2036 + await act(() => {
2037 renderer = ReactTestRenderer.create(
2038 <React.Profiler id="root-mount" onPostCommit={callback}>
2039 <React.Profiler id="a">
@@ -2060,7 +2060,7 @@ describe(`onPostCommit`, () => {
2060 expect(call[2]).toBe(1010); // durations
2061 expect(call[3]).toBe(2); // commit start time (before mutations or effects)
2062
2063 - await act(async () => setCountRef.current(count => count + 1));
2063 + await act(() => setCountRef.current(count => count + 1));
2064
2065 expect(callback).toHaveBeenCalledTimes(2);
2066
@@ -2072,7 +2072,7 @@ describe(`onPostCommit`, () => {
2072 expect(call[2]).toBe(110); // durations
2073 expect(call[3]).toBe(1013); // commit start time (before mutations or effects)
2074
2075 - await act(async () => {
2075 + await act(() => {
2076 renderer.update(
2077 <React.Profiler id="root-update" onPostCommit={callback}>
2078 <React.Profiler id="b">
@@ -2131,7 +2131,7 @@ describe(`onPostCommit`, () => {
2131
2132 // Test an error that happens during an effect
2133
2134 - await act(async () => {
2134 + await act(() => {
2135 ReactTestRenderer.create(
2136 <React.Profiler id="root" onPostCommit={callback}>
2137 <ErrorBoundary
@@ -2218,7 +2218,7 @@ describe(`onPostCommit`, () => {
2218
2219 let renderer = null;
2220
2221 - await act(async () => {
2221 + await act(() => {
2222 renderer = ReactTestRenderer.create(
2223 <React.Profiler id="root" onPostCommit={callback}>
2224 <ErrorBoundary
@@ -2260,7 +2260,7 @@ describe(`onPostCommit`, () => {
2260
2261 // Test an error that happens during an cleanup function
2262
2263 - await act(async () => {
2263 + await act(() => {
2264 renderer.update(
2265 <React.Profiler id="root" onPostCommit={callback}>
2266 <ErrorBoundary
@@ -2377,7 +2377,7 @@ describe(`onNestedUpdateScheduled`, () => {
2377
2378 const onNestedUpdateScheduled = jest.fn();
2379
2380 - await act(async () => {
2380 + await act(() => {
2381 ReactNoop.render(
2382 <React.Profiler
2383 id="test"
@@ -2438,7 +2438,7 @@ describe(`onNestedUpdateScheduled`, () => {
2438 const onNestedUpdateScheduledTwo = jest.fn();
2439 const onNestedUpdateScheduledThree = jest.fn();
2440
2441 - await act(async () => {
2441 + await act(() => {
2442 ReactNoop.render(
2443 <React.Profiler
2444 id="one"
@@ -2486,7 +2486,7 @@ describe(`onNestedUpdateScheduled`, () => {
2486
2487 const onNestedUpdateScheduled = jest.fn();
2488
2489 - await act(async () => {
2489 + await act(() => {
2490 ReactNoop.renderToRootWithID(
2491 <React.Profiler
2492 id="test"
@@ -2526,7 +2526,7 @@ describe(`onNestedUpdateScheduled`, () => {
2526
2527 const onNestedUpdateScheduled = jest.fn();
2528
2529 - await act(async () => {
2529 + await act(() => {
2530 ReactNoop.render(
2531 <React.Profiler
2532 id="test"
@@ -2552,7 +2552,7 @@ describe(`onNestedUpdateScheduled`, () => {
2552
2553 const onNestedUpdateScheduled = jest.fn();
2554
2555 - await act(async () => {
2555 + await act(() => {
2556 ReactNoop.render(
2557 <React.Profiler
2558 id="test"
@@ -2563,7 +2563,7 @@ describe(`onNestedUpdateScheduled`, () => {
2563 });
2564 assertLog(['Component:false']);
2565
2566 - await act(async () => {
2566 + await act(() => {
2567 updateFnRef.current();
2568 });
2569 assertLog(['Component:true']);
@@ -2582,7 +2582,7 @@ describe(`onNestedUpdateScheduled`, () => {
2582
2583 const onNestedUpdateScheduled = jest.fn();
2584
2585 - await act(async () => {
2585 + await act(() => {
2586 ReactNoop.render(
2587 <React.Profiler
2588 id="test"
@@ -2613,7 +2613,7 @@ describe(`onNestedUpdateScheduled`, () => {
2613
2614 const onNestedUpdateScheduled = jest.fn();
2615
2616 - await act(async () => {
2616 + await act(() => {
2617 ReactNoop.render(
2618 <React.Profiler
2619 id="test"
@@ -2627,7 +2627,7 @@ describe(`onNestedUpdateScheduled`, () => {
2627 expect(onNestedUpdateScheduled).toHaveBeenCalledTimes(1);
2628 expect(onNestedUpdateScheduled.mock.calls[0][0]).toBe('test');
2629
2630 - await act(async () => {
2630 + await act(() => {
2631 ReactNoop.render(
2632 <React.Profiler
2633 id="test"
@@ -2659,7 +2659,7 @@ describe(`onNestedUpdateScheduled`, () => {
2659
2660 const onNestedUpdateScheduled = jest.fn();
2661
2662 - await act(async () => {
2662 + await act(() => {
2663 ReactNoop.render(
2664 <React.Profiler
2665 id="test"
@@ -2699,7 +2699,7 @@ describe(`onNestedUpdateScheduled`, () => {
2699
2700 const onNestedUpdateScheduled = jest.fn();
2701
2702 - await act(async () => {
2702 + await act(() => {
2703 ReactNoop.render(
2704 <React.Profiler
2705 id="test"
@@ -2711,7 +2711,7 @@ describe(`onNestedUpdateScheduled`, () => {
2711 assertLog(['Component:false:false']);
2712 expect(onNestedUpdateScheduled).not.toHaveBeenCalled();
2713
2714 - await act(async () => {
2714 + await act(() => {
2715 ReactNoop.render(
2716 <React.Profiler
2717 id="test"
@@ -2743,7 +2743,7 @@ describe(`onNestedUpdateScheduled`, () => {
2743
2744 const onNestedUpdateScheduled = jest.fn();
2745
2746 - await act(async () => {
2746 + await act(() => {
2747 ReactNoop.render(
2748 <React.Profiler
2749 id="test"
@@ -2754,7 +2754,7 @@ describe(`onNestedUpdateScheduled`, () => {
2754 });
2755 assertLog(['Component:false']);
2756
2757 - await act(async () => {
2757 + await act(() => {
2758 updateFnRef.current();
2759 });
2760 assertLog(['Component:true']);
packages/react/src/__tests__/ReactStartTransition-test.js
+3 -3
@@ -47,14 +47,14 @@ describe('ReactStartTransition', () => {
47 return null;
48 };
49
50 - await act(async () => {
50 + await act(() => {
51 ReactTestRenderer.create(<Component level={0} />, {
52 unstable_isConcurrent: true,
53 });
54 });
55
56 await expect(async () => {
57 - await act(async () => {
57 + await act(() => {
58 React.startTransition(() => {
59 subs.forEach(setState => {
60 setState(state => state + 1);
@@ -71,7 +71,7 @@ describe('ReactStartTransition', () => {
71 );
72
73 await expect(async () => {
74 - await act(async () => {
74 + await act(() => {
75 triggerHookTransition(() => {
76 subs.forEach(setState => {
77 setState(state => state + 1);
packages/react/src/__tests__/ReactStrictMode-test.internal.js
+4 -4
@@ -46,7 +46,7 @@ describe('ReactStrictMode', () => {
46 }
47
48 it('should default to not strict', async () => {
49 - await act(async () => {
49 + await act(() => {
50 const container = document.createElement('div');
51 const root = ReactDOMClient.createRoot(container);
52 root.render(<Component label="A" />);
@@ -61,7 +61,7 @@ describe('ReactStrictMode', () => {
61
62 if (__DEV__) {
63 it('should support enabling strict mode via createRoot option', async () => {
64 - await act(async () => {
64 + await act(() => {
65 const container = document.createElement('div');
66 const root = ReactDOMClient.createRoot(container, {
67 unstable_strictMode: true,
@@ -82,7 +82,7 @@ describe('ReactStrictMode', () => {
82 });
83
84 it('should include legacy + strict effects mode', async () => {
85 - await act(async () => {
85 + await act(() => {
86 const container = document.createElement('div');
87 const root = ReactDOMClient.createRoot(container);
88 root.render(
@@ -105,7 +105,7 @@ describe('ReactStrictMode', () => {
105 });
106
107 it('should allow level to be increased with nesting', async () => {
108 - await act(async () => {
108 + await act(() => {
109 const container = document.createElement('div');
110 const root = ReactDOMClient.createRoot(container);
111 root.render(
packages/react/src/__tests__/ReactStrictMode-test.js
+8 -8
@@ -356,7 +356,7 @@ describe('ReactStrictMode', () => {
356 const root = ReactDOMClient.createRoot(container);
357
358 // Mount
359 - await act(async () => {
359 + await act(() => {
360 root.render(
361 <React.StrictMode>
362 <Uppercased text="hello" />
@@ -372,7 +372,7 @@ describe('ReactStrictMode', () => {
372 log = [];
373
374 // Update
375 - await act(async () => {
375 + await act(() => {
376 root.render(
377 <React.StrictMode>
378 <Uppercased text="goodbye" />
@@ -407,7 +407,7 @@ describe('ReactStrictMode', () => {
407 const root = ReactDOMClient.createRoot(container);
408
409 // Mount
410 - await act(async () => {
410 + await act(() => {
411 root.render(
412 <React.StrictMode>
413 <Uppercased text="hello" />
@@ -429,7 +429,7 @@ describe('ReactStrictMode', () => {
429 log = [];
430
431 // Update
432 - await act(async () => {
432 + await act(() => {
433 root.render(
434 <React.StrictMode>
435 <Uppercased text="goodbye" />
@@ -463,7 +463,7 @@ describe('ReactStrictMode', () => {
463 const container = document.createElement('div');
464 const root = ReactDOMClient.createRoot(container);
465
466 - await act(async () => {
466 + await act(() => {
467 root.render(
468 <React.StrictMode>
469 <App />
@@ -472,7 +472,7 @@ describe('ReactStrictMode', () => {
472 });
473 expect(container.textContent).toBe('0');
474
475 - await act(async () => {
475 + await act(() => {
476 setCount(() => {
477 log.push('Compute count: 1');
478 return 1;
@@ -501,7 +501,7 @@ describe('ReactStrictMode', () => {
501 const container = document.createElement('div');
502 const root = ReactDOMClient.createRoot(container);
503
504 - await act(async () => {
504 + await act(() => {
505 root.render(
506 <React.StrictMode>
507 <App />
@@ -510,7 +510,7 @@ describe('ReactStrictMode', () => {
510 });
511 expect(container.textContent).toBe('0');
512
513 - await act(async () => {
513 + await act(() => {
514 dispatch(1);
515 });
516 expect(container.textContent).toBe('1');
packages/use-subscription/src/__tests__/useSubscription-test.js
+23 -29
@@ -81,7 +81,7 @@ describe('useSubscription', () => {
81
82 const observable = createBehaviorSubject();
83 let renderer;
84 - await act(async () => {
84 + await act(() => {
85 renderer = ReactTestRenderer.create(
86 <Subscription source={observable} />,
87 {unstable_isConcurrent: true},
@@ -90,14 +90,14 @@ describe('useSubscription', () => {
90 assertLog(['default']);
91
92 // Updates while subscribed should re-render the child component
93 - await act(async () => observable.next(123));
93 + await act(() => observable.next(123));
94 assertLog([123]);
95 - await act(async () => observable.next('abc'));
95 + await act(() => observable.next('abc'));
96 assertLog(['abc']);
97
98 // Unmounting the subscriber should remove listeners
99 - await act(async () => renderer.update(<div />));
100 - await act(async () => observable.next(456));
99 + await act(() => renderer.update(<div />));
100 + await act(() => observable.next(456));
101 await waitForAll([]);
102 });
103
@@ -133,23 +133,21 @@ describe('useSubscription', () => {
133
134 let observable = createReplaySubject('initial');
135 let renderer;
136 - await act(async () => {
136 + await act(() => {
137 renderer = ReactTestRenderer.create(
138 <Subscription source={observable} />,
139 {unstable_isConcurrent: true},
140 );
141 });
142 assertLog(['initial']);
143 - await act(async () => observable.next('updated'));
143 + await act(() => observable.next('updated'));
144 assertLog(['updated']);
145
146 await waitForAll([]);
147
148 // Unsetting the subscriber prop should reset subscribed values
149 observable = createReplaySubject(undefined);
150 - await act(async () =>
151 - renderer.update(<Subscription source={observable} />),
152 - );
150 + await act(() => renderer.update(<Subscription source={observable} />));
151 assertLog(['default']);
152 });
153
@@ -184,7 +182,7 @@ describe('useSubscription', () => {
182 expect(subscriptions).toHaveLength(0);
183
184 let renderer;
187 - await act(async () => {
185 + await act(() => {
186 renderer = ReactTestRenderer.create(
187 <Subscription source={observableA} />,
188 {unstable_isConcurrent: true},
@@ -197,20 +195,18 @@ describe('useSubscription', () => {
195 expect(subscriptions[0]).toBe(observableA);
196
197 // Unsetting the subscriber prop should reset subscribed values
200 - await act(async () =>
201 - renderer.update(<Subscription source={observableB} />),
202 - );
198 + await act(() => renderer.update(<Subscription source={observableB} />));
199
200 assertLog(['b-0']);
201 expect(subscriptions).toHaveLength(2);
202 expect(subscriptions[1]).toBe(observableB);
203
204 // Updates to the old subscribable should not re-render the child component
209 - await act(async () => observableA.next('a-1'));
205 + await act(() => observableA.next('a-1'));
206 await waitForAll([]);
207
208 // Updates to the bew subscribable should re-render the child component
213 - await act(async () => observableB.next('b-1'));
209 + await act(() => observableB.next('b-1'));
210 assertLog(['b-1']);
211
212 expect(subscriptions).toHaveLength(2);
@@ -245,7 +241,7 @@ describe('useSubscription', () => {
241 expect(subscriptions).toHaveLength(0);
242
243 let renderer;
248 - await act(async () => {
244 + await act(() => {
245 renderer = ReactTestRenderer.create(
246 <Subscription source={observableA} />,
247 {unstable_isConcurrent: true},
@@ -258,19 +254,17 @@ describe('useSubscription', () => {
254 expect(subscriptions[0]).toBe(observableA);
255
256 // Unsetting the subscriber prop should reset subscribed values
261 - await act(async () =>
262 - renderer.update(<Subscription source={observableB} />),
263 - );
257 + await act(() => renderer.update(<Subscription source={observableB} />));
258 assertLog(['b-0']);
259 expect(subscriptions).toHaveLength(2);
260 expect(subscriptions[1]).toBe(observableB);
261
262 // Updates to the old subscribable should not re-render the child component
269 - await act(async () => observableA.next('a-1'));
263 + await act(() => observableA.next('a-1'));
264 await waitForAll([]);
265
266 // Updates to the bew subscribable should re-render the child component
273 - await act(async () => observableB.next('b-1'));
267 + await act(() => observableB.next('b-1'));
268 assertLog(['b-1']);
269
270 expect(subscriptions).toHaveLength(2);
@@ -335,7 +329,7 @@ describe('useSubscription', () => {
329 const observableB = createBehaviorSubject('b-0');
330
331 let renderer;
338 - await act(async () => {
332 + await act(() => {
333 renderer = ReactTestRenderer.create(<Parent observed={observableA} />, {
334 unstable_isConcurrent: true,
335 });
@@ -359,7 +353,7 @@ describe('useSubscription', () => {
353 });
354
355 // Update again
362 - await act(async () => renderer.update(<Parent observed={observableA} />));
356 + await act(() => renderer.update(<Parent observed={observableA} />));
357
358 // Flush everything and ensure that the correct subscribable is used
359 // We expect the last emitted update to be rendered (because of the commit phase value check)
@@ -438,7 +432,7 @@ describe('useSubscription', () => {
432 const observableB = createBehaviorSubject('b-0');
433
434 let renderer;
441 - await act(async () => {
435 + await act(() => {
436 renderer = ReactTestRenderer.create(<Parent observed={observableA} />, {
437 unstable_isConcurrent: true,
438 });
@@ -480,7 +474,7 @@ describe('useSubscription', () => {
474
475 // Updates from the new subscribable should be ignored.
476 log.splice(0);
483 - await act(async () => observableB.next('b-1'));
477 + await act(() => observableB.next('b-1'));
478 await waitForAll([]);
479 expect(log).toEqual([]);
480 });
@@ -535,7 +529,7 @@ describe('useSubscription', () => {
529 });
530
531 let renderer;
538 - await act(async () => {
532 + await act(() => {
533 renderer = ReactTestRenderer.create(
534 <Subscription source={eventHandler} />,
535 {unstable_isConcurrent: true},
@@ -569,7 +563,7 @@ describe('useSubscription', () => {
563 }
564
565 let renderer;
572 - await act(async () => {
566 + await act(() => {
567 renderer = ReactTestRenderer.create(
568 <Subscription subscription={subscription1} />,
569 {unstable_isConcurrent: true},
@@ -577,7 +571,7 @@ describe('useSubscription', () => {
571 });
572 await waitForAll([]);
573
580 - await act(async () =>
574 + await act(() =>
575 renderer.update(<Subscription subscription={subscription2} />),
576 );
577 await waitForAll([]);
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js
+4 -4
@@ -117,7 +117,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
117 }
118
119 const root = ReactNoop.createRoot();
120 - await act(async () => {
120 + await act(() => {
121 root.render(<App />);
122 });
123 assertLog(['client']);
@@ -161,13 +161,13 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
161 }
162
163 const root = ReactNoop.createRoot();
164 - await act(async () => root.render(<App />));
164 + await act(() => root.render(<App />));
165
166 assertLog(['A0', 'B0']);
167 expect(root).toMatchRenderedOutput('A0B0');
168
169 // Update b but not a
170 - await act(async () => {
170 + await act(() => {
171 store.set({a: 0, b: 1});
172 });
173 // Only b re-renders
@@ -175,7 +175,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
175 expect(root).toMatchRenderedOutput('A0B1');
176
177 // Update a but not b
178 - await act(async () => {
178 + await act(() => {
179 store.set({a: 1, b: 1});
180 });
181 // Only a re-renders
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js
+41 -41
@@ -142,12 +142,12 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
142
143 const container = document.createElement('div');
144 const root = createRoot(container);
145 - await act(async () => root.render(<App />));
145 + await act(() => root.render(<App />));
146
147 assertLog(['Initial']);
148 expect(container.textContent).toEqual('Initial');
149
150 - await act(async () => {
150 + await act(() => {
151 store.set('Updated');
152 });
153 assertLog(['Updated']);
@@ -164,13 +164,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
164
165 const container = document.createElement('div');
166 const root = createRoot(container);
167 - await act(async () => root.render(<App />));
167 + await act(() => root.render(<App />));
168
169 assertLog(['Initial']);
170 expect(container.textContent).toEqual('Initial');
171
172 // Update to the same value
173 - await act(async () => {
173 + await act(() => {
174 store.set('Initial');
175 });
176 // Should not re-render
@@ -192,19 +192,19 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
192
193 const container = document.createElement('div');
194 const root = createRoot(container);
195 - await act(async () => root.render(<App />));
195 + await act(() => root.render(<App />));
196
197 assertLog([0]);
198 expect(container.textContent).toEqual('0');
199
200 - await act(async () => {
200 + await act(() => {
201 storeA.set(1);
202 });
203 assertLog([1]);
204 expect(container.textContent).toEqual('1');
205
206 // Switch stores and update in the same batch
207 - await act(async () => {
207 + await act(() => {
208 ReactDOM.flushSync(() => {
209 // This update will be disregarded
210 storeA.set(2);
@@ -216,7 +216,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
216 expect(container.textContent).toEqual('0');
217
218 // Update A
219 - await act(async () => {
219 + await act(() => {
220 storeA.set(3);
221 });
222 // Nothing happened, because we're no longer subscribed to A
@@ -224,7 +224,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
224 expect(container.textContent).toEqual('0');
225
226 // Update B
227 - await act(async () => {
227 + await act(() => {
228 storeB.set(1);
229 });
230 assertLog([1]);
@@ -254,13 +254,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
254
255 const container = document.createElement('div');
256 const root = createRoot(container);
257 - await act(async () => root.render(<App />));
257 + await act(() => root.render(<App />));
258
259 assertLog(['A0', 'B0']);
260 expect(container.textContent).toEqual('A0B0');
261
262 // Update b but not a
263 - await act(async () => {
263 + await act(() => {
264 store.set({a: 0, b: 1});
265 });
266 // Only b re-renders
@@ -268,7 +268,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
268 expect(container.textContent).toEqual('A0B1');
269
270 // Update a but not b
271 - await act(async () => {
271 + await act(() => {
272 store.set({a: 1, b: 1});
273 });
274 // Only a re-renders
@@ -295,7 +295,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
295
296 const container = document.createElement('div');
297 const root = createRoot(container);
298 - await act(async () => root.render(<App />));
298 + await act(() => root.render(<App />));
299 assertLog([0, 'Passive effect: 0']);
300
301 // Schedule an update. We'll intentionally not use `act` so that we can
@@ -365,11 +365,11 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
365
366 const container = document.createElement('div');
367 const root = createRoot(container);
368 - await act(async () => root.render(<App />));
368 + await act(() => root.render(<App />));
369 assertLog(['A1']);
370 expect(container.textContent).toEqual('A1');
371
372 - await act(async () => {
372 + await act(() => {
373 // Change getSnapshot and update the store in the same batch
374 setStep(1);
375 });
@@ -423,13 +423,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
423
424 const container = document.createElement('div');
425 const root = createRoot(container);
426 - await act(async () => root.render(<App />));
426 + await act(() => root.render(<App />));
427 assertLog(['A1']);
428 expect(container.textContent).toEqual('A1');
429
430 // This will cause a layout effect, and in the layout effect we'll update
431 // the store
432 - await act(async () => {
432 + await act(() => {
433 setStep(1);
434 });
435 assertLog([
@@ -463,7 +463,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
463
464 const container = document.createElement('div');
465 const root = createRoot(container);
466 - await act(async () =>
466 + await act(() =>
467 root.render(
468 <>
469 <Child1 />
@@ -474,7 +474,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
474 assertLog([0, 0]);
475 expect(container.textContent).toEqual('00');
476
477 - await act(async () => {
477 + await act(() => {
478 store.set(1);
479 });
480 assertLog([1, 1, 'Reset back to 0', 0, 0]);
@@ -497,11 +497,11 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
497
498 const container = document.createElement('div');
499 const root = createRoot(container);
500 - await act(async () => root.render(<App />));
500 + await act(() => root.render(<App />));
501 assertLog([0]);
502
503 // Update the store and getSnapshot at the same time
504 - await act(async () => {
504 + await act(() => {
505 ReactDOM.flushSync(() => {
506 setGetSnapshot(() => getSnapshotB);
507 store.set({a: 1, b: 2});
@@ -546,7 +546,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
546 const errorBoundary = React.createRef(null);
547 const container = document.createElement('div');
548 const root = createRoot(container);
549 - await act(async () =>
549 + await act(() =>
550 root.render(
551 <ErrorBoundary ref={errorBoundary}>
552 <App />
@@ -557,7 +557,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
557 expect(container.textContent).toEqual('0');
558
559 // Update that throws in a getSnapshot. We can catch it with an error boundary.
560 - await act(async () => {
560 + await act(() => {
561 store.set({value: 1, throwInGetSnapshot: true, throwInIsEqual: false});
562 });
563 if (gate(flags => !flags.enableUseSyncExternalStoreShim)) {
@@ -612,15 +612,15 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
612
613 // Initial render that reads a snapshot of NaN. This is OK because we use
614 // Object.is algorithm to compare values.
615 - await act(async () => root.render(<App />));
615 + await act(() => root.render(<App />));
616 expect(container.textContent).toEqual('NaN');
617
618 // Update to real number
619 - await act(async () => store.set(123));
619 + await act(() => store.set(123));
620 expect(container.textContent).toEqual('123');
621
622 // Update back to NaN
623 - await act(async () => store.set('not a number'));
623 + await act(() => store.set('not a number'));
624 expect(container.textContent).toEqual('NaN');
625 });
626
@@ -648,13 +648,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
648
649 const container = document.createElement('div');
650 const root = createRoot(container);
651 - await act(async () => root.render(<App />));
651 + await act(() => root.render(<App />));
652
653 assertLog(['App', 'Selector', 'A0']);
654 expect(container.textContent).toEqual('A0');
655
656 // Update the store
657 - await act(async () => {
657 + await act(() => {
658 store.set({a: 1, b: 0});
659 });
660 assertLog([
@@ -707,13 +707,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
707
708 const container = document.createElement('div');
709 const root = createRoot(container);
710 - await act(async () => root.render(<App />));
710 + await act(() => root.render(<App />));
711
712 assertLog(['A0', 'B0']);
713 expect(container.textContent).toEqual('A0B0');
714
715 // Update b but not a
716 - await act(async () => {
716 + await act(() => {
717 store.set({a: 0, b: 1});
718 });
719 // Only b re-renders
@@ -721,7 +721,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
721 expect(container.textContent).toEqual('A0B1');
722
723 // Update a but not b
724 - await act(async () => {
724 + await act(() => {
725 store.set({a: 1, b: 1});
726 });
727 // Only a re-renders
@@ -754,7 +754,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
754 const serverRenderedDiv = container.getElementsByTagName('div')[0];
755
756 if (gate(flags => !flags.enableUseSyncExternalStoreShim)) {
757 - await act(async () => {
757 + await act(() => {
758 ReactDOMClient.hydrateRoot(container, <App />);
759 });
760 assertLog([
@@ -770,7 +770,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
770 // currently hydrating, so `getServerSnapshot` is not called on the
771 // client. To avoid this server mismatch warning, user must account for
772 // this themselves and return the correct value inside `getSnapshot`.
773 - await act(async () => {
773 + await act(() => {
774 expect(() => ReactDOM.hydrate(<App />, container)).toErrorDev(
775 'Text content did not match',
776 );
@@ -797,12 +797,12 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
797
798 const container = document.createElement('div');
799 const root = createRoot(container);
800 - await act(async () => root.render(<App />));
800 + await act(() => root.render(<App />));
801
802 assertLog(['INITIAL']);
803 expect(container.textContent).toEqual('INITIAL');
804
805 - await act(async () => {
805 + await act(() => {
806 store.set('Updated');
807 });
808 assertLog(['UPDATED']);
@@ -860,12 +860,12 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
860
861 const container = document.createElement('div');
862 const root = createRoot(container);
863 - await act(async () => {
863 + await act(() => {
864 root.render(<App step={0} />);
865 });
866 assertLog(['Inline selector', 'A', 'B', 'C', 'Sibling: 0']);
867
868 - await act(async () => {
868 + await act(() => {
869 root.render(<App step={1} />);
870 });
871 assertLog([
@@ -920,7 +920,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
920
921 const container = document.createElement('div');
922 const root = createRoot(container);
923 - await act(async () =>
923 + await act(() =>
924 root.render(
925 <ErrorBoundary>
926 <App />
@@ -931,7 +931,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
931 expect(container.textContent).toEqual('A');
932
933 await expect(async () => {
934 - await act(async () => {
934 + await act(() => {
935 store.set({});
936 });
937 }).toWarnDev(
@@ -965,7 +965,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
965
966 const container = document.createElement('div');
967 const root = createRoot(container);
968 - await act(async () =>
968 + await act(() =>
969 root.render(
970 <ErrorBoundary>
971 <App />
@@ -976,7 +976,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
976 expect(container.textContent).toEqual('A');
977
978 await expect(async () => {
979 - await act(async () => {
979 + await act(() => {
980 store.set({});
981 });
982 }).toWarnDev(