vitest-mobile@0.2.1
Patch Changes
-
66f4239: Add
metro.babelPluginsoption to inject extra Babel plugins into Metro's transform pipeline.Native modules like
react-native-reanimatedrequire compile-time Babel transforms (e.g. worklet directives) that Metro won't apply unless the plugin is explicitly wired in. Previously, users had no way to add these — worklet transforms were silently skipped in both watch mode and pre-built bundles.New option:
metro.babelPlugins.nativePlugin({ harness: { nativeModules: ['react-native-reanimated'] }, metro: { babelPlugins: ['react-native-reanimated/plugin'] }, });
Plugins are resolved from the harness project's
node_modulesand injected into the generated Metro transformer shim. They run before vitest-mobile's own plugins so worklet transforms etc. are applied before the test wrapper inspects the output. Works in both live Metro (watch mode) andbundlepre-builds.Auto-injection for known modules. When a native module listed in
harness.nativeModuleshas a well-known companion Babel plugin (currently justreact-native-reanimated→react-native-reanimated/plugin), the harness builder automatically adds it tobabel.config.jsduringbootstrap.CLI plumbing. The
bundlecommand now readsmetro.babelPluginsfrom the vitest config and passes them through to the bundler, so pre-built bundles match live-Metro output.