Repository navigation
Conversation
Libraries ship their test support for Jest: setup files that call jest.mock for their native modules, and mocks that call jest.fn or import @jest/globals. Under Vitest such a file got vi, whose mock never reaches Node's require, so it changed nothing. Each support file now gets a jest of its own that registers in the Node-side registry, and jest.requireActual of a package a preset shadows is the package.
…ted or required An import resolved such a package through its react-native field and a require through main, so a library required by another got a second copy, and a context one copy created was not the other's. A bare require now resolves the react-native field, as Metro and Vite's import do.
…om-sheet and netinfo are their library's own mock under the native engine The hand-written presets drifted from what each library ships for Jest: missing names, different resting values, and hooks that were not mock functions. Under the native engine each is now the library's own mock module, as a Jest suite installs it with jest.mock; the mock engine keeps the hand-written presets.
…heir own Jest setup Their presets replaced the whole package, so gesture-handler 3's hook API, many builder methods and its own test helpers were missing, and the list rendered every row. Each library's own jestSetup.js mocks only its native layer, as under Jest; the native engine now runs it before the project's setup files, and migrate drops it from a migrated config.
|
Deployment failed for project vitest-native with the following error: Learn More: https://vercel.com/danfry1s-projects?upgradeToPro=build-rate-limit |
This was referenced Nov 12, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under the native engine,
hotRuntimenow defaults to'auto': workers stay alive across test files where the run can be bounded, and each file keeps a fresh worker elsewhere.hotRuntime: falsekeeps 0.15's per-file isolation.Why
The hot runtime loads React Native once per worker while each file still gets fresh app and test modules, mocks and timers. Its known differences from per-file isolation are documented, and a suite can opt out with one setting. Making
'auto'the default gives every native-engine suite the hot runtime where it can run safely.Changes
plugin.ts: unsethotRuntimeis'auto'. A default'auto'that falls back to per-file isolation raises no warning. Instead, the engine banner every run prints says so, with the reason:(platform ios, hot runtime declined: 'forks' is explicitly configured)(printEngineBanner, tested innative-unit.test.ts). The "kept default isolation" warning still prints when the option is set ordiagnosticsis on.'auto'and thefalseopt-out. That covers the hot runtime, plugin options, engines, troubleshooting, errors, comparison, both migration guides,versioning.md, both READMEs,llms.txtand thehotRuntimetype doc. New page: "Upgrading to 0.16".initandmigrateprint the new default and the opt-out.native-unittests and the cold-cache case inregistry-process, whose background registry build is per-file only. Also the landing page's recorded run, whose banner now names the hot runtime.Notes
Do not merge yet. This waits for the v0.15.0 tag, and for two rows of the 0.16 hot-default gate that are still open: corpus equivalence (per-test hot vs per-file on the trial apps, pJ) and the speed claim (pK's container method). The museum in both modes, no-hangs, memory and synthetic-parity rows are met.
Unaffected by the flip:
test:native(every tests-native config setshotRuntime) and the bug museum (every native-engine exhibit pins it). The consumer projects leave it unset, so they now run hot, and all pass.Blocked by Hot runtime: an import and a require() of one ES package are two instances, and require(esm) is never re-run per file #722. With the hot runtime as the default, Hot runtime: an import and a require() of one ES package are two instances, and require(esm) is never re-run per file #722 (an ES package reached by both
importandrequire()is two instances in one file, and require(esm) is not re-run per file) becomes a wrong-results bug on the default path. This does not merge until the change for Hot runtime: an import and a require() of one ES package are two instances, and require(esm) is never re-run per file #722 (fix(hot): one instance per test file for an ES package, imported or required #725) has landed.