vitest-native 0.14.1 → 0.15.0-rc.2

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.
Files changed (89) hide show
  1. package/README.md +11 -10
  2. package/dist/cli.d.mts +9 -1
  3. package/dist/cli.mjs +2609 -361
  4. package/dist/context.d.mts +19 -0
  5. package/dist/context.mjs +47 -1
  6. package/dist/docs-url.d.mts +4 -0
  7. package/dist/docs-url.mjs +9 -0
  8. package/dist/errors.d.mts +21 -1
  9. package/dist/hang-watch-setup.mjs +55 -0
  10. package/dist/hang-watch.d.mts +56 -0
  11. package/dist/hang-watch.mjs +343 -0
  12. package/dist/helpers.cjs +24 -53
  13. package/dist/helpers.mjs +22 -1
  14. package/dist/host-D0r3P_T1.mjs +1985 -0
  15. package/dist/{index-aNBCTfA5.d.mts → index-JOR602XU.d.mts} +105 -2
  16. package/dist/index.d.mts +2 -1
  17. package/dist/index.mjs +723 -149
  18. package/dist/jest-compat/aliases.d.mts +1 -0
  19. package/dist/jest-compat/aliases.mjs +11 -0
  20. package/dist/jest-compat/interop.mjs +1 -1
  21. package/dist/jest-compat/jest-object.mjs +23 -5
  22. package/dist/jest-compat/node-registry.mjs +836 -68
  23. package/dist/jest-compat/setup.mjs +205 -12
  24. package/dist/jest-compat.cjs +383 -47
  25. package/dist/jest-compat.d.cts +19 -2
  26. package/dist/jest-compat.d.mts +19 -2
  27. package/dist/jest-compat.mjs +232 -47
  28. package/dist/matchers.d.cts +0 -1
  29. package/dist/matchers.d.mts +0 -1
  30. package/dist/native/assets.mjs +3 -1
  31. package/dist/native/babel-caller.d.mts +13 -0
  32. package/dist/native/babel-caller.mjs +24 -0
  33. package/dist/native/babel-toolchain.mjs +27 -3
  34. package/dist/native/boundary.mjs +45 -8
  35. package/dist/native/bounded-process.mjs +63 -5
  36. package/dist/native/bridge-client.mjs +133 -0
  37. package/dist/native/bridge-server.mjs +215 -0
  38. package/dist/native/bridge-thread.mjs +79 -0
  39. package/dist/native/bridge.mjs +512 -0
  40. package/dist/native/compile-error.mjs +120 -0
  41. package/dist/native/explain.mjs +3 -2
  42. package/dist/native/expo-module-mocks.mjs +2 -0
  43. package/dist/native/export-condition-recovery.mjs +20 -99
  44. package/dist/native/hooks.mjs +256 -133
  45. package/dist/native/jest-resolvers.mjs +94 -0
  46. package/dist/native/library-jest.mjs +352 -0
  47. package/dist/native/loader.mjs +167 -73
  48. package/dist/native/match.mjs +67 -7
  49. package/dist/native/module-reset.mjs +44 -49
  50. package/dist/native/ownership-ledger.d.mts +87 -0
  51. package/dist/native/ownership-ledger.mjs +524 -0
  52. package/dist/native/ownership.d.mts +20 -0
  53. package/dist/native/ownership.mjs +114 -0
  54. package/dist/native/registry-compiler.mjs +39 -5
  55. package/dist/native/registry-process.mjs +327 -28
  56. package/dist/native/registry.mjs +752 -200
  57. package/dist/native/resident-health.mjs +1 -0
  58. package/dist/native/resolve.d.mts +7 -0
  59. package/dist/native/resolve.mjs +119 -4
  60. package/dist/native/rntl-hooks.mjs +9 -5
  61. package/dist/native/rntl-text-host.mjs +5 -15
  62. package/dist/native/root-spelling.d.mts +6 -0
  63. package/dist/native/root-spelling.mjs +77 -0
  64. package/dist/native/runner.mjs +2 -19
  65. package/dist/native/setup.mjs +119 -38
  66. package/dist/native/shared-resolver.d.mts +141 -0
  67. package/dist/native/shared-resolver.mjs +719 -0
  68. package/dist/native/test-runner.mjs +26 -0
  69. package/dist/native/transform.mjs +18 -22
  70. package/dist/native/worker.mjs +9 -4
  71. package/dist/node-dispatch.mjs +293 -0
  72. package/dist/{preset-map-CogjYmSw.mjs → preset-map-DdAexIwz.mjs} +113 -2
  73. package/dist/{presets-CXDyg51l.mjs → presets-_EaSw29m.mjs} +710 -130
  74. package/dist/presets.d.mts +1 -1
  75. package/dist/presets.mjs +1 -1
  76. package/dist/rntl-matchers.d.ts +11 -15
  77. package/dist/rntl-support.mjs +28 -13
  78. package/dist/root-mocks-BNXeosbR.mjs +155 -0
  79. package/dist/serializer.cjs +7 -5
  80. package/dist/serializer.d.cts +7 -5
  81. package/dist/serializer.d.mts +7 -5
  82. package/dist/serializer.mjs +7 -5
  83. package/dist/setup.mjs +26 -27
  84. package/docs/migrating-from-jest.md +9 -232
  85. package/docs/migrating-from-vitest-react-native.md +4 -4
  86. package/docs/release-readiness.md +9 -11
  87. package/docs/versioning.md +38 -9
  88. package/package.json +59 -33
  89. package/dist/host-BAAAlSkO.mjs +0 -1028
@@ -0,0 +1,141 @@
1
+ /** An alias entry: a Vite string `find`, a serialized RegExp, or a tsconfig wildcard prefix. */
2
+ /** A Vite alias (a string or a RegExp), or a tsconfig `paths` entry (exact, or a wildcard prefix). */
3
+ export type ResolutionAliasFind =
4
+ | string
5
+ | { source: string; flags: string }
6
+ | { prefix: string }
7
+ | { exact: string };
8
+ export type ResolutionAlias = [ResolutionAliasFind, string];
9
+
10
+ /** What every realm builds its resolver from (the project context's `resolverInputs`). */
11
+ export interface ResolverInputs {
12
+ projectRoot: string;
13
+ platform: string;
14
+ sourceExts?: string[];
15
+ preserveSymlinks?: boolean;
16
+ aliases?: ResolutionAlias[];
17
+ /** Node's CommonJS conditions in the workers, `react-native` excluded. */
18
+ conditions?: string[];
19
+ /**
20
+ * Packages that run as themselves under their own Jest support (the library setup
21
+ * files): resolved as their Jest oracle resolves them, to `main`, never their
22
+ * `react-native` field.
23
+ */
24
+ ownJestSupport?: string[];
25
+ }
26
+
27
+ export interface ResolverCounters {
28
+ calls: number;
29
+ hits: number;
30
+ misses: number;
31
+ manifestReads: number;
32
+ fallbacks: Record<string, number>;
33
+ /** The first few errors, named. */
34
+ errors: string[];
35
+ /** Requests the replaced resolution answered differently, and the first 50. */
36
+ deltas: number;
37
+ deltaSample: { request: string; from: string; previous: string; next: string }[];
38
+ }
39
+
40
+ /** The relative target a package's `exports` gives `subpath` under `conditions`, or null. */
41
+ export declare function exportTarget(
42
+ exportsField: unknown,
43
+ subpath: string,
44
+ conditions: readonly string[],
45
+ ): string | null;
46
+
47
+ /** A main field's file as the resolver completes it (platform files, `sourceExts`, `index`), or null. */
48
+ export declare function mainFieldFile(
49
+ target: string,
50
+ platform: string,
51
+ sourceExts: readonly string[],
52
+ ): string | null;
53
+
54
+ /** The context's resolver inputs, checked; null with the flag off; throws when they are missing. */
55
+ export declare function ownershipResolverInputs(
56
+ context:
57
+ | { ownershipModel?: string; resolverInputs?: ResolverInputs; resolverInputsHash?: string }
58
+ | null
59
+ | undefined,
60
+ realm: string,
61
+ nodeConditions?: readonly string[],
62
+ ): ResolverInputs | null;
63
+
64
+ /** Under diagnostics, the JSON-lines file every realm writes the resolution shadow to. */
65
+ export declare function ownershipShadowFile(contextRef: string, inputsHash: string): string;
66
+
67
+ /** Per realm, fallbacks outside FALLBACK_ALLOWED with the errors named; empty when none. */
68
+ export declare function unexpectedFallbacks(
69
+ realms?: Record<string, ResolverCounters>,
70
+ ): Record<string, Record<string, number | string[]>>;
71
+
72
+ /** The native real path (Vite's id spelling): the key for comparing paths across realms. */
73
+ export declare function identityKey(file: string): string;
74
+
75
+ export declare const FALLBACK_ALLOWED: readonly string[];
76
+ export declare const OWNERSHIP_MODEL_VALUES: readonly string[];
77
+
78
+ export declare function resolverCounters(): Record<string, ResolverCounters> | undefined;
79
+ export declare function resolverInputsHash(inputs: ResolverInputs): string;
80
+
81
+ export interface SharedResolver {
82
+ /** The real path `request` loads from `parentFile`, or null to let the caller decide. */
83
+ resolve(
84
+ request: string,
85
+ parentFile: string | null | undefined,
86
+ nodeResolve?: (id: string) => string,
87
+ ): string | null;
88
+ shadow(
89
+ request: string,
90
+ fromFile: string | null | undefined,
91
+ next: string,
92
+ previous: string | null | undefined,
93
+ ): void;
94
+ /** Forget the answer held for `request` from `parentFile` (its file is gone). */
95
+ forget(request: string, parentFile: string | null | undefined): void;
96
+ clear(): void;
97
+ counters: ResolverCounters;
98
+ conditions: string[];
99
+ }
100
+
101
+ export declare function createSharedResolver(
102
+ inputs: ResolverInputs,
103
+ options?: {
104
+ realm?: string;
105
+ memo?: boolean;
106
+ shadowFile?: string | null;
107
+ viteAliasesApplied?: boolean;
108
+ globalFolders?: boolean;
109
+ },
110
+ ): SharedResolver;
111
+
112
+ /** This worker's resolver for `realm`: every realm in a worker shares one core. */
113
+ export declare function workerSharedResolver(
114
+ inputs: ResolverInputs,
115
+ realm: string,
116
+ options?: { shadowFile?: string | null; globalFolders?: boolean },
117
+ ): SharedResolver;
118
+
119
+ export declare function serializeResolutionAliases(
120
+ alias: unknown[],
121
+ root: string,
122
+ ): { entries: ResolutionAlias[]; skipped: string[] };
123
+
124
+ export declare function aliasList(value: unknown): unknown[];
125
+
126
+ export declare function expandResolutionAlias(
127
+ specifier: string,
128
+ entries: ResolutionAlias[],
129
+ ): string;
130
+
131
+ export declare function conditionsIn(options: string[]): string[];
132
+ export declare function nodeOptionsList(value: unknown): string[];
133
+
134
+ export declare function checkResolverInputs(
135
+ inputs: ResolverInputs,
136
+ hash: string,
137
+ realm: string,
138
+ view?: { nodeConditions?: string[] },
139
+ ): void;
140
+
141
+ export declare function nodeDefaultConditions(features?: { require_module?: boolean }): string[];