vitest 0.12.5 → 0.12.8

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 (27) hide show
  1. package/LICENSE.md +0 -72
  2. package/dist/{chunk-api-setup.62de6413.js → chunk-api-setup.9ccd19b5.js} +5 -4
  3. package/dist/{chunk-constants.153353ee.js → chunk-constants.3570739f.js} +1 -1
  4. package/dist/{chunk-defaults.374342ed.js → chunk-defaults.7d81a6ca.js} +1 -1
  5. package/dist/{chunk-install-pkg.eb979c48.js → chunk-install-pkg.fd8d1022.js} +9 -11
  6. package/dist/chunk-integrations-globals.23cc66c3.js +26 -0
  7. package/dist/{chunk-magic-string.d5e0e473.js → chunk-magic-string.41232190.js} +0 -4
  8. package/dist/{chunk-runtime-chain.eb563278.js → chunk-runtime-chain.5021a6b6.js} +44 -10
  9. package/dist/{chunk-runtime-mocker.efd6b7ac.js → chunk-runtime-mocker.d26f8110.js} +8 -7
  10. package/dist/{chunk-runtime-rpc.ef131645.js → chunk-runtime-rpc.47bae3f9.js} +1 -1
  11. package/dist/{chunk-utils-global.03413604.js → chunk-utils-global.2fab7e5c.js} +3 -9
  12. package/dist/{chunk-utils-timers.a0f0fe66.js → chunk-utils-timers.da6ac0a6.js} +3 -2
  13. package/dist/{chunk-vite-node-externalize.8560ca65.js → chunk-vite-node-externalize.fc385bba.js} +67 -58
  14. package/dist/{chunk-vite-node-utils.1064f66b.js → chunk-vite-node-utils.46e2a803.js} +8 -1064
  15. package/dist/cli.js +11 -9
  16. package/dist/config.d.ts +6 -3
  17. package/dist/entry.js +7 -6
  18. package/dist/index.d.ts +247 -249
  19. package/dist/index.js +5 -4
  20. package/dist/node.d.ts +215 -0
  21. package/dist/node.js +13 -11
  22. package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
  23. package/dist/{vendor-entry.5b810598.js → vendor-entry.ca05c118.js} +28 -83
  24. package/dist/{vendor-index.4e550a2c.js → vendor-index.6c69a0a8.js} +5 -5
  25. package/dist/worker.js +6 -5
  26. package/package.json +8 -7
  27. package/dist/chunk-integrations-globals.4fea033a.js +0 -25
package/LICENSE.md CHANGED
@@ -427,33 +427,6 @@ Repository: git@github.com:moxystudio/node-cross-spawn.git
427
427
 
428
428
  ---------------------------------------
429
429
 
430
- ## debug
431
- License: MIT
432
- By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne
433
- Repository: git://github.com/debug-js/debug.git
434
-
435
- > (The MIT License)
436
- >
437
- > Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
438
- > Copyright (c) 2018-2021 Josh Junon
439
- >
440
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software
441
- > and associated documentation files (the 'Software'), to deal in the Software without restriction,
442
- > including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
443
- > and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
444
- > subject to the following conditions:
445
- >
446
- > The above copyright notice and this permission notice shall be included in all copies or substantial
447
- > portions of the Software.
448
- >
449
- > THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
450
- > LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
451
- > IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
452
- > WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
453
- > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
454
-
455
- ---------------------------------------
456
-
457
430
  ## diff
458
431
  License: BSD-3-Clause
459
432
  Repository: git://github.com/kpdecker/jsdiff.git
@@ -1294,34 +1267,6 @@ Repository: unjs/mlly
1294
1267
 
1295
1268
  ---------------------------------------
1296
1269
 
1297
- ## ms
1298
- License: MIT
1299
- Repository: zeit/ms
1300
-
1301
- > The MIT License (MIT)
1302
- >
1303
- > Copyright (c) 2016 Zeit, Inc.
1304
- >
1305
- > Permission is hereby granted, free of charge, to any person obtaining a copy
1306
- > of this software and associated documentation files (the "Software"), to deal
1307
- > in the Software without restriction, including without limitation the rights
1308
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1309
- > copies of the Software, and to permit persons to whom the Software is
1310
- > furnished to do so, subject to the following conditions:
1311
- >
1312
- > The above copyright notice and this permission notice shall be included in all
1313
- > copies or substantial portions of the Software.
1314
- >
1315
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1316
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1317
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1318
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1319
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1320
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1321
- > SOFTWARE.
1322
-
1323
- ---------------------------------------
1324
-
1325
1270
  ## natural-compare
1326
1271
  License: MIT
1327
1272
  By: Lauri Rooden
@@ -1947,23 +1892,6 @@ Repository: sindresorhus/strip-final-newline
1947
1892
 
1948
1893
  ---------------------------------------
1949
1894
 
1950
- ## supports-color
1951
- License: MIT
1952
- By: Sindre Sorhus
1953
- Repository: chalk/supports-color
1954
-
1955
- > MIT License
1956
- >
1957
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1958
- >
1959
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1960
- >
1961
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1962
- >
1963
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1964
-
1965
- ---------------------------------------
1966
-
1967
1895
  ## to-regex-range
1968
1896
  License: MIT
1969
1897
  By: Jon Schlinkert, Rouven Weßling
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { b as createBirpc } from './chunk-vite-node-utils.1064f66b.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.46e2a803.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,16 +9,17 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.153353ee.js';
13
- import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.a0f0fe66.js';
12
+ import { A as API_PATH } from './chunk-constants.3570739f.js';
13
+ import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.da6ac0a6.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.03413604.js';
16
+ import './chunk-utils-global.2fab7e5c.js';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'path';
20
20
  import 'assert';
21
21
  import 'util';
22
+ import 'debug';
22
23
 
23
24
  /*! (c) 2020 Andrea Giammarchi */
24
25
 
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { k as resolve } from './chunk-utils-global.03413604.js';
2
+ import { h as resolve } from './chunk-utils-global.2fab7e5c.js';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, k as resolve } from './chunk-utils-global.03413604.js';
4
+ import { t as toArray, h as resolve } from './chunk-utils-global.2fab7e5c.js';
5
5
 
6
6
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
7
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -1,12 +1,10 @@
1
1
  import path$2 from 'path';
2
2
  import fs$2 from 'fs';
3
- import require$$1 from 'util';
3
+ import require$$0 from 'util';
4
4
  import childProcess$1 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.4e550a2c.js';
6
- import require$$0 from 'os';
7
- import './chunk-utils-global.03413604.js';
8
- import 'tty';
9
- import 'local-pkg';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.6c69a0a8.js';
6
+ import require$$0$1 from 'os';
7
+ import './vendor-_commonjsHelpers.addc3445.js';
10
8
  import 'assert';
11
9
  import 'events';
12
10
  import 'buffer';
@@ -208,7 +206,7 @@ var pLocate_1 = pLocate$1;
208
206
 
209
207
  const path$1 = path$2;
210
208
  const fs$1 = fs$2;
211
- const {promisify: promisify$1} = require$$1;
209
+ const {promisify: promisify$1} = require$$0;
212
210
  const pLocate = pLocate_1;
213
211
 
214
212
  const fsStat = promisify$1(fs$1.stat);
@@ -277,7 +275,7 @@ locatePath.exports.sync = (paths, options) => {
277
275
  var pathExists = {exports: {}};
278
276
 
279
277
  const fs = fs$2;
280
- const {promisify} = require$$1;
278
+ const {promisify} = require$$0;
281
279
 
282
280
  const pAccess = promisify(fs.access);
283
281
 
@@ -760,7 +758,7 @@ standard:"posix"};
760
758
  const SIGRTMIN=34;
761
759
  const SIGRTMAX=64;realtime.SIGRTMAX=SIGRTMAX;
762
760
 
763
- Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0;
761
+ Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0$1;
764
762
 
765
763
  var _core=core;
766
764
  var _realtime$1=realtime;
@@ -795,7 +793,7 @@ const number=supported?constantSignal:defaultNumber;
795
793
  return {name,number,description,supported,action,forced,standard};
796
794
  };
797
795
 
798
- Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0;
796
+ Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0$1;
799
797
 
800
798
  var _signals=signals;
801
799
  var _realtime=realtime;
@@ -1008,7 +1006,7 @@ stdio.exports.node = options => {
1008
1006
  return [...stdio, 'ipc'];
1009
1007
  };
1010
1008
 
1011
- const os = require$$0;
1009
+ const os = require$$0$1;
1012
1010
  const onExit = signalExit.exports;
1013
1011
 
1014
1012
  const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
@@ -0,0 +1,26 @@
1
+ import { g as globalApis } from './chunk-constants.3570739f.js';
2
+ import { i as index } from './vendor-entry.ca05c118.js';
3
+ import 'url';
4
+ import './chunk-utils-global.2fab7e5c.js';
5
+ import 'tty';
6
+ import 'local-pkg';
7
+ import 'path';
8
+ import 'fs';
9
+ import './chunk-runtime-chain.5021a6b6.js';
10
+ import 'chai';
11
+ import './vendor-_commonjsHelpers.addc3445.js';
12
+ import './chunk-runtime-rpc.47bae3f9.js';
13
+ import './chunk-utils-timers.da6ac0a6.js';
14
+ import './chunk-integrations-spy.bee66426.js';
15
+ import 'tinyspy';
16
+ import 'util';
17
+ import './chunk-defaults.7d81a6ca.js';
18
+ import 'module';
19
+
20
+ function registerApiGlobally() {
21
+ globalApis.forEach((api) => {
22
+ globalThis[api] = index[api];
23
+ });
24
+ }
25
+
26
+ export { registerApiGlobally };
@@ -1,8 +1,4 @@
1
- var charToInteger = {};
2
1
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
3
- for (var i = 0; i < chars.length; i++) {
4
- charToInteger[chars.charCodeAt(i)] = i;
5
- }
6
2
  function encode(decoded) {
7
3
  var sourceFileIndex = 0; // second field
8
4
  var sourceCodeLine = 0; // third field
@@ -1,10 +1,11 @@
1
- import chai$1, { expect as expect$1, util } from 'chai';
2
- import { c as commonjsGlobal, i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, e as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.03413604.js';
3
- import { r as rpc } from './chunk-runtime-rpc.ef131645.js';
1
+ import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
2
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
3
+ import { r as rpc } from './chunk-runtime-rpc.47bae3f9.js';
4
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.2fab7e5c.js';
4
5
  import fs, { promises } from 'fs';
5
- import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.a0f0fe66.js';
6
+ import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.da6ac0a6.js';
6
7
  import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.bee66426.js';
7
- import require$$1, { format } from 'util';
8
+ import require$$0, { format } from 'util';
8
9
 
9
10
  var __defProp$5 = Object.defineProperty;
10
11
  var __defProps$2 = Object.defineProperties;
@@ -585,7 +586,7 @@ function deepMergeSnapshot(target, source) {
585
586
  }
586
587
 
587
588
  async function saveInlineSnapshots(snapshots) {
588
- const MagicString = (await import('./chunk-magic-string.d5e0e473.js')).default;
589
+ const MagicString = (await import('./chunk-magic-string.41232190.js')).default;
589
590
  const files = new Set(snapshots.map((i) => i.file));
590
591
  await Promise.all(Array.from(files).map(async (file) => {
591
592
  const map = await rpc().getSourceMap(file);
@@ -1085,10 +1086,21 @@ const JestChaiExpect = (chai, utils) => {
1085
1086
  return function(...args) {
1086
1087
  const promise = utils.flag(this, "promise");
1087
1088
  const object = utils.flag(this, "object");
1089
+ const isNot = utils.flag(this, "negate");
1088
1090
  if (promise === "rejects") {
1089
1091
  utils.flag(this, "object", () => {
1090
1092
  throw object;
1091
1093
  });
1094
+ } else if (promise === "resolves" && typeof object !== "function") {
1095
+ if (!isNot) {
1096
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
1097
+ const error = {
1098
+ showDiff: false
1099
+ };
1100
+ throw new AssertionError(message, error, utils.flag(this, "ssfi"));
1101
+ } else {
1102
+ return;
1103
+ }
1092
1104
  }
1093
1105
  _super.apply(this, args);
1094
1106
  };
@@ -1324,9 +1336,20 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1324
1336
  return this.throws(expected);
1325
1337
  const obj = this._obj;
1326
1338
  const promise = utils.flag(this, "promise");
1339
+ const isNot = utils.flag(this, "negate");
1327
1340
  let thrown = null;
1328
- if (promise) {
1341
+ if (promise === "rejects") {
1329
1342
  thrown = obj;
1343
+ } else if (promise === "resolves" && typeof obj !== "function") {
1344
+ if (!isNot) {
1345
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
1346
+ const error = {
1347
+ showDiff: false
1348
+ };
1349
+ throw new AssertionError(message, error, utils.flag(this, "ssfi"));
1350
+ } else {
1351
+ return;
1352
+ }
1330
1353
  } else {
1331
1354
  try {
1332
1355
  obj();
@@ -1390,6 +1413,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1390
1413
  utils.flag(this, "promise", "resolves");
1391
1414
  utils.flag(this, "error", new Error("resolves"));
1392
1415
  const obj = utils.flag(this, "object");
1416
+ if (typeof (obj == null ? void 0 : obj.then) !== "function")
1417
+ throw new TypeError(`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`);
1393
1418
  const proxy = new Proxy(this, {
1394
1419
  get: (target, key, receiver) => {
1395
1420
  const result = Reflect.get(target, key, receiver);
@@ -1400,7 +1425,7 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1400
1425
  utils.flag(this, "object", value);
1401
1426
  return result.call(this, ...args);
1402
1427
  }, (err) => {
1403
- throw new Error(`promise rejected "${err}" instead of resolving`);
1428
+ throw new Error(`promise rejected "${toString(err)}" instead of resolving`);
1404
1429
  });
1405
1430
  };
1406
1431
  }
@@ -1412,6 +1437,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1412
1437
  utils.flag(this, "error", new Error("rejects"));
1413
1438
  const obj = utils.flag(this, "object");
1414
1439
  const wrapper = typeof obj === "function" ? obj() : obj;
1440
+ if (typeof (wrapper == null ? void 0 : wrapper.then) !== "function")
1441
+ throw new TypeError(`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`);
1415
1442
  const proxy = new Proxy(this, {
1416
1443
  get: (target, key, receiver) => {
1417
1444
  const result = Reflect.get(target, key, receiver);
@@ -1419,7 +1446,7 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1419
1446
  return result instanceof chai.Assertion ? proxy : result;
1420
1447
  return async (...args) => {
1421
1448
  return wrapper.then((value) => {
1422
- throw new Error(`promise resolved "${value}" instead of rejecting`);
1449
+ throw new Error(`promise resolved "${toString(value)}" instead of rejecting`);
1423
1450
  }, (err) => {
1424
1451
  utils.flag(this, "object", err);
1425
1452
  return result.call(this, ...args);
@@ -1449,6 +1476,13 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1449
1476
  });
1450
1477
  utils.addMethod(chai.expect, "addSnapshotSerializer", addSerializer);
1451
1478
  };
1479
+ function toString(value) {
1480
+ try {
1481
+ return `${value}`;
1482
+ } catch (_error) {
1483
+ return "unknown";
1484
+ }
1485
+ }
1452
1486
 
1453
1487
  var __defProp$2 = Object.defineProperty;
1454
1488
  var __defProps$1 = Object.defineProperties;
@@ -2916,7 +2950,7 @@ function withGlobal(_global) {
2916
2950
  hrtimePresent && typeof _global.process.hrtime.bigint === "function";
2917
2951
  const nextTickPresent =
2918
2952
  _global.process && typeof _global.process.nextTick === "function";
2919
- const utilPromisify = _global.process && require$$1.promisify;
2953
+ const utilPromisify = _global.process && require$$0.promisify;
2920
2954
  const performancePresent =
2921
2955
  _global.performance && typeof _global.performance.now === "function";
2922
2956
  const hasPerformancePrototype =
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.1064f66b.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.46e2a803.js';
2
2
  import { normalizePath } from 'vite';
3
- import { a as getWorkerState, E as isWindows, F as mergeSlashes, d as dirname, h as basename, k as resolve, G as getType, H as getAllProperties, s as slash } from './chunk-utils-global.03413604.js';
3
+ import { a as getWorkerState, D as isWindows, E as mergeSlashes, d as dirname, h as resolve, f as basename, F as getType, G as getAllProperties, s as slash } from './chunk-utils-global.2fab7e5c.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.153353ee.js';
5
+ import { d as distDir } from './chunk-constants.3570739f.js';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -50,9 +50,10 @@ const _VitestMocker = class {
50
50
  }
51
51
  async resolvePath(id, importer) {
52
52
  const path = await this.options.resolveId(id, importer);
53
+ const external = path == null || path.id.includes("/node_modules/") ? id : null;
53
54
  return {
54
55
  path: normalizeRequestId((path == null ? void 0 : path.id) || id),
55
- external: (path == null ? void 0 : path.id.includes("/node_modules/")) ? id : null
56
+ external
56
57
  };
57
58
  }
58
59
  async resolveMocks() {
@@ -79,7 +80,7 @@ const _VitestMocker = class {
79
80
  return this.getMocks()[this.resolveDependency(dep)];
80
81
  }
81
82
  resolveDependency(dep) {
82
- return normalizeRequestId(dep).replace(/^\/@fs\//, isWindows ? "" : "/");
83
+ return normalizeRequestId(dep.replace(this.root, "")).replace(/^\/@fs\//, isWindows ? "" : "/");
83
84
  }
84
85
  normalizePath(path) {
85
86
  return normalizeRequestId(path.replace(this.root, "")).replace(/^\/@fs\//, isWindows ? "" : "/");
@@ -91,13 +92,13 @@ const _VitestMocker = class {
91
92
  }
92
93
  resolveMockPath(mockPath, external) {
93
94
  const path = normalizeRequestId(external || mockPath);
94
- if (external || isNodeBuiltin(mockPath)) {
95
+ if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
95
96
  const mockDirname = dirname(path);
96
- const baseFilename = basename(path);
97
97
  const mockFolder = resolve(this.root, "__mocks__", mockDirname);
98
98
  if (!existsSync(mockFolder))
99
99
  return null;
100
100
  const files = readdirSync(mockFolder);
101
+ const baseFilename = basename(path);
101
102
  for (const file of files) {
102
103
  const [basename2] = file.split(".");
103
104
  if (basename2 === baseFilename)
@@ -1,4 +1,4 @@
1
- import { a as getWorkerState } from './chunk-utils-global.03413604.js';
1
+ import { a as getWorkerState } from './chunk-utils-global.2fab7e5c.js';
2
2
 
3
3
  const rpc = () => {
4
4
  return getWorkerState().rpc;
@@ -2,12 +2,6 @@ import require$$0 from 'tty';
2
2
  import { isPackageExists } from 'local-pkg';
3
3
  import path from 'path';
4
4
 
5
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
-
7
- function getDefaultExportFromCjs (x) {
8
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9
- }
10
-
11
5
  var picocolors = {exports: {}};
12
6
 
13
7
  let tty = require$$0;
@@ -391,7 +385,7 @@ function getNames(task) {
391
385
  return names;
392
386
  }
393
387
 
394
- const isNode = typeof process !== "undefined" && typeof process.stdout !== "undefined";
388
+ const isNode = typeof process !== "undefined" && typeof process.platform !== "undefined";
395
389
  const isWindows = isNode && process.platform === "win32";
396
390
  function partitionSuiteChildren(suite) {
397
391
  let tasksGroup = [];
@@ -439,7 +433,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
439
433
  message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
440
434
  });
441
435
  if (install) {
442
- await (await import('./chunk-install-pkg.eb979c48.js')).installPackage(dependency, { dev: true });
436
+ await (await import('./chunk-install-pkg.fd8d1022.js')).installPackage(dependency, { dev: true });
443
437
  process.stderr.write(picocolors.exports.yellow(`
444
438
  Package ${dependency} installed, re-run the command to start.
445
439
  `));
@@ -477,4 +471,4 @@ function getCallLastIndex(code) {
477
471
  return null;
478
472
  }
479
473
 
480
- export { ensurePackageInstalled as A, stdout as B, extname as C, getDefaultExportFromCjs as D, isWindows as E, mergeSlashes as F, getType as G, getAllProperties as H, isNode as I, clone as J, partitionSuiteChildren as K, hasTests as L, getWorkerState as a, getNames as b, commonjsGlobal as c, dirname as d, assertTypes as e, notNullish as f, getCallLastIndex as g, basename as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, normalize as x, deepMerge as y, toNamespacedPath as z };
474
+ export { ensurePackageInstalled as A, stdout as B, extname as C, isWindows as D, mergeSlashes as E, getType as F, getAllProperties as G, clone as H, partitionSuiteChildren as I, hasTests as J, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, notNullish as e, basename as f, getCallLastIndex as g, resolve as h, isObject as i, join as j, isAbsolute as k, relative as l, isNode as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, normalize as x, deepMerge as y, toNamespacedPath as z };
@@ -1,4 +1,4 @@
1
- import { s as slash, f as notNullish, p as picocolors } from './chunk-utils-global.03413604.js';
1
+ import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.2fab7e5c.js';
2
2
 
3
3
  const setTimeout$1 = globalThis.setTimeout;
4
4
  const setInterval = globalThis.setInterval;
@@ -7238,7 +7238,8 @@ function cliTruncate(text, columns, options) {
7238
7238
  }
7239
7239
 
7240
7240
  function formatLine(line, outputTruncateLength) {
7241
- return cliTruncate(line, (outputTruncateLength ?? (process.stdout.columns || 80)) - 4);
7241
+ var _a;
7242
+ return cliTruncate(line, (outputTruncateLength ?? (((_a = process.stdout) == null ? void 0 : _a.columns) || 80)) - 4);
7242
7243
  }
7243
7244
  function unifiedDiff(actual, expected, options = {}) {
7244
7245
  if (actual === expected)