);
// Now we can client render it instead.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
[
@@ -684,7 +694,7 @@ describe('ReactDOMFizzServer', () => {
expect(getVisibleChildren(container)).toEqual(
Loading...
);
// Now we can client render it instead.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
@@ -843,7 +853,7 @@ describe('ReactDOMFizzServer', () => {
expect(getVisibleChildren(container)).toEqual(
Loading...
);
// Now we can client render it instead.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
@@ -1161,7 +1171,7 @@ describe('ReactDOMFizzServer', () => {
});
// We still can't render it on the client.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
[
@@ -1883,7 +1893,7 @@ describe('ReactDOMFizzServer', () => {
expect(getVisibleChildren(container)).toEqual(
Loading...
);
// That will let us client render it instead.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
[
@@ -2139,7 +2149,7 @@ describe('ReactDOMFizzServer', () => {
);
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['server']);
+ assertLog(['server']);
ReactDOMClient.hydrateRoot(container, , {
onRecoverableError(error) {
@@ -2149,9 +2159,9 @@ describe('ReactDOMFizzServer', () => {
},
});
- expect(() => {
+ await expect(async () => {
// The first paint switches to client rendering due to mismatch
- expect(Scheduler).toFlushUntilNextPaint([
+ await waitForPaint([
'client',
'Log recoverable error: Hydration failed because the initial ' +
'UI does not match what was rendered on the server.',
@@ -2224,7 +2234,7 @@ describe('ReactDOMFizzServer', () => {
);
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['server']);
+ assertLog(['server']);
ReactDOMClient.hydrateRoot(container, , {
onRecoverableError(error) {
@@ -2235,9 +2245,9 @@ describe('ReactDOMFizzServer', () => {
});
// The first paint uses the client due to mismatch forcing client render
- expect(() => {
+ await expect(async () => {
// The first paint switches to client rendering due to mismatch
- expect(Scheduler).toFlushUntilNextPaint([
+ await waitForPaint([
'client',
'Log recoverable error: Hydration failed because the initial ' +
'UI does not match what was rendered on the server.',
@@ -2304,7 +2314,7 @@ describe('ReactDOMFizzServer', () => {
const {pipe} = renderToPipeableStream();
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['Yay!']);
+ assertLog(['Yay!']);
const span = container.getElementsByTagName('span')[0];
@@ -2319,8 +2329,8 @@ describe('ReactDOMFizzServer', () => {
// An error logged but instead of surfacing it to the UI, we switched
// to client rendering.
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Yay!',
'Hydration error',
'There was an error while hydrating. Because the error happened ' +
@@ -2394,7 +2404,7 @@ describe('ReactDOMFizzServer', () => {
const {pipe} = renderToPipeableStream();
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['Yay!']);
+ assertLog(['Yay!']);
const [span1, span2, span3] = container.getElementsByTagName('span');
@@ -2409,7 +2419,7 @@ describe('ReactDOMFizzServer', () => {
// An error logged but instead of surfacing it to the UI, we switched
// to client rendering.
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Yay!',
'Hydration error',
'There was an error while hydrating this Suspense boundary. Switched to client rendering.',
@@ -2484,7 +2494,7 @@ describe('ReactDOMFizzServer', () => {
const {pipe} = renderToPipeableStream();
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['Yay!']);
+ assertLog(['Yay!']);
// Hydrate the tree. Child will throw during render.
isClient = true;
@@ -2497,7 +2507,7 @@ describe('ReactDOMFizzServer', () => {
// Because we failed to recover from the error, onRecoverableError
// shouldn't be called.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual('Oops!');
expectErrors(errors, [], []);
@@ -2541,7 +2551,7 @@ describe('ReactDOMFizzServer', () => {
});
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['[s!] Oops.']);
+ assertLog(['[s!] Oops.']);
// The server could not complete this boundary, so we'll retry on the client.
const serverFallback = container.getElementsByTagName('p')[0];
@@ -2555,7 +2565,7 @@ describe('ReactDOMFizzServer', () => {
},
});
// This should not report any errors yet.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
Loading...
@@ -2573,7 +2583,7 @@ describe('ReactDOMFizzServer', () => {
await act(async () => {
resolveText('Yay!');
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Yay!',
'[c!] The server could not finish this Suspense boundary, ' +
'likely due to an error during server rendering. ' +
@@ -2626,7 +2636,7 @@ describe('ReactDOMFizzServer', () => {
});
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['[s!] Oops.']);
+ assertLog(['[s!] Oops.']);
// The server could not complete this boundary, so we'll retry on the client.
const serverFallback = container.getElementsByTagName('p')[0];
@@ -2640,7 +2650,7 @@ describe('ReactDOMFizzServer', () => {
},
});
// This should not report any errors yet.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
Loading...
@@ -2667,7 +2677,7 @@ describe('ReactDOMFizzServer', () => {
await act(async () => {
resolveText('Yay!');
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Yay! (red)',
'[c!] The server could not finish this Suspense boundary, ' +
'likely due to an error during server rendering. ' +
@@ -2727,7 +2737,7 @@ describe('ReactDOMFizzServer', () => {
);
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['[s!] Oops.']);
+ assertLog(['[s!] Oops.']);
const serverFallback = container.getElementsByTagName('p')[0];
expect(serverFallback.innerHTML).toBe('Loading...');
@@ -2744,7 +2754,7 @@ describe('ReactDOMFizzServer', () => {
},
);
// This should not report any errors yet.
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
Loading...
@@ -2763,7 +2773,7 @@ describe('ReactDOMFizzServer', () => {
root.render();
Scheduler.unstable_flushAll();
jest.runAllTimers();
- expect(Scheduler).toHaveYielded([
+ assertLog([
'[c!] The server could not finish this Suspense boundary, ' +
'likely due to an error during server rendering. ' +
'Switched to client rendering.',
@@ -2781,7 +2791,7 @@ describe('ReactDOMFizzServer', () => {
await act(async () => {
resolveText('Yay!');
});
- expect(Scheduler).toFlushAndYield(['Yay!']);
+ await waitForAll(['Yay!']);
expect(getVisibleChildren(container)).toEqual(
Yay!
@@ -2849,7 +2859,7 @@ describe('ReactDOMFizzServer', () => {
const {pipe} = renderToPipeableStream();
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['Yay!']);
+ assertLog(['Yay!']);
const [span1, span2, span3] = container.getElementsByTagName('span');
@@ -2864,7 +2874,7 @@ describe('ReactDOMFizzServer', () => {
// An error logged but instead of surfacing it to the UI, we switched
// to client rendering.
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Hydration error',
'There was an error while hydrating this Suspense boundary. Switched ' +
'to client rendering.',
@@ -2880,7 +2890,7 @@ describe('ReactDOMFizzServer', () => {
await act(async () => {
resolveText('Yay!');
});
- expect(Scheduler).toFlushAndYield(['Yay!']);
+ await waitForAll(['Yay!']);
expect(getVisibleChildren(container)).toEqual(
@@ -2937,13 +2947,13 @@ describe('ReactDOMFizzServer', () => {
});
// Partially render A, but yield before the render has finished
- expect(Scheduler).toFlushAndYieldThrough(['Oops!', 'Oops!']);
+ await waitFor(['Oops!', 'Oops!']);
// React will try rendering again synchronously. During the retry, A will
// not throw. This simulates a concurrent data race that is fixed by
// blocking the main thread.
shouldThrow = false;
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
// Finish initial render attempt
'B',
@@ -3001,7 +3011,7 @@ describe('ReactDOMFizzServer', () => {
const {pipe} = renderToPipeableStream();
pipe(writable);
});
- expect(Scheduler).toHaveYielded(['A', 'B']);
+ assertLog(['A', 'B']);
// Hydrate the tree. Child will throw during hydration, but not when it
// falls back to client rendering.
@@ -3014,7 +3024,7 @@ describe('ReactDOMFizzServer', () => {
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'A',
'B',
@@ -3151,7 +3161,7 @@ describe('ReactDOMFizzServer', () => {
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
@@ -3232,7 +3242,7 @@ describe('ReactDOMFizzServer', () => {
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expectErrors(
errors,
@@ -3299,7 +3309,7 @@ describe('ReactDOMFizzServer', () => {
},
},
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
});
describe('error escaping', () => {
@@ -3442,7 +3452,7 @@ describe('ReactDOMFizzServer', () => {
errors.push({error, errorInfo});
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
// If escaping were not done we would get a message that says "bad hash"
expectErrors(
@@ -3729,7 +3739,7 @@ describe('ReactDOMFizzServer', () => {
// Now that the boundary resolves to it's children the hydration completes and discovers that there is a mismatch requiring
// client-side rendering.
await clientResolve();
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
A
@@ -3808,8 +3818,8 @@ describe('ReactDOMFizzServer', () => {
// Now that the boundary resolves to it's children the hydration completes and discovers that there is a mismatch requiring
// client-side rendering.
await clientResolve();
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Logged recoverable error: Text content does not match server-rendered HTML.',
'Logged recoverable error: There was an error while hydrating this Suspense boundary. Switched to client rendering.',
]);
@@ -3823,7 +3833,7 @@ describe('ReactDOMFizzServer', () => {
,
);
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
});
// @gate enableClientRenderFallbackOnTextMismatch
@@ -3867,7 +3877,7 @@ describe('ReactDOMFizzServer', () => {
);
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Logged recoverable error: Text content does not match server-rendered HTML.',
'Logged recoverable error: Text content does not match server-rendered HTML.',
'Logged recoverable error: Text content does not match server-rendered HTML.',
@@ -3882,7 +3892,7 @@ describe('ReactDOMFizzServer', () => {
,
);
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
if (__DEV__) {
expect(mockError.mock.calls.length).toBe(1);
expect(mockError.mock.calls[0]).toEqual([
@@ -3958,7 +3968,7 @@ describe('ReactDOMFizzServer', () => {
);
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'Logged recoverable error: uh oh',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
@@ -3973,7 +3983,7 @@ describe('ReactDOMFizzServer', () => {
,
);
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
});
// @gate __DEV__
@@ -4050,7 +4060,7 @@ describe('ReactDOMFizzServer', () => {
);
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'throwing: first error',
// this repeated first error is the invokeGuardedCallback throw
'throwing: first error',
@@ -4081,7 +4091,7 @@ describe('ReactDOMFizzServer', () => {
,
);
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(mockError.mock.calls).toEqual([]);
} finally {
console.error = originalConsoleError;
@@ -4181,7 +4191,7 @@ describe('ReactDOMFizzServer', () => {
);
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'suspending',
'throwing: first error',
// There is no repeated first error because we already suspended and no
@@ -4202,7 +4212,7 @@ describe('ReactDOMFizzServer', () => {
await unsuspend();
// Since our client components only throw on the very first render there are no
// new throws in this pass
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(mockError.mock.calls).toEqual([]);
} finally {
@@ -4304,7 +4314,7 @@ describe('ReactDOMFizzServer', () => {
);
},
});
- expect(Scheduler).toFlushAndYield([
+ await waitForAll([
'throwing: first error',
// duplicate because first error is re-done in invokeGuardedCallback
'throwing: first error',
@@ -4331,7 +4341,7 @@ describe('ReactDOMFizzServer', () => {
await unsuspend();
// Since our client components only throw on the very first render there are no
// new throws in this pass
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(mockError.mock.calls).toEqual([]);
} finally {
console.error = originalConsoleError;
@@ -4365,7 +4375,7 @@ describe('ReactDOMFizzServer', () => {
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(errors).toEqual([]);
expect(getVisibleChildren(container)).toEqual(
',
@@ -155,7 +159,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
// The text mismatch should be *silently* fixed. Even in production.
expect(getVisibleChildren(container)).toEqual(
@@ -236,8 +240,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
@@ -283,7 +287,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
{'Client'}
@@ -319,8 +323,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
@@ -367,8 +371,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
@@ -418,8 +422,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
@@ -467,8 +471,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
@@ -521,7 +525,7 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(Scheduler).toFlushAndYield([]);
+ await waitForAll([]);
expect(getVisibleChildren(container)).toEqual(
@@ -591,8 +595,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
@@ -637,8 +641,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
- expect(() => {
- expect(Scheduler).toFlushAndYield([
+ await expect(async () => {
+ await waitForAll([
'Hydration failed because the initial UI does not match what was rendered on the server.',
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
]);
diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
index 5be13e9cdac68..eebc2f078ead0 100644
--- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
@@ -33,6 +33,8 @@ let buffer = '';
let hasErrored = false;
let fatalError = undefined;
let renderOptions;
+let waitForAll;
+let assertLog;
function resetJSDOM(markup) {
// Test Environment
@@ -63,6 +65,10 @@ describe('ReactDOMFloat', () => {
Stream = require('stream');
Suspense = React.Suspense;
+ const InternalTestUtils = require('internal-test-utils');
+ waitForAll = InternalTestUtils.waitForAll;
+ assertLog = InternalTestUtils.assertLog;
+
textCache = new Map();
resetJSDOM('
');
@@ -259,10 +265,14 @@ describe('ReactDOMFloat', () => {
root.render(children);
return expect(() => {
try {
- expect(Scheduler).toFlushWithoutYielding();
+ // TODO: Migrate this to waitForAll()
+ Scheduler.unstable_flushAll();
+ assertLog([]);
} catch (e) {
try {
- expect(Scheduler).toFlushWithoutYielding();
+ // TODO: Migrate this to waitForAll()
+ Scheduler.unstable_flushAll();
+ assertLog([]);
} catch (f) {}
}
});
@@ -283,11 +293,11 @@ describe('ReactDOMFloat', () => {
>,
);
try {
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
} catch (e) {
// for DOMExceptions that happen when expecting this test to fail we need
// to clear the scheduler first otherwise the expected failure will fail
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
throw e;
}
expect(getMeaningfulChildren(document)).toEqual(
@@ -351,7 +361,7 @@ describe('ReactDOMFloat', () => {
foo
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -476,7 +486,7 @@ describe('ReactDOMFloat', () => {
>,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -494,7 +504,7 @@ describe('ReactDOMFloat', () => {
>,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
// we don't see the attribute because the resource is the same and was not reconstructed
expect(getMeaningfulChildren(document)).toEqual(
@@ -671,7 +681,7 @@ describe('ReactDOMFloat', () => {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -968,7 +978,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -1107,7 +1117,7 @@ body {
errors.push(err.digest);
},
});
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -1157,7 +1167,7 @@ body {
Hello
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -1627,7 +1637,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -1649,7 +1659,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -1694,7 +1704,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -2327,8 +2337,8 @@ body {
);
const root = ReactDOMClient.hydrateRoot(document, );
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev([
'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered something with type "object" as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered something with type "object" as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
@@ -2343,8 +2353,8 @@ body {
);
root.render();
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev([
'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered something with type "object" as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered something with type "object" as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
@@ -2397,8 +2407,8 @@ body {
);
const root = ReactDOMClient.hydrateRoot(document, );
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev(
'ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered something with type "boolean" instead. Try removing this option or passing a string value instead.',
);
@@ -2414,8 +2424,8 @@ body {
);
root.render();
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev(
'ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered something with type "boolean" instead. Try removing this option or passing a string value instead.',
);
@@ -2502,7 +2512,7 @@ body {
);
}
ReactDOMClient.hydrateRoot(document, );
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -2724,7 +2734,7 @@ body {
}
ReactDOMClient.hydrateRoot(document, );
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -2754,7 +2764,7 @@ body {
const root = ReactDOMClient.createRoot(document);
root.render();
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -2829,7 +2839,7 @@ body {
}
ReactDOMClient.hydrateRoot(document, );
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -2858,7 +2868,7 @@ body {
const root = ReactDOMClient.createRoot(document);
root.render();
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3050,7 +3060,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3088,7 +3098,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3171,7 +3181,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3206,7 +3216,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
root.render(
@@ -3214,7 +3224,7 @@ body {
hello world
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3256,8 +3266,8 @@ body {
},
},
);
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev(
[
'Warning: Text content did not match. Server: "server" Client: "client"',
@@ -3308,8 +3318,8 @@ body {
},
},
);
- expect(() => {
- expect(Scheduler).toFlushWithoutYielding();
+ await expect(async () => {
+ await waitForAll([]);
}).toErrorDev(
[
'Warning: Text content did not match. Server: "server" Client: "client"',
@@ -3342,7 +3352,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3364,7 +3374,7 @@ body {
,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
// The reason we do not see preloads in the head is they are inserted synchronously
// during render and then when the new singleton mounts it resets it's content, retaining only styles
expect(getMeaningfulChildren(document)).toEqual(
@@ -3401,7 +3411,7 @@ body {
container
>,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3461,7 +3471,7 @@ body {
container
>,
);
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3533,7 +3543,7 @@ body {
);
}
root.render();
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3596,7 +3606,7 @@ body {
container = document.getElementById('container');
const root = ReactDOMClient.createRoot(container);
root.render();
- expect(Scheduler).toFlushWithoutYielding();
+ await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
@@ -3672,7 +3682,7 @@ body {