vitest-native 0.9.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 +921 -0
- package/README.md +33 -1
- package/dist/cli.cjs +185 -31
- package/dist/cli.mjs +182 -28
- package/dist/ecosystem-BJzJU3Cf.cjs +568 -0
- package/dist/ecosystem-C4qT_vl3.mjs +506 -0
- package/dist/errors-B3lJK46O.cjs +75 -0
- package/dist/errors-CxoBUfVJ.mjs +64 -0
- package/dist/errors.d.mts +46 -0
- package/dist/errors.mjs +78 -0
- package/dist/helpers.cjs +6 -23
- package/dist/helpers.d.cts +0 -6
- package/dist/helpers.d.mts +0 -6
- package/dist/helpers.mjs +6 -23
- package/dist/{index-CEgRDdhd.d.cts → index-CrMeE8rd.d.mts} +14 -9
- package/dist/{index-j-0tueBr.d.mts → index-DIMbjH8R.d.cts} +15 -7
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +307 -91
- package/dist/jest-compat/interop.mjs +15 -0
- package/dist/jest-compat/setup.mjs +102 -7
- 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/matchers.cjs +16 -7
- package/dist/matchers.mjs +16 -7
- package/dist/native/hooks.mjs +152 -13
- package/dist/native/loader.mjs +36 -11
- package/dist/native/match.d.mts +33 -0
- package/dist/native/match.mjs +94 -22
- package/dist/native/module-reset.mjs +63 -0
- package/dist/native/registry.mjs +110 -13
- package/dist/native/resolve.d.mts +22 -0
- package/dist/native/resolve.mjs +21 -13
- package/dist/native/runner.mjs +21 -0
- package/dist/native/setup.mjs +4 -2
- package/dist/native/transform.mjs +108 -3
- package/dist/native/worker.mjs +59 -16
- package/dist/{pool-DzsEo9vv.cjs → pool-BU-1ecIF.cjs} +7 -6
- package/dist/{pool-CJmjRgsB.mjs → pool-Bcxn9a3I.mjs} +4 -3
- package/dist/{preset-map-CG4FMtsl.cjs → preset-map-BoG19dLa.cjs} +1 -1
- package/dist/{preset-map-CNsZKfvu.mjs → preset-map-DuX0ocdn.mjs} +1 -1
- package/dist/{presets-C4faM3ds.cjs → presets-CwO_c4aL.cjs} +224 -55
- package/dist/{presets-CuDrNA_W.mjs → presets-IStcJEOa.mjs} +216 -53
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/rntl-matchers.d.ts +35 -0
- 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 +34 -4
- package/dist/serializer.mjs +34 -4
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +237 -74
- package/docs/release-readiness.md +22 -5
- package/docs/versioning.md +133 -0
- package/package.json +38 -46
- package/dist/ecosystem-BIWaVwYL.cjs +0 -294
- package/dist/ecosystem-EFtHnKS9.mjs +0 -256
- package/dist/index.cjs +0 -788
- package/dist/index.d.cts +0 -14
- package/dist/presets.cjs +0 -18
- package/dist/presets.d.cts +0 -2
- package/dist/setup.cjs +0 -2702
- package/dist/setup.d.cts +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for errors.mjs. Hand-written because the implementation is plain .mjs — see the
|
|
3
|
+
* comment there for why it cannot be TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Stable identifiers for the failures this package raises. They are part of the public
|
|
8
|
+
* surface: renaming one is a breaking change for anyone branching on it.
|
|
9
|
+
*/
|
|
10
|
+
export type VitestNativeErrorCode =
|
|
11
|
+
| "INVALID_OPTION"
|
|
12
|
+
| "UNKNOWN_OPTION"
|
|
13
|
+
| "UNSUPPORTED_PEER"
|
|
14
|
+
| "UNSUPPORTED_POOL"
|
|
15
|
+
| "ENGINE_REQUIRES_BABEL"
|
|
16
|
+
| "MOCKS_REQUIRE_MOCK_ENGINE"
|
|
17
|
+
| "TRANSFORM_FAILED"
|
|
18
|
+
| "UNTRANSPILED_PACKAGE"
|
|
19
|
+
| "HOT_WORKER_ENV"
|
|
20
|
+
| "HOT_WORKER_PRELOAD"
|
|
21
|
+
| "HOT_RUNTIME_UNAVAILABLE"
|
|
22
|
+
| "PRESET_UNAVAILABLE"
|
|
23
|
+
| "WRONG_ENGINE_FOR_HELPER"
|
|
24
|
+
| "HELPERS_BEFORE_SETUP"
|
|
25
|
+
| "JEST_API_UNSUPPORTED"
|
|
26
|
+
| "MATCHER_BAD_RECEIVER";
|
|
27
|
+
|
|
28
|
+
export interface VitestNativeErrorOptions {
|
|
29
|
+
cause?: unknown;
|
|
30
|
+
/** A docs URL appended to the message, since fields do not reach the reporter. */
|
|
31
|
+
docs?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare class VitestNativeError extends Error {
|
|
35
|
+
readonly code: VitestNativeErrorCode;
|
|
36
|
+
constructor(code: VitestNativeErrorCode, message: string, options?: VitestNativeErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare class VitestNativeTypeError extends TypeError {
|
|
40
|
+
readonly code: VitestNativeErrorCode;
|
|
41
|
+
constructor(code: VitestNativeErrorCode, message: string, options?: VitestNativeErrorOptions);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare function isVitestNativeError(
|
|
45
|
+
error: unknown,
|
|
46
|
+
): error is VitestNativeError | VitestNativeTypeError;
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error types this package throws.
|
|
3
|
+
*
|
|
4
|
+
* Plain .mjs on purpose. The shipped native and jest-compat runtimes are copied to dist
|
|
5
|
+
* verbatim and import this by relative path, and the test suite loads those same files
|
|
6
|
+
* from src — so the module has to resolve identically in both trees. A .ts source would
|
|
7
|
+
* only exist in one of them.
|
|
8
|
+
*
|
|
9
|
+
* WHAT SURVIVES WHERE, measured rather than assumed:
|
|
10
|
+
*
|
|
11
|
+
* - In the main process, and in a user's own try/catch inside a test, everything is
|
|
12
|
+
* intact.
|
|
13
|
+
* - Across the worker/reporter boundary Vitest keeps only `name`, `message` and
|
|
14
|
+
* `stack`. `code` and every other own property is dropped.
|
|
15
|
+
*
|
|
16
|
+
* So the message must stay self-sufficient: nothing may move out of it into a field on
|
|
17
|
+
* the assumption a reader will see it.
|
|
18
|
+
*
|
|
19
|
+
* `isVitestNativeError` deliberately checks SHAPE rather than `instanceof`. Bundled
|
|
20
|
+
* entries and the verbatim .mjs runtimes can hold separate copies of this module, and a
|
|
21
|
+
* prototype check would quietly fail across that seam. Shape does not care.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const PREFIX = "[vitest-native]";
|
|
25
|
+
|
|
26
|
+
/** Guarantees the prefix exactly once, however the caller wrote the message. */
|
|
27
|
+
function withPrefix(message) {
|
|
28
|
+
return message.startsWith(PREFIX) ? message : `${PREFIX} ${message}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function buildMessage(message, options) {
|
|
32
|
+
const base = withPrefix(message);
|
|
33
|
+
return options?.docs ? `${base}\nSee ${options.docs}` : base;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Error options, omitted entirely when there is no cause.
|
|
38
|
+
*
|
|
39
|
+
* `new Error(msg, { cause: undefined })` installs an own `cause` property set to
|
|
40
|
+
* undefined, which a plain `new Error(msg)` does not — enough to make some reporters
|
|
41
|
+
* print an empty cause and to make these errors shaped differently from every other
|
|
42
|
+
* error in the process. Passing nothing keeps them identical.
|
|
43
|
+
*/
|
|
44
|
+
function errorOptions(options) {
|
|
45
|
+
return options && "cause" in options && options.cause !== undefined
|
|
46
|
+
? { cause: options.cause }
|
|
47
|
+
: undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A failure originating in vitest-native. */
|
|
51
|
+
export class VitestNativeError extends Error {
|
|
52
|
+
constructor(code, message, options) {
|
|
53
|
+
super(buildMessage(message, options), errorOptions(options));
|
|
54
|
+
this.name = "VitestNativeError";
|
|
55
|
+
this.code = code;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A vitest-native failure that is also a type error — a badly typed option, say.
|
|
61
|
+
* Extends TypeError so `instanceof TypeError` keeps working for consumers.
|
|
62
|
+
*/
|
|
63
|
+
export class VitestNativeTypeError extends TypeError {
|
|
64
|
+
constructor(code, message, options) {
|
|
65
|
+
super(buildMessage(message, options), errorOptions(options));
|
|
66
|
+
this.name = "VitestNativeTypeError";
|
|
67
|
+
this.code = code;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** True for any error this package raised, whichever copy of this module created it. */
|
|
72
|
+
export function isVitestNativeError(error) {
|
|
73
|
+
return (
|
|
74
|
+
error instanceof Error &&
|
|
75
|
+
typeof (/** @type {{ code?: unknown }} */ (error).code) === "string" &&
|
|
76
|
+
(error.name === "VitestNativeError" || error.name === "VitestNativeTypeError")
|
|
77
|
+
);
|
|
78
|
+
}
|
package/dist/helpers.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors = require("./errors-B3lJK46O.cjs");
|
|
2
3
|
//#region src/helpers.ts
|
|
3
4
|
/**
|
|
4
5
|
* Test helpers for vitest-native.
|
|
@@ -8,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
8
9
|
*/
|
|
9
10
|
function getMock() {
|
|
10
11
|
const mock = globalThis.__vitest_native_mock;
|
|
11
|
-
if (!mock) throw new
|
|
12
|
+
if (!mock) throw new require_errors.VitestNativeError("HELPERS_BEFORE_SETUP", "helpers were called before setup ran. Ensure the vitest-native plugin is configured.");
|
|
12
13
|
return mock;
|
|
13
14
|
}
|
|
14
15
|
function getNativeControl() {
|
|
@@ -81,21 +82,10 @@ function resetAllMocks() {
|
|
|
81
82
|
mock.Platform.select.mockImplementation((specifics) => {
|
|
82
83
|
return specifics.ios ?? specifics.default;
|
|
83
84
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
height: 844,
|
|
89
|
-
scale: 3,
|
|
90
|
-
fontScale: 1
|
|
91
|
-
},
|
|
92
|
-
screen: {
|
|
93
|
-
width: 390,
|
|
94
|
-
height: 844,
|
|
95
|
-
scale: 3,
|
|
96
|
-
fontScale: 1
|
|
97
|
-
}
|
|
98
|
-
});
|
|
85
|
+
for (const value of Object.values(mock)) {
|
|
86
|
+
const candidate = value;
|
|
87
|
+
if (candidate && typeof candidate === "object" && typeof candidate._reset === "function") candidate._reset();
|
|
88
|
+
}
|
|
99
89
|
if (mock.useWindowDimensions._resetDimensions) mock.useWindowDimensions._resetDimensions({
|
|
100
90
|
width: 390,
|
|
101
91
|
height: 844,
|
|
@@ -108,15 +98,8 @@ function resetAllMocks() {
|
|
|
108
98
|
scale: 3,
|
|
109
99
|
fontScale: 1
|
|
110
100
|
});
|
|
111
|
-
if (mock.Appearance._reset) mock.Appearance._reset();
|
|
112
|
-
else mock.Appearance.setColorScheme("light");
|
|
113
101
|
if (mock.useColorScheme._resetScheme) mock.useColorScheme._resetScheme("light");
|
|
114
102
|
else if (mock.useColorScheme._setScheme) mock.useColorScheme._setScheme("light");
|
|
115
|
-
if (mock.Keyboard._reset) mock.Keyboard._reset();
|
|
116
|
-
if (mock.AppState._reset) mock.AppState._reset();
|
|
117
|
-
if (mock.BackHandler._reset) mock.BackHandler._reset();
|
|
118
|
-
if (mock.I18nManager._reset) mock.I18nManager._reset();
|
|
119
|
-
if (mock.DeviceEventEmitter._reset) mock.DeviceEventEmitter._reset();
|
|
120
103
|
if (originalNativeModules !== null) {
|
|
121
104
|
mock.NativeModules = originalNativeModules;
|
|
122
105
|
originalNativeModules = null;
|
package/dist/helpers.d.cts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
//#region src/helpers.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Test helpers for vitest-native.
|
|
4
|
-
*
|
|
5
|
-
* These functions mutate the live mock instances created by the setup file.
|
|
6
|
-
* Import from 'vitest-native/helpers' in your test files.
|
|
7
|
-
*/
|
|
8
2
|
declare function setPlatform(os: "ios" | "android"): void;
|
|
9
3
|
declare function setDimensions(dims: {
|
|
10
4
|
width: number;
|
package/dist/helpers.d.mts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
//#region src/helpers.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Test helpers for vitest-native.
|
|
4
|
-
*
|
|
5
|
-
* These functions mutate the live mock instances created by the setup file.
|
|
6
|
-
* Import from 'vitest-native/helpers' in your test files.
|
|
7
|
-
*/
|
|
8
2
|
declare function setPlatform(os: "ios" | "android"): void;
|
|
9
3
|
declare function setDimensions(dims: {
|
|
10
4
|
width: number;
|
package/dist/helpers.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as VitestNativeError } from "./errors-CxoBUfVJ.mjs";
|
|
1
2
|
//#region src/helpers.ts
|
|
2
3
|
/**
|
|
3
4
|
* Test helpers for vitest-native.
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
*/
|
|
8
9
|
function getMock() {
|
|
9
10
|
const mock = globalThis.__vitest_native_mock;
|
|
10
|
-
if (!mock) throw new
|
|
11
|
+
if (!mock) throw new VitestNativeError("HELPERS_BEFORE_SETUP", "helpers were called before setup ran. Ensure the vitest-native plugin is configured.");
|
|
11
12
|
return mock;
|
|
12
13
|
}
|
|
13
14
|
function getNativeControl() {
|
|
@@ -80,21 +81,10 @@ function resetAllMocks() {
|
|
|
80
81
|
mock.Platform.select.mockImplementation((specifics) => {
|
|
81
82
|
return specifics.ios ?? specifics.default;
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
height: 844,
|
|
88
|
-
scale: 3,
|
|
89
|
-
fontScale: 1
|
|
90
|
-
},
|
|
91
|
-
screen: {
|
|
92
|
-
width: 390,
|
|
93
|
-
height: 844,
|
|
94
|
-
scale: 3,
|
|
95
|
-
fontScale: 1
|
|
96
|
-
}
|
|
97
|
-
});
|
|
84
|
+
for (const value of Object.values(mock)) {
|
|
85
|
+
const candidate = value;
|
|
86
|
+
if (candidate && typeof candidate === "object" && typeof candidate._reset === "function") candidate._reset();
|
|
87
|
+
}
|
|
98
88
|
if (mock.useWindowDimensions._resetDimensions) mock.useWindowDimensions._resetDimensions({
|
|
99
89
|
width: 390,
|
|
100
90
|
height: 844,
|
|
@@ -107,15 +97,8 @@ function resetAllMocks() {
|
|
|
107
97
|
scale: 3,
|
|
108
98
|
fontScale: 1
|
|
109
99
|
});
|
|
110
|
-
if (mock.Appearance._reset) mock.Appearance._reset();
|
|
111
|
-
else mock.Appearance.setColorScheme("light");
|
|
112
100
|
if (mock.useColorScheme._resetScheme) mock.useColorScheme._resetScheme("light");
|
|
113
101
|
else if (mock.useColorScheme._setScheme) mock.useColorScheme._setScheme("light");
|
|
114
|
-
if (mock.Keyboard._reset) mock.Keyboard._reset();
|
|
115
|
-
if (mock.AppState._reset) mock.AppState._reset();
|
|
116
|
-
if (mock.BackHandler._reset) mock.BackHandler._reset();
|
|
117
|
-
if (mock.I18nManager._reset) mock.I18nManager._reset();
|
|
118
|
-
if (mock.DeviceEventEmitter._reset) mock.DeviceEventEmitter._reset();
|
|
119
102
|
if (originalNativeModules !== null) {
|
|
120
103
|
mock.NativeModules = originalNativeModules;
|
|
121
104
|
originalNativeModules = null;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Mock } from "vitest";
|
|
2
|
-
|
|
3
|
-
//#region \0rolldown/runtime.js
|
|
4
|
-
//#endregion
|
|
5
2
|
//#region src/types.d.ts
|
|
6
3
|
/** Static methods available on the Image component mock. */
|
|
7
4
|
interface ImageStatic {
|
|
@@ -244,9 +241,14 @@ interface VitestNativeOptions {
|
|
|
244
241
|
*/
|
|
245
242
|
engine?: "auto" | "mock" | "native";
|
|
246
243
|
/**
|
|
247
|
-
* Built-in third-party library presets.
|
|
248
|
-
*
|
|
249
|
-
*
|
|
244
|
+
* Built-in third-party library presets.
|
|
245
|
+
*
|
|
246
|
+
* An ARRAY replaces auto-detection entirely: only those presets are used.
|
|
247
|
+
*
|
|
248
|
+
* An OBJECT keeps auto-detection and turns individual presets off by name —
|
|
249
|
+
* `{ navigation: false }` — which is what you want when one preset gets in the
|
|
250
|
+
* way. Listing every other detected preset back by hand just to drop one is
|
|
251
|
+
* both tedious and a thing that silently rots as dependencies change.
|
|
250
252
|
*
|
|
251
253
|
* Only built-in presets are supported (reanimated, gestureHandler,
|
|
252
254
|
* safeAreaContext, navigation, asyncStorage, screens, expo). For custom
|
|
@@ -258,7 +260,7 @@ interface VitestNativeOptions {
|
|
|
258
260
|
* reactNative({ presets: [presets.reanimated(), presets.navigation()] })
|
|
259
261
|
* ```
|
|
260
262
|
*/
|
|
261
|
-
presets?: Preset[]
|
|
263
|
+
presets?: Preset[] | Record<string, boolean>;
|
|
262
264
|
/**
|
|
263
265
|
* `engine: 'mock'` only. Plain-data overrides merged into the react-native
|
|
264
266
|
* module mock.
|
|
@@ -349,6 +351,9 @@ declare function deviceInfo(): Preset;
|
|
|
349
351
|
//#region src/presets/mmkv.d.ts
|
|
350
352
|
declare function mmkv(): Preset;
|
|
351
353
|
//#endregion
|
|
354
|
+
//#region src/presets/netinfo.d.ts
|
|
355
|
+
declare function netInfo(): Preset;
|
|
356
|
+
//#endregion
|
|
352
357
|
//#region src/presets/svg.d.ts
|
|
353
358
|
declare function svg(): Preset;
|
|
354
359
|
//#endregion
|
|
@@ -370,7 +375,7 @@ declare function keyboardController(): Preset;
|
|
|
370
375
|
//#region src/presets/worklets.d.ts
|
|
371
376
|
declare function worklets(): Preset;
|
|
372
377
|
declare namespace index_d_exports {
|
|
373
|
-
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
378
|
+
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, netInfo, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
374
379
|
}
|
|
375
380
|
//#endregion
|
|
376
|
-
export {
|
|
381
|
+
export { gestureHandler as _, flashList as a, ReactNativeMock as b, svg as c, deviceInfo as d, expo as f, safeAreaContext as g, navigation as h, bottomSheet as i, netInfo as l, asyncStorage as m, worklets as n, vectorIcons as o, screens as p, keyboardController as r, webview as s, index_d_exports as t, mmkv as u, reanimated as v, VitestNativeOptions as x, Preset as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mock } from "vitest";
|
|
2
|
-
|
|
2
|
+
//#endregion
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
/** Static methods available on the Image component mock. */
|
|
5
5
|
interface ImageStatic {
|
|
@@ -242,9 +242,14 @@ interface VitestNativeOptions {
|
|
|
242
242
|
*/
|
|
243
243
|
engine?: "auto" | "mock" | "native";
|
|
244
244
|
/**
|
|
245
|
-
* Built-in third-party library presets.
|
|
246
|
-
*
|
|
247
|
-
*
|
|
245
|
+
* Built-in third-party library presets.
|
|
246
|
+
*
|
|
247
|
+
* An ARRAY replaces auto-detection entirely: only those presets are used.
|
|
248
|
+
*
|
|
249
|
+
* An OBJECT keeps auto-detection and turns individual presets off by name —
|
|
250
|
+
* `{ navigation: false }` — which is what you want when one preset gets in the
|
|
251
|
+
* way. Listing every other detected preset back by hand just to drop one is
|
|
252
|
+
* both tedious and a thing that silently rots as dependencies change.
|
|
248
253
|
*
|
|
249
254
|
* Only built-in presets are supported (reanimated, gestureHandler,
|
|
250
255
|
* safeAreaContext, navigation, asyncStorage, screens, expo). For custom
|
|
@@ -256,7 +261,7 @@ interface VitestNativeOptions {
|
|
|
256
261
|
* reactNative({ presets: [presets.reanimated(), presets.navigation()] })
|
|
257
262
|
* ```
|
|
258
263
|
*/
|
|
259
|
-
presets?: Preset[]
|
|
264
|
+
presets?: Preset[] | Record<string, boolean>;
|
|
260
265
|
/**
|
|
261
266
|
* `engine: 'mock'` only. Plain-data overrides merged into the react-native
|
|
262
267
|
* module mock.
|
|
@@ -347,6 +352,9 @@ declare function deviceInfo(): Preset;
|
|
|
347
352
|
//#region src/presets/mmkv.d.ts
|
|
348
353
|
declare function mmkv(): Preset;
|
|
349
354
|
//#endregion
|
|
355
|
+
//#region src/presets/netinfo.d.ts
|
|
356
|
+
declare function netInfo(): Preset;
|
|
357
|
+
//#endregion
|
|
350
358
|
//#region src/presets/svg.d.ts
|
|
351
359
|
declare function svg(): Preset;
|
|
352
360
|
//#endregion
|
|
@@ -368,7 +376,7 @@ declare function keyboardController(): Preset;
|
|
|
368
376
|
//#region src/presets/worklets.d.ts
|
|
369
377
|
declare function worklets(): Preset;
|
|
370
378
|
declare namespace index_d_exports {
|
|
371
|
-
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
379
|
+
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, netInfo, reanimated, safeAreaContext, screens, svg, vectorIcons, webview, worklets };
|
|
372
380
|
}
|
|
373
381
|
//#endregion
|
|
374
|
-
export {
|
|
382
|
+
export { gestureHandler as _, flashList as a, ReactNativeMock as b, svg as c, deviceInfo as d, expo as f, safeAreaContext as g, navigation as h, bottomSheet as i, netInfo as l, asyncStorage as m, worklets as n, vectorIcons as o, screens as p, keyboardController as r, webview as s, index_d_exports as t, mmkv as u, reanimated as v, VitestNativeOptions as x, Preset as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as ReactNativeMock, t as index_d_exports, x as VitestNativeOptions, y as Preset } from "./index-CrMeE8rd.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/plugin.d.ts
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Preset names switched off by the object form of the `presets` option.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* The array form replaces auto-detection wholesale, which meant that turning ONE
|
|
8
|
+
* preset off required listing every other detected preset by hand — tedious, and a
|
|
9
|
+
* list that silently rots as dependencies change. The object form keeps detection
|
|
10
|
+
* and names only what to drop.
|
|
11
11
|
*/
|
|
12
|
+
declare function disabledPresetNames(presets: unknown): Set<string>;
|
|
12
13
|
declare function reactNative(options?: VitestNativeOptions): Plugin;
|
|
13
14
|
//#endregion
|
|
14
|
-
export { type Preset, type ReactNativeMock, type VitestNativeOptions, index_d_exports as presets, reactNative };
|
|
15
|
+
export { type Preset, type ReactNativeMock, type VitestNativeOptions, disabledPresetNames, index_d_exports as presets, reactNative };
|