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.
Files changed (99) hide show
  1. package/README.md +91 -72
  2. package/dist/cli.d.mts +1 -3
  3. package/dist/cli.mjs +215 -76
  4. package/dist/context.d.mts +45 -0
  5. package/dist/context.mjs +243 -0
  6. package/dist/errors.d.mts +3 -0
  7. package/dist/helpers.cjs +53 -4
  8. package/dist/helpers.d.cts +1 -3
  9. package/dist/helpers.d.mts +1 -3
  10. package/dist/helpers.mjs +2 -3
  11. package/dist/host-5o48Ujzs.mjs +939 -0
  12. package/dist/{index-BSyUeoga.d.mts → index-DqU4YO3D.d.mts} +32 -53
  13. package/dist/index.d.mts +1 -3
  14. package/dist/index.mjs +464 -596
  15. package/dist/jest-compat/error-equality.mjs +127 -0
  16. package/dist/jest-compat/jest-object.mjs +149 -4
  17. package/dist/jest-compat/node-registry.mjs +233 -58
  18. package/dist/jest-compat/setup.mjs +34 -4
  19. package/dist/jest-compat.cjs +227 -52
  20. package/dist/jest-compat.d.cts +5 -6
  21. package/dist/jest-compat.d.mts +5 -6
  22. package/dist/jest-compat.mjs +204 -52
  23. package/dist/matchers.cjs +1 -2
  24. package/dist/matchers.d.cts +0 -2
  25. package/dist/matchers.d.mts +0 -2
  26. package/dist/matchers.mjs +1 -2
  27. package/dist/{memory-FYbP0_gg.mjs → memory-Couw0Esx.mjs} +31 -6
  28. package/dist/native/assets.d.mts +2 -0
  29. package/dist/native/assets.mjs +34 -0
  30. package/dist/native/babel-toolchain.mjs +190 -0
  31. package/dist/native/babel-worker.mjs +47 -0
  32. package/dist/native/boundary.mjs +23 -8
  33. package/dist/native/compile-cache.mjs +21 -9
  34. package/dist/native/coverage-v8.mjs +287 -0
  35. package/dist/native/esm-interop.mjs +216 -0
  36. package/dist/native/expo-native-modules.mjs +7 -1
  37. package/dist/native/globals.mjs +104 -6
  38. package/dist/native/hooks.mjs +271 -60
  39. package/dist/native/loader.mjs +409 -20
  40. package/dist/native/match.d.mts +24 -2
  41. package/dist/native/match.mjs +117 -12
  42. package/dist/native/metro-profile-compiler.mjs +2 -31
  43. package/dist/native/module-reset.mjs +37 -5
  44. package/dist/native/native-modules.d.mts +2 -3
  45. package/dist/native/native-modules.mjs +22 -21
  46. package/dist/native/ownership.d.mts +10 -0
  47. package/dist/native/ownership.mjs +96 -9
  48. package/dist/native/registry-compiler.mjs +6 -0
  49. package/dist/native/registry.mjs +138 -119
  50. package/dist/native/resident-health.mjs +133 -0
  51. package/dist/native/resolve.d.mts +6 -0
  52. package/dist/native/resolve.mjs +100 -9
  53. package/dist/native/rntl-hooks.mjs +157 -6
  54. package/dist/native/rntl-text-host.mjs +64 -0
  55. package/dist/native/runner.mjs +106 -1
  56. package/dist/native/setup.mjs +105 -77
  57. package/dist/native/state-manifest.mjs +14 -8
  58. package/dist/native/transform.d.mts +2 -0
  59. package/dist/native/transform.mjs +476 -59
  60. package/dist/native/worker.mjs +151 -46
  61. package/dist/{pool-DjpOjOf3.mjs → pool-CFSpNfyw.mjs} +37 -11
  62. package/dist/{preset-map-BlBriTA0.mjs → preset-map-CogjYmSw.mjs} +4 -19
  63. package/dist/preset-modules.mjs +2 -11
  64. package/dist/{presets--zrEWQC2.mjs → presets-CXDyg51l.mjs} +65 -82
  65. package/dist/presets.d.mts +1 -1
  66. package/dist/presets.mjs +1 -1
  67. package/dist/report-error.d.mts +20 -0
  68. package/dist/report-error.mjs +145 -0
  69. package/dist/rntl-support.d.mts +12 -0
  70. package/dist/rntl-support.mjs +189 -0
  71. package/dist/{rolldown-runtime-BhDjJH2R.mjs → rolldown-runtime-D70C1uOS.mjs} +1 -2
  72. package/dist/serializer.cjs +1 -2
  73. package/dist/serializer.d.cts +1 -3
  74. package/dist/serializer.d.mts +1 -3
  75. package/dist/serializer.mjs +1 -2
  76. package/dist/setup.mjs +95 -156
  77. package/dist/{worker-vitest-BGPo0ek6.mjs → worker-vitest-CILPFeRX.mjs} +2 -3
  78. package/docs/migrating-from-jest.md +76 -12
  79. package/docs/migrating-from-vitest-react-native.md +1 -1
  80. package/docs/release-readiness.md +6 -5
  81. package/docs/versioning.md +1 -1
  82. package/package.json +121 -103
  83. package/CHANGELOG.md +0 -2475
  84. package/dist/cli.cjs +0 -1924
  85. package/dist/cli.d.cts +0 -3
  86. package/dist/ecosystem-D6e1OVOg.mjs +0 -1019
  87. package/dist/ecosystem-MFwkbnaC.cjs +0 -1099
  88. package/dist/errors-B3lJK46O.cjs +0 -75
  89. package/dist/errors-CxoBUfVJ.mjs +0 -64
  90. package/dist/index-bZ7AHqLc.d.cts +0 -482
  91. package/dist/memory-6EPHrJA1.cjs +0 -144
  92. package/dist/pool-B4yesGhI.cjs +0 -121
  93. package/dist/preset-map-jSFsNy1Q.cjs +0 -241
  94. package/dist/preset-modules-BoLkaeEN.cjs +0 -53
  95. package/dist/preset-modules-CG8-G82P.mjs +0 -36
  96. package/dist/presets-9f83H0WW.cjs +0 -3939
  97. package/dist/rolldown-runtime-C0BPl7ul.cjs +0 -43
  98. package/dist/worker-vitest-BfiQB8ND.cjs +0 -62
  99. package/docs/hot-default-design.md +0 -216
@@ -1,6 +1,31 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ // \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ let node_fs = require("node:fs");
24
+ node_fs = __toESM(node_fs, 1);
25
+ let node_path = require("node:path");
26
+ node_path = __toESM(node_path, 1);
2
27
  let magic_string = require("magic-string");
3
- //#region src/jest-compat/transform.ts
28
+ // src/jest-compat/transform.ts
4
29
  const HOISTABLE = /* @__PURE__ */ new Set([
5
30
  "mock",
6
31
  "unmock",
@@ -14,10 +39,13 @@ const HAS_JEST_MOCK = /\bjest\s*\.\s*(?:mock|unmock|doMock|doUnmock)\s*\(/;
14
39
  const SETUP = "__vn_jest_compat__";
15
40
  /** Prepended to a file whose mock factories use the setup. Exported for tests. */
16
41
  const SETUP_ACCESSOR = `const ${SETUP} = vi.hoisted(() => (name) => {\n if (typeof globalThis[name] === "function") return globalThis[name];\n throw Object.assign(new Error("[vitest-native] jest.mock() factories need the jest-compat setup, which this test run does not load. " +\n "Add jestCompatSetup from 'vitest-native/jest-compat' to test.setupFiles, ahead of any setup file that calls jest.mock()."),\n { name: "VitestNativeError", code: "JEST_COMPAT_SETUP_MISSING" });\n});\n`;
17
- /** Visit every node in an ESTree AST (depth-first), calling `fn` on each. */
42
+ /**
43
+ * Visit every node in an ESTree AST (depth-first), calling `fn` on each. Returning
44
+ * `false` from `fn` skips that node's children.
45
+ */
18
46
  function walk(node, fn) {
19
47
  if (!node || typeof node.type !== "string") return;
20
- fn(node);
48
+ if (fn(node) === false) return;
21
49
  for (const key in node) {
22
50
  if (key === "type" || key === "start" || key === "end" || key === "loc") continue;
23
51
  const child = node[key];
@@ -26,6 +54,78 @@ function walk(node, fn) {
26
54
  } else if (child && typeof child.type === "string") walk(child, fn);
27
55
  }
28
56
  }
57
+ const FUNCTION = /* @__PURE__ */ new Set([
58
+ "FunctionExpression",
59
+ "ArrowFunctionExpression",
60
+ "FunctionDeclaration"
61
+ ]);
62
+ const NODE_MODULES = /[\\/]node_modules[\\/]/;
63
+ const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
64
+ /** The string specifier of a `jest.requireActual('<literal>')` call, or null. */
65
+ function requireActualSpec(node) {
66
+ if (node.type !== "CallExpression" || node.arguments.length !== 1) return null;
67
+ const callee = node.callee;
68
+ if (callee?.type !== "MemberExpression" || callee.computed) return null;
69
+ if (callee.object?.type !== "Identifier" || callee.object.name !== "jest") return null;
70
+ if (callee.property?.type !== "Identifier" || callee.property.name !== "requireActual") return null;
71
+ const arg = node.arguments[0];
72
+ if (arg.type === "Literal" && typeof arg.value === "string") return arg.value;
73
+ if (arg.type === "TemplateLiteral" && arg.expressions.length === 0) return arg.quasis[0].value.cooked ?? null;
74
+ return null;
75
+ }
76
+ /**
77
+ * The `jest.requireActual` calls a factory makes while it runs: those in its own body,
78
+ * not in a nested function or a class body (where `await` is not allowed either).
79
+ */
80
+ function ownRequireActualCalls(factory) {
81
+ const calls = [];
82
+ walk(factory.body, (node) => {
83
+ if (FUNCTION.has(node.type) || node.type === "ClassBody") return false;
84
+ const spec = requireActualSpec(node);
85
+ if (spec !== null) calls.push({
86
+ node,
87
+ spec
88
+ });
89
+ });
90
+ return calls;
91
+ }
92
+ const matchesRegExp = (patterns, file) => patterns.some((pattern) => {
93
+ if (pattern === true) return true;
94
+ if (!(pattern instanceof RegExp)) return false;
95
+ pattern.lastIndex = 0;
96
+ const hit = pattern.test(file);
97
+ pattern.lastIndex = 0;
98
+ return hit;
99
+ });
100
+ /**
101
+ * Whether a resolveId result is a source file Vite evaluates itself, so the real
102
+ * module `vi.importActual` loads is the one the app imports.
103
+ *
104
+ * The owner is the engine's ownership policy, as for every other load: a workspace
105
+ * package the engine detected as React Native, or one named in `transform`, resolves
106
+ * outside node_modules but is Node's, and loading its actual module through Vite would
107
+ * make the second copy this rewrite exists to avoid. `resolved.external` cannot say so:
108
+ * Vitest externalizes in its module runner, after resolveId, and never sets it (this
109
+ * change's first version relied on it and refused such a partial mock as a cycle).
110
+ * Where the policy defers to Vitest, or there is none (the mock engine), Vitest's own
111
+ * rule applies: a file outside node_modules is inlined unless a `server.deps.external`
112
+ * regex names it and no `server.deps.inline` regex (or `inline: true`) does. The engine also lists its
113
+ * Node-owned patterns there (native/apply.ts), so the two agree.
114
+ */
115
+ function isViteOwnedSource(resolved, project) {
116
+ if (!resolved || resolved.external) return false;
117
+ const id = resolved.id.split("?")[0];
118
+ if (id.startsWith("\0") || !node_path.default.isAbsolute(id) || !SOURCE_FILE.test(id)) return false;
119
+ let file = id;
120
+ try {
121
+ file = node_fs.default.realpathSync.native(id);
122
+ } catch {}
123
+ const owner = project.ownership()?.decideFile(file).owner;
124
+ if (owner === "vite") return true;
125
+ if (owner === "node" || NODE_MODULES.test(file)) return false;
126
+ const normalized = file.replace(/\\/g, "/");
127
+ return matchesRegExp(project.inline, normalized) || !matchesRegExp(project.external, normalized);
128
+ }
29
129
  /**
30
130
  * Vite plugin that adapts a Jest suite's `jest.mock(...)` calls for Vitest:
31
131
  *
@@ -51,8 +151,23 @@ function walk(node, fn) {
51
151
  * Opt-in: add after `reactNative()`; pair with `jestCompatSetup` + `globals: true`.
52
152
  */
53
153
  function jestMockTransform() {
154
+ let project = {
155
+ ownership: () => null,
156
+ inline: [],
157
+ external: []
158
+ };
54
159
  return {
55
160
  name: "vitest-native:jest-mock-hoist",
161
+ configResolved(config) {
162
+ const native = config.plugins.find((plugin) => plugin.name === "vitest-native");
163
+ const deps = config.test?.server?.deps;
164
+ const list = (value) => Array.isArray(value) ? value : value == null ? [] : [value];
165
+ project = {
166
+ ownership: () => native?.api?.nativeOwnership?.() ?? null,
167
+ inline: list(deps?.inline),
168
+ external: list(deps?.external)
169
+ };
170
+ },
56
171
  transform(code, id) {
57
172
  if (id.includes("/node_modules/")) return null;
58
173
  const file = id.split("?")[0];
@@ -64,60 +179,121 @@ function jestMockTransform() {
64
179
  } catch {
65
180
  return null;
66
181
  }
67
- const s = new magic_string.MagicString(code);
68
- let changed = false;
69
- const topLevel = /* @__PURE__ */ new Map();
70
- for (const statement of ast.body) if (statement.type === "ExpressionStatement") topLevel.set(statement.expression, statement);
71
- let usesSetup = false;
72
- const replaced = [];
182
+ const candidates = /* @__PURE__ */ new Map();
73
183
  walk(ast, (node) => {
74
- if (node.type !== "CallExpression") return;
75
- if (replaced.some(([start, end]) => node.start >= start && node.end <= end)) return;
76
- const callee = node.callee;
77
- if (!callee || callee.type !== "MemberExpression" || callee.computed) return;
78
- const obj = callee.object;
79
- const prop = callee.property;
80
- if (!obj || obj.type !== "Identifier" || obj.name !== "jest") return;
81
- if (!prop || prop.type !== "Identifier" || !HOISTABLE.has(prop.name)) return;
82
- s.overwrite(obj.start, obj.end, "vi");
83
- changed = true;
84
- const specNode = node.arguments[0];
85
- const spec = specNode && (specNode.type === "Literal" && typeof specNode.value === "string" || specNode.type === "TemplateLiteral" && specNode.expressions.length === 0 || specNode.type === "Identifier") ? code.slice(specNode.start, specNode.end) : null;
86
- if (WITH_FACTORY.has(prop.name) && node.arguments.length >= 2) {
87
- const factory = node.arguments[1];
88
- if (factory.type === "ArrowFunctionExpression" || factory.type === "FunctionExpression") {
89
- usesSetup = true;
90
- if (spec !== null) {
91
- const register = `globalThis.__vnJestMock?.(import.meta.url, ${spec}, ${code.slice(factory.start, factory.end)})`;
92
- const lookup = `() => ${SETUP}("__vnJestMocked")(import.meta.url, ${spec})`;
93
- const statement = topLevel.get(node);
94
- if (prop.name === "mock" && statement) {
95
- s.prependLeft(statement.start, `vi.hoisted(() => ${register});\n`);
96
- s.overwrite(factory.start, factory.end, lookup);
97
- } else s.overwrite(factory.start, factory.end, `(${register}, ${lookup})`);
98
- replaced.push([factory.start, factory.end]);
99
- } else {
100
- s.appendLeft(factory.start, `() => ${SETUP}("__vnInteropMock")((`);
101
- s.appendRight(factory.end, ")())");
102
- }
103
- }
104
- } else if (UNMOCK.has(prop.name) && spec !== null) {
105
- s.appendLeft(specNode.start, `(globalThis.__vnJestUnmock?.(import.meta.url, ${spec}), `);
106
- s.appendRight(specNode.end, ")");
184
+ const factory = mockFactoryOf(node);
185
+ if (!factory || factory.generator) return;
186
+ const calls = ownRequireActualCalls(factory);
187
+ if (calls.length > 0) candidates.set(factory, calls);
188
+ });
189
+ if (candidates.size === 0) return rewrite(code, ast, /* @__PURE__ */ new Map());
190
+ const specs = new Set([...candidates.values()].flat().map((call) => call.spec));
191
+ return Promise.all([...specs].map(async (spec) => {
192
+ try {
193
+ return [spec, isViteOwnedSource(await this.resolve(spec, id), project)];
194
+ } catch {
195
+ return [spec, false];
107
196
  }
197
+ })).then((resolved) => {
198
+ const owned = new Set(resolved.filter(([, yes]) => yes).map(([spec]) => spec));
199
+ const toAsync = /* @__PURE__ */ new Map();
200
+ for (const [factory, calls] of candidates) {
201
+ const moved = calls.filter((call) => owned.has(call.spec)).map((call) => call.node);
202
+ if (moved.length > 0) toAsync.set(factory, moved);
203
+ }
204
+ return rewrite(code, ast, toAsync);
108
205
  });
109
- if (!changed) return null;
110
- if (usesSetup) s.prepend(SETUP_ACCESSOR);
111
- return {
112
- code: s.toString(),
113
- map: s.generateMap({ hires: true })
114
- };
115
206
  }
116
207
  };
117
208
  }
118
- //#endregion
119
- //#region src/jest-compat/index.ts
120
- /** Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`. */
209
+ /** The factory of a `jest.mock`/`jest.doMock` call with an inline function factory. */
210
+ function mockFactoryOf(node) {
211
+ if (node.type !== "CallExpression" || node.arguments.length < 2) return null;
212
+ const callee = node.callee;
213
+ if (callee?.type !== "MemberExpression" || callee.computed) return null;
214
+ if (callee.object?.type !== "Identifier" || callee.object.name !== "jest") return null;
215
+ if (callee.property?.type !== "Identifier" || !WITH_FACTORY.has(callee.property.name)) return null;
216
+ const factory = node.arguments[1];
217
+ return factory.type === "ArrowFunctionExpression" || factory.type === "FunctionExpression" ? factory : null;
218
+ }
219
+ /**
220
+ * The transform itself. `toAsync` maps a factory to the `jest.requireActual` calls that
221
+ * load through Vite instead (see "`jest.requireActual` of project source" above).
222
+ */
223
+ function rewrite(code, ast, toAsync) {
224
+ const s = new magic_string.MagicString(code);
225
+ let changed = false;
226
+ const topLevel = /* @__PURE__ */ new Map();
227
+ for (const statement of ast.body) if (statement.type === "ExpressionStatement") topLevel.set(statement.expression, statement);
228
+ let usesSetup = false;
229
+ const replaced = [];
230
+ /** The factory's source, async, with its own project `requireActual`s via Vite. */
231
+ const asyncFactory = (factory, calls) => {
232
+ let text = "";
233
+ let at = factory.start;
234
+ for (const call of [...calls].sort((a, b) => a.start - b.start)) {
235
+ const arg = call.arguments[0];
236
+ text += code.slice(at, call.start);
237
+ text += `(${SETUP}("__vnActualExports")(await vi.importActual(${code.slice(arg.start, arg.end)})))`;
238
+ at = call.end;
239
+ }
240
+ text += code.slice(at, factory.end);
241
+ return factory.async ? text : `async ${text}`;
242
+ };
243
+ walk(ast, (node) => {
244
+ if (node.type !== "CallExpression") return;
245
+ if (replaced.some(([start, end]) => node.start >= start && node.end <= end)) return;
246
+ const callee = node.callee;
247
+ if (!callee || callee.type !== "MemberExpression" || callee.computed) return;
248
+ const obj = callee.object;
249
+ const prop = callee.property;
250
+ if (!obj || obj.type !== "Identifier" || obj.name !== "jest") return;
251
+ if (!prop || prop.type !== "Identifier" || !HOISTABLE.has(prop.name)) return;
252
+ s.overwrite(obj.start, obj.end, "vi");
253
+ changed = true;
254
+ const specNode = node.arguments[0];
255
+ const spec = specNode && (specNode.type === "Literal" && typeof specNode.value === "string" || specNode.type === "TemplateLiteral" && specNode.expressions.length === 0 || specNode.type === "Identifier") ? code.slice(specNode.start, specNode.end) : null;
256
+ if (WITH_FACTORY.has(prop.name) && node.arguments.length >= 2) {
257
+ const factory = node.arguments[1];
258
+ if (factory.type === "ArrowFunctionExpression" || factory.type === "FunctionExpression") {
259
+ usesSetup = true;
260
+ const moved = toAsync.get(factory);
261
+ if (spec !== null) {
262
+ const original = code.slice(factory.start, factory.end);
263
+ const register = `globalThis.__vnJestMock?.(import.meta.url, ${spec}, ${moved ? `${original}, ${asyncFactory(factory, moved)}` : original})`;
264
+ const lookup = `() => ${SETUP}("__vnJestMocked")(import.meta.url, ${spec})`;
265
+ const statement = topLevel.get(node);
266
+ if (prop.name === "mock" && statement) {
267
+ s.prependLeft(statement.start, `vi.hoisted(() => ${register});\n`);
268
+ s.overwrite(factory.start, factory.end, lookup);
269
+ } else s.overwrite(factory.start, factory.end, `(${register}, ${lookup})`);
270
+ replaced.push([factory.start, factory.end]);
271
+ } else {
272
+ if (moved) {
273
+ s.overwrite(factory.start, factory.end, asyncFactory(factory, moved));
274
+ replaced.push([factory.start, factory.end]);
275
+ }
276
+ s.appendLeft(factory.start, `() => ${SETUP}("__vnInteropMock")((`);
277
+ s.appendRight(factory.end, ")())");
278
+ }
279
+ }
280
+ } else if (UNMOCK.has(prop.name) && spec !== null) {
281
+ s.appendLeft(specNode.start, `(globalThis.__vnJestUnmock?.(import.meta.url, ${spec}), `);
282
+ s.appendRight(specNode.end, ")");
283
+ }
284
+ });
285
+ if (!changed) return null;
286
+ if (usesSetup) s.prepend(SETUP_ACCESSOR);
287
+ return {
288
+ code: s.toString(),
289
+ map: s.generateMap({ hires: true })
290
+ };
291
+ }
292
+ // src/jest-compat/index.ts
293
+ /**
294
+ * Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`, with the
295
+ * synchronous `jest.requireActual` and `jest.requireMock`.
296
+ */
121
297
  const jestCompatSetup = "vitest-native/jest-compat/setup";
122
298
  /**
123
299
  * `resolve.alias` entries that redirect Jest-only modules to Vitest-backed shims:
@@ -133,7 +309,6 @@ function jestCompatAliases() {
133
309
  "@testing-library/jest-native/extend-expect": "vitest-native/jest-compat/extend-expect-noop"
134
310
  };
135
311
  }
136
- //#endregion
137
312
  exports.jestCompatAliases = jestCompatAliases;
138
313
  exports.jestCompatSetup = jestCompatSetup;
139
314
  exports.jestMockTransform = jestMockTransform;
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
- //#region src/jest-compat/transform.d.ts
3
2
  /**
4
3
  * Vite plugin that adapts a Jest suite's `jest.mock(...)` calls for Vitest:
5
4
  *
@@ -25,9 +24,10 @@ import { Plugin } from "vite";
25
24
  * Opt-in: add after `reactNative()`; pair with `jestCompatSetup` + `globals: true`.
26
25
  */
27
26
  export declare function jestMockTransform(): Plugin;
28
- //#endregion
29
- //#region src/jest-compat/index.d.ts
30
- /** Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`. */
27
+ /**
28
+ * Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`, with the
29
+ * synchronous `jest.requireActual` and `jest.requireMock`.
30
+ */
31
31
  export declare const jestCompatSetup = "vitest-native/jest-compat/setup";
32
32
  /**
33
33
  * `resolve.alias` entries that redirect Jest-only modules to Vitest-backed shims:
@@ -37,5 +37,4 @@ export declare const jestCompatSetup = "vitest-native/jest-compat/setup";
37
37
  *
38
38
  * Spread into your config's `resolve.alias`.
39
39
  */
40
- export declare function jestCompatAliases(): Record<string, string>;
41
- //#endregion
40
+ export declare function jestCompatAliases(): Record<string, string>;
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
- //#region src/jest-compat/transform.d.ts
3
2
  /**
4
3
  * Vite plugin that adapts a Jest suite's `jest.mock(...)` calls for Vitest:
5
4
  *
@@ -25,9 +24,10 @@ import { Plugin } from "vite";
25
24
  * Opt-in: add after `reactNative()`; pair with `jestCompatSetup` + `globals: true`.
26
25
  */
27
26
  export declare function jestMockTransform(): Plugin;
28
- //#endregion
29
- //#region src/jest-compat/index.d.ts
30
- /** Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`. */
27
+ /**
28
+ * Setup-file specifier: gives the suite a `jest` global backed by Vitest's `vi`, with the
29
+ * synchronous `jest.requireActual` and `jest.requireMock`.
30
+ */
31
31
  export declare const jestCompatSetup = "vitest-native/jest-compat/setup";
32
32
  /**
33
33
  * `resolve.alias` entries that redirect Jest-only modules to Vitest-backed shims:
@@ -37,5 +37,4 @@ export declare const jestCompatSetup = "vitest-native/jest-compat/setup";
37
37
  *
38
38
  * Spread into your config's `resolve.alias`.
39
39
  */
40
- export declare function jestCompatAliases(): Record<string, string>;
41
- //#endregion
40
+ export declare function jestCompatAliases(): Record<string, string>;