vitest-native 0.4.1 → 0.6.0
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/CHANGELOG.md +98 -1
- package/README.md +270 -180
- package/dist/helpers.cjs +13 -0
- package/dist/helpers.mjs +13 -0
- package/dist/{index-DEB7OFaJ.d.cts → index-DGNLmGjq.d.mts} +19 -12
- package/dist/{index-CJIhukN_.d.mts → index-Dr3WvKWI.d.cts} +21 -10
- package/dist/index.cjs +106 -39
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +103 -36
- package/dist/jest-compat.cjs +1 -1
- package/dist/native/boundary.mjs +82 -32
- package/dist/native/globals.mjs +1 -0
- package/dist/native/hooks.mjs +35 -7
- package/dist/native/loader.mjs +18 -5
- package/dist/native/reset.mjs +79 -43
- package/dist/native/resolve.mjs +25 -7
- package/dist/native/runner.mjs +13 -2
- package/dist/native/setup.mjs +95 -4
- package/dist/native/transform.mjs +15 -9
- package/dist/native/worker.mjs +20 -3
- package/dist/{pool-oPTZiSXU.mjs → pool-B7LBfcMQ.mjs} +10 -1
- package/dist/{pool-B4mWN3N5.cjs → pool-p54QV1dQ.cjs} +11 -2
- package/dist/{preset-map-OJm5IWuL.mjs → preset-map-C1UwEald.mjs} +3 -1
- package/dist/{preset-map-C3jxnkiX.cjs → preset-map-CNBOeqAu.cjs} +3 -1
- package/dist/{presets-2I68Ipyl.cjs → presets-BPVVlfI2.cjs} +93 -23
- package/dist/{presets-DOGXQzYT.mjs → presets-DVLDrPC-.mjs} +86 -22
- package/dist/presets.cjs +2 -1
- package/dist/presets.d.cts +2 -2
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/setup.cjs +71 -13
- package/dist/setup.mjs +69 -11
- package/docs/migrating-from-jest.md +6 -4
- package/docs/migrating-from-vitest-react-native.md +6 -3
- package/docs/release-readiness.md +52 -0
- package/package.json +31 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,102 @@
|
|
|
1
1
|
# vitest-native
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3297e5b: Add a built-in `vectorIcons` preset for `@react-native-vector-icons` (v10+),
|
|
8
|
+
auto-detected like the other third-party presets.
|
|
9
|
+
|
|
10
|
+
The library's v10 icon sets (`@react-native-vector-icons/material-icons`, …) are
|
|
11
|
+
all built on the shared `@react-native-vector-icons/common` module, whose dynamic
|
|
12
|
+
font loader runs at import time and queries the native `ExpoFontLoader` — which
|
|
13
|
+
cannot exist in Node. Without shadowing, importing any icon set throws and the set
|
|
14
|
+
is wrongly reported "not available", so icons render nothing. The preset shadows
|
|
15
|
+
the single `common` module (the way jest mocks vector-icons) so `createIconSet(...)`
|
|
16
|
+
returns a lightweight Text-based stub that forwards `name`/`size`/`color`/`style`/
|
|
17
|
+
`testID` — fixing every icon set at once. The legacy `react-native-vector-icons`
|
|
18
|
+
package is mapped to the same preset.
|
|
19
|
+
|
|
20
|
+
Surfaced by the `@rneui/base` bake-off, where every `Icon` test failure traced to
|
|
21
|
+
this import-time crash.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- e333954: Fix two `Animated` mock fidelity gaps surfaced by the mock-vs-real-RN cross-check:
|
|
26
|
+
|
|
27
|
+
- `Animated.Text` (and the other `Animated.*` components) now render the base host
|
|
28
|
+
component (`Text`, `View`, …) instead of a host literally named `Animated.Text`,
|
|
29
|
+
so RNTL's `getByText`/`queryByText` can find their text children — matching real
|
|
30
|
+
React Native.
|
|
31
|
+
- An `Animated.Value` (or interpolation/color node) used in a `style` prop now
|
|
32
|
+
resolves to its current value on the host's style, so assertions like
|
|
33
|
+
`toHaveStyle({ opacity: 0.3 })` against `new Animated.Value(0.3)` pass — matching
|
|
34
|
+
how real React Native writes the live value onto the host.
|
|
35
|
+
|
|
36
|
+
- Restore Vitest 4.0.x compatibility in the hot-runtime runner. 0.5.0 imported `TestRunner` from the `vitest` main entry, which only exists in 4.1+; on 4.0.x the hot runner threw `Class extends value undefined`. It now prefers the main-entry export and falls back to the (deprecated) `vitest/runners` subpath only when the main export is absent — so 4.1+ stays warning-free and 4.0.x works again.
|
|
37
|
+
- 3297e5b: Native engine: stub asset `require()`s reaching Node's CJS loader. A literal
|
|
38
|
+
`const img = require('./logo.png')` or `require('./Icon.ttf')` (common in real RN
|
|
39
|
+
components) escapes Vite's asset handling and hits Node's loader, where the binary
|
|
40
|
+
was compiled as JS and threw `SyntaxError: Invalid or unexpected token`, taking
|
|
41
|
+
down the whole test file. The Node require-hook now stubs asset extensions
|
|
42
|
+
(images, media, and fonts) to their basename string, matching the Vite graph and
|
|
43
|
+
Metro/Jest behaviour.
|
|
44
|
+
|
|
45
|
+
Surfaced by a real bake-off of the `@rneui/base` (react-native-elements) Jest +
|
|
46
|
+
RNTL suite under the native engine.
|
|
47
|
+
|
|
48
|
+
## 0.5.0
|
|
49
|
+
|
|
50
|
+
### Native engine
|
|
51
|
+
|
|
52
|
+
- Propagate the configured iOS/Android platform through native resolution,
|
|
53
|
+
transformation caches, Babel caller metadata, and native boundary constants.
|
|
54
|
+
- Bring assets, helper controls, native-module injection, animated matchers, and
|
|
55
|
+
snapshot serialization to the native engine contract.
|
|
56
|
+
- Reject mock-only `mocks` overrides under the native engine instead of silently
|
|
57
|
+
ignoring them.
|
|
58
|
+
|
|
59
|
+
### Mock engine
|
|
60
|
+
|
|
61
|
+
- Block `onPress` on disabled `Pressable`/`Touchable*`/`Button` under
|
|
62
|
+
`@testing-library/react-native` v14. RNTL 14 resolves press handlers by walking
|
|
63
|
+
the composite fiber, which re-finds `onPress` on the wrapping `forwardRef` mock,
|
|
64
|
+
so the earlier host-prop stripping no longer blocked the press; disabled hosts
|
|
65
|
+
are now marked `pointerEvents: "none"` so RNTL's `isEventEnabled` rejects it
|
|
66
|
+
(no-op under RNTL ≤13). Thanks @jakeboone02.
|
|
67
|
+
- Stop passing the `hostComponentNames` option to `configure()` on RNTL ≥14,
|
|
68
|
+
which removed it in favor of auto-detection; this silences an "Unknown
|
|
69
|
+
option(s) passed to configure" warning while preserving the option for
|
|
70
|
+
RNTL ≤13.
|
|
71
|
+
|
|
72
|
+
### Reliability
|
|
73
|
+
|
|
74
|
+
- Fix hot-runtime cross-file leaks from import-time globals, direct environment
|
|
75
|
+
mutations, and app-owned RN event listeners.
|
|
76
|
+
- Add a dedicated one-worker hot-isolation gate, a generated 100-file soak,
|
|
77
|
+
end-to-end memory-triggered worker recycling, and Android platform-resolution
|
|
78
|
+
coverage.
|
|
79
|
+
- Validate plugin and hot-runtime options eagerly with actionable errors.
|
|
80
|
+
- Fail configuration for unsupported required Vite, Vitest, and React peers
|
|
81
|
+
instead of continuing after a console error.
|
|
82
|
+
|
|
83
|
+
### Compatibility and release engineering
|
|
84
|
+
|
|
85
|
+
- Validate packed release tarballs in bare RN 0.83/RNTL 12, Expo 56/RNTL 13,
|
|
86
|
+
Vite 8 monorepo/RNTL 14, RN 0.86 Android, and a mock-engine RNTL 14 consumer
|
|
87
|
+
(the combination that guards the disabled-press fix above).
|
|
88
|
+
- Support Vite 8's Oxc JSX configuration without the deprecated `esbuild`
|
|
89
|
+
option, while retaining Vite 6–7 support.
|
|
90
|
+
- Load RNTL matchers across the public, `build`, and `dist` layouts used by
|
|
91
|
+
RNTL 12–14, and expose Vitest's `expect` for RNTL matcher registration without
|
|
92
|
+
enabling all Vitest globals.
|
|
93
|
+
- Upgrade the validated baseline to Vitest 4.1.8, RN 0.85.3, and React 19.2,
|
|
94
|
+
with exact peer upper bounds for unsupported future majors.
|
|
95
|
+
- Require patched Vite floors (^6.4.2, ^7.3.2, or ^8.0.5) and refresh build
|
|
96
|
+
tooling/transitive resolutions to remove known high-severity advisories.
|
|
97
|
+
- Make Linux Node 20/22, macOS, Windows, packed consumers, the example app,
|
|
98
|
+
soak tests, cross-checks, and package export analysis blocking release gates.
|
|
99
|
+
|
|
3
100
|
## 0.4.1
|
|
4
101
|
|
|
5
102
|
### Patch Changes
|
|
@@ -12,7 +109,7 @@ Documentation fixes (the README is consumers' primary reference):
|
|
|
12
109
|
note on the `globals: true` alternative.
|
|
13
110
|
- **Installation** notes the companion dependencies the examples need
|
|
14
111
|
(`@testing-library/react-native`; a real RN app already provides `react-native`
|
|
15
|
-
|
|
112
|
+
- `@react-native/babel-preset` + `@babel/core`).
|
|
16
113
|
- Corrected the RN-conformance count (118 ported: 115 passing, 3 documented skips).
|
|
17
114
|
- "Spiritual successor" → "Maintained successor" wording, with a migration link.
|
|
18
115
|
|