vitest 0.25.2 → 0.25.4

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 (34) hide show
  1. package/LICENSE.md +47 -2
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +10 -9
  4. package/dist/{chunk-api-setup.c5a9009c.js → chunk-api-setup.1c8923c4.js} +4 -2
  5. package/dist/{chunk-integrations-globals.06c8d418.js → chunk-integrations-globals.789c69e2.js} +7 -7
  6. package/dist/{chunk-runtime-chain.a0b441dc.js → chunk-runtime-chain.315721df.js} +25 -9
  7. package/dist/{chunk-runtime-error.6287172c.js → chunk-runtime-error.95c286d7.js} +2 -2
  8. package/dist/{chunk-runtime-mocker.a5151f99.js → chunk-runtime-mocker.cdc0ec57.js} +35 -19
  9. package/dist/{chunk-runtime-rpc.1e7530d3.js → chunk-runtime-rpc.b368762d.js} +2 -2
  10. package/dist/chunk-runtime-setup.80b27439.js +659 -0
  11. package/dist/{chunk-runtime-test-state.3cbc4575.js → chunk-runtime-test-state.7c288e2d.js} +78 -39
  12. package/dist/{chunk-typecheck-constants.4891f22f.js → chunk-typecheck-constants.ed987901.js} +12 -2
  13. package/dist/{chunk-utils-source-map.c6dfbbc1.js → chunk-utils-source-map.29ff1088.js} +3 -1
  14. package/dist/{chunk-utils-timers.06f993db.js → chunk-utils-timers.b81cda77.js} +2 -0
  15. package/dist/{chunk-vite-node-externalize.72a4d20b.js → chunk-vite-node-externalize.ddcbafa3.js} +59 -29
  16. package/dist/{chunk-vite-node-client.85cc7113.js → chunk-vite-node-source-map.61c5ea66.js} +37 -11
  17. package/dist/{chunk-vite-node-utils.8f0b4a12.js → chunk-vite-node-utils.abe05c5c.js} +105 -120
  18. package/dist/cli.js +14 -10
  19. package/dist/config.cjs +2 -1
  20. package/dist/config.d.ts +2 -1
  21. package/dist/config.js +2 -1
  22. package/dist/entry.js +9 -8
  23. package/dist/environments.d.ts +1 -1
  24. package/dist/{index-2f5b6168.d.ts → index-81973d31.d.ts} +1 -1
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.js +7 -7
  27. package/dist/loader.js +2 -2
  28. package/dist/node.d.ts +5 -4
  29. package/dist/node.js +9 -8
  30. package/dist/suite.js +6 -6
  31. package/dist/{types-f302dae9.d.ts → types-1cf24598.d.ts} +71 -24
  32. package/dist/{chunk-runtime-setup.419ccdd8.js → vendor-source-map-support.1ce17397.js} +1 -657
  33. package/dist/worker.js +9 -7
  34. package/package.json +6 -6
@@ -8,55 +8,39 @@ import assert from 'assert';
8
8
  import { format, inspect } from 'util';
9
9
 
10
10
  const TRAILING_SLASH_RE = /\/$|\/\?/;
11
- function hasTrailingSlash(input = "", queryParams = false) {
12
- if (!queryParams) {
11
+ function hasTrailingSlash(input = "", queryParameters = false) {
12
+ if (!queryParameters) {
13
13
  return input.endsWith("/");
14
14
  }
15
15
  return TRAILING_SLASH_RE.test(input);
16
16
  }
17
- function withTrailingSlash(input = "", queryParams = false) {
18
- if (!queryParams) {
17
+ function withTrailingSlash(input = "", queryParameters = false) {
18
+ if (!queryParameters) {
19
19
  return input.endsWith("/") ? input : input + "/";
20
20
  }
21
21
  if (hasTrailingSlash(input, true)) {
22
22
  return input || "/";
23
23
  }
24
24
  const [s0, ...s] = input.split("?");
25
- return s0 + "/" + (s.length ? `?${s.join("?")}` : "");
25
+ return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "");
26
26
  }
27
27
  function hasLeadingSlash(input = "") {
28
28
  return input.startsWith("/");
29
29
  }
30
30
  function withoutLeadingSlash(input = "") {
31
- return (hasLeadingSlash(input) ? input.substr(1) : input) || "/";
31
+ return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
32
32
  }
33
33
  function isNonEmptyURL(url) {
34
34
  return url && url !== "/";
35
35
  }
36
36
  function joinURL(base, ...input) {
37
37
  let url = base || "";
38
- for (const i of input.filter(isNonEmptyURL)) {
39
- url = url ? withTrailingSlash(url) + withoutLeadingSlash(i) : i;
38
+ for (const index of input.filter((url2) => isNonEmptyURL(url2))) {
39
+ url = url ? withTrailingSlash(url) + withoutLeadingSlash(index) : index;
40
40
  }
41
41
  return url;
42
42
  }
43
43
 
44
- function normalizeWindowsPath$1(input = "") {
45
- if (!input || !input.includes("\\")) {
46
- return input;
47
- }
48
- return input.replace(/\\/g, "/");
49
- }
50
- const _IS_ABSOLUTE_RE$1 = /^[\\/](?![\\/])|^[\\/]{2}(?!\.)|^[a-zA-Z]:[\\/]/;
51
- const isAbsolute$1 = function(p) {
52
- return _IS_ABSOLUTE_RE$1.test(p);
53
- };
54
- const _EXTNAME_RE = /.(\.[^/.]+)$/;
55
- const extname = function(p) {
56
- const match = _EXTNAME_RE.exec(normalizeWindowsPath$1(p));
57
- return match && match[1] || "";
58
- };
59
-
60
44
  function normalizeWindowsPath(input = "") {
61
45
  if (!input || !input.includes("\\")) {
62
46
  return input;
@@ -64,9 +48,9 @@ function normalizeWindowsPath(input = "") {
64
48
  return input.replace(/\\/g, "/");
65
49
  }
66
50
 
67
- const _UNC_REGEX = /^[\\/]{2}/;
68
- const _IS_ABSOLUTE_RE = /^[\\/](?![\\/])|^[\\/]{2}(?!\.)|^[a-zA-Z]:[\\/]/;
69
- const _DRIVE_LETTER_RE = /^[a-zA-Z]:$/;
51
+ const _UNC_REGEX = /^[/\\]{2}/;
52
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
53
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
70
54
  const normalize = function(path) {
71
55
  if (path.length === 0) {
72
56
  return ".";
@@ -96,18 +80,17 @@ const normalize = function(path) {
96
80
  }
97
81
  return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
98
82
  };
99
- const join = function(...args) {
100
- if (args.length === 0) {
83
+ const join = function(...arguments_) {
84
+ if (arguments_.length === 0) {
101
85
  return ".";
102
86
  }
103
87
  let joined;
104
- for (let i = 0; i < args.length; ++i) {
105
- const arg = args[i];
106
- if (arg && arg.length > 0) {
88
+ for (const argument of arguments_) {
89
+ if (argument && argument.length > 0) {
107
90
  if (joined === void 0) {
108
- joined = arg;
91
+ joined = argument;
109
92
  } else {
110
- joined += `/${arg}`;
93
+ joined += `/${argument}`;
111
94
  }
112
95
  }
113
96
  }
@@ -116,12 +99,12 @@ const join = function(...args) {
116
99
  }
117
100
  return normalize(joined.replace(/\/\/+/g, "/"));
118
101
  };
119
- const resolve = function(...args) {
120
- args = args.map((arg) => normalizeWindowsPath(arg));
102
+ const resolve = function(...arguments_) {
103
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
121
104
  let resolvedPath = "";
122
105
  let resolvedAbsolute = false;
123
- for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
124
- const path = i >= 0 ? args[i] : process.cwd().replace(/\\/g, "/");
106
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
107
+ const path = index >= 0 ? arguments_[index] : process.cwd().replace(/\\/g, "/");
125
108
  if (!path || path.length === 0) {
126
109
  continue;
127
110
  }
@@ -140,16 +123,16 @@ function normalizeString(path, allowAboveRoot) {
140
123
  let lastSlash = -1;
141
124
  let dots = 0;
142
125
  let char = null;
143
- for (let i = 0; i <= path.length; ++i) {
144
- if (i < path.length) {
145
- char = path[i];
126
+ for (let index = 0; index <= path.length; ++index) {
127
+ if (index < path.length) {
128
+ char = path[index];
146
129
  } else if (char === "/") {
147
130
  break;
148
131
  } else {
149
132
  char = "/";
150
133
  }
151
134
  if (char === "/") {
152
- if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
135
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
153
136
  if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
154
137
  if (res.length > 2) {
155
138
  const lastSlashIndex = res.lastIndexOf("/");
@@ -160,13 +143,13 @@ function normalizeString(path, allowAboveRoot) {
160
143
  res = res.slice(0, lastSlashIndex);
161
144
  lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
162
145
  }
163
- lastSlash = i;
146
+ lastSlash = index;
164
147
  dots = 0;
165
148
  continue;
166
- } else if (res.length !== 0) {
149
+ } else if (res.length > 0) {
167
150
  res = "";
168
151
  lastSegmentLength = 0;
169
- lastSlash = i;
152
+ lastSlash = index;
170
153
  dots = 0;
171
154
  continue;
172
155
  }
@@ -177,13 +160,13 @@ function normalizeString(path, allowAboveRoot) {
177
160
  }
178
161
  } else {
179
162
  if (res.length > 0) {
180
- res += `/${path.slice(lastSlash + 1, i)}`;
163
+ res += `/${path.slice(lastSlash + 1, index)}`;
181
164
  } else {
182
- res = path.slice(lastSlash + 1, i);
165
+ res = path.slice(lastSlash + 1, index);
183
166
  }
184
- lastSegmentLength = i - lastSlash - 1;
167
+ lastSegmentLength = index - lastSlash - 1;
185
168
  }
186
- lastSlash = i;
169
+ lastSlash = index;
187
170
  dots = 0;
188
171
  } else if (char === "." && dots !== -1) {
189
172
  ++dots;
@@ -196,6 +179,11 @@ function normalizeString(path, allowAboveRoot) {
196
179
  const isAbsolute = function(p) {
197
180
  return _IS_ABSOLUTE_RE.test(p);
198
181
  };
182
+ const _EXTNAME_RE = /.(\.[^./]+)$/;
183
+ const extname = function(p) {
184
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
185
+ return match && match[1] || "";
186
+ };
199
187
 
200
188
  const defaultFindOptions = {
201
189
  startingFrom: ".",
@@ -208,7 +196,6 @@ const defaultFindOptions = {
208
196
  }
209
197
  } catch {
210
198
  }
211
- return null;
212
199
  }
213
200
  };
214
201
  async function findFile(filename, _options = {}) {
@@ -224,15 +211,15 @@ async function findFile(filename, _options = {}) {
224
211
  root = 0;
225
212
  }
226
213
  if (!options.reverse) {
227
- for (let i = segments.length; i > root; i--) {
228
- const filePath = join(...segments.slice(0, i), filename);
214
+ for (let index = segments.length; index > root; index--) {
215
+ const filePath = join(...segments.slice(0, index), filename);
229
216
  if (await options.test(filePath)) {
230
217
  return filePath;
231
218
  }
232
219
  }
233
220
  } else {
234
- for (let i = root + 1; i <= segments.length; i++) {
235
- const filePath = join(...segments.slice(0, i), filename);
221
+ for (let index = root + 1; index <= segments.length; index++) {
222
+ const filePath = join(...segments.slice(0, index), filename);
236
223
  if (await options.test(filePath)) {
237
224
  return filePath;
238
225
  }
@@ -243,35 +230,43 @@ async function findFile(filename, _options = {}) {
243
230
  function findNearestFile(filename, _options = {}) {
244
231
  return findFile(filename, _options);
245
232
  }
246
- async function readPackageJSON(id, opts = {}) {
247
- const resolvedPath = await resolvePackageJSON(id, opts);
248
- const blob = await promises.readFile(resolvedPath, "utf-8");
249
- return JSON.parse(blob);
233
+ const FileCache = /* @__PURE__ */ new Map();
234
+ async function readPackageJSON(id, options = {}) {
235
+ const resolvedPath = await resolvePackageJSON(id, options);
236
+ const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache;
237
+ if (options.cache && cache.has(resolvedPath)) {
238
+ return cache.get(resolvedPath);
239
+ }
240
+ const blob = await promises.readFile(resolvedPath, "utf8");
241
+ const parsed = JSON.parse(blob);
242
+ cache.set(resolvedPath, parsed);
243
+ return parsed;
250
244
  }
251
- async function resolvePackageJSON(id = process.cwd(), opts = {}) {
252
- const resolvedPath = isAbsolute(id) ? id : await resolvePath(id, opts);
253
- return findNearestFile("package.json", { startingFrom: resolvedPath, ...opts });
245
+ async function resolvePackageJSON(id = process.cwd(), options = {}) {
246
+ const resolvedPath = isAbsolute(id) ? id : await resolvePath(id, options);
247
+ return findNearestFile("package.json", { startingFrom: resolvedPath, ...options });
254
248
  }
255
249
 
256
250
  const BUILTIN_MODULES = new Set(builtinModules);
257
- function normalizeSlash(str) {
258
- return str.replace(/\\/g, "/");
251
+ function normalizeSlash(string_) {
252
+ return string_.replace(/\\/g, "/");
259
253
  }
260
- function pcall(fn, ...args) {
254
+ function pcall(function_, ...arguments_) {
261
255
  try {
262
- return Promise.resolve(fn(...args)).catch((err) => perr(err));
263
- } catch (err) {
264
- return perr(err);
256
+ return Promise.resolve(function_(...arguments_)).catch((error) => perr(error));
257
+ } catch (error) {
258
+ return perr(error);
265
259
  }
266
260
  }
267
- function perr(_err) {
268
- const err = new Error(_err);
269
- err.code = _err.code;
270
- Error.captureStackTrace(err, pcall);
271
- return Promise.reject(err);
261
+ function perr(_error) {
262
+ const error = new Error(_error);
263
+ error.code = _error.code;
264
+ Error.captureStackTrace(error, pcall);
265
+ return Promise.reject(error);
272
266
  }
273
267
 
274
268
  const reader = { read };
269
+ const packageJsonReader = reader;
275
270
  function read(jsonPath) {
276
271
  return find(path.dirname(jsonPath));
277
272
  }
@@ -591,7 +586,7 @@ function getPackageConfig(path2, specifier, base) {
591
586
  if (existing !== void 0) {
592
587
  return existing;
593
588
  }
594
- const source = reader.read(path2).string;
589
+ const source = packageJsonReader.read(path2).string;
595
590
  if (source === void 0) {
596
591
  const packageConfig2 = {
597
592
  pjsonPath: path2,
@@ -1212,7 +1207,7 @@ function isNodeBuiltin(id = "") {
1212
1207
  const ProtocolRegex = /^(?<proto>.{2,}?):.+$/;
1213
1208
  function getProtocol(id) {
1214
1209
  const proto = id.match(ProtocolRegex);
1215
- return proto ? proto.groups.proto : null;
1210
+ return proto ? proto.groups.proto : void 0;
1216
1211
  }
1217
1212
 
1218
1213
  const DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set(["node", "import"]);
@@ -1222,35 +1217,36 @@ const NOT_FOUND_ERRORS = /* @__PURE__ */ new Set(["ERR_MODULE_NOT_FOUND", "ERR_U
1222
1217
  function _tryModuleResolve(id, url, conditions) {
1223
1218
  try {
1224
1219
  return moduleResolve(id, url, conditions);
1225
- } catch (err) {
1226
- if (!NOT_FOUND_ERRORS.has(err.code)) {
1227
- throw err;
1220
+ } catch (error) {
1221
+ if (!NOT_FOUND_ERRORS.has(error.code)) {
1222
+ throw error;
1228
1223
  }
1229
- return null;
1230
1224
  }
1231
1225
  }
1232
- function _resolve(id, opts = {}) {
1226
+ function _resolve(id, options = {}) {
1233
1227
  if (/(node|data|http|https):/.test(id)) {
1234
1228
  return id;
1235
1229
  }
1236
1230
  if (BUILTIN_MODULES.has(id)) {
1237
1231
  return "node:" + id;
1238
1232
  }
1239
- if (isAbsolute$1(id) && existsSync(id)) {
1233
+ if (isAbsolute(id) && existsSync(id)) {
1240
1234
  const realPath2 = realpathSync(fileURLToPath(id));
1241
1235
  return pathToFileURL(realPath2).toString();
1242
1236
  }
1243
- const conditionsSet = opts.conditions ? new Set(opts.conditions) : DEFAULT_CONDITIONS_SET;
1244
- const _urls = (Array.isArray(opts.url) ? opts.url : [opts.url]).filter(Boolean).map((u) => new URL(normalizeid(u.toString())));
1245
- if (!_urls.length) {
1237
+ const conditionsSet = options.conditions ? new Set(options.conditions) : DEFAULT_CONDITIONS_SET;
1238
+ const _urls = (Array.isArray(options.url) ? options.url : [options.url]).filter(Boolean).map((u) => new URL(normalizeid(u.toString())));
1239
+ if (_urls.length === 0) {
1246
1240
  _urls.push(DEFAULT_URL);
1247
1241
  }
1248
1242
  const urls = [..._urls];
1249
1243
  for (const url of _urls) {
1250
1244
  if (url.protocol === "file:") {
1251
- urls.push(new URL("./", url));
1252
- urls.push(new URL(joinURL(url.pathname, "_index.js"), url));
1253
- urls.push(new URL("./node_modules", url));
1245
+ urls.push(
1246
+ new URL("./", url),
1247
+ new URL(joinURL(url.pathname, "_index.js"), url),
1248
+ new URL("node_modules", url)
1249
+ );
1254
1250
  }
1255
1251
  }
1256
1252
  let resolved;
@@ -1260,8 +1256,8 @@ function _resolve(id, opts = {}) {
1260
1256
  break;
1261
1257
  }
1262
1258
  for (const prefix of ["", "/index"]) {
1263
- for (const ext of opts.extensions || DEFAULT_EXTENSIONS) {
1264
- resolved = _tryModuleResolve(id + prefix + ext, url, conditionsSet);
1259
+ for (const extension of options.extensions || DEFAULT_EXTENSIONS) {
1260
+ resolved = _tryModuleResolve(id + prefix + extension, url, conditionsSet);
1265
1261
  if (resolved) {
1266
1262
  break;
1267
1263
  }
@@ -1272,24 +1268,24 @@ function _resolve(id, opts = {}) {
1272
1268
  }
1273
1269
  }
1274
1270
  if (!resolved) {
1275
- const err = new Error(`Cannot find module ${id} imported from ${urls.join(", ")}`);
1276
- err.code = "ERR_MODULE_NOT_FOUND";
1277
- throw err;
1271
+ const error = new Error(`Cannot find module ${id} imported from ${urls.join(", ")}`);
1272
+ error.code = "ERR_MODULE_NOT_FOUND";
1273
+ throw error;
1278
1274
  }
1279
1275
  const realPath = realpathSync(fileURLToPath(resolved));
1280
1276
  return pathToFileURL(realPath).toString();
1281
1277
  }
1282
- function resolveSync(id, opts) {
1283
- return _resolve(id, opts);
1278
+ function resolveSync(id, options) {
1279
+ return _resolve(id, options);
1284
1280
  }
1285
- function resolvePathSync(id, opts) {
1286
- return fileURLToPath(resolveSync(id, opts));
1281
+ function resolvePathSync(id, options) {
1282
+ return fileURLToPath(resolveSync(id, options));
1287
1283
  }
1288
- function resolvePath(id, opts) {
1289
- return pcall(resolvePathSync, id, opts);
1284
+ function resolvePath(id, options) {
1285
+ return pcall(resolvePathSync, id, options);
1290
1286
  }
1291
1287
 
1292
- const ESM_RE = /([\s;]|^)(import[\w,{}\s*]*from|import\s*['"*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
1288
+ const ESM_RE = /([\s;]|^)(import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
1293
1289
  const BUILTIN_EXTENSIONS = /* @__PURE__ */ new Set([".mjs", ".cjs", ".node", ".wasm"]);
1294
1290
  function hasESMSyntax(code) {
1295
1291
  return ESM_RE.test(code);
@@ -1301,19 +1297,19 @@ function hasCJSSyntax(code) {
1301
1297
  const validNodeImportDefaults = {
1302
1298
  allowedProtocols: ["node", "file", "data"]
1303
1299
  };
1304
- async function isValidNodeImport(id, _opts = {}) {
1300
+ async function isValidNodeImport(id, _options = {}) {
1305
1301
  if (isNodeBuiltin(id)) {
1306
1302
  return true;
1307
1303
  }
1308
- const opts = { ...validNodeImportDefaults, ..._opts };
1304
+ const options = { ...validNodeImportDefaults, ..._options };
1309
1305
  const proto = getProtocol(id);
1310
- if (proto && !opts.allowedProtocols.includes(proto)) {
1306
+ if (proto && !options.allowedProtocols.includes(proto)) {
1311
1307
  return false;
1312
1308
  }
1313
1309
  if (proto === "data") {
1314
1310
  return true;
1315
1311
  }
1316
- const resolvedPath = await resolvePath(id, opts);
1312
+ const resolvedPath = await resolvePath(id, options);
1317
1313
  const extension = extname(resolvedPath);
1318
1314
  if (BUILTIN_EXTENSIONS.has(extension)) {
1319
1315
  return true;
@@ -1321,14 +1317,16 @@ async function isValidNodeImport(id, _opts = {}) {
1321
1317
  if (extension !== ".js") {
1322
1318
  return false;
1323
1319
  }
1324
- const pkg = await readPackageJSON(resolvedPath).catch(() => null);
1325
- if (pkg?.type === "module") {
1320
+ const package_ = await readPackageJSON(resolvedPath).catch(() => {
1321
+ });
1322
+ if (package_?.type === "module") {
1326
1323
  return true;
1327
1324
  }
1328
- if (resolvedPath.match(/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//)) {
1325
+ if (/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//.test(resolvedPath)) {
1329
1326
  return false;
1330
1327
  }
1331
- const code = opts.code || await promises.readFile(resolvedPath, "utf-8").catch(() => null) || "";
1328
+ const code = options.code || await promises.readFile(resolvedPath, "utf8").catch(() => {
1329
+ }) || "";
1332
1330
  return hasCJSSyntax(code) || !hasESMSyntax(code);
1333
1331
  }
1334
1332
 
@@ -1376,19 +1374,6 @@ function toFilePath(id, root) {
1376
1374
  absolute = absolute.slice(1);
1377
1375
  return isWindows && absolute.startsWith("/") ? slash(fileURLToPath$1(pathToFileURL(absolute.slice(1)).href)) : absolute;
1378
1376
  }
1379
- let SOURCEMAPPING_URL = "sourceMa";
1380
- SOURCEMAPPING_URL += "ppingURL";
1381
- async function withInlineSourcemap(result) {
1382
- const { code, map } = result;
1383
- if (code.includes(`${SOURCEMAPPING_URL}=`))
1384
- return result;
1385
- if (map)
1386
- result.code = `${code}
1387
-
1388
- //# ${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
1389
- `;
1390
- return result;
1391
- }
1392
1377
  function toArray(array) {
1393
1378
  if (array === null || array === void 0)
1394
1379
  array = [];
@@ -1397,4 +1382,4 @@ function toArray(array) {
1397
1382
  return [array];
1398
1383
  }
1399
1384
 
1400
- export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, hasCJSSyntax as h, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, pathFromRoot as p, slash as s, toArray as t, withInlineSourcemap as w };
1385
+ export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, hasCJSSyntax as h, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, pathFromRoot as p, slash as s, toArray as t };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
2
2
  import { EventEmitter } from 'events';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.72a4d20b.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.ddcbafa3.js';
4
4
  import 'tty';
5
5
  import 'url';
6
6
  import 'path';
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
9
  import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.4891f22f.js';
11
+ import './chunk-typecheck-constants.ed987901.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -16,25 +16,26 @@ import 'os';
16
16
  import 'util';
17
17
  import 'stream';
18
18
  import './vendor-_commonjsHelpers.addc3445.js';
19
- import './chunk-vite-node-client.85cc7113.js';
19
+ import './chunk-vite-node-source-map.61c5ea66.js';
20
20
  import 'module';
21
21
  import 'vm';
22
- import './chunk-vite-node-utils.8f0b4a12.js';
22
+ import './chunk-vite-node-utils.abe05c5c.js';
23
23
  import 'acorn';
24
24
  import 'assert';
25
25
  import 'debug';
26
+ import './vendor-source-map-support.1ce17397.js';
27
+ import 'source-map';
26
28
  import 'perf_hooks';
27
29
  import 'fs/promises';
28
30
  import './vendor-index.737c3cff.js';
29
31
  import 'buffer';
30
32
  import 'child_process';
31
33
  import './vendor-index.e1d4cf84.js';
32
- import 'source-map';
33
34
  import 'acorn-walk';
34
35
  import 'worker_threads';
35
36
  import 'tinypool';
36
- import './chunk-utils-timers.06f993db.js';
37
- import './chunk-utils-source-map.c6dfbbc1.js';
37
+ import './chunk-utils-timers.b81cda77.js';
38
+ import './chunk-utils-source-map.29ff1088.js';
38
39
  import 'crypto';
39
40
  import './vendor-index.9c919048.js';
40
41
  import './chunk-magic-string.ffe2b171.js';
@@ -687,9 +688,12 @@ async function typecheck(cliFilters = [], options = {}) {
687
688
  await start("typecheck", cliFilters, options);
688
689
  }
689
690
  function normalizeOptions(argv) {
690
- argv.root = argv.root && normalize(argv.root);
691
- argv.config = argv.config && normalize(argv.config);
692
- argv.dir = argv.dir && normalize(argv.dir);
691
+ if (argv.root)
692
+ argv.root = normalize(argv.root);
693
+ if (argv.config)
694
+ argv.config = normalize(argv.config);
695
+ if (argv.dir)
696
+ argv.dir = normalize(argv.dir);
693
697
  return argv;
694
698
  }
695
699
  async function start(mode, cliFilters, options) {
package/dist/config.cjs CHANGED
@@ -81,7 +81,8 @@ const config = {
81
81
  checker: "tsc",
82
82
  include: ["**/*.{test,spec}-d.{ts,js}"],
83
83
  exclude: defaultExclude
84
- }
84
+ },
85
+ slowTestThreshold: 300
85
86
  };
86
87
  const configDefaults = Object.freeze(config);
87
88
 
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-f302dae9.js';
3
+ import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-1cf24598.js';
4
4
  import 'tinybench';
5
5
  import 'fs';
6
6
  import 'worker_threads';
@@ -43,6 +43,7 @@ declare const config: {
43
43
  include: string[];
44
44
  exclude: string[];
45
45
  };
46
+ slowTestThreshold: number;
46
47
  };
47
48
  declare const configDefaults: Required<Pick<UserConfig$1, keyof typeof config>>;
48
49
 
package/dist/config.js CHANGED
@@ -77,7 +77,8 @@ const config = {
77
77
  checker: "tsc",
78
78
  include: ["**/*.{test,spec}-d.{ts,js}"],
79
79
  exclude: defaultExclude
80
- }
80
+ },
81
+ slowTestThreshold: 300
81
82
  };
82
83
  const configDefaults = Object.freeze(config);
83
84
 
package/dist/entry.js CHANGED
@@ -1,26 +1,27 @@
1
1
  import { promises } from 'fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.4891f22f.js';
3
- import { v as vi } from './chunk-runtime-test-state.3cbc4575.js';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.ed987901.js';
3
+ import { v as vi } from './chunk-runtime-test-state.7c288e2d.js';
4
4
  import { a as envs } from './chunk-env-node.67948209.js';
5
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.419ccdd8.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.80b27439.js';
6
6
  import 'path';
7
7
  import './chunk-utils-env.03f840f2.js';
8
8
  import 'tty';
9
9
  import 'url';
10
10
  import 'local-pkg';
11
- import './chunk-runtime-chain.a0b441dc.js';
11
+ import './chunk-runtime-chain.315721df.js';
12
12
  import 'util';
13
13
  import 'chai';
14
14
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.1e7530d3.js';
16
- import './chunk-utils-timers.06f993db.js';
17
- import './chunk-utils-source-map.c6dfbbc1.js';
15
+ import './chunk-runtime-rpc.b368762d.js';
16
+ import './chunk-utils-timers.b81cda77.js';
17
+ import './chunk-utils-source-map.29ff1088.js';
18
18
  import './spy.js';
19
19
  import 'tinyspy';
20
20
  import 'console';
21
21
  import 'perf_hooks';
22
22
  import './chunk-integrations-coverage.befed097.js';
23
- import './chunk-runtime-error.6287172c.js';
23
+ import './chunk-runtime-error.95c286d7.js';
24
+ import './vendor-source-map-support.1ce17397.js';
24
25
  import 'source-map';
25
26
 
26
27
  function groupBy(collection, iteratee) {
@@ -1,4 +1,4 @@
1
- import { ae as Environment } from './types-f302dae9.js';
1
+ import { ae as Environment } from './types-1cf24598.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
4
  import 'fs';
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-f302dae9.js';
2
+ import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-1cf24598.js';
3
3
 
4
4
  declare type Not<T extends boolean> = T extends true ? false : true;
5
5
  declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-2f5b6168.js';
2
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-2f5b6168.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-f302dae9.js';
4
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-f302dae9.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-81973d31.js';
2
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-81973d31.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-1cf24598.js';
4
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-1cf24598.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
@@ -146,7 +146,7 @@ declare class VitestUtils {
146
146
  /**
147
147
  * Wait for all imports to load.
148
148
  * Useful, if you have a synchronous call that starts
149
- * importing a module, that you cannot wait otherwise.
149
+ * importing a module that you cannot wait otherwise.
150
150
  */
151
151
  dynamicImportSettled(): Promise<void>;
152
152
  private _config;