react/scripts/jest
Josh Story b526a0a419
[Flight][Fizz] schedule work async (#29551)
While most builds of Flight and Fizz schedule work in new tasks some do
execute work synchronously. While this is necessary for legacy APIs like
renderToString for modern APIs there really isn't a great reason to do
this synchronously.

We could schedule works as microtasks but we actually want to yield so
the runtime can run events and other things that will unblock additional
work before starting the next work loop.

This change updates all non-legacy uses to be async using the best
availalble macrotask scheduler.

Browser now uses postMessage
Bun uses setTimeout because while it also supports setImmediate the
scheduling is not as eager as the same API in node
the FB build also uses setTimeout

This change required a number of changes to tests which were utilizing
the sync nature of work in the Browser builds to avoid having to manage
timers and tasks. I added a patch to install MessageChannel which is
required by the browser builds and made this patched version integrate
with the Scheduler mock. This way we can effectively use `act` to flush
flight and fizz work similar to how we do this on the client.
2024-06-06 10:07:24 -07:00
..
devtools fix: gate react/jsx-runtime upgrade only for React >= 17 tests (#28256) 2024-02-06 15:03:36 +00:00
matchers [Fiber] Use Owner/JSX Stack When Appending Stacks to Console (#29206) 2024-05-25 11:58:17 -04:00
spec-equivalence-reporter Migrate testRunner from jasmine2 to jest-circus (#26144) 2023-02-10 13:39:14 -05:00
typescript Use declare const instead of declare var (#28599) 2024-03-22 11:20:18 -04:00
config.base.js Revert "[Tests] Reset modules by default" (#28318) 2024-02-13 11:39:45 -05:00
config.build-devtools.js feat[devtools]: support x_google_ignoreList source maps extension (#26951) 2023-06-21 12:36:48 +01:00
config.build.js New internal testing helpers: waitFor, waitForAll, waitForPaint (#26285) 2023-03-02 21:58:11 -05:00
config.source-persistent.js DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
config.source-www.js DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
config.source-xplat.js Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00
config.source.js DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
dont-run-jest-directly.js Add error when running jest directly (#12726) 2018-05-01 12:46:17 -07:00
jest-cli.js Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00
jest.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
jestSequencer.js Parallelize Jest in CI (#19552) 2020-08-07 16:32:59 -04:00
patchMessageChannel.js [Flight][Fizz] schedule work async (#29551) 2024-06-06 10:07:24 -07:00
patchSetImmediate.js [Flight][Fizz] schedule work async (#29551) 2024-06-06 10:07:24 -07:00
preprocessor.js fix: gate react/jsx-runtime upgrade only for React >= 17 tests (#28256) 2024-02-06 15:03:36 +00:00
ReactDOMServerIntegrationEnvironment.js Use require() to implement script src in tests (#26717) 2023-04-25 09:12:16 -04:00
setupEnvironment.js [Flight][Fizz] schedule work async (#29551) 2024-06-06 10:07:24 -07:00
setupGlobal.js Use toMatchInlineSnapshot for dehydrated values (#20618) 2021-04-26 12:30:34 -04:00
setupHostConfigs.js Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00
setupTests.build.js Enforce that the "react-server" build of "react" is used (#27436) 2023-09-29 18:24:05 -04:00
setupTests.js Track Stack of JSX Calls (#29032) 2024-05-09 12:23:05 -04:00
setupTests.persistent.js Update jest to v26 (#21574) 2021-05-27 16:33:57 +01:00
setupTests.www.js Enable flag disableClientCache (#28846) 2024-04-16 10:59:36 -04:00
setupTests.xplat.js Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00
TestFlags.js Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00