vitest-mobile@0.4.0
Minor Changes
-
be23517: Fix component hot reload during
pause()and improve build robustness.HMR fix: Editing a component file while paused previously triggered a full
app reload instead of a live Fast Refresh update. The root cause was twofold:- Components loaded with
__ReactRefreshdisabled had no family registrations,
soperformReactRefresh()couldn't map old→new component types. - Restoring the real Refresh runtime during pause caused Metro to detect a
boundary status change ("invalidated boundary") and call
performFullRefresh().
The fix installs a registration-only shim that builds component families from
initial load (forwardingregister()) while preventing implicit self-accept
(isLikelyComponentType()→ false). During pause,performFullRefresh()is
suppressed andperformReactRefresh()is triggered manually.Build improvements:
- Use
npx react-native build-ios/build-androidinstead of raw
xcodebuild/gradlew — simplifies the build step and lets RN CLI handle
pod install, gem setup, and gradle wrapper automatically. - Detect and recover from stale build locks (killed/interrupted builds no
longer block subsequent runs indefinitely). - Clean incomplete binaries and DerivedData before rebuilding.
- Add
--verboseflag to all CLI commands (streams child-process output
instead of using a spinner).
- Components loaded with
Patch Changes
-
2035ecc: Anchor the generated Metro config's
vitest-stubs/lookup at the active
workspace'snode_modules/vitest-mobile/instead of the cached harness's.The cached harness's
node_modules/vitest-mobileis installed viafile:,
so npm creates a symlink to whichever workspace first built the cache.
Two workspaces with the same RN version + native modules + vitest-mobile
version share a cache key, and the second one would hit Metro errors likeFailed to get the SHA-1 for: <other-workspace>/node_modules/vitest-mobile/src/metro/vitest-stubs/empty.js. Potential causes: 1) The file is not watched. Ensure it is under the configured `projectRoot` or `watchFolders`.— because the symlink target lives outside the second workspace's
projectRootandwatchFolders, so Metro's file map doesn't track it.Resolving the stubs from
projectRootinstead is safe:computeCacheKey
already includes the vitest-mobile package version, so the workspace's
stubs are guaranteed to match the harness's on every run. The fix is
template-only — existing cached harness binaries continue to work
unchanged, no rebuild required.Unblocks running tests from multiple checkouts of the same repo (and
fixes CI tarball-restore scenarios where the originating workspace
isn't present on the runner). -
a3eeb10: Default the device picker to an existing simulator/AVD instead of "Create new"
The interactive device picker (used by
bootstrapandboot-device) now
defaults to an existing device rather than prompting to create a dedicated
one. On iOS the pre-selected device is the most recently booted simulator,
matching Expo CLI's heuristic; on Android it's the first available AVD."Create new dedicated simulator/AVD" is still available at the bottom of
the list for users who want isolation. The non-interactive (CI) fallback
is unchanged — it still auto-creates a project-scoped device.This prevents vitest-mobile from stealing Expo CLI's default simulator:
previously, creating and booting aVitestMobile-*sim made it macOS
Simulator.app's "most recently used" device, so Expo would target it
on the nextexpo start→ipress.