Skip to content

v0.15.0

Choose a tag to compare

@github-actions github-actions released this 14 Nov 13:07
· 46 commits to main since this release
515d0b5

Upgrading from 0.14

  • Node 22.22.3+, 24.12+ or 26+. An older Node stops at startup with UNSUPPORTED_NODE.
  • Vitest 5 and Vite 8. Vitest 4, or Vite 6 or 7, stops at startup with UNSUPPORTED_PEER.
  • React 19, React Native Testing Library 13 or 14, and React Native 0.86+ (Expo SDK 57+) for the
    native engine.
    An older React or React Native stops at startup with UNSUPPORTED_PEER.
  • Snapshots print in Jest's format. Run vitest -u once to re-record existing snapshots,
    then review the diff.
  • jestMockTransform() applies Jest's manual mocks of installed packages (__mocks__/<pkg>),
    as Jest does. Pass jestMockTransform({ rootMocks: false }) to keep the previous behaviour.
  • Run npx vitest-native doctor to check all of these. Each entry below has the details.

Minor Changes

  • 48fc91d: vitest-native compare --hot shows whether hotRuntime: 'auto' changes any test's result in your suite. It runs your Vitest config per file and hot, three times each (one warm-up and two timed runs), plus one hot run with shuffled files and one at --maxWorkers=2. It matches every test by file, name and occurrence, compares failures by kind, and checks the engine's banner, so a declined 'auto' gives no verdict. It lists each test whose result differs. With no differences it prints each mode's median and range, and calls hot faster or slower only when each mode has at least two timed runs and their ranges don't overlap. --runs <n> changes the run count; 2 or fewer give no speed verdict, and --json records each run's role. See the CLI guide. No action needed.

  • 98c62f4: The hot runtime can run React, its renderers, scheduler and RNTL fresh in every file (experimental). Set hotRuntime: { freshRuntime: true } so useId values, React's once-per-process warnings, an act() scope an earlier file left open, the scheduler's timers and RNTL's fake-timer reinstall no longer carry from one file to the next. It costs about 5 ms per file at four workers, and about 17 ms at one. It needs esmGeneration, which is on by default.

  • e4473ae: A test stuck in synchronous code no longer hangs a hot-runtime run forever: the run fails and names the file and test. Vitest's testTimeout can't interrupt a test that never yields, such as a loop that never ends, so such a run used to wait with nothing on screen. The new hangTimeout option fails a run when nothing has made progress for 60 s (or twice the longest test or hook timeout) and every running test is past its own timeout, retries included. Every module a file loads through Vite counts as progress, so a slow cold start is not taken for a hang. The report gives each file's running test and when it started, or how long ago a worker took the file, and when the last module loaded. It's on by default under the hot runtime and off otherwise. Add reactNative({ hangTimeout: <ms> }) to turn it on everywhere, or hangTimeout: false to turn it off.

  • 1cb74f0: Behaviour change: jestMockTransform() applies Jest's manual mocks of node_modules packages. To keep the previous behaviour, pass jestMockTransform({ rootMocks: false }). A file such as __mocks__/moti.ts in a __mocks__ folder under Jest's roots now replaces that package with no jest.mock() call, as under Jest, for imports and require() alike, __mocks__/react-native.js included. Before, the real package ran. A setup file's or test file's own jest.mock() or jest.unmock() still wins.

    • migrate lists each such file and carries over Jest's roots and modulePathIgnorePatterns.
    • A package a preset covers keeps its preset; the run warns that its manual mock is not applied.
  • 41959da: Under jest-compat, View.prototype has the native methods, as React Native's Jest preset gives it. jest.spyOn(View.prototype, 'measure') now reaches every View ref. It used to fail because React Native's View has no prototype. Under the native engine, each native view name now has one host class, so every View ref shares the methods a spy replaces.

    No action needed. Text and ScrollView get no prototype.

  • 23275f8: jest-compat supports jest.replaceProperty(). jest.replaceProperty(Platform, 'OS', 'android') replaces the value in place, as Jest does. It used to throw. The returned handle has replaceValue() and restore(). jest.restoreAllMocks(), the restoreMocks setting and the end of the test file also restore it; vi.restoreAllMocks() does not. It throws Jest's errors for a getter, a function or a missing property.

    No action needed.

  • ece53b3: Files that need a plugin from your project's Babel config now compile with that config, as Metro and babel-jest compile them. Legacy decorators (WatermelonDB models), macros, react-native-dotenv, the worklets plugin, custom plugins and Flow used to fail or behave differently. Remove any babel() entry you added only to run them; set projectBabel: 'never' for the previous behaviour.

    • Only a file that uses such a plugin compiles with Babel; other files keep Oxc.
    • migrate and doctor list these plugins as applied, and doctor calls a babel() entry that repeats one redundant.
    • It needs @babel/core in the project. Without it, migrate, doctor and the mock engine's startup say so.
  • e517388: Behaviour change: snapshots of React Native trees print in Jest's format. Run vitest -u once to re-record existing vitest-native snapshots, then review the diff. vitest-native no longer registers its own serializer. Jest-written snapshots share the format, but ones inside a describe, or of components Jest's preset stubs, still need one re-record (Snapshots).

    • No host prints ref. A host ref, such as a Text ref under the native engine or any host ref under the mock engine, is now an instance with measure, focus and the other native methods, where it used to be the test renderer's node or null.
    • vitest-native/serializer keeps the old format for one release; it is deprecated.
  • a107e3a: New vitest-native compare runs your suite under your own Jest and under Vitest and lists every test whose result differs. Use it while both runners are in place: npx vitest-native compare names each test that passes under Jest but not under Vitest, grouped by its first error, and exits 0 only when every one of them passes and vitest run exits 0. Neither run writes snapshots or changes project files, and --json <file> writes a report without stack traces or absolute paths, for attaching to an issue. See the CLI reference.

  • 4271252: Under the native engine, react-native-gesture-handler and @shopify/flash-list run as themselves, with the jestSetup.js each ships before the project's setup files, as a Jest suite lists them. No action needed; to keep a preset, set presets: { gestureHandler: true } or { flashList: true }.

    • Gesture Handler 3's hook API, builder methods and test helpers work, and a Pressable press fires onPress.
    • A FlashList renders a window of rows, as under Jest, where the preset rendered every row.
    • react-native-gesture-handler/Swipeable and the other modules Gesture Handler 3 does not ship no longer resolve, as under Jest.
  • 4271252: Under the native engine, a React Native library's own Jest setup and mocks get a jest with Jest's semantics. No action needed; a suite that imports react-native-gesture-handler/jestSetup or react-native-safe-area-context/jest/mock gets what Jest gave it.

    • Their jest.mock reaches every require of the module, and jest.requireActual and @jest/globals work.
    • Implementations a library installs while building its mocks survive vi.resetAllMocks() and mockReset: true.
    • jest.requireActual of a package a preset shadows returns the package, as under Jest.
  • ebdda39: Breaking: vitest-native now requires Node 22.22.3+, 24.12+ or 26+, for both engines. An unsupported Node stops at startup with UNSUPPORTED_NODE, naming the release to install; vitest-native doctor reports the same.

    Update Node within your major, or move from Node 20, 23 or 25 to a supported line, including CI images and .nvmrc or engines pins. Remove VITEST_NATIVE_LOADER_THREAD from scripts and CI; it no longer has an effect.

    • Under the native engine, a runtime without module.registerHooks (Bun) gets UNSUPPORTED_NODE too.
    • The support policy is in docs/versioning.md.
  • dae3119: Native engine: a file that Vite and Node both load, with both copies in use, is now reported by name, SOURCE_EVALUATED_TWICE, instead of silently existing twice. No action needed. To fail on it, set reactNative({ ownership: 'error' }).

    • The report names the file, how each side loaded it, and the fix. Exempt a deliberate case with ownership: { allow: [{ path, reason }] }.
    • require() of a CommonJS project file a test already imported now returns that same module.exports.
    • The warning, its end-of-run summary and vitest-native doctor link the error reference.
  • 5cad255: Native engine: a new opt-in flag makes Vite and Node resolve a package to the same file, so one package is one module. Add experimental: { ownershipModel: 'resolver' } to try it. Nothing changes without it.

    • Any package with separate import and require builds, or a react-native field, loads one file on both sides; a JSX or Flow react-native field is compiled, as Metro does.
    • RegExp aliases and tsconfig paths also apply to Node's require, including jest.requireActual. NODE_PATH applies to require only, as in Node.
    • Not covered: an alias with a custom resolver or a function replacement. It is refused at startup by name. See experimental.
  • 45154cf: Native engine: experimental: { ownershipModel: 'resolution' } gives Node's require of a project file the same instance a test's import gets, whichever loads it first. To try it, set the flag; it also turns on nodeMocks, and refuses nodeMocks: false.

    • A file not yet evaluated is evaluated then. A require back into a module from inside its own evaluation gets its exports so far, as in Node and Jest.
    • Mocks apply to what Node's require reaches, as to the test's imports.
    • What cannot be served fails by name: top-level await, a module that throws, one still evaluating when required from elsewhere, or a mock not available synchronously (MOCK_NOT_SEEN_BY_NODE).
  • 4271252: Under the native engine, the worklets, safe-area-context, keyboard-controller, bottom-sheet and netinfo presets are each library's own Jest mock, as a Jest suite installs it. No action needed; snapshots of the presets' own output may change, and the mock engine keeps the hand-written presets.

    • Safe-area insets are zero unless <SafeAreaProvider initialMetrics> sets them; setInsets() still sets them until resetAllMocks().
    • Bottom-sheet's views render only their children, and netinfo reports a connected cellular network.
    • Names a preset served that a mock lacks stay: bottom-sheet's *_STATUS enums and footer components, netinfo's useNetInfoInstance.
  • 4271252: Reanimated's interpolate, interpolateColor and clamp return real values, and its scroll and event hooks run their handlers. No action needed; snapshots of interpolated styles may change.

    • Of Reanimated's own mock, only what still answers with a no-op is replaced, so a later Reanimated whose mock does better keeps its own.
    • Shared values take listeners, so a Gesture Handler 3 gesture configured with a shared value works.
    • Reanimated 3.17 to 4.6 get the same fixes in the hand-written preset.
  • 4271252: Under the native engine, Reanimated 4.7+ (with Worklets 0.9+) is Reanimated's own test mock, as a Jest suite installs it with jest.mock('react-native-reanimated', () => require('react-native-reanimated/mock')). No action needed; presets: { reanimated: false } turns it off, and older versions keep the hand-written preset.

    • The hand-written preset lacked 104 of the mock's names, among them interpolateColor, Keyframe, useScrollOffset and most layout animations.
    • Worklets is its own test mock too, so a test and Reanimated share one instance; its runOnJS and scheduleOnRN run a tick later, as under Jest.
    • A setup file that calls Reanimated's setUpTests() keeps toHaveAnimatedStyle and toHaveAnimatedProps working; keep or delete the call.
  • 0a71dff: Native engine: a cold run now starts at once instead of waiting for React Native's precompiled modules to build. They compile in a low-priority background process.

    To opt out, set reactNative({ registryBuild: 'wait' }) to build them before the run, as before.

    • Test files that start before the build lands load React Native file by file, which is slower; column numbers in React Native's stack frames can differ.
    • CI runs and hotRuntime still wait. On close, a running build gets half of teardownTimeout to finish.
    • Not covered: on Windows, a Vitest process killed outright can leave the compiler running for about 130 s.
  • 5a7f226: Breaking: vitest-native now requires React 19 and supports React Native Testing Library 13 or 14, and the native engine requires React Native 0.86+. An older React or React Native stops at startup with UNSUPPORTED_PEER, for example react-native 0.85.3 is not supported: the native engine supports react-native 0.86–0.88; vitest-native doctor reports the same.

    Upgrade to React Native 0.86 or later (Expo SDK 57 or later) and React 19, and move from React Native Testing Library 12 to 13 or 14.

    • Testing Library 14 makes render, fireEvent and act async: await render(<App />).
    • The mock engine runs on any React Native.
    • Testing Library outside 13–14, React Native above 0.88, or an Expo SDK other than 57 and 58, warns rather than fails.
  • 25f0147: Under the native engine, a test file that imports react-native now loads only the React Native modules it uses. No action needed.

    • Each export is read when a test uses it, as under Jest, instead of all at once on import, which loaded React Native's whole module graph.
    • A change made to an export on the real react-native module is now visible through import { … } from "react-native" too.
  • 2b764f1: Breaking: vitest-native now requires Vitest 5 and Vite 8. Vitest 4, or Vite 6 or 7, stops at startup with UNSUPPORTED_PEER, naming the supported range; vitest-native doctor reports the same.

    Install vitest@^5 with matching @vitest/* packages, and vite@^8.0.5.

    • Vitest 5 clears mocks before every test (clearMocks: true). A suite that asserts on calls recorded before the test started sets test.clearMocks: false.
    • The plugin turns on Vitest 5's fsModuleCache unless the config sets test.fsModuleCache or test.experimental.fsModuleCache.
    • Babel plugins your tests need go through @rolldown/plugin-babel; @vitejs/plugin-react 6 removed its babel option.

Patch Changes

  • 2560a79: vitest-native doctor no longer misreads a config whose binding has $ in its name. It reads bindings from the config's source with regular expressions, and $ is legal in a JavaScript identifier but an anchor in a pattern. So import $base from "@scope/preset"; export default $base was reported as unconfigured. An aliased reactNative as $rn or import * as $vn was reported as imported but never called. Bindings are now escaped before they are matched. No action needed.

  • b00e2df: vitest-native doctor no longer reports does not import vitest-native for a config that builds on a shared module through a relative import, such as a monorepo package's config merging ../../vitest.shared.ts. doctor follows the config's relative imports up to three levels deep and reports the module that calls reactNative(). When it can't settle the question (an import that doesn't resolve, or a deeper chain), it says it couldn't confirm. No action needed.

  • b532d38: hotRuntime.freshRuntime now declines, with one line naming the presets, while a preset whose module uses React is active, instead of failing later files with "Invalid hook call". Those presets' modules keep the first file's React, so under freshRuntime every later file on a hot worker failed with "Invalid hook call" or read a default value (navigation's useTheme returned DefaultTheme). The affected presets are navigation, expo, screens, svg, vector-icons, webview, mmkv, unistyles, flash-list, gesture-handler, reanimated and bottom-sheet, and safe-area and keyboard-controller when the installed library ships no built Jest mock (such as react-native-safe-area-context before 5.8.1, which Expo SDK 57 pins). React then stays resident, as without freshRuntime. No action needed.

  • 5d16f28: Under the hot runtime, an ES module dependency that imports a preset package now sees the running test file's preset mock, not the first file's. Before, from the second file on a hot worker, such a dependency read another file's mock: mockReturnValue, setInsets and similar changes did not reach it, and call assertions such as toHaveBeenCalled missed its calls, so not.toHaveBeenCalled could pass when it should have failed. This affected only ES module builds in node_modules that import a preset package (for example react-native-safe-area-context), and only under hotRuntime; CommonJS dependencies and per-file runs were not affected. No action needed.

  • 68b2018: migrate keeps Jest's moduleNameMapper order in resolve.alias. Both take the first match, but the suggested config listed a catch-all such as @ ahead of an anchored /^@\/assets\/(.*)$/, so @/assets/x resolved to src/assets/x. Run vitest-native migrate again, or move the specific entries above the catch-all by hand.

  • 28c715b: projectBabel checks each file against the project root once per run. Ruling out a file outside the root can take native realpath calls, and both the transform cache key and the load hook asked for every module. No action needed.

  • 6dbaa56: A Reanimated derived value now follows the shared values it reads, without a render. useDerivedValue ran its updater only when the component rendered, so progress.set(0.5) followed by a read of the derived value gave the old result. A child React skipped (memoized, as React Compiler does) kept its first result, so Skia props and assertions saw stale values. It now reruns when a shared value it read changes, as Reanimated's mapper does, with or without the worklets Babel plugin. This covers Reanimated 4.7's own mock and the built-in preset for older versions. No action needed.

  • 98381c9: Reanimated's layout animations, Keyframe, useAnimatedRef and worklet runtimes behave as Reanimated's own under the native engine. Its test mock gave one shared object per builder, so new FadeIn(), instanceof FadeIn and a class that extends a builder failed; useAnimatedRef() was not a function ref; and createWorkletRuntime / runOnRuntime did nothing. No action needed.

    • Builders are Reanimated's own classes; the static chains (FadeIn.duration(300)) work as before.
    • runOnRuntime(runtime, worklet) returns a function that runs the worklet.
  • cf43f5f: A cold run with root __mocks__ no longer warns that a sourcemap points to missing source files. The module jest-compat generates for root manual mocks, vitest-native.root-mocks.mjs, has no file on disk, so Vite looked for its source there on the first run after a cache clear and in CI. No action needed.

  • c0e54bd: The presets guide lists the supported Reanimated, Worklets and Gesture Handler versions. Each floor is what Expo SDK 57, the oldest supported SDK, ships, and each ceiling is below the next major. No action needed.

    • react-native-reanimated >=4.5.0 <5, react-native-worklets >=0.10.0 <1, react-native-gesture-handler >=2.32.0 <4.
  • e37eaf7: A Reanimated mock that spreads jest.requireActual('react-native-reanimated') works on Reanimated 4.5 and 4.6. On those versions the engine dropped the project's react-native-worklets/plugin (and the one babel-preset-expo adds), so the real useAnimatedStyle threw "used without a dependency array or Babel plugin" where Jest passed. The plugin is now applied whenever Reanimated or Worklets is installed. No action needed.

  • f8d18c2: presets: { gestureHandler: false } no longer turns off Gesture Handler's own Jest setup under the native engine. A project that kept the setting from older mocks lost the setup too, so Gesture Handler's native module was the engine's generic stub and it warned Failed to install UI runtime bindings. flashList: false behaves the same. No action needed.

  • 1c2171a, e88bbd0: Under the hot runtime, RNTL's auto-cleanup and its dont-cleanup-after-each opt-out apply in every file on a worker, not just the first. The hot reset put back Vitest's own worker state from the first file on a worker, so later files read that file's module graph. After a file that opted out, every later file on the worker lost auto-cleanup, and a test's components stayed mounted into the next. A file that shares one render across its tests found it unmounted after the first test when it was not the first file its worker ran. The reset now leaves Vitest's globals alone, and fails a file by name if Vitest's worker state names another file (#534, #698; reported in #527). Delete any vi.stubEnv('RNTL_SKIP_AUTO_CLEANUP', 'true') added as a workaround.

  • 6d8ec6a: Every Reanimated hook that gives a shared value now gives one with Reanimated 4's shape under the native engine. Reanimated's test mock gave plain values from useTimestamp, the scroll offsets, useAnimatedKeyboard and useAnimatedSensor, and shared values without modify(), listeners or the isSharedValue() mark, so app code calling .get() failed. No action needed.

    • Covers useSharedValue, useDerivedValue, useScrollOffset, useScrollViewOffset, useTimestamp, useAnimatedKeyboard, useAnimatedSensor and makeMutable.
    • A mock that already gives the right shape keeps its own.
  • d07f8c1: A machine going to sleep mid-run no longer slows the run that follows. On macOS, Node's clocks count time asleep, so precompiling React Native looked like it had overrun its time limit and was stopped on wake. The run then loaded React Native file by file, and its duration, which included the sleep, read as a stall of over ten minutes. Time limits now leave out time the machine spends asleep, and a precompile that still fails says how long the machine slept. A run also stops retrying a precompile that has already failed. No action needed.

  • 19b3f5e: Vitest below 5.1.0 now gets one startup warning and a doctor entry, naming the bug it avoids. With Vite 8.3.5 or later, Vitest 5.0.x can hide a startup error behind "No test files found" and a formatter crash (vitest-dev/vitest#11682, fixed in 5.1.0). Vitest 5.0.x still runs: 5.1.0 is the recommended version, and 5.0.0 stays the minimum. Upgrade Vitest to 5.1.0 or later to avoid it.

  • aae2bfd: The documentation moved to vitest-native.danfry.dev. The links in vitest-native's messages, the README and npm's Homepage link now point there. The old address, danfry1.github.io/vitest-native, redirects each page to the same page on the new site, anchor included, so links printed by earlier versions keep working. No action needed.

  • b79416e: vitest-native doctor reports a missing @babel/core with the engine's own startup notice, once. It then lists each Babel plugin or preset that therefore goes unapplied, instead of repeating the install advice on every line. No action needed.

  • c8ed918: Under the hot runtime, a file that mocks react-native partially no longer breaks RNTL in later files. When RNTL first loaded in a file with jest.mock('react-native', () => ({ Platform: … })), it kept that mock for the worker's life, and later files failed in fireEvent with Cannot read properties of undefined (reading 'flatten'). React's, its renderers' and RNTL's own requires now get the actual module under hot; the file's code still gets its mock. No action needed.

  • c43384f: A factory-less jest.mock('pkg') now automocks pkg for require() too, as under Jest. Before, only the test's imports got Vitest's automock: a require('pkg') in the test or in an installed package got the real package. The mock is now one automocked instance that every load in the file shares. No action needed.

    • Applies to an installed package with no manual mock; a manual mock still wins.
    • Relative or aliased project modules, Node core modules and react-native keep Vitest's own handling.
  • 1286bab: Under the hot runtime, a test file no longer fails to load with "TypeError: # is not an integer typed array". When Vite evaluated an installed ES module that Node had already imported in the same worker, the SOURCE_EVALUATED_TWICE check read the hot runtime's generation from the wrong object and threw. Which file failed depended on the files that ran before it in the worker. No action needed.

  • 4c09d68: vitest-native migrate names each jest.mock() factory that reads a module-level const, let or class while it runs. Mock factories run before the test file's body, so under Vitest such a read throws "Cannot access '…' before initialization". Under Jest it often read undefined instead, because React Native's Babel preset compiles const to var. Reads inside a function the factory returns are not reported. Move the value into the factory, or create it with vi.hoisted().

  • a1e74a7: A project with a Babel config no longer fails every test file when a plugin serves a module under the project root. Most visibly: with a root __mocks__ for an installed package and jestMockTransform(), each file failed with ENOENT … vitest-native.root-mocks.mjs. The projectBabel and project .js JSX load hooks now leave an id with no file on disk to the plugin that serves it. No action needed.

  • 3fbe353: vitest-native compare no longer misses an error in vitest run's output when stdout and stderr interleave. The two streams were split into lines through one shared buffer, a chunk was decoded on its own, and an error header's message was taken from the next line of either stream. Depending on how the pipes delivered output, an Uncaught Exception or Unhandled Rejection could be dropped from the verdict. Each stream now has its own line buffer, UTF-8 decoder and pending header. No action needed.

  • 587167d: A test file that fails because a module does not compile now names that module's file, line and column. A decorator or other syntax that reached Node uncompiled failed the file with only SyntaxError: Invalid or unexpected token. The report now reads SyntaxError: Invalid or unexpected token (src/model/Subscription.js:24:3) and shows the source line, mapped through the module's sourcemap. No action needed. A project that sets its own test.runner keeps Vitest's message.

  • b9a5b67: A jest.mock factory that requires your own source now gets the module the test imports. With jestMockTransform(), a require('<path>') in a factory's body loads through Vite, as its jest.requireActual calls already do, or returns the mock where the file mocks that module. It used to load a second copy through Node, with its own module state, and a SOURCE_EVALUATED_TWICE warning was printed for every file that copy imported: thousands of lines on a large suite. No action needed.

  • b3ec366: The SOURCE_EVALUATED_TWICE warning prints one entry per cause instead of one per file. Files Node loaded through the same first require() are grouped: the first is printed in full, and the end-of-run summary gives each cause one line with its file count, its test files and the fix. On a large suite, one jest.mock factory's require could print thousands of warnings; it is now one summary line and one warning per worker. The fix line names await vi.importActual(...) in an async factory, or experimental.ownershipModel: 'resolution'. No action needed.

  • a1e57a8: The IMPORT_META_IN_NODE_OWNED error now names the whole fix for a package published as an ES module. For a "type": "module" or .mjs package, transform: { exclude: [...] } alone left the package to Node, uncompiled, where import.meta.env is undefined. The message and the error reference now say so. Add such a package to test.server.deps.inline as well as to transform.exclude, so that Vite loads it.

  • 1effb20: Under the native engine, checking whether Node compiles a file no longer grows with the number of React Native packages. The check runs on every file Node resolves or loads. It used to test each file against two patterns per package, hundreds on an Expo project. It now looks the package name up after each node_modules segment, and checks the file's parent directories against the linked packages' directories. No action needed.

  • 8122180: projectBabel no longer compiles a file with Babel because a comment in it holds an @ tag. A config with legacy decorators sent every file with a // @ts-ignore or a JSDoc @param through Babel. On one large app, 48 of 64 such files had no decorator. A tag after //, on a JSDoc line or inside a /* … */ on the same line no longer counts. No action needed.

  • 5d45540: A project whose Babel config lists @babel/plugin-transform-dynamic-import, or turns babel-preset-expo's native module transform back on, loads its files again. Since projectBabel, every file that config applies to failed with @babel/plugin-transform-dynamic-import depends on a modules transform plugin, because the module transform is left out so the output stays an ES module. The dynamic-import transform is now left out with it, as import() runs as written, and babel-preset-expo's per-platform disableImportExportTransform is turned on too. No action needed.

  • 3a0143c: require('@jest/globals') gets jest-compat's shim, as an import does. A CommonJS require of it reached the installed package, which throws outside Jest, so a .js test that required it did not load. It now returns the same module as import … from '@jest/globals', under both engines.

    No action needed.

  • fde2449: vi.resetAllMocks() no longer loops forever with a jest.spyOn spy under jest-compat. A spy on an arrow function, or any function new cannot construct, put itself back in the set of mocks Vitest was resetting. The reset then never returned and the worker spun at full CPU, most often under the hot runtime, where a spy from an earlier file is still alive. Resetting now ends, and the spy still falls back to its original as before.

    No action needed.

  • 63a2021: A jest.mock of a react-native/Libraries/... path now replaces the module import { … } from 'react-native' returns, as under Jest. A mock of a module with platform files, such as react-native/Libraries/Utilities/BackHandler, applied to BackHandler.js while React Native loads BackHandler.ios.js, so BackHandler.mockPressBack was undefined. It now lands on the platform file, cold and under the hot runtime, and so does vi.mock with experimental.nodeMocks. A jest.mock inside a helper the test calls now applies when the helper runs, instead of failing with "defined outside of the module's top level scope". Remove any workaround that mocked the .ios.js file directly.

  • a1e57a8: A project reached through another spelling of its path is recognised everywhere vitest-native asks whether a file belongs to it. Such spellings include a Windows short (8.3) name such as C:\Users\RUNNER~1\..., the default temporary directory on GitHub's Windows runners, and a symlinked or junctioned directory. Paths were compared as plain strings, so files Vite names by their long, real path were missed. No action needed.

    • App source Node loads uses your Babel config again, with its presets, macros and plugins, including babel-preset-expo. Files projectBabel compiles parse, and .babelrc files are read. Asset locations resolve too.
    • The checks that decide whether Vite or Node loads a file, the require bridge, the warning about Node resolving the package under test, the setup-file check and vitest-native compare match either spelling.
    • The SOURCE_EVALUATED_TWICE guard reports a file evaluated twice, and ownership.allow entries match either spelling.
  • d406ffe: Under the native engine, each test worker works out which packages Node compiles once, from directories the plugin already resolved. A worker used to resolve the directory of every package Node compiles twice per test file, once for its ES module loader and once for its require hooks. With per-file isolation every test file has a new worker, so the cost grew with the number of test files. The plugin now records those directories for its workers, and the two hooks share one answer per worker. No action needed.

  • a107e3a: vitest-native init, doctor and migrate now refuse a flag they do not take, instead of ignoring it. A typo such as migrate --wirte used to run a dry report without saying so; it now exits 1 with ✗ unknown option --wirte for migrate. Valid: --root, --help, --write, --force. Check scripts that pass extra flags to these commands. Change any misspelled flag to one the error lists.

  • b388ce5: vitest-native doctor now warns on Node 24.13.0, which can crash a test run at startup with a segmentation fault. The crash is in V8's garbage collector on a worker thread and is intermittent. Use another Node 24 release, such as 24.14 or later; the troubleshooting guide has the details.

  • 0ed099c: ErrorCode now includes HOT_RESIDENT_UNUSABLE and HOT_FILE_NOT_RUN, two codes the hot runtime already throws.

    Code that narrows error.code can now name them. No action needed. Every code is described in the new error-code reference.

  • ad5d90c: init and migrate --write say when the new config takes over from a vite.config.*. Vitest reads a vite.config.* only when there is no vitest.config.*, so its plugins, resolve options and aliases silently stopped applying to tests. The CLI now names the file Vitest loads instead and shows how to extend it with mergeConfig. Under Vite+, a project with both files is told about the vitest.config.* that Vitest loads.

    To keep the Vite config's plugins and aliases in tests, use mergeConfig as the CLI shows.

  • 8bef987: Installs now get magic-string 1.4.5 (was 1.4.4), the library the jest-compat transform uses to hoist jest.mock calls in test files.

    No action needed.

  • 1c3e3a7: Messages that point at documentation now link the published site. No action needed.

    • JEST_API_UNSUPPORTED links its entry in the error reference, and the message for a package Node cannot run links the page on untranspiled packages.
    • vitest-native compare's snapshot hints link the snapshots section of the Jest migration guide, in place of a section number the guide no longer has. Its refusals of --jest-args and --vitest-args link the compare reference.
  • 834a146: init --force and migrate --write --force replace the config Vitest loads. With an existing vitest.config.ts, they wrote vitest.config.mts beside it and reported it replaced, but Vitest kept loading the .ts, so the config did not change. They now write over the file Vitest picks first, under its own name. A CommonJS vitest.config.cjs or .cts is refused with a message instead.

    No action needed.

  • 3ba30c4: vitest-native migrate translates more of a Jest config, and lists the Reanimated settings vitest-native covers as safe to delete. No action needed.

    • A local preset such as ./jest.preset.js is read as Jest applies it: one spreading jest-expo translates as jest-expo; one spreading no known preset is translated and flagged for review.
    • A '^prefix/(.*)$' mapper becomes a resolve.alias for any prefix, and a $-anchored testPathIgnorePatterns literal a test.exclude glob when that skips no directory.
    • Where the Reanimated preset applies, Reanimated's Jest resolver, a serializer that only strips animated props and a setup file that only calls setUpTests() are listed as covered.
  • 5cad255: Native engine with experimental: { nodeMocks: true }: a vi.mock or jest.mock reaches modules Node loads, as jest.mock does under Jest. To try it, set the flag.

    • An installed package's require or import of a mocked module gets the test's mock, the same instance. This covers factories, automocks, { spy: true } and __mocks__ files.
    • A mock Node cannot be handed synchronously fails by name, MOCK_NOT_SEEN_BY_NODE, instead of loading the real module. Examples are an async factory that has not settled, or a vi.doMock not yet applied.
    • An installed package's TypeScript source loads once when a test both requires and imports it.
  • 4271252: Under the native engine, a package whose react-native field and main name different files is one module, imported or required. No action needed.

    • A bare require resolves the react-native field, as Metro and an import do, for a package that depends on React Native or has a TypeScript entry. Before, a library's require and a test's import held separate copies.
    • jest.mock('react-native-reanimated', () => require('react-native-reanimated/mock')) works, as under Jest.
    • Other packages keep main, and require.resolve with paths is unchanged.
  • 499f888: JSX in your project's own .js files now compiles, as Metro and babel-jest compile it. A jest.setup.js that renders a provider, a .js test, or a .js component imported by a test used to fail with Failed to parse source for import analysis. Remove any rename to .jsx or oxc.include override added as a workaround. Files in node_modules are unchanged; packages that ship JSX in .js still go in transform.

  • Thank you

    Thank you to @believer for the issues and pull requests in this release.

    What's Changed

    • ci: run the documented snippets when only their pages change by @danfry1 in #525
    • docs(site): an error-code reference, gated against the codes the package throws by @danfry1 in #523
    • docs(site): one header per option on the options page, gated against the type by @danfry1 in #526
    • docs(site): a Hot Runtime page, and a gate for site anchors by @danfry1 in #529
    • feat!: require Node 22.22.3+, 24.12+ or 26+ and run the loader hooks in-thread by @danfry1 in #377
    • feat!: require Vitest 5 and Vite 8 by @danfry1 in #411
    • ci: pin the Linux Node 24 leg to the Node 24 floor, 24.12.0 by @danfry1 in #533
    • feat!: require React Native 0.86+, React 19 and RNTL 13+ by @danfry1 in #412
    • test(docs): read an option's object type without the JSDoc of its keys by @danfry1 in #536
    • chore(deps): bump magic-string from 1.4.4 to 1.4.5 in the production-dependencies group by @dependabot[bot] in #532
    • feat(doctor): warn on Node 24.13.0, whose V8 can crash a run at startup by @danfry1 in #535
    • chore(deps-dev): bump the dev-dependencies group with 3 updates by @dependabot[bot] in #531
    • build: derive the bundles' external runtime files from the verbatim list by @danfry1 in #510
    • fix(hot): RNTL's dont-cleanup-after-each takes effect in every file on a worker by @danfry1 in #534
    • feat(cli): compare a suite's results under Jest and under Vitest by @danfry1 in #352
    • feat(native): one owner per module under experimental.ownershipModel (the ownership stack) by @danfry1 in #497
    • docs(migration): rework the Jest guide around migrate, compare and removing Jest by @danfry1 in #538
    • test(ownership): one precompiled registry per run, reused by the next by @danfry1 in #543
    • fix(cli): init --force and migrate --write --force replace the config Vitest loads by @danfry1 in #546
    • feat(native): libraries run with their own Jest support under the native engine by @danfry1 in #500
    • feat(native): report files evaluated by both Node and Vite by @danfry1 in #353
    • test(museum): record every column against main after the 0.15 stacks by @danfry1 in #549
    • fix(presets): Reanimated's setUpTests() keeps the engine's animated matchers by @danfry1 in #551
    • docs: link the published pages from the ownership guard and doctor by @danfry1 in #550
    • ci: add a Repro workflow that runs one command on one runner, by hand by @danfry1 in #537
    • fix(native): with nodeMocks on, an installed package's TypeScript source has one owner, Node by @danfry1 in #552
    • test(museum): record #353's fix, and fail when an exhibit's bug shows again by @danfry1 in #554
    • perf(native): read each react-native export when it is used by @danfry1 in #553
    • docs(changesets): edit the pending 0.15 entries as release notes by @danfry1 in #555
    • fix(cli): init and migrate say when a new vitest.config takes over from a vite.config by @danfry1 in #556
    • fix(cli): migrate reads a project-local Jest preset as Jest applies it by @danfry1 in #557
    • fix(cli): migrate translates prefix mappers and $-anchored ignores, and drops keys with no Vitest effect by @danfry1 in #559
    • perf(native): start a cold run without waiting for the precompiled registry by @danfry1 in #392
    • fix(cli): migrate reports the Reanimated test settings vitest-native covers as deletable by @danfry1 in #560
    • test(hot): restore the packed CJS drain control on a first-load re-export by @danfry1 in #565
    • docs(changesets): merge the migrate entries before 0.15.0-rc.1 by @danfry1 in #567
    • fix(transform): compile JSX in a project's own .js files by @danfry1 in #564
    • docs(messages): link the published site from error messages and compare's hints by @danfry1 in #558
    • docs: add an npm downloads badge to the README by @danfry1 in #570
    • chore(release): 0.15.0-rc.1 by @danfry1 in #572
    • fix(cli): migrate keeps the worklets Babel plugin where Reanimated runs as its own mock by @danfry1 in #581
    • docs(site): correct stale support facts and share a PNG social card by @danfry1 in #568
    • docs(site): meet WCAG AA contrast in both themes, with a test by @danfry1 in #569
    • ci: re-baseline the package budget about 25% above main's artifact by @danfry1 in #591
    • fix(snapshots): print React Native trees in Jest's format, and keep ref off host props by @danfry1 in #585
    • feat(jest-compat): support jest.replaceProperty by @danfry1 in #588
    • fix(cli): compare reads stdout and stderr as separate streams by @danfry1 in #593
    • fix(jest-compat): require('@jest/globals') gets the shim an import gets by @danfry1 in #587
    • docs: performance against Jest on the 0.15 corpus by @danfry1 in #596
    • fix(jest-compat): vi.resetAllMocks() ends with a jest.spyOn spy on an arrow by @danfry1 in #595
    • docs(site): a landing page that says what it is, in a neutral theme with one green by @danfry1 in #589
    • docs(site): show where the mock boundary sits, as a diagram by @danfry1 in #598
    • docs: workflow skills and a practices section by @danfry1 in #599
    • lint: vitest-native's own oxlint rules (no Vitest monkey-patching, no repository doc links in src/) by @danfry1 in #600
    • docs: the hot runtime's worker cap, measured by @danfry1 in #608
    • perf(native): build the ownership policy once per worker, from package directories the plugin resolved by @danfry1 in #604
    • ci: fail a hung test run fast, naming the file and test that were running by @danfry1 in #606
    • perf(native): match Node-compiled packages by name lookup, not a pattern per package by @danfry1 in #605
    • test(museum): exhibits for nine bugs found on 2026-11-06 by @danfry1 in #609
    • feat: hangTimeout fails a run whose tests stop making progress, naming the file and test by @danfry1 in #607
    • test: stop the dispatch fixtures from making concurrent native runs find no test files by @danfry1 in #610
    • docs: upstream policy: floors, the upstream-bug ladder and cadence by @danfry1 in #613
    • ci: fail a pull request whose closing keyword names another pull request by @danfry1 in #612
    • test: hold the requirement tables to the ranges the startup checks enforce by @danfry1 in #619
    • ci: latest-supported column for Vite and RNTL, read from the peer requirements by @danfry1 in #620
    • fix(native): import.meta fix message for ES module packages; Babel config on Windows short paths by @danfry1 in #563
    • docs(src): say which path spelling each realpath call needs by @danfry1 in #603
    • fix(runner): a module that does not compile fails naming its file, line and column by @danfry1 in #586
    • docs: upstream workaround registry, with its checks by @danfry1 in #625
    • ci: open a monthly upstream review issue by @danfry1 in #626
    • fix(jest-compat): a jest.mock factory's require of project source loads through Vite by @danfry1 in #580
    • fix(native): the ownership guard groups dual evaluations by cause by @danfry1 in #584
    • feat(jest-compat): View.prototype holds the native methods its refs call by @danfry1 in #594
    • ci: weekly run of the supported Expo SDKs at their newest patch by @danfry1 in #623
    • test(native): keep cold imports out of test timeouts, and name tests near their timeout by @danfry1 in #629
    • ci: canary against upstream's next releases by @danfry1 in #628
    • feat(transform): compile project source with the project's Babel config where Oxc does not cover it by @danfry1 in #597
    • docs(troubleshooting): class fields on React Native 0.86 and earlier compile differently under Jest by @danfry1 in #630
    • fix(jest-compat): a mock of a react-native deep path reaches the module react-native exports by @danfry1 in #582
    • fix(cli): migrate and doctor report the Babel plugins the engine applies instead of wiring babel() by @danfry1 in #632
    • fix(transform): say when the project's Babel config is not applied because @babel/core is missing by @danfry1 in #633
    • ci(compat-check): canary channel for Expo's next SDK by @danfry1 in #631
    • docs(changesets): edit the entries since rc.1 as release notes by @danfry1 in #637
    • perf(transform): projectBabel's decorator test skips comment tags by @danfry1 in #634
    • lint: enable realpath-spelling for src/ by @danfry1 in #635
    • fix(transform): projectBabel takes out the dynamic-import transform with the module transforms by @danfry1 in #639
    • lint: report baseline counts above a file's sites by @danfry1 in #644
    • docs: never use git stash in a shared repository by @danfry1 in #648
    • docs(site): one constant for the site's address, a configurable base, and a Vercel build by @danfry1 in #643
    • fix(project-babel): match the project root in whichever spelling a file is under by @danfry1 in #645
    • feat(jest-compat): apply root mocks of node_modules packages as Jest does by @danfry1 in #566
    • ci: per-script test:native deadlines from measured durations by @danfry1 in #651
    • chore(release): 0.15.0-rc.2 by @danfry1 in #649
    • ci(site): deploy the site only when something it is built from changes by @danfry1 in #650
    • docs(site): an Upgrading to 0.15 page by @danfry1 in #655
    • ci(site): publish the fidelity matrix for the Vercel build by @danfry1 in #654
    • fix(native): the ownership guard keys Node's and Vite's copies of a file alike by @danfry1 in #647
    • feat(cli): vitest-native compare --hot by @danfry1 in #641
    • fix(project-babel): leave ids with no file on disk to the plugin that serves them by @danfry1 in #668
    • test(museum): refresh on 0.15.0-rc.2 by @danfry1 in #671
    • docs(site): move the docs to vitest-native.danfry.dev and redirect the old address by @danfry1 in #664
    • fix(native): match a directory in every spelling wherever a file is checked against it by @danfry1 in #661
    • fix(native): the ownership guard reads the hot generation from its counter by @danfry1 in #672
    • docs: fix the compare --hot changeset's docs link and the fidelity matrix's stale notes by @danfry1 in #674
    • fix(hot): a file's mock does not reach React's or RNTL's own requires under the hot runtime by @danfry1 in #673
    • test(native): a kitchen-sink app that combines what Jest-migrated apps have by @danfry1 in #667
    • fix(jest-compat): a factory-less jest.mock of a package automocks it for require() too by @danfry1 in #656
    • test: guard re-rendering Reanimated's real animated component (#583) by @danfry1 in #658
    • refactor(project-babel): check the file exists before reading the Babel config in cacheKey by @danfry1 in #675
    • feat(migrate): name jest.mock factories that read a later const while they run by @danfry1 in #676
    • fix(doctor): report a missing @babel/core once, with the engine's own notice by @danfry1 in #677
    • feat(hot): hotRuntime.freshRuntime runs React, the renderer, scheduler and RNTL fresh per file by @danfry1 in #657
    • test(redirect-site): pass on version PRs that consume the move's release note by @danfry1 in #683
    • fix(native): turning the gestureHandler preset off keeps Gesture Handler's own Jest setup by @danfry1 in #685
    • ci: install npm and corepack from integrity-checked tarballs by @danfry1 in #646
    • fix(registry): leave time asleep out of the compiler's deadlines, and don't retry a failed registry by @danfry1 in #701
    • fix(hang-watch): count module loads as progress, and report each file's phase by @danfry1 in #699
    • chore(deps): Vitest 5.1.0, with 5.1.0 as the recommended floor by @danfry1 in #704
    • fix(cli): compare --hot claims a speed difference only when its timed runs support it by @danfry1 in #706
    • test: run every Vitest-spawning test file in the end-to-end config by @danfry1 in #678
    • docs: the dont-cleanup-after-each fix ships in 0.15.0; check versions the docs name by @danfry1 in #693
    • fix(hot): the hot reset leaves Vitest's globals alone by @danfry1 in #698
    • test(museum): a --hot off|auto axis runs every exhibit in one hot runtime mode by @danfry1 in #703
    • fix(presets): every Reanimated hook that gives a shared value gives Reanimated 4's shape by @danfry1 in #684
    • test: a conformance gate for the Reanimated and Gesture Handler modules the native engine serves by @danfry1 in #697
    • chore(release): 0.15.0-rc.3 by @danfry1 in #686
    • docs(changelog): one entry per feature in the 0.15.0 notes by @danfry1 in #726
    • fix(presets): Reanimated's builders are its own classes under the native engine by @danfry1 in #707
    • docs: recommend Vitest 5.1.0 or later on the install and upgrade pages by @danfry1 in #727
    • refactor(cli): one default for compare --hot's runs, shuffle and seed by @danfry1 in #729
    • test(hot): the parity check proves its probes still see bleed, and runs freshRuntime too by @danfry1 in #731
    • docs: Reanimated requireActual mocks, gestureHandler: false, and the DrawerLayoutAndroid warning by @danfry1 in #735
    • test(native): the ownership guard's fix lines name options the plugin accepts by @danfry1 in #730
    • fix(jest-compat): no missing-sources sourcemap warning for the generated root-mocks module by @danfry1 in #733
    • fix(presets): keep the worklets Babel plugin whenever Reanimated or Worklets is installed by @danfry1 in #742
    • test: the conformance gate covers Safe Area, FlashList, NetInfo, Skia and react-native-svg by @danfry1 in #711
    • test(native): leave scratch apps to the run's temporary root instead of deleting them in a hook by @danfry1 in #653
    • chore(release): 0.15.0-rc.4 by @danfry1 in #743
    • ci: no bunx or npx where the repository runs commands by @danfry1 in #662
    • ci(site): Vercel deploys only main and docs/ branches, and only for their own site changes by @danfry1 in #736
    • fix(doctor): follow a config's relative imports before saying it does not import vitest-native by @danfry1 in #695
    • test(museum): a vendored package replaces anything already at its name by @danfry1 in #746
    • docs: cover every 0.15 change a 0.14 suite can notice in the upgrade guide by @danfry1 in #737
    • test: react-native-floor skips the registry compile; fidelity-matrix's expected failure stays quiet by @danfry1 in #720
    • perf(project-babel): check each id against the project root once per run by @danfry1 in #652
    • lint: enable root-containment for src/ by @danfry1 in #640
    • fix(migrate): keep Jest's moduleNameMapper order in resolve.alias by @danfry1 in #748
    • lint: root-containment baseline matches main by @danfry1 in #750
    • lint: enable escaped-regexp, and fix doctor's $-binding misread by @danfry1 in #642
    • fix(hot): an ES dependency links the running file's preset module, not the first file's by @danfry1 in #749
    • fix(hot): freshRuntime declines while a preset's module holds React per worker by @danfry1 in #751
    • ci: a scratch-install script that keeps the release cooldown by @danfry1 in #740
    • ci: Reanimated 4.5.3 end to end in the packed consumer gate by @danfry1 in #741
    • fix(presets): a Reanimated derived value follows the shared values it reads by @danfry1 in #753
    • docs: upgrading to 0.15 from 0.9 or older by @danfry1 in #764
    • chore(release): 0.15.0-rc.5 by @danfry1 in #760
    • test(museum): run.mjs refuses an argument it does not read by @danfry1 in #771
    • test(native): remove a real-time race from the spied-setTimeout findBy test by @danfry1 in #759
    • test(museum): record verdicts measured on 0.15.0-rc.3 by @danfry1 in #734
    • test(museum): the require bridge under load by @danfry1 in #789
    • test(conformance): probe react-native-keyboard-controller as each engine serves it by @danfry1 in #710
    • fix(scripts): scratch-install resolves each override round without the previous lock by @danfry1 in #803
    • docs: open both READMEs with the logo and name, light and dark by @danfry1 in #702
    • fix(scripts): scratch-install refuses packages resolved from git, a URL or a local path by @danfry1 in #758
    • ci: unit-test and site changes skip the native steps and the RN, axes and packed cells by @danfry1 in #802
    • docs(site): six sections in the nav and sidebar, and a releases index by @danfry1 in #781
    • docs(site): find your error on the errors and troubleshooting pages by @danfry1 in #788
    • docs(site): links to an error code reach its entry by @danfry1 in #790
    • ci: mock conformance job, and conformance on the newest supported libraries by @danfry1 in #700
    • test(conformance): probe @react-navigation/native and native-stack as the navigation preset serves them by @danfry1 in #713
    • test(conformance): every waiver names an issue or a reason it can never close by @danfry1 in #794
    • test(conformance): probe @gorhom/bottom-sheet as each engine serves it by @danfry1 in #715
    • test(site): links in the theme, nav, sidebar and frontmatter reach a page and a heading by @danfry1 in #793
    • docs(site): proof cards on the landing page, read from their sources at build by @danfry1 in #780
    • test(museum): a nodeMocks axis, alone or with --ownership by @danfry1 in #805
    • test(native): fail fast when dist/ is stale by @danfry1 in #804
    • test(conformance): probe react-native-screens as the screens preset serves it by @danfry1 in #721
    • ci: split the Windows native Full gate job into two shards by @danfry1 in #806
    • test(museum): the stale derived value exhibit is fixed by #753 by @danfry1 in #817
    • test(museum): the globals-off jest.mock exhibit names its issue by @danfry1 in #819
    • ci: stop starting test:native's long scripts together on unsharded legs by @danfry1 in #821
    • test(native): the registry rebuild test builds a registry of its own by @danfry1 in #822
    • chore: release 0.15.0 by @danfry1 in #826

    Full Changelog: v0.14.1...v0.15.0