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 +11 -0
- package/dist/cli.mjs +18 -23
- package/dist/helpers.mjs +1 -1
- package/dist/{host-CzQ2Jpia.mjs → host-5o48Ujzs.mjs} +64 -722
- package/dist/index.mjs +40 -449
- package/dist/jest-compat.mjs +1 -1
- package/dist/{memory-B9IFtT_r.mjs → memory-Couw0Esx.mjs} +15 -0
- package/dist/native/babel-worker.mjs +11 -17
- package/dist/native/hooks.mjs +11 -0
- package/dist/native/state-manifest.mjs +13 -8
- package/dist/native/transform.mjs +107 -35
- package/dist/native/worker.mjs +7 -2
- package/dist/{pool-DQ2EE9e6.mjs → pool-CFSpNfyw.mjs} +2 -2
- package/dist/{preset-map-n08Oz-ZL.mjs → preset-map-CogjYmSw.mjs} +2 -33
- package/dist/{presets-tEIGoZMO.mjs → presets-CXDyg51l.mjs} +2 -2
- package/dist/presets.mjs +1 -1
- package/dist/setup.mjs +7 -291
- package/dist/{worker-vitest-xlSyOBxD.mjs → worker-vitest-CILPFeRX.mjs} +1 -1
- package/package.json +1 -1
- package/dist/errors-ijs8WAcX.mjs +0 -63
- package/dist/preset-modules-CNrYP5IR.mjs +0 -30
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 {
|
|
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-
|
|
4
|
-
import { n as formatHotMemoryPlan, t as createHotMemoryPlan } from "./memory-
|
|
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
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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(
|
|
350
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
356
351
|
} catch {
|
|
357
|
-
return
|
|
352
|
+
return null;
|
|
358
353
|
}
|
|
359
354
|
}
|
|
360
355
|
const versionParts = (version) => {
|
package/dist/helpers.mjs
CHANGED