vitest-native 0.14.0-rc.8 → 0.14.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/README.md +91 -72
- package/dist/cli.d.mts +1 -3
- package/dist/cli.mjs +215 -76
- package/dist/context.d.mts +45 -0
- package/dist/context.mjs +243 -0
- package/dist/errors.d.mts +3 -0
- package/dist/helpers.cjs +53 -4
- package/dist/helpers.d.cts +1 -3
- package/dist/helpers.d.mts +1 -3
- package/dist/helpers.mjs +2 -3
- package/dist/host-5o48Ujzs.mjs +939 -0
- package/dist/{index-BSyUeoga.d.mts → index-DqU4YO3D.d.mts} +32 -53
- package/dist/index.d.mts +1 -3
- package/dist/index.mjs +464 -596
- package/dist/jest-compat/error-equality.mjs +127 -0
- package/dist/jest-compat/jest-object.mjs +149 -4
- package/dist/jest-compat/node-registry.mjs +233 -58
- package/dist/jest-compat/setup.mjs +34 -4
- package/dist/jest-compat.cjs +227 -52
- package/dist/jest-compat.d.cts +5 -6
- package/dist/jest-compat.d.mts +5 -6
- package/dist/jest-compat.mjs +204 -52
- package/dist/matchers.cjs +1 -2
- package/dist/matchers.d.cts +0 -2
- package/dist/matchers.d.mts +0 -2
- package/dist/matchers.mjs +1 -2
- package/dist/{memory-FYbP0_gg.mjs → memory-Couw0Esx.mjs} +31 -6
- package/dist/native/assets.d.mts +2 -0
- package/dist/native/assets.mjs +34 -0
- package/dist/native/babel-toolchain.mjs +190 -0
- package/dist/native/babel-worker.mjs +47 -0
- package/dist/native/boundary.mjs +23 -8
- package/dist/native/compile-cache.mjs +21 -9
- package/dist/native/coverage-v8.mjs +287 -0
- package/dist/native/esm-interop.mjs +216 -0
- package/dist/native/expo-native-modules.mjs +7 -1
- package/dist/native/globals.mjs +104 -6
- package/dist/native/hooks.mjs +271 -60
- package/dist/native/loader.mjs +409 -20
- package/dist/native/match.d.mts +24 -2
- package/dist/native/match.mjs +117 -12
- package/dist/native/metro-profile-compiler.mjs +2 -31
- package/dist/native/module-reset.mjs +37 -5
- package/dist/native/native-modules.d.mts +2 -3
- package/dist/native/native-modules.mjs +22 -21
- package/dist/native/ownership.d.mts +10 -0
- package/dist/native/ownership.mjs +96 -9
- package/dist/native/registry-compiler.mjs +6 -0
- package/dist/native/registry.mjs +138 -119
- package/dist/native/resident-health.mjs +133 -0
- package/dist/native/resolve.d.mts +6 -0
- package/dist/native/resolve.mjs +100 -9
- package/dist/native/rntl-hooks.mjs +157 -6
- package/dist/native/rntl-text-host.mjs +64 -0
- package/dist/native/runner.mjs +106 -1
- package/dist/native/setup.mjs +105 -77
- package/dist/native/state-manifest.mjs +14 -8
- package/dist/native/transform.d.mts +2 -0
- package/dist/native/transform.mjs +476 -59
- package/dist/native/worker.mjs +151 -46
- package/dist/{pool-DjpOjOf3.mjs → pool-CFSpNfyw.mjs} +37 -11
- package/dist/{preset-map-BlBriTA0.mjs → preset-map-CogjYmSw.mjs} +4 -19
- package/dist/preset-modules.mjs +2 -11
- package/dist/{presets--zrEWQC2.mjs → presets-CXDyg51l.mjs} +65 -82
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/report-error.d.mts +20 -0
- package/dist/report-error.mjs +145 -0
- package/dist/rntl-support.d.mts +12 -0
- package/dist/rntl-support.mjs +189 -0
- package/dist/{rolldown-runtime-BhDjJH2R.mjs → rolldown-runtime-D70C1uOS.mjs} +1 -2
- package/dist/serializer.cjs +1 -2
- package/dist/serializer.d.cts +1 -3
- package/dist/serializer.d.mts +1 -3
- package/dist/serializer.mjs +1 -2
- package/dist/setup.mjs +95 -156
- package/dist/{worker-vitest-BGPo0ek6.mjs → worker-vitest-CILPFeRX.mjs} +2 -3
- package/docs/migrating-from-jest.md +76 -12
- package/docs/migrating-from-vitest-react-native.md +1 -1
- package/docs/release-readiness.md +6 -5
- package/docs/versioning.md +1 -1
- package/package.json +121 -103
- package/CHANGELOG.md +0 -2475
- package/dist/cli.cjs +0 -1924
- package/dist/cli.d.cts +0 -3
- package/dist/ecosystem-D6e1OVOg.mjs +0 -1019
- package/dist/ecosystem-MFwkbnaC.cjs +0 -1099
- package/dist/errors-B3lJK46O.cjs +0 -75
- package/dist/errors-CxoBUfVJ.mjs +0 -64
- package/dist/index-bZ7AHqLc.d.cts +0 -482
- package/dist/memory-6EPHrJA1.cjs +0 -144
- package/dist/pool-B4yesGhI.cjs +0 -121
- package/dist/preset-map-jSFsNy1Q.cjs +0 -241
- package/dist/preset-modules-BoLkaeEN.cjs +0 -53
- package/dist/preset-modules-CG8-G82P.mjs +0 -36
- package/dist/presets-9f83H0WW.cjs +0 -3939
- package/dist/rolldown-runtime-C0BPl7ul.cjs +0 -43
- package/dist/worker-vitest-BfiQB8ND.cjs +0 -62
- package/docs/hot-default-design.md +0 -216
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Mock } from "vitest";
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
/** Static methods available on the Image component mock. */
|
|
4
3
|
interface ImageStatic {
|
|
5
4
|
getSize: Mock;
|
|
@@ -243,6 +242,13 @@ interface NavigationPresetOptions {
|
|
|
243
242
|
*/
|
|
244
243
|
defaultRouteParams?: Record<string, unknown>;
|
|
245
244
|
}
|
|
245
|
+
/** The `hotRuntime` object form's recycling options, shared by both of its modes. */
|
|
246
|
+
interface HotRuntimeRecycleOptions {
|
|
247
|
+
recycleAfterFiles?: number;
|
|
248
|
+
memoryLimit?: number;
|
|
249
|
+
preserveGlobals?: string[];
|
|
250
|
+
esmGeneration?: boolean;
|
|
251
|
+
}
|
|
246
252
|
interface VitestNativeOptions {
|
|
247
253
|
/** Target platform. Default: 'ios' */
|
|
248
254
|
platform?: "ios" | "android";
|
|
@@ -368,7 +374,9 @@ interface VitestNativeOptions {
|
|
|
368
374
|
* or exceeds this value, also between scheduler tasks. By default a
|
|
369
375
|
* constrained-memory-aware plan derives this threshold, caps automatic
|
|
370
376
|
* concurrency at four, reserves main-process and worker-replacement RSS,
|
|
371
|
-
* and stops before crossing 90% of the host/container limit.
|
|
377
|
+
* and stops before crossing 90% of the host/container limit. A worker count
|
|
378
|
+
* you set (`maxWorkers`, `--maxWorkers` or `VITEST_MAX_WORKERS`) is capped
|
|
379
|
+
* only by what that memory envelope admits.
|
|
372
380
|
* - `allowUnboundedMemory`: explicitly permit configurations where Vitest
|
|
373
381
|
* cannot enforce file-boundary recycling, notably `maxWorkers: 1`. This
|
|
374
382
|
* also disables the automatic worker cap and process-RSS hard stop. Use
|
|
@@ -384,24 +392,34 @@ interface VitestNativeOptions {
|
|
|
384
392
|
* re-execution: a suite whose files import many externalized (non-React
|
|
385
393
|
* Native) packages measured 55% more wall clock at the extreme — still 9x
|
|
386
394
|
* stock isolation, against 13.9x with it off. Set false to trade that back,
|
|
387
|
-
* accepting that a package holding state across files will keep it.
|
|
395
|
+
* accepting that a package holding state across files will keep it. While it
|
|
396
|
+
* is on, hot workers leave Node's V8 compile cache off, because every file
|
|
397
|
+
* would add an entry per re-evaluated module (unless `NODE_COMPILE_CACHE` is
|
|
398
|
+
* set, which turns the cache on before vitest-native runs).
|
|
388
399
|
*
|
|
389
400
|
* `'auto'` selects the bounded hot runtime when the configuration has recyclable
|
|
390
401
|
* task boundaries (enough memory headroom for at least two workers) and no
|
|
391
|
-
* explicit custom pool; otherwise the run keeps per-file isolation
|
|
392
|
-
*
|
|
393
|
-
*
|
|
402
|
+
* explicit custom pool; otherwise the run keeps per-file isolation and prints the
|
|
403
|
+
* reason for falling back.
|
|
404
|
+
*
|
|
405
|
+
* - `mode: 'auto'` in the object form selects the same way, with the object's
|
|
406
|
+
* recycling options applied when the hot runtime runs:
|
|
407
|
+
* `{ mode: 'auto', memoryLimit: 2 * 1024 ** 3 }`. Without `mode`, the object
|
|
408
|
+
* form requires the hot runtime, as `true` does. Cannot be combined with
|
|
409
|
+
* `allowUnboundedMemory: true`. Worker count and process-RSS limits still come
|
|
410
|
+
* from the memory plan; `memoryLimit: 0` turns the heap threshold off.
|
|
394
411
|
*
|
|
395
|
-
* Default: `
|
|
396
|
-
* Native reloaded per file.
|
|
412
|
+
* Default: `false`, as in 0.13.0: each file runs in a fresh worker, with React
|
|
413
|
+
* Native reloaded per file. The hot runtime has known differences from per-file
|
|
414
|
+
* isolation, listed in the troubleshooting guide.
|
|
397
415
|
*/
|
|
398
|
-
hotRuntime?: boolean | "auto" | {
|
|
399
|
-
|
|
400
|
-
memoryLimit?: number;
|
|
416
|
+
hotRuntime?: boolean | "auto" | (HotRuntimeRecycleOptions & {
|
|
417
|
+
mode?: undefined;
|
|
401
418
|
allowUnboundedMemory?: boolean;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
419
|
+
}) | (HotRuntimeRecycleOptions & {
|
|
420
|
+
mode: "auto";
|
|
421
|
+
allowUnboundedMemory?: false;
|
|
422
|
+
});
|
|
405
423
|
/**
|
|
406
424
|
* `engine: 'native'` only. How native module lookups answer.
|
|
407
425
|
*
|
|
@@ -417,65 +435,26 @@ interface VitestNativeOptions {
|
|
|
417
435
|
*/
|
|
418
436
|
nativeModules?: "device" | "permissive";
|
|
419
437
|
}
|
|
420
|
-
//#endregion
|
|
421
|
-
//#region src/presets/reanimated.d.ts
|
|
422
438
|
declare function reanimated(): Preset;
|
|
423
|
-
//#endregion
|
|
424
|
-
//#region src/presets/gesture-handler.d.ts
|
|
425
439
|
declare function gestureHandler(): Preset;
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/presets/safe-area.d.ts
|
|
428
440
|
declare function safeAreaContext(): Preset;
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/presets/navigation.d.ts
|
|
431
441
|
declare function navigation(presetOptions?: NavigationPresetOptions): Preset;
|
|
432
|
-
//#endregion
|
|
433
|
-
//#region src/presets/async-storage.d.ts
|
|
434
442
|
declare function asyncStorage(): Preset;
|
|
435
|
-
//#endregion
|
|
436
|
-
//#region src/presets/screens.d.ts
|
|
437
443
|
declare function screens(): Preset;
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/presets/expo.d.ts
|
|
440
444
|
declare function expo(): Preset;
|
|
441
|
-
//#endregion
|
|
442
|
-
//#region src/presets/device-info.d.ts
|
|
443
445
|
declare function deviceInfo(): Preset;
|
|
444
|
-
//#endregion
|
|
445
|
-
//#region src/presets/mmkv.d.ts
|
|
446
446
|
declare function mmkv(): Preset;
|
|
447
|
-
//#endregion
|
|
448
|
-
//#region src/presets/netinfo.d.ts
|
|
449
447
|
declare function netInfo(): Preset;
|
|
450
|
-
//#endregion
|
|
451
|
-
//#region src/presets/svg.d.ts
|
|
452
448
|
declare function svg(): Preset;
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/presets/webview.d.ts
|
|
455
449
|
declare function webview(): Preset;
|
|
456
|
-
//#endregion
|
|
457
|
-
//#region src/presets/vector-icons.d.ts
|
|
458
450
|
declare function vectorIcons(): Preset;
|
|
459
|
-
//#endregion
|
|
460
|
-
//#region src/presets/flash-list.d.ts
|
|
461
451
|
declare function flashList(): Preset;
|
|
462
|
-
//#endregion
|
|
463
|
-
//#region src/presets/bottom-sheet.d.ts
|
|
464
452
|
declare function bottomSheet(): Preset;
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region src/presets/keyboard-controller.d.ts
|
|
467
453
|
declare function keyboardController(): Preset;
|
|
468
|
-
//#endregion
|
|
469
|
-
//#region src/presets/worklets.d.ts
|
|
470
454
|
declare function worklets(): Preset;
|
|
471
|
-
//#endregion
|
|
472
|
-
//#region src/presets/unistyles.d.ts
|
|
473
455
|
declare function unistyles(): Preset;
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region src/presets/skia.d.ts
|
|
476
456
|
declare function skia(): Preset;
|
|
477
457
|
declare namespace index_d_exports {
|
|
478
458
|
export { asyncStorage, bottomSheet, deviceInfo, expo, flashList, gestureHandler, keyboardController, mmkv, navigation, netInfo, reanimated, safeAreaContext, screens, skia, svg, unistyles, vectorIcons, webview, worklets };
|
|
479
459
|
}
|
|
480
|
-
//#endregion
|
|
481
460
|
export { VitestNativeOptions as C, ReactNativeMock as S, navigation as _, keyboardController as a, reanimated as b, vectorIcons as c, netInfo as d, mmkv as f, asyncStorage as g, screens as h, worklets as i, webview as l, expo as m, skia as n, bottomSheet as o, deviceInfo as p, unistyles as r, flashList as s, index_d_exports as t, svg as u, safeAreaContext as v, Preset as x, gestureHandler as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { C as VitestNativeOptions, S as ReactNativeMock, t as index_d_exports, x as Preset } from "./index-
|
|
1
|
+
import { C as VitestNativeOptions, S as ReactNativeMock, t as index_d_exports, x as Preset } from "./index-DqU4YO3D.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
//#region src/plugin.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Preset names switched off by the object form of the `presets` option.
|
|
6
5
|
*
|
|
@@ -11,5 +10,4 @@ import { Plugin } from "vite";
|
|
|
11
10
|
*/
|
|
12
11
|
export declare function disabledPresetNames(presets: unknown): Set<string>;
|
|
13
12
|
export declare function reactNative(options?: VitestNativeOptions): Plugin;
|
|
14
|
-
//#endregion
|
|
15
13
|
export { type Preset, type ReactNativeMock, type VitestNativeOptions, index_d_exports as presets };
|