vitest-native 0.14.0-rc.13 → 0.14.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -975,6 +975,17 @@ reactNative({
975
975
 
976
976
  This prints details about which presets were detected, which modules are being mocked, and how imports are resolved. Useful for debugging unexpected behavior.
977
977
 
978
+ To turn it on for a single run, read an environment variable you choose, then run
979
+ `RN_TEST_DEBUG=1 vitest run`:
980
+
981
+ ```ts
982
+ reactNative({ diagnostics: process.env.RN_TEST_DEBUG === "1" });
983
+ ```
984
+
985
+ There is no `VITEST_NATIVE_DIAGNOSTICS` variable. Older releases' `VITEST_NATIVE_*` settings, such
986
+ as `VITEST_NATIVE_PLATFORM`, are no longer read; set the matching option. Startup warns when one
987
+ is set.
988
+
978
989
  ---
979
990
 
980
991
  ## Support Policy
package/dist/cli.mjs CHANGED
@@ -1,27 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { D as validatePeerDependency, S as PEER_REQUIREMENTS, T as unsupportedExpoSdkMessage, b as fsModuleCacheOnByDefault, c as detectEngine, i as ownVitestPackage, l as resolveTransformPreset, o as usesVitePlus, p as formatNativeOwnershipManifest, r as installedViteVersion, s as detectEcosystemPackages, u as createNativeOwnershipPolicy, w as installedExpoVersion } from "./host-CzQ2Jpia.mjs";
3
- import { i as autoDetectedPresetApplies, n as DEFAULT_ASSET_EXTS, o as presetShadowing, r as PRESET_MODULES, s as testsItself, t as AUTO_DETECT_PRESETS } from "./preset-map-n08Oz-ZL.mjs";
4
- import { n as formatHotMemoryPlan, t as createHotMemoryPlan } from "./memory-B9IFtT_r.mjs";
2
+ import { c as detectEcosystemPackages, d as fsModuleCacheOnByDefault, g as unsupportedExpoSdkMessage, h as installedExpoVersion, i as ownVitestPackage, l as detectEngine, o as usesVitePlus, p as PEER_REQUIREMENTS, r as installedViteVersion, v as validatePeerDependency } from "./host-5o48Ujzs.mjs";
3
+ import { i as autoDetectedPresetApplies, n as DEFAULT_ASSET_EXTS, o as presetShadowing, r as PRESET_MODULES, s as testsItself, t as AUTO_DETECT_PRESETS } from "./preset-map-CogjYmSw.mjs";
4
+ import { n as formatHotMemoryPlan, t as createHotMemoryPlan } from "./memory-Couw0Esx.mjs";
5
5
  import { createRequire } from "node:module";
6
- import fs from "node:fs";
6
+ import { fileURLToPath } from "node:url";
7
7
  import path from "node:path";
8
- // src/native/state-manifest.mjs
9
- const HOT_STATE_MANIFEST_ENTRIES = Object.freeze([
10
- "vitest-runtime",
11
- "native-boundary-mocks",
12
- "native-module-mocks",
13
- "react-native.dimensions",
14
- "react-native.appearance",
15
- "react-native.event-listeners",
16
- "process.env",
17
- "process.listeners",
18
- "global.descriptors",
19
- "console.descriptors",
20
- "react-native.error-utils",
21
- "expo.runtime",
22
- "jest-compat.node-mocks",
23
- "expo.sdk-warnings"
24
- ]);
8
+ import fs from "node:fs";
9
+ import { createNativeOwnershipPolicy, formatNativeOwnershipManifest } from "./native/ownership.mjs";
10
+ import { resolveTransformPreset } from "./native/babel-preset.mjs";
11
+ import { HOT_STATE_MANIFEST_ENTRIES } from "./native/state-manifest.mjs";
25
12
  // src/cli/manifest.ts
26
13
  /**
27
14
  * Installed-package facts for the CLI, read from disk.
@@ -351,10 +338,18 @@ function packageVersion(root, name) {
351
338
  */
352
339
  function nodeRange() {
353
340
  const fallback = ">=22.13.0 <23 || >=24.3.0";
341
+ for (let dir = path.dirname(fileURLToPath(import.meta.url));; dir = path.dirname(dir)) {
342
+ const manifest = readManifest(path.join(dir, "package.json"));
343
+ if (manifest?.name === "vitest-native") return manifest.engines?.node?.trim() || fallback;
344
+ if (path.dirname(dir) === dir) return fallback;
345
+ }
346
+ }
347
+ /** A package.json, or null where there is none or it does not parse. */
348
+ function readManifest(file) {
354
349
  try {
355
- return JSON.parse(fs.readFileSync(new URL("../../package.json", import.meta.url), "utf8")).engines?.node?.trim() || fallback;
350
+ return JSON.parse(fs.readFileSync(file, "utf8"));
356
351
  } catch {
357
- return fallback;
352
+ return null;
358
353
  }
359
354
  }
360
355
  const versionParts = (version) => {
package/dist/helpers.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as VitestNativeError } from "./errors-ijs8WAcX.mjs";
1
+ import { VitestNativeError } from "./errors.mjs";
2
2
  // src/helpers.ts
3
3
  /**
4
4
  * Test helpers for vitest-native.