Skip to content

feat(hot)!: the hot runtime is the native engine's default - #739

Draft
danfry1 wants to merge 4 commits into
mainfrom
feat/library-setup-files
Draft

danfry1 wants to merge 4 commits into
mainfrom
feat/library-setup-files

Conversation

@danfry1

@danfry1 danfry1 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Under the native engine, hotRuntime now defaults to 'auto': workers stay alive across test files where the run can be bounded, and each file keeps a fresh worker elsewhere. hotRuntime: false keeps 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: unset hotRuntime is '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 in native-unit.test.ts). The "kept default isolation" warning still prints when the option is set or diagnostics is on.
  • Docs: every place that described per-file isolation as the default now describes 'auto' and the false opt-out. That covers the hot runtime, plugin options, engines, troubleshooting, errors, comparison, both migration guides, versioning.md, both READMEs, llms.txt and the hotRuntime type doc. New page: "Upgrading to 0.16".
  • init and migrate print the new default and the opt-out.
  • Tests that asserted per-file by default: two native-unit tests and the cold-cache case in registry-process, whose background registry build is per-file only. Also the landing page's recorded run, whose banner now names the hot runtime.

Notes

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.
@danfry1 danfry1 added this to the 0.16.0 milestone Nov 9, 2026
@danfry1 danfry1 added enhancement New feature or request area:hot-runtime hotRuntime: worker reuse, per-file reset, memory plan breaking Changes or removes supported behaviour; needs an upgrade note labels Nov 9, 2026
@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

Deployment failed for project vitest-native with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/danfry1s-projects?upgradeToPro=build-rate-limit

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:hot-runtime hotRuntime: worker reuse, per-file reset, memory plan breaking Changes or removes supported behaviour; needs an upgrade note enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant