vitest-native 0.10.0 → 0.11.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 +190 -0
- package/README.md +1 -0
- package/dist/cli.cjs +25 -7
- package/dist/cli.mjs +22 -4
- package/dist/{ecosystem-IuZ-Gv0R.cjs → ecosystem-BJzJU3Cf.cjs} +226 -14
- package/dist/{ecosystem-CO5vqExO.mjs → ecosystem-C4qT_vl3.mjs} +200 -12
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.mjs +1 -1
- package/dist/{index-BJL4cQ-l.d.cts → index-CrMeE8rd.d.mts} +5 -5
- package/dist/{index-CvCU0cLl.d.mts → index-DIMbjH8R.d.cts} +6 -3
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +78 -48
- package/dist/jest-compat.cjs +4 -4
- package/dist/jest-compat.d.cts +0 -1
- package/dist/jest-compat.d.mts +0 -1
- package/dist/jest-compat.mjs +2 -2
- package/dist/native/hooks.mjs +77 -12
- package/dist/native/loader.mjs +10 -5
- package/dist/native/match.d.mts +33 -0
- package/dist/native/match.mjs +94 -22
- package/dist/native/registry.mjs +30 -2
- package/dist/{pool-CFND7plG.cjs → pool-BU-1ecIF.cjs} +6 -6
- package/dist/{pool-Bcxp4Qrg.mjs → pool-Bcxn9a3I.mjs} +3 -3
- package/dist/{preset-map-DxilQ4pI.cjs → preset-map-BoG19dLa.cjs} +1 -0
- package/dist/{preset-map-BpDG_D5m.mjs → preset-map-DuX0ocdn.mjs} +1 -0
- package/dist/{presets-BGTqVH6C.cjs → presets-CwO_c4aL.cjs} +131 -6
- package/dist/{presets-CK85x8ey.mjs → presets-IStcJEOa.mjs} +123 -4
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{chunk-CjcI7cDX.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
- package/dist/{chunk-CZWwpsFl.cjs → rolldown-runtime-C0BPl7ul.cjs} +1 -1
- package/dist/serializer.cjs +1 -1
- package/dist/serializer.mjs +1 -1
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +5 -5
- package/docs/versioning.md +1 -1
- package/package.json +17 -15
- /package/dist/{errors-flXDIeWk.cjs → errors-B3lJK46O.cjs} +0 -0
- /package/dist/{errors-Dm5yLNTF.mjs → errors-CxoBUfVJ.mjs} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_errors = require("./errors-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
+
const require_errors = require("./errors-B3lJK46O.cjs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
|
-
node_path =
|
|
4
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
let vitest = require("vitest");
|
|
7
7
|
let react = require("react");
|
|
8
|
-
react =
|
|
8
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
9
9
|
//#region src/presets/reanimated.ts
|
|
10
10
|
/**
|
|
11
11
|
* Resolve the *active* React Native module — the mock under `engine: 'mock'`
|
|
@@ -17,7 +17,8 @@ let _rnCache = null;
|
|
|
17
17
|
function getRN() {
|
|
18
18
|
if (_rnCache) return _rnCache;
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
const base = node_path.default.join(process.env.VITEST_NATIVE_PROJECT_ROOT || process.cwd(), "package.json");
|
|
21
|
+
_rnCache = (0, node_module.createRequire)(base)("react-native");
|
|
21
22
|
} catch {
|
|
22
23
|
_rnCache = {};
|
|
23
24
|
}
|
|
@@ -1712,6 +1713,123 @@ function mmkv() {
|
|
|
1712
1713
|
};
|
|
1713
1714
|
}
|
|
1714
1715
|
//#endregion
|
|
1716
|
+
//#region src/presets/netinfo.ts
|
|
1717
|
+
/**
|
|
1718
|
+
* The state every fetch/listener resolves to until a test changes it.
|
|
1719
|
+
*
|
|
1720
|
+
* Derived from ONE constant so `_reset()` and the initial value cannot drift — the
|
|
1721
|
+
* failure mode where `beforeEach(_reset())` masks the default it claims to test.
|
|
1722
|
+
*
|
|
1723
|
+
* The real library starts at `{ type: 'unknown', isConnected: null, … }` and resolves
|
|
1724
|
+
* to the device's actual connection a moment later. A mock has no device, and a null
|
|
1725
|
+
* resting state would send every component under test down its offline branch, so the
|
|
1726
|
+
* resting state here is a connected wifi device — the same reasoning that gives
|
|
1727
|
+
* Dimensions a device-shaped default.
|
|
1728
|
+
*/
|
|
1729
|
+
const RESTING = {
|
|
1730
|
+
type: "wifi",
|
|
1731
|
+
isConnected: true,
|
|
1732
|
+
isInternetReachable: true,
|
|
1733
|
+
details: {
|
|
1734
|
+
isConnectionExpensive: false,
|
|
1735
|
+
ssid: null,
|
|
1736
|
+
bssid: null,
|
|
1737
|
+
strength: null,
|
|
1738
|
+
ipAddress: null,
|
|
1739
|
+
subnet: null,
|
|
1740
|
+
frequency: null,
|
|
1741
|
+
linkSpeed: null,
|
|
1742
|
+
rxLinkSpeed: null,
|
|
1743
|
+
txLinkSpeed: null
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
const state = () => structuredClone(RESTING);
|
|
1747
|
+
function netInfo() {
|
|
1748
|
+
return {
|
|
1749
|
+
name: "netInfo",
|
|
1750
|
+
modules: { "@react-native-community/netinfo": {
|
|
1751
|
+
exports: [
|
|
1752
|
+
"configure",
|
|
1753
|
+
"fetch",
|
|
1754
|
+
"refresh",
|
|
1755
|
+
"addEventListener",
|
|
1756
|
+
"useNetInfo",
|
|
1757
|
+
"useNetInfoInstance",
|
|
1758
|
+
"NetInfoStateType",
|
|
1759
|
+
"NetInfoCellularGeneration"
|
|
1760
|
+
],
|
|
1761
|
+
factory: () => {
|
|
1762
|
+
let current = state();
|
|
1763
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1764
|
+
const emit = () => {
|
|
1765
|
+
for (const listener of listeners) listener(current);
|
|
1766
|
+
};
|
|
1767
|
+
const fetch = vitest.vi.fn(async () => current);
|
|
1768
|
+
const refresh = vitest.vi.fn(async () => current);
|
|
1769
|
+
const configure = vitest.vi.fn(() => {
|
|
1770
|
+
listeners.clear();
|
|
1771
|
+
});
|
|
1772
|
+
const addEventListener = vitest.vi.fn((listener) => {
|
|
1773
|
+
listeners.add(listener);
|
|
1774
|
+
listener(current);
|
|
1775
|
+
return () => {
|
|
1776
|
+
listeners.delete(listener);
|
|
1777
|
+
};
|
|
1778
|
+
});
|
|
1779
|
+
const useNetInfo = vitest.vi.fn(() => current);
|
|
1780
|
+
const useNetInfoInstance = vitest.vi.fn(() => ({
|
|
1781
|
+
netInfo: current,
|
|
1782
|
+
refresh
|
|
1783
|
+
}));
|
|
1784
|
+
const NetInfoStateType = {
|
|
1785
|
+
unknown: "unknown",
|
|
1786
|
+
none: "none",
|
|
1787
|
+
cellular: "cellular",
|
|
1788
|
+
wifi: "wifi",
|
|
1789
|
+
bluetooth: "bluetooth",
|
|
1790
|
+
ethernet: "ethernet",
|
|
1791
|
+
wimax: "wimax",
|
|
1792
|
+
vpn: "vpn",
|
|
1793
|
+
other: "other"
|
|
1794
|
+
};
|
|
1795
|
+
const NetInfoCellularGeneration = {
|
|
1796
|
+
"2g": "2g",
|
|
1797
|
+
"3g": "3g",
|
|
1798
|
+
"4g": "4g",
|
|
1799
|
+
"5g": "5g"
|
|
1800
|
+
};
|
|
1801
|
+
const api = {
|
|
1802
|
+
configure,
|
|
1803
|
+
fetch,
|
|
1804
|
+
refresh,
|
|
1805
|
+
addEventListener,
|
|
1806
|
+
useNetInfo,
|
|
1807
|
+
useNetInfoInstance
|
|
1808
|
+
};
|
|
1809
|
+
return {
|
|
1810
|
+
...api,
|
|
1811
|
+
NetInfoStateType,
|
|
1812
|
+
NetInfoCellularGeneration,
|
|
1813
|
+
default: api,
|
|
1814
|
+
/** Drive the connection state from a test. */
|
|
1815
|
+
_setState: (next) => {
|
|
1816
|
+
current = {
|
|
1817
|
+
...current,
|
|
1818
|
+
...next
|
|
1819
|
+
};
|
|
1820
|
+
emit();
|
|
1821
|
+
},
|
|
1822
|
+
/** Internal: restore the resting state. Called by resetAllMocks(). */
|
|
1823
|
+
_reset: () => {
|
|
1824
|
+
current = state();
|
|
1825
|
+
listeners.clear();
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
} }
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
//#endregion
|
|
1715
1833
|
//#region src/presets/svg.ts
|
|
1716
1834
|
const SVG_COMPONENTS = [
|
|
1717
1835
|
"Svg",
|
|
@@ -2601,7 +2719,7 @@ function worklets() {
|
|
|
2601
2719
|
}
|
|
2602
2720
|
//#endregion
|
|
2603
2721
|
//#region src/presets/index.ts
|
|
2604
|
-
var presets_exports = /* @__PURE__ */
|
|
2722
|
+
var presets_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
2605
2723
|
asyncStorage: () => asyncStorage,
|
|
2606
2724
|
bottomSheet: () => bottomSheet,
|
|
2607
2725
|
deviceInfo: () => deviceInfo,
|
|
@@ -2611,6 +2729,7 @@ var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
2611
2729
|
keyboardController: () => keyboardController,
|
|
2612
2730
|
mmkv: () => mmkv,
|
|
2613
2731
|
navigation: () => navigation,
|
|
2732
|
+
netInfo: () => netInfo,
|
|
2614
2733
|
reanimated: () => reanimated,
|
|
2615
2734
|
safeAreaContext: () => safeAreaContext,
|
|
2616
2735
|
screens: () => screens,
|
|
@@ -2740,6 +2859,12 @@ Object.defineProperty(exports, "navigation", {
|
|
|
2740
2859
|
return navigation;
|
|
2741
2860
|
}
|
|
2742
2861
|
});
|
|
2862
|
+
Object.defineProperty(exports, "netInfo", {
|
|
2863
|
+
enumerable: true,
|
|
2864
|
+
get: function() {
|
|
2865
|
+
return netInfo;
|
|
2866
|
+
}
|
|
2867
|
+
});
|
|
2743
2868
|
Object.defineProperty(exports, "presets_exports", {
|
|
2744
2869
|
enumerable: true,
|
|
2745
2870
|
get: function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./
|
|
2
|
-
import { t as VitestNativeError } from "./errors-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
+
import { t as VitestNativeError } from "./errors-CxoBUfVJ.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { vi } from "vitest";
|
|
@@ -15,7 +15,8 @@ let _rnCache = null;
|
|
|
15
15
|
function getRN() {
|
|
16
16
|
if (_rnCache) return _rnCache;
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
const base = path.join(process.env.VITEST_NATIVE_PROJECT_ROOT || process.cwd(), "package.json");
|
|
19
|
+
_rnCache = createRequire(base)("react-native");
|
|
19
20
|
} catch {
|
|
20
21
|
_rnCache = {};
|
|
21
22
|
}
|
|
@@ -1710,6 +1711,123 @@ function mmkv() {
|
|
|
1710
1711
|
};
|
|
1711
1712
|
}
|
|
1712
1713
|
//#endregion
|
|
1714
|
+
//#region src/presets/netinfo.ts
|
|
1715
|
+
/**
|
|
1716
|
+
* The state every fetch/listener resolves to until a test changes it.
|
|
1717
|
+
*
|
|
1718
|
+
* Derived from ONE constant so `_reset()` and the initial value cannot drift — the
|
|
1719
|
+
* failure mode where `beforeEach(_reset())` masks the default it claims to test.
|
|
1720
|
+
*
|
|
1721
|
+
* The real library starts at `{ type: 'unknown', isConnected: null, … }` and resolves
|
|
1722
|
+
* to the device's actual connection a moment later. A mock has no device, and a null
|
|
1723
|
+
* resting state would send every component under test down its offline branch, so the
|
|
1724
|
+
* resting state here is a connected wifi device — the same reasoning that gives
|
|
1725
|
+
* Dimensions a device-shaped default.
|
|
1726
|
+
*/
|
|
1727
|
+
const RESTING = {
|
|
1728
|
+
type: "wifi",
|
|
1729
|
+
isConnected: true,
|
|
1730
|
+
isInternetReachable: true,
|
|
1731
|
+
details: {
|
|
1732
|
+
isConnectionExpensive: false,
|
|
1733
|
+
ssid: null,
|
|
1734
|
+
bssid: null,
|
|
1735
|
+
strength: null,
|
|
1736
|
+
ipAddress: null,
|
|
1737
|
+
subnet: null,
|
|
1738
|
+
frequency: null,
|
|
1739
|
+
linkSpeed: null,
|
|
1740
|
+
rxLinkSpeed: null,
|
|
1741
|
+
txLinkSpeed: null
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
const state = () => structuredClone(RESTING);
|
|
1745
|
+
function netInfo() {
|
|
1746
|
+
return {
|
|
1747
|
+
name: "netInfo",
|
|
1748
|
+
modules: { "@react-native-community/netinfo": {
|
|
1749
|
+
exports: [
|
|
1750
|
+
"configure",
|
|
1751
|
+
"fetch",
|
|
1752
|
+
"refresh",
|
|
1753
|
+
"addEventListener",
|
|
1754
|
+
"useNetInfo",
|
|
1755
|
+
"useNetInfoInstance",
|
|
1756
|
+
"NetInfoStateType",
|
|
1757
|
+
"NetInfoCellularGeneration"
|
|
1758
|
+
],
|
|
1759
|
+
factory: () => {
|
|
1760
|
+
let current = state();
|
|
1761
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1762
|
+
const emit = () => {
|
|
1763
|
+
for (const listener of listeners) listener(current);
|
|
1764
|
+
};
|
|
1765
|
+
const fetch = vi.fn(async () => current);
|
|
1766
|
+
const refresh = vi.fn(async () => current);
|
|
1767
|
+
const configure = vi.fn(() => {
|
|
1768
|
+
listeners.clear();
|
|
1769
|
+
});
|
|
1770
|
+
const addEventListener = vi.fn((listener) => {
|
|
1771
|
+
listeners.add(listener);
|
|
1772
|
+
listener(current);
|
|
1773
|
+
return () => {
|
|
1774
|
+
listeners.delete(listener);
|
|
1775
|
+
};
|
|
1776
|
+
});
|
|
1777
|
+
const useNetInfo = vi.fn(() => current);
|
|
1778
|
+
const useNetInfoInstance = vi.fn(() => ({
|
|
1779
|
+
netInfo: current,
|
|
1780
|
+
refresh
|
|
1781
|
+
}));
|
|
1782
|
+
const NetInfoStateType = {
|
|
1783
|
+
unknown: "unknown",
|
|
1784
|
+
none: "none",
|
|
1785
|
+
cellular: "cellular",
|
|
1786
|
+
wifi: "wifi",
|
|
1787
|
+
bluetooth: "bluetooth",
|
|
1788
|
+
ethernet: "ethernet",
|
|
1789
|
+
wimax: "wimax",
|
|
1790
|
+
vpn: "vpn",
|
|
1791
|
+
other: "other"
|
|
1792
|
+
};
|
|
1793
|
+
const NetInfoCellularGeneration = {
|
|
1794
|
+
"2g": "2g",
|
|
1795
|
+
"3g": "3g",
|
|
1796
|
+
"4g": "4g",
|
|
1797
|
+
"5g": "5g"
|
|
1798
|
+
};
|
|
1799
|
+
const api = {
|
|
1800
|
+
configure,
|
|
1801
|
+
fetch,
|
|
1802
|
+
refresh,
|
|
1803
|
+
addEventListener,
|
|
1804
|
+
useNetInfo,
|
|
1805
|
+
useNetInfoInstance
|
|
1806
|
+
};
|
|
1807
|
+
return {
|
|
1808
|
+
...api,
|
|
1809
|
+
NetInfoStateType,
|
|
1810
|
+
NetInfoCellularGeneration,
|
|
1811
|
+
default: api,
|
|
1812
|
+
/** Drive the connection state from a test. */
|
|
1813
|
+
_setState: (next) => {
|
|
1814
|
+
current = {
|
|
1815
|
+
...current,
|
|
1816
|
+
...next
|
|
1817
|
+
};
|
|
1818
|
+
emit();
|
|
1819
|
+
},
|
|
1820
|
+
/** Internal: restore the resting state. Called by resetAllMocks(). */
|
|
1821
|
+
_reset: () => {
|
|
1822
|
+
current = state();
|
|
1823
|
+
listeners.clear();
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
} }
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
//#endregion
|
|
1713
1831
|
//#region src/presets/svg.ts
|
|
1714
1832
|
const SVG_COMPONENTS = [
|
|
1715
1833
|
"Svg",
|
|
@@ -2609,6 +2727,7 @@ var presets_exports = /* @__PURE__ */ __exportAll({
|
|
|
2609
2727
|
keyboardController: () => keyboardController,
|
|
2610
2728
|
mmkv: () => mmkv,
|
|
2611
2729
|
navigation: () => navigation,
|
|
2730
|
+
netInfo: () => netInfo,
|
|
2612
2731
|
reanimated: () => reanimated,
|
|
2613
2732
|
safeAreaContext: () => safeAreaContext,
|
|
2614
2733
|
screens: () => screens,
|
|
@@ -2618,4 +2737,4 @@ var presets_exports = /* @__PURE__ */ __exportAll({
|
|
|
2618
2737
|
worklets: () => worklets
|
|
2619
2738
|
});
|
|
2620
2739
|
//#endregion
|
|
2621
|
-
export {
|
|
2740
|
+
export { asyncStorage as C, createPressableMock as D, gestureHandler as E, buildPressableHostProps as O, screens as S, safeAreaContext as T, svg as _, bottomSheet as a, deviceInfo as b, createTouchableOpacityMock as c, createFlatListMock as d, createScrollViewMock as f, webview as g, vectorIcons as h, createViewMock as i, reanimated as k, createVirtualizedListMock as l, flashList as m, worklets as n, createTouchableWithoutFeedbackMock as o, createTextInputMock as p, keyboardController as r, createTouchableHighlightMock as s, presets_exports as t, createSectionListMock as u, netInfo as v, navigation as w, expo as x, mmkv as y };
|
package/dist/presets.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
1
|
+
import { _ as gestureHandler, a as flashList, c as svg, d as deviceInfo, f as expo, g as safeAreaContext, h as navigation, i as bottomSheet, l as netInfo, m as asyncStorage, n as worklets, o as vectorIcons, p as screens, r as keyboardController, s as webview, u as mmkv, v as reanimated } from "./index-CrMeE8rd.mjs";
|
|
2
|
+
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, netInfo, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
package/dist/presets.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
1
|
+
import { C as asyncStorage, E as gestureHandler, S as screens, T as safeAreaContext, _ as svg, a as bottomSheet, b as deviceInfo, g as webview, h as vectorIcons, k as reanimated, m as flashList, n as worklets, r as keyboardController, v as netInfo, w as navigation, x as expo, y as mmkv } from "./presets-IStcJEOa.mjs";
|
|
2
|
+
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, netInfo, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
@@ -10,6 +10,6 @@ var __exportAll = (all, no_symbols) => {
|
|
|
10
10
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
11
|
return target;
|
|
12
12
|
};
|
|
13
|
-
var __require = /*
|
|
13
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
14
14
|
//#endregion
|
|
15
15
|
export { __require as n, __exportAll as t };
|
|
@@ -24,7 +24,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
24
|
}
|
|
25
25
|
return to;
|
|
26
26
|
};
|
|
27
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
28
28
|
value: mod,
|
|
29
29
|
enumerable: true
|
|
30
30
|
}) : target, mod));
|
package/dist/serializer.cjs
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
9
9
|
* Usage: expect.addSnapshotSerializer(serializer)
|
|
10
10
|
*/
|
|
11
11
|
/** Props that are React internals and should be omitted from snapshot output. */
|
|
12
|
-
const INTERNAL_PROPS = new Set([
|
|
12
|
+
const INTERNAL_PROPS = /* @__PURE__ */ new Set([
|
|
13
13
|
"__reactFiber",
|
|
14
14
|
"__reactInternalInstance",
|
|
15
15
|
"__reactEvents",
|
package/dist/serializer.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Usage: expect.addSnapshotSerializer(serializer)
|
|
9
9
|
*/
|
|
10
10
|
/** Props that are React internals and should be omitted from snapshot output. */
|
|
11
|
-
const INTERNAL_PROPS = new Set([
|
|
11
|
+
const INTERNAL_PROPS = /* @__PURE__ */ new Set([
|
|
12
12
|
"__reactFiber",
|
|
13
13
|
"__reactInternalInstance",
|
|
14
14
|
"__reactEvents",
|
package/dist/setup.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as __require } from "./
|
|
2
|
-
import { t as AUTO_DETECT_PRESETS } from "./preset-map-
|
|
3
|
-
import { D as
|
|
1
|
+
import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
+
import { t as AUTO_DETECT_PRESETS } from "./preset-map-DuX0ocdn.mjs";
|
|
3
|
+
import { D as createPressableMock, O as buildPressableHostProps, c as createTouchableOpacityMock, d as createFlatListMock, f as createScrollViewMock, i as createViewMock, l as createVirtualizedListMock, o as createTouchableWithoutFeedbackMock, p as createTextInputMock, s as createTouchableHighlightMock, t as presets_exports, u as createSectionListMock } from "./presets-IStcJEOa.mjs";
|
|
4
4
|
import { serializer } from "./serializer.mjs";
|
|
5
5
|
import { animatedMatchers } from "./matchers.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -1815,7 +1815,7 @@ const NEWTON_MIN_SLOPE = .001;
|
|
|
1815
1815
|
const SUBDIVISION_PRECISION = 1e-7;
|
|
1816
1816
|
const SUBDIVISION_MAX_ITERATIONS = 10;
|
|
1817
1817
|
const kSplineTableSize = 11;
|
|
1818
|
-
const kSampleStepSize = 1 /
|
|
1818
|
+
const kSampleStepSize = 1 / 10;
|
|
1819
1819
|
function A(aA1, aA2) {
|
|
1820
1820
|
return 1 - 3 * aA2 + 3 * aA1;
|
|
1821
1821
|
}
|
|
@@ -1863,7 +1863,7 @@ function bezier(mX1, mY1, mX2, mY2) {
|
|
|
1863
1863
|
function getTForX(aX) {
|
|
1864
1864
|
let intervalStart = 0;
|
|
1865
1865
|
let currentSample = 1;
|
|
1866
|
-
const lastSample =
|
|
1866
|
+
const lastSample = 10;
|
|
1867
1867
|
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) intervalStart += kSampleStepSize;
|
|
1868
1868
|
--currentSample;
|
|
1869
1869
|
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
package/docs/versioning.md
CHANGED
|
@@ -24,7 +24,7 @@ and deep paths are not supported even when they happen to resolve.
|
|
|
24
24
|
| --- | --- |
|
|
25
25
|
| `vitest-native` | `reactNative`, `presets`, `disabledPresetNames` |
|
|
26
26
|
| `vitest-native/helpers` | `setPlatform`, `setDimensions`, `setColorScheme`, `setInsets`, `mockNativeModule`, `resetAllMocks` |
|
|
27
|
-
| `vitest-native/presets` | the
|
|
27
|
+
| `vitest-native/presets` | the 17 preset factories, by name |
|
|
28
28
|
| `vitest-native/matchers` | `toHaveAnimatedStyle`, `toHaveAnimatedProps`, `animatedMatchers` |
|
|
29
29
|
| `vitest-native/serializer` | `serializer` |
|
|
30
30
|
| `vitest-native/jest-compat` | `jestMockTransform`, `jestCompatAliases`, `jestCompatSetup` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Run real React Native tests under Vitest. One install, zero config.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -135,16 +135,17 @@
|
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@babel/core": "^7.29.7",
|
|
137
137
|
"@gorhom/bottom-sheet": "5.2.14",
|
|
138
|
+
"@react-native-community/netinfo": "12.0.1",
|
|
138
139
|
"@react-native-vector-icons/common": "13.0.1",
|
|
139
140
|
"@react-native-vector-icons/material-icons": "13.1.2",
|
|
140
|
-
"@react-native/babel-preset": "^0.
|
|
141
|
-
"@react-navigation/native": "7.
|
|
142
|
-
"@react-navigation/native-stack": "7.
|
|
141
|
+
"@react-native/babel-preset": "^0.86.2",
|
|
142
|
+
"@react-navigation/native": "7.3.14",
|
|
143
|
+
"@react-navigation/native-stack": "7.18.6",
|
|
143
144
|
"@shopify/flash-list": "2.3.2",
|
|
144
145
|
"@testing-library/react-native": "14.0.0",
|
|
145
146
|
"@types/node": "25.3.5",
|
|
146
|
-
"@types/react": "19.2.
|
|
147
|
-
"@vitest/coverage-v8": "4.1.
|
|
147
|
+
"@types/react": "19.2.18",
|
|
148
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
148
149
|
"expo-constants": "56.0.16",
|
|
149
150
|
"expo-status-bar": "56.0.4",
|
|
150
151
|
"ext-platform-lib": "file:./tests-native/fixtures/ext-platform-lib",
|
|
@@ -152,27 +153,28 @@
|
|
|
152
153
|
"generic-mainfield-lib": "file:./tests-native/fixtures/generic-mainfield-lib",
|
|
153
154
|
"react": "^19.2.8",
|
|
154
155
|
"react-native": "^0.86.0",
|
|
155
|
-
"react-native-gesture-handler": "3.
|
|
156
|
-
"react-native-keyboard-controller": "1.
|
|
157
|
-
"react-native-reanimated": "4.3
|
|
156
|
+
"react-native-gesture-handler": "3.1.0",
|
|
157
|
+
"react-native-keyboard-controller": "1.22.2",
|
|
158
|
+
"react-native-reanimated": "4.5.3",
|
|
158
159
|
"react-native-safe-area-context": "5.8.0",
|
|
159
|
-
"react-native-worklets": "0.
|
|
160
|
+
"react-native-worklets": "0.11.3",
|
|
160
161
|
"react-test-renderer": "^19.2.8",
|
|
161
162
|
"resident-singleton": "file:./tests-native/fixtures/resident-singleton",
|
|
163
|
+
"rn-condition-cjs-lib": "file:./tests-native/fixtures/rn-condition-cjs-lib",
|
|
162
164
|
"rn-condition-lib": "file:./tests-native/fixtures/rn-condition-lib",
|
|
163
165
|
"rn-ecosystem-lib": "file:./tests-native/fixtures/rn-ecosystem-lib",
|
|
164
166
|
"rn-mainfield-lib": "file:./tests-native/fixtures/rn-mainfield-lib",
|
|
165
167
|
"rn-platform-flow-lib": "file:./tests-native/fixtures/rn-platform-flow-lib",
|
|
166
168
|
"rn-singleton-lib": "file:./tests-native/fixtures/rn-singleton-lib",
|
|
167
169
|
"test-renderer": "^1.2.0",
|
|
168
|
-
"tsdown": "0.
|
|
170
|
+
"tsdown": "0.22.14",
|
|
169
171
|
"typescript": "6.0.3",
|
|
170
172
|
"untranspiled-jsx-lib": "file:./tests-native/fixtures/untranspiled-jsx-lib",
|
|
171
|
-
"vite": "^8.0
|
|
172
|
-
"vitest": "4.1.
|
|
173
|
+
"vite": "^8.2.0",
|
|
174
|
+
"vitest": "4.1.10"
|
|
173
175
|
},
|
|
174
176
|
"scripts": {
|
|
175
|
-
"build": "tsdown && node scripts/copy-static-types.mjs",
|
|
177
|
+
"build": "bunx --bun tsdown && node scripts/copy-static-types.mjs",
|
|
176
178
|
"test": "vitest run",
|
|
177
179
|
"test:native": "vitest run --config tests-native/vitest.config.mts",
|
|
178
180
|
"test:native:forks": "vitest run --config tests-native/vitest.forks.config.mts",
|
|
@@ -198,7 +200,7 @@
|
|
|
198
200
|
"validate:hot-parity": "node validation/idiomatic/scale/run-compare.mjs"
|
|
199
201
|
},
|
|
200
202
|
"dependencies": {
|
|
201
|
-
"flow-remove-types": "^2.
|
|
203
|
+
"flow-remove-types": "^2.325.0",
|
|
202
204
|
"magic-string": "^1.1.0"
|
|
203
205
|
},
|
|
204
206
|
"bin": {
|
|
File without changes
|
|
File without changes
|