vitest 0.27.0 → 0.27.1

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 (36) hide show
  1. package/LICENSE.md +13 -12
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +9 -9
  4. package/dist/{chunk-api-setup.16ac28c0.js → chunk-api-setup.2be3cc38.js} +54 -30
  5. package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
  6. package/dist/{chunk-integrations-globals.3dfaeb99.js → chunk-integrations-globals.02f1259c.js} +6 -6
  7. package/dist/{chunk-mock-date.a1c85759.js → chunk-mock-date.149ed990.js} +11 -6
  8. package/dist/{chunk-node-git.543e964a.js → chunk-node-git.125c9008.js} +3 -3
  9. package/dist/{chunk-runtime-chain.6df5a66b.js → chunk-runtime-chain.4e2aa823.js} +6 -6
  10. package/dist/{chunk-runtime-error.fad2c32b.js → chunk-runtime-error.97854396.js} +1 -1
  11. package/dist/{chunk-runtime-mocker.a677dd28.js → chunk-runtime-mocker.4755840f.js} +4 -4
  12. package/dist/{chunk-runtime-rpc.7f83c8a9.js → chunk-runtime-rpc.25cc9413.js} +1 -1
  13. package/dist/{chunk-runtime-setup.731b2b04.js → chunk-runtime-setup.56d71d30.js} +11 -11
  14. package/dist/{chunk-snapshot-manager.700322bf.js → chunk-snapshot-manager.1a2dbf96.js} +70 -40
  15. package/dist/{chunk-utils-env.b861e3a0.js → chunk-utils-env.f4a39d2c.js} +7 -7
  16. package/dist/{chunk-utils-import.2baa69a9.js → chunk-utils-import.16d9fb0d.js} +3 -3
  17. package/dist/{chunk-utils-source-map.60562959.js → chunk-utils-source-map.4e9b891d.js} +2 -2
  18. package/dist/cli-wrapper.js +5 -5
  19. package/dist/cli.js +7 -7
  20. package/dist/config.d.ts +1 -1
  21. package/dist/entry.js +8 -8
  22. package/dist/environments.d.ts +1 -1
  23. package/dist/{index-2d10c3fd.d.ts → index-1cfc7f58.d.ts} +4 -2
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +7 -7
  26. package/dist/loader.js +8 -9
  27. package/dist/node.d.ts +2 -2
  28. package/dist/node.js +11 -9
  29. package/dist/suite.js +5 -5
  30. package/dist/{types-e1e1d1e5.d.ts → types-5617096e.d.ts} +9 -1
  31. package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
  32. package/dist/vendor-index.b0346fe4.js +395 -0
  33. package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
  34. package/dist/worker.js +23 -18
  35. package/package.json +10 -9
  36. package/dist/vendor-index.2e96c50b.js +0 -215
@@ -1,13 +1,13 @@
1
- import { j as join, c as basename, d as dirname, r as relative, e as extname, b as resolve, f as distDir, g as rootDir, h as isAbsolute, i as isNode, k as configFiles, l as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.b861e3a0.js';
1
+ import { j as join, c as basename, d as dirname, r as relative, e as extname, b as resolve, f as distDir, g as rootDir, h as isAbsolute, i as isNode, k as configFiles, l as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.f4a39d2c.js';
2
2
  import { p as pLimit, g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, a as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.44413252.js';
3
3
  import { g as getEnvPackageName } from './chunk-env-node.b3664da2.js';
4
- import { y as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, k as relativePath, z as getTests, e as getFullName, u as hasFailed, B as hasFailedSnapshot, C as getSuites, j as notNullish, l as shuffle, t as toArray, n as noop$1, D as deepMerge, b as getCallLastIndex, E as removeUndefinedValues, F as isWindows, G as stdout } from './chunk-mock-date.a1c85759.js';
4
+ import { y as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, k as relativePath, z as getTests, e as getFullName, u as hasFailed, B as hasFailedSnapshot, C as getSuites, j as notNullish, l as shuffle, t as toArray, n as noop$1, D as deepMerge, b as getCallLastIndex, E as removeUndefinedValues, F as isWindows, G as stdout } from './chunk-mock-date.149ed990.js';
5
5
  import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
6
6
  import path$a from 'node:path';
7
7
  import url, { fileURLToPath } from 'node:url';
8
8
  import process$1 from 'node:process';
9
9
  import fs$8, { promises, existsSync } from 'node:fs';
10
- import g from 'path';
10
+ import k from 'path';
11
11
  import require$$0 from 'os';
12
12
  import util$2 from 'util';
13
13
  import require$$0$1 from 'stream';
@@ -18,9 +18,9 @@ import c from 'picocolors';
18
18
  import { ViteNodeRunner } from 'vite-node/client';
19
19
  import { ViteNodeServer } from 'vite-node/server';
20
20
  import { writeFile, rm } from 'node:fs/promises';
21
- import { e as execa } from './vendor-index.b2fdde54.js';
21
+ import { e as execa } from './vendor-index.451e37bc.js';
22
22
  import { SourceMapConsumer } from 'source-map';
23
- import H from 'module';
23
+ import K, { createRequire } from 'module';
24
24
  import { parse as parse$4 } from 'acorn';
25
25
  import { ancestor } from 'acorn-walk';
26
26
  import { MessageChannel } from 'node:worker_threads';
@@ -28,20 +28,20 @@ import { cpus, hostname } from 'node:os';
28
28
  import { Tinypool } from 'tinypool';
29
29
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
30
30
  import { performance } from 'perf_hooks';
31
- import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.60562959.js';
31
+ import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.4e9b891d.js';
32
32
  import { g as safeSetInterval, h as safeClearInterval, s as safeSetTimeout, d as ansiStyles, c as createPatch, a as stringify$5, b as safeClearTimeout } from './chunk-utils-timers.52534f96.js';
33
33
  import { resolveModule } from 'local-pkg';
34
34
  import { createHash } from 'crypto';
35
35
  import { slash as slash$2, cleanUrl } from 'vite-node/utils';
36
36
  import { o as onetime } from './vendor-index.9c919048.js';
37
- import { s as signalExit } from './vendor-index.7a2cebfe.js';
37
+ import { s as signalExit } from './vendor-index.e6c27006.js';
38
38
  import { createHash as createHash$1 } from 'node:crypto';
39
39
  import MagicString from './chunk-magic-string.3a794426.js';
40
40
  import { stripLiteral } from 'strip-literal';
41
41
  import require$$0$3 from 'readline';
42
42
  import { p as prompts } from './vendor-index.9f20a9be.js';
43
43
 
44
- var version$1 = "0.27.0";
44
+ var version$1 = "0.27.1";
45
45
 
46
46
  class EndError extends Error {
47
47
  constructor(value) {
@@ -247,7 +247,7 @@ var path$9 = {};
247
247
 
248
248
  Object.defineProperty(path$9, "__esModule", { value: true });
249
249
  path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
250
- const path$8 = g;
250
+ const path$8 = k;
251
251
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
252
252
  const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
253
253
  /**
@@ -453,7 +453,7 @@ var isGlob$1 = function isGlob(str, options) {
453
453
  };
454
454
 
455
455
  var isGlob = isGlob$1;
456
- var pathPosixDirname = g.posix.dirname;
456
+ var pathPosixDirname = k.posix.dirname;
457
457
  var isWin32 = require$$0.platform() === 'win32';
458
458
 
459
459
  var slash = '/';
@@ -1917,7 +1917,7 @@ var picomatch$2 = {exports: {}};
1917
1917
 
1918
1918
  var utils$f = {};
1919
1919
 
1920
- const path$7 = g;
1920
+ const path$7 = k;
1921
1921
  const WIN_SLASH = '\\\\/';
1922
1922
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1923
1923
 
@@ -2097,7 +2097,7 @@ var constants$3 = {
2097
2097
 
2098
2098
  (function (exports) {
2099
2099
 
2100
- const path = g;
2100
+ const path = k;
2101
2101
  const win32 = process.platform === 'win32';
2102
2102
  const {
2103
2103
  REGEX_BACKSLASH,
@@ -3641,7 +3641,7 @@ parse$1.fastpaths = (input, options) => {
3641
3641
 
3642
3642
  var parse_1 = parse$1;
3643
3643
 
3644
- const path$6 = g;
3644
+ const path$6 = k;
3645
3645
  const scan = scan_1;
3646
3646
  const parse = parse_1;
3647
3647
  const utils$c = utils$f;
@@ -4455,7 +4455,7 @@ var micromatch_1 = micromatch$1;
4455
4455
 
4456
4456
  Object.defineProperty(pattern$1, "__esModule", { value: true });
4457
4457
  pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
4458
- const path$5 = g;
4458
+ const path$5 = k;
4459
4459
  const globParent = globParent$1;
4460
4460
  const micromatch = micromatch_1;
4461
4461
  const GLOBSTAR = '**';
@@ -5374,7 +5374,7 @@ var fs$1 = {};
5374
5374
  } (fs$1));
5375
5375
 
5376
5376
  Object.defineProperty(settings$2, "__esModule", { value: true });
5377
- const path$3 = g;
5377
+ const path$3 = k;
5378
5378
  const fsStat$3 = out$1;
5379
5379
  const fs = fs$1;
5380
5380
  class Settings$1 {
@@ -6028,7 +6028,7 @@ sync$3.default = SyncProvider;
6028
6028
  var settings$1 = {};
6029
6029
 
6030
6030
  Object.defineProperty(settings$1, "__esModule", { value: true });
6031
- const path$2 = g;
6031
+ const path$2 = k;
6032
6032
  const fsScandir = out$2;
6033
6033
  class Settings {
6034
6034
  constructor(_options = {}) {
@@ -6090,7 +6090,7 @@ function getSettings(settingsOrOptions = {}) {
6090
6090
  var reader = {};
6091
6091
 
6092
6092
  Object.defineProperty(reader, "__esModule", { value: true });
6093
- const path$1 = g;
6093
+ const path$1 = k;
6094
6094
  const fsStat$2 = out$1;
6095
6095
  const utils$6 = utils$k;
6096
6096
  class Reader {
@@ -6484,7 +6484,7 @@ class EntryTransformer {
6484
6484
  entry.default = EntryTransformer;
6485
6485
 
6486
6486
  Object.defineProperty(provider, "__esModule", { value: true });
6487
- const path = g;
6487
+ const path = k;
6488
6488
  const deep_1 = deep;
6489
6489
  const entry_1 = entry$1;
6490
6490
  const error_1 = error;
@@ -6854,9 +6854,9 @@ function addSnapshotResult(summary, result) {
6854
6854
  summary.total += result.added + result.matched + result.unmatched + result.updated;
6855
6855
  }
6856
6856
 
6857
- function T(r){const t=/^\\\\\?\\/.test(r),n=/[^\u0000-\u0080]+/.test(r);return t||n?r:r.replace(/\\/g,"/")}function B(r,t){for(;;){const n=g.join(r,t);if(require$$0$2.existsSync(n))return T(n);const e=g.dirname(r);if(e===r)return;r=e;}}function G(r,t){t===void 0&&(t=!1);var n=r.length,e=0,i="",a=0,o=16,u=0,f=0,d=0,C=0,c=0;function y(s,m){for(var v=0,b=0;v<s||!m;){var h=r.charCodeAt(e);if(h>=48&&h<=57)b=b*16+h-48;else if(h>=65&&h<=70)b=b*16+h-65+10;else if(h>=97&&h<=102)b=b*16+h-97+10;else break;e++,v++;}return v<s&&(b=-1),b}function V(s){e=s,i="",a=0,o=16,c=0;}function $(){var s=e;if(r.charCodeAt(e)===48)e++;else for(e++;e<r.length&&j(r.charCodeAt(e));)e++;if(e<r.length&&r.charCodeAt(e)===46)if(e++,e<r.length&&j(r.charCodeAt(e)))for(e++;e<r.length&&j(r.charCodeAt(e));)e++;else return c=3,r.substring(s,e);var m=e;if(e<r.length&&(r.charCodeAt(e)===69||r.charCodeAt(e)===101))if(e++,(e<r.length&&r.charCodeAt(e)===43||r.charCodeAt(e)===45)&&e++,e<r.length&&j(r.charCodeAt(e))){for(e++;e<r.length&&j(r.charCodeAt(e));)e++;m=e;}else c=3;return r.substring(s,m)}function _(){for(var s="",m=e;;){if(e>=n){s+=r.substring(m,e),c=2;break}var v=r.charCodeAt(e);if(v===34){s+=r.substring(m,e),e++;break}if(v===92){if(s+=r.substring(m,e),e++,e>=n){c=2;break}var b=r.charCodeAt(e++);switch(b){case 34:s+='"';break;case 92:s+="\\";break;case 47:s+="/";break;case 98:s+="\b";break;case 102:s+="\f";break;case 110:s+=`
6858
- `;break;case 114:s+="\r";break;case 116:s+=" ";break;case 117:var h=y(4,!0);h>=0?s+=String.fromCharCode(h):c=4;break;default:c=5;}m=e;continue}if(v>=0&&v<=31)if(P(v)){s+=r.substring(m,e),c=2;break}else c=6;e++;}return s}function S(){if(i="",c=0,a=e,f=u,C=d,e>=n)return a=n,o=17;var s=r.charCodeAt(e);if(U(s)){do e++,i+=String.fromCharCode(s),s=r.charCodeAt(e);while(U(s));return o=15}if(P(s))return e++,i+=String.fromCharCode(s),s===13&&r.charCodeAt(e)===10&&(e++,i+=`
6859
- `),u++,d=e,o=14;switch(s){case 123:return e++,o=1;case 125:return e++,o=2;case 91:return e++,o=3;case 93:return e++,o=4;case 58:return e++,o=6;case 44:return e++,o=5;case 34:return e++,i=_(),o=10;case 47:var m=e-1;if(r.charCodeAt(e+1)===47){for(e+=2;e<n&&!P(r.charCodeAt(e));)e++;return i=r.substring(m,e),o=12}if(r.charCodeAt(e+1)===42){e+=2;for(var v=n-1,b=!1;e<v;){var h=r.charCodeAt(e);if(h===42&&r.charCodeAt(e+1)===47){e+=2,b=!0;break}e++,P(h)&&(h===13&&r.charCodeAt(e)===10&&e++,u++,d=e);}return b||(e++,c=1),i=r.substring(m,e),o=13}return i+=String.fromCharCode(s),e++,o=16;case 45:if(i+=String.fromCharCode(s),e++,e===n||!j(r.charCodeAt(e)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=$(),o=11;default:for(;e<n&&k(s);)e++,s=r.charCodeAt(e);if(a!==e){switch(i=r.substring(a,e),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(s),e++,o=16}}function k(s){if(U(s)||P(s))return !1;switch(s){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return !1}return !0}function l(){var s;do s=S();while(s>=12&&s<=15);return s}return {setPosition:V,getPosition:function(){return e},scan:t?l:S,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return a},getTokenLength:function(){return e-a},getTokenStartLine:function(){return f},getTokenStartCharacter:function(){return a-C},getTokenError:function(){return c}}}function U(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function P(r){return r===10||r===13||r===8232||r===8233}function j(r){return r>=48&&r<=57}var N;(function(r){r.DEFAULT={allowTrailingComma:!1};})(N||(N={}));function K(r,t,n){t===void 0&&(t=[]),n===void 0&&(n=N.DEFAULT);var e=null,i=[],a=[];function o(f){Array.isArray(i)?i.push(f):e!==null&&(i[e]=f);}var u={onObjectBegin:function(){var f={};o(f),a.push(i),i=f,e=null;},onObjectProperty:function(f){e=f;},onObjectEnd:function(){i=a.pop();},onArrayBegin:function(){var f=[];o(f),a.push(i),i=f,e=null;},onArrayEnd:function(){i=a.pop();},onLiteralValue:o,onError:function(f,d,C){t.push({error:f,offset:d,length:C});}};return Q(r,u,n),i[0]}function Q(r,t,n){n===void 0&&(n=N.DEFAULT);var e=G(r,!1);function i(p){return p?function(){return p(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter())}:function(){return !0}}function a(p){return p?function(w){return p(w,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter())}:function(){return !0}}var o=i(t.onObjectBegin),u=a(t.onObjectProperty),f=i(t.onObjectEnd),d=i(t.onArrayBegin),C=i(t.onArrayEnd),c=a(t.onLiteralValue),y=a(t.onSeparator),V=i(t.onComment),$=a(t.onError),_=n&&n.disallowComments,S=n&&n.allowTrailingComma;function k(){for(;;){var p=e.scan();switch(e.getTokenError()){case 4:l(14);break;case 5:l(15);break;case 3:l(13);break;case 1:_||l(11);break;case 2:l(12);break;case 6:l(16);break}switch(p){case 12:case 13:_?l(10):V();break;case 16:l(1);break;case 15:case 14:break;default:return p}}}function l(p,w,L){if(w===void 0&&(w=[]),L===void 0&&(L=[]),$(p),w.length+L.length>0)for(var D=e.getToken();D!==17;){if(w.indexOf(D)!==-1){k();break}else if(L.indexOf(D)!==-1)break;D=k();}}function s(p){var w=e.getTokenValue();return p?c(w):u(w),k(),!0}function m(){switch(e.getToken()){case 11:var p=e.getTokenValue(),w=Number(p);isNaN(w)&&(l(2),w=0),c(w);break;case 7:c(null);break;case 8:c(!0);break;case 9:c(!1);break;default:return !1}return k(),!0}function v(){return e.getToken()!==10?(l(3,[],[2,5]),!1):(s(!1),e.getToken()===6?(y(":"),k(),F()||l(4,[],[2,5])):l(5,[],[2,5]),!0)}function b(){o(),k();for(var p=!1;e.getToken()!==2&&e.getToken()!==17;){if(e.getToken()===5){if(p||l(4,[],[]),y(","),k(),e.getToken()===2&&S)break}else p&&l(6,[],[]);v()||l(4,[],[2,5]),p=!0;}return f(),e.getToken()!==2?l(7,[2],[]):k(),!0}function h(){d(),k();for(var p=!1;e.getToken()!==4&&e.getToken()!==17;){if(e.getToken()===5){if(p||l(4,[],[]),y(","),k(),e.getToken()===4&&S)break}else p&&l(6,[],[]);F()||l(4,[],[4,5]),p=!0;}return C(),e.getToken()!==4?l(8,[4],[]):k(),!0}function F(){switch(e.getToken()){case 3:return h();case 1:return b();case 10:return s(!0);default:return m()}}return k(),e.getToken()===17?n.allowEmptyContent?!0:(l(4,[],[]),!1):F()?(e.getToken()!==17&&l(9,[],[]),!0):(l(4,[],[]),!1)}var X=K;const W=/^\.{1,2}(\/.*)?$/,J=r=>T(W.test(r)?r:`./${r}`),{existsSync:E}=require$$0$2,Y=r=>{try{return JSON.parse(r)}catch{}},Z=()=>{const{findPnpApi:r}=H;return r&&r(process.cwd())};function I(r){const t=Y(require$$0$2.readFileSync(r,"utf8"));return g.join(r,"..",t&&"tsconfig"in t?t.tsconfig:"tsconfig.json")}function x(r,t){let n=r;if(n===".."&&(n+="/tsconfig.json"),n.startsWith(".")){let a=g.resolve(t,n);if(E(a)&&require$$0$2.statSync(a).isFile()||!a.endsWith(".json")&&(a+=".json",E(a)))return a;throw new Error(`File '${r}' not found.`)}const e=Z();if(e){const{resolveRequest:a}=e,[o,u]=r.split("/"),f=o.startsWith("@")?`${o}/${u}`:o;try{if(f===r){const d=a(g.join(f,"package.json"),t);if(d){const C=I(d);if(E(C))return C}}else try{return a(r,t,{extensions:[".json"]})}catch{return a(g.join(r,"tsconfig.json"),t)}}catch{}}let i=B(t,g.join("node_modules",n));if(i){if(require$$0$2.statSync(i).isDirectory()){const a=g.join(i,"package.json");if(E(a)?i=I(a):i=g.join(i,"tsconfig.json"),E(i))return i}else if(i.endsWith(".json"))return i}if(!n.endsWith(".json")&&(n+=".json",i=B(t,g.join("node_modules",n)),i))return i;throw new Error(`File '${r}' not found.`)}var ee=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,q=(r,t,n)=>t in r?ee(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,A=(r,t)=>{for(var n in t||(t={}))te.call(t,n)&&q(r,n,t[n]);if(R)for(var n of R(t))ae.call(t,n)&&q(r,n,t[n]);return r},oe=(r,t)=>re(r,ne(t));function M(r){var t;let n;try{n=require$$0$2.realpathSync(r);}catch{throw new Error(`Cannot resolve tsconfig at path: ${r}`)}const e=g.dirname(n),i=require$$0$2.readFileSync(n,"utf8").trim();let a={};if(i&&(a=X(i),!a||typeof a!="object"))throw new SyntaxError(`Failed to parse tsconfig at: ${r}`);if(a.extends){const o=x(a.extends,e),u=M(o);if(delete u.references,(t=u.compilerOptions)!=null&&t.baseUrl){const{compilerOptions:d}=u;d.baseUrl=g.relative(e,g.join(g.dirname(o),d.baseUrl))||"./";}u.files&&(u.files=u.files.map(d=>g.relative(e,g.join(g.dirname(o),d)))),u.include&&(u.include=u.include.map(d=>g.relative(e,g.join(g.dirname(o),d)))),delete a.extends;const f=oe(A(A({},u),a),{compilerOptions:A(A({},u.compilerOptions),a.compilerOptions)});u.watchOptions&&(f.watchOptions=A(A({},u.watchOptions),a.watchOptions)),a=f;}if(a.compilerOptions){const{compilerOptions:o}=a;o.baseUrl&&(o.baseUrl=J(o.baseUrl)),o.outDir&&(Array.isArray(a.exclude)||(a.exclude=[]),a.exclude.push(o.outDir),o.outDir=J(o.outDir));}if(a.files&&(a.files=a.files.map(J)),a.include&&(a.include=a.include.map(T)),a.watchOptions){const{watchOptions:o}=a;o.excludeDirectories&&(o.excludeDirectories=o.excludeDirectories.map(u=>T(g.resolve(e,u))));}return a}function ie(r=process.cwd(),t="tsconfig.json"){const n=B(r,t);if(!n)return null;const e=M(n);return {path:n,config:e}}
6857
+ function A(n){return /^\\\\\?\\/.test(n)?n:n.replace(/\\/g,"/")}function y(n,u){for(;;){const l=k.join(n,u);if(require$$0$2.existsSync(l))return A(l);const e=k.dirname(n);if(e===n)return;n=e;}}const M=/^\.{1,2}(\/.*)?$/,R=n=>A(M.test(n)?n:`./${n}`);function d(n,u=!1){const l=n.length;let e=0,t="",f=0,i=16,b=0,c=0,w=0,T=0,p=0;function V(o,r){let s=0,O=0;for(;s<o||!r;){let m=n.charCodeAt(e);if(m>=48&&m<=57)O=O*16+m-48;else if(m>=65&&m<=70)O=O*16+m-65+10;else if(m>=97&&m<=102)O=O*16+m-97+10;else break;e++,s++;}return s<o&&(O=-1),O}function D(o){e=o,t="",f=0,i=16,p=0;}function v(){let o=e;if(n.charCodeAt(e)===48)e++;else for(e++;e<n.length&&B(n.charCodeAt(e));)e++;if(e<n.length&&n.charCodeAt(e)===46)if(e++,e<n.length&&B(n.charCodeAt(e)))for(e++;e<n.length&&B(n.charCodeAt(e));)e++;else return p=3,n.substring(o,e);let r=e;if(e<n.length&&(n.charCodeAt(e)===69||n.charCodeAt(e)===101))if(e++,(e<n.length&&n.charCodeAt(e)===43||n.charCodeAt(e)===45)&&e++,e<n.length&&B(n.charCodeAt(e))){for(e++;e<n.length&&B(n.charCodeAt(e));)e++;r=e;}else p=3;return n.substring(o,r)}function L(){let o="",r=e;for(;;){if(e>=l){o+=n.substring(r,e),p=2;break}const s=n.charCodeAt(e);if(s===34){o+=n.substring(r,e),e++;break}if(s===92){if(o+=n.substring(r,e),e++,e>=l){p=2;break}switch(n.charCodeAt(e++)){case 34:o+='"';break;case 92:o+="\\";break;case 47:o+="/";break;case 98:o+="\b";break;case 102:o+="\f";break;case 110:o+=`
6858
+ `;break;case 114:o+="\r";break;case 116:o+=" ";break;case 117:const m=V(4,!0);m>=0?o+=String.fromCharCode(m):p=4;break;default:p=5;}r=e;continue}if(s>=0&&s<=31)if(U(s)){o+=n.substring(r,e),p=2;break}else p=6;e++;}return o}function E(){if(t="",p=0,f=e,c=b,T=w,e>=l)return f=l,i=17;let o=n.charCodeAt(e);if(J(o)){do e++,t+=String.fromCharCode(o),o=n.charCodeAt(e);while(J(o));return i=15}if(U(o))return e++,t+=String.fromCharCode(o),o===13&&n.charCodeAt(e)===10&&(e++,t+=`
6859
+ `),b++,w=e,i=14;switch(o){case 123:return e++,i=1;case 125:return e++,i=2;case 91:return e++,i=3;case 93:return e++,i=4;case 58:return e++,i=6;case 44:return e++,i=5;case 34:return e++,t=L(),i=10;case 47:const r=e-1;if(n.charCodeAt(e+1)===47){for(e+=2;e<l&&!U(n.charCodeAt(e));)e++;return t=n.substring(r,e),i=12}if(n.charCodeAt(e+1)===42){e+=2;const s=l-1;let O=!1;for(;e<s;){const m=n.charCodeAt(e);if(m===42&&n.charCodeAt(e+1)===47){e+=2,O=!0;break}e++,U(m)&&(m===13&&n.charCodeAt(e)===10&&e++,b++,w=e);}return O||(e++,p=1),t=n.substring(r,e),i=13}return t+=String.fromCharCode(o),e++,i=16;case 45:if(t+=String.fromCharCode(o),e++,e===l||!B(n.charCodeAt(e)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return t+=v(),i=11;default:for(;e<l&&W(o);)e++,o=n.charCodeAt(e);if(f!==e){switch(t=n.substring(f,e),t){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return t+=String.fromCharCode(o),e++,i=16}}function W(o){if(J(o)||U(o))return !1;switch(o){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return !1}return !0}function _(){let o;do o=E();while(o>=12&&o<=15);return o}return {setPosition:D,getPosition:()=>e,scan:u?_:E,getToken:()=>i,getTokenValue:()=>t,getTokenOffset:()=>f,getTokenLength:()=>e-f,getTokenStartLine:()=>c,getTokenStartCharacter:()=>f-T,getTokenError:()=>p}}function J(n){return n===32||n===9}function U(n){return n===10||n===13}function B(n){return n>=48&&n<=57}var H;(function(n){n[n.lineFeed=10]="lineFeed",n[n.carriageReturn=13]="carriageReturn",n[n.space=32]="space",n[n._0=48]="_0",n[n._1=49]="_1",n[n._2=50]="_2",n[n._3=51]="_3",n[n._4=52]="_4",n[n._5=53]="_5",n[n._6=54]="_6",n[n._7=55]="_7",n[n._8=56]="_8",n[n._9=57]="_9",n[n.a=97]="a",n[n.b=98]="b",n[n.c=99]="c",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.g=103]="g",n[n.h=104]="h",n[n.i=105]="i",n[n.j=106]="j",n[n.k=107]="k",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.p=112]="p",n[n.q=113]="q",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.v=118]="v",n[n.w=119]="w",n[n.x=120]="x",n[n.y=121]="y",n[n.z=122]="z",n[n.A=65]="A",n[n.B=66]="B",n[n.C=67]="C",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.G=71]="G",n[n.H=72]="H",n[n.I=73]="I",n[n.J=74]="J",n[n.K=75]="K",n[n.L=76]="L",n[n.M=77]="M",n[n.N=78]="N",n[n.O=79]="O",n[n.P=80]="P",n[n.Q=81]="Q",n[n.R=82]="R",n[n.S=83]="S",n[n.T=84]="T",n[n.U=85]="U",n[n.V=86]="V",n[n.W=87]="W",n[n.X=88]="X",n[n.Y=89]="Y",n[n.Z=90]="Z",n[n.asterisk=42]="asterisk",n[n.backslash=92]="backslash",n[n.closeBrace=125]="closeBrace",n[n.closeBracket=93]="closeBracket",n[n.colon=58]="colon",n[n.comma=44]="comma",n[n.dot=46]="dot",n[n.doubleQuote=34]="doubleQuote",n[n.minus=45]="minus",n[n.openBrace=123]="openBrace",n[n.openBracket=91]="openBracket",n[n.plus=43]="plus",n[n.slash=47]="slash",n[n.formFeed=12]="formFeed",n[n.tab=9]="tab";})(H||(H={}));var I;(function(n){n.DEFAULT={allowTrailingComma:!1};})(I||(I={}));function C(n,u=[],l=I.DEFAULT){let e=null,t=[];const f=[];function i(c){Array.isArray(t)?t.push(c):e!==null&&(t[e]=c);}return nn(n,{onObjectBegin:()=>{const c={};i(c),f.push(t),t=c,e=null;},onObjectProperty:c=>{e=c;},onObjectEnd:()=>{t=f.pop();},onArrayBegin:()=>{const c=[];i(c),f.push(t),t=c,e=null;},onArrayEnd:()=>{t=f.pop();},onLiteralValue:i,onError:(c,w,T)=>{u.push({error:c,offset:w,length:T});}},l),t[0]}function nn(n,u,l=I.DEFAULT){const e=d(n,!1),t=[];function f(g){return g?()=>g(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter()):()=>!0}function i(g){return g?()=>g(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter(),()=>t.slice()):()=>!0}function b(g){return g?a=>g(a,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter()):()=>!0}function c(g){return g?a=>g(a,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter(),()=>t.slice()):()=>!0}const w=i(u.onObjectBegin),T=c(u.onObjectProperty),p=f(u.onObjectEnd),V=i(u.onArrayBegin),D=f(u.onArrayEnd),v=c(u.onLiteralValue),L=b(u.onSeparator),E=f(u.onComment),W=b(u.onError),_=l&&l.disallowComments,o=l&&l.allowTrailingComma;function r(){for(;;){const g=e.scan();switch(e.getTokenError()){case 4:s(14);break;case 5:s(15);break;case 3:s(13);break;case 1:_||s(11);break;case 2:s(12);break;case 6:s(16);break}switch(g){case 12:case 13:_?s(10):E();break;case 16:s(1);break;case 15:case 14:break;default:return g}}}function s(g,a=[],z=[]){if(W(g),a.length+z.length>0){let F=e.getToken();for(;F!==17;){if(a.indexOf(F)!==-1){r();break}else if(z.indexOf(F)!==-1)break;F=r();}}}function O(g){const a=e.getTokenValue();return g?v(a):(T(a),t.push(a)),r(),!0}function m(){switch(e.getToken()){case 11:const g=e.getTokenValue();let a=Number(g);isNaN(a)&&(s(2),a=0),v(a);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return !1}return r(),!0}function P(){return e.getToken()!==10?(s(3,[],[2,5]),!1):(O(!1),e.getToken()===6?(L(":"),r(),$()||s(4,[],[2,5])):s(5,[],[2,5]),t.pop(),!0)}function q(){w(),r();let g=!1;for(;e.getToken()!==2&&e.getToken()!==17;){if(e.getToken()===5){if(g||s(4,[],[]),L(","),r(),e.getToken()===2&&o)break}else g&&s(6,[],[]);P()||s(4,[],[2,5]),g=!0;}return p(),e.getToken()!==2?s(7,[2],[]):r(),!0}function x(){V(),r();let g=!0,a=!1;for(;e.getToken()!==4&&e.getToken()!==17;){if(e.getToken()===5){if(a||s(4,[],[]),L(","),r(),e.getToken()===4&&o)break}else a&&s(6,[],[]);g?(t.push(0),g=!1):t[t.length-1]++,$()||s(4,[],[4,5]),a=!0;}return D(),g||t.pop(),e.getToken()!==4?s(8,[4],[]):r(),!0}function $(){switch(e.getToken()){case 3:return x();case 1:return q();case 10:return O(!0);default:return m()}}return r(),e.getToken()===17?l.allowEmptyContent?!0:(s(4,[],[]),!1):$()?(e.getToken()!==17&&s(9,[],[]),!0):(s(4,[],[]),!1)}var G;(function(n){n[n.None=0]="None",n[n.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=2]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",n[n.InvalidUnicode=4]="InvalidUnicode",n[n.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",n[n.InvalidCharacter=6]="InvalidCharacter";})(G||(G={}));var X;(function(n){n[n.OpenBraceToken=1]="OpenBraceToken",n[n.CloseBraceToken=2]="CloseBraceToken",n[n.OpenBracketToken=3]="OpenBracketToken",n[n.CloseBracketToken=4]="CloseBracketToken",n[n.CommaToken=5]="CommaToken",n[n.ColonToken=6]="ColonToken",n[n.NullKeyword=7]="NullKeyword",n[n.TrueKeyword=8]="TrueKeyword",n[n.FalseKeyword=9]="FalseKeyword",n[n.StringLiteral=10]="StringLiteral",n[n.NumericLiteral=11]="NumericLiteral",n[n.LineCommentTrivia=12]="LineCommentTrivia",n[n.BlockCommentTrivia=13]="BlockCommentTrivia",n[n.LineBreakTrivia=14]="LineBreakTrivia",n[n.Trivia=15]="Trivia",n[n.Unknown=16]="Unknown",n[n.EOF=17]="EOF";})(X||(X={}));const en=C;var Y;(function(n){n[n.InvalidSymbol=1]="InvalidSymbol",n[n.InvalidNumberFormat=2]="InvalidNumberFormat",n[n.PropertyNameExpected=3]="PropertyNameExpected",n[n.ValueExpected=4]="ValueExpected",n[n.ColonExpected=5]="ColonExpected",n[n.CommaExpected=6]="CommaExpected",n[n.CloseBraceExpected=7]="CloseBraceExpected",n[n.CloseBracketExpected=8]="CloseBracketExpected",n[n.EndOfFileExpected=9]="EndOfFileExpected",n[n.InvalidCommentToken=10]="InvalidCommentToken",n[n.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=12]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",n[n.InvalidUnicode=14]="InvalidUnicode",n[n.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",n[n.InvalidCharacter=16]="InvalidCharacter";})(Y||(Y={}));const Z=n=>en(require$$0$2.readFileSync(n,"utf8")),{existsSync:N}=require$$0$2,tn=()=>{const{findPnpApi:n}=K;return n&&n(process.cwd())};function h(n){const u=Z(n);return k.join(n,"..",u&&"tsconfig"in u?u.tsconfig:"tsconfig.json")}function ln(n,u){let l=n;const e=n[0]===".";if(e||k.isAbsolute(n)){if(e&&(l===".."&&(l+="/tsconfig.json"),l=k.resolve(u,l)),N(l)&&require$$0$2.statSync(l).isFile()||!l.endsWith(".json")&&(l+=".json",N(l)))return l;throw new Error(`File '${n}' not found.`)}const t=tn();if(t){const{resolveRequest:i}=t,[b,c]=n.split("/"),w=b.startsWith("@")?`${b}/${c}`:b;try{if(w===n){const T=i(k.join(w,"package.json"),u);if(T){const p=h(T);if(N(p))return p}}else {let T;try{T=i(n,u,{extensions:[".json"]});}catch{T=i(k.join(n,"tsconfig.json"),u);}if(T)return T}}catch{}}let f=y(u,k.join("node_modules",l));if(f){if(require$$0$2.statSync(f).isDirectory()){const i=k.join(f,"package.json");if(N(i)?f=h(i):f=k.join(f,"tsconfig.json"),N(f))return f}else if(f.endsWith(".json"))return f}if(!l.endsWith(".json")&&(l+=".json",f=y(u,k.join("node_modules",l)),f))return f;throw new Error(`File '${n}' not found.`)}function Q(n){var u;let l;try{l=require$$0$2.realpathSync(n);}catch{throw new Error(`Cannot resolve tsconfig at path: ${n}`)}const e=k.dirname(l);let t=Z(l)||{};if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${n}`);if(t.extends){const f=ln(t.extends,e),i=Q(f);if(delete i.references,(u=i.compilerOptions)!=null&&u.baseUrl){const{compilerOptions:c}=i;c.baseUrl=k.relative(e,k.join(k.dirname(f),c.baseUrl))||"./";}i.files&&(i.files=i.files.map(c=>k.relative(e,k.join(k.dirname(f),c)))),i.include&&(i.include=i.include.map(c=>k.relative(e,k.join(k.dirname(f),c)))),delete t.extends;const b={...i,...t,compilerOptions:{...i.compilerOptions,...t.compilerOptions}};i.watchOptions&&(b.watchOptions={...i.watchOptions,...t.watchOptions}),t=b;}if(t.compilerOptions){const{compilerOptions:f}=t;f.baseUrl&&(f.baseUrl=R(f.baseUrl)),f.outDir&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.push(f.outDir),f.outDir=R(f.outDir));}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(R)),t.include&&(t.include=t.include.map(A)),t.watchOptions){const{watchOptions:f}=t;f.excludeDirectories&&(f.excludeDirectories=f.excludeDirectories.map(i=>A(k.resolve(e,i))));}return t}function fn(n=process.cwd(),u="tsconfig.json"){const l=y(n,u);if(!l)return null;const e=Q(l);return {path:l,config:e}}
6860
6860
 
6861
6861
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
6862
6862
  const newLineRegExp = /\r?\n/;
@@ -6897,7 +6897,7 @@ async function getTsconfig(root, config) {
6897
6897
  var _a;
6898
6898
  const tempConfigPath = join(root, "tsconfig.temp.json");
6899
6899
  const configName = ((_a = config.tsconfig) == null ? void 0 : _a.includes("jsconfig.json")) ? "jsconfig.json" : void 0;
6900
- const tsconfig = ie(config.tsconfig || root, configName);
6900
+ const tsconfig = fn(config.tsconfig || root, configName);
6901
6901
  if (!tsconfig)
6902
6902
  throw new Error("no tsconfig.json found");
6903
6903
  try {
@@ -7366,6 +7366,7 @@ function createPool(ctx) {
7366
7366
  return {
7367
7367
  runTests: runWithFiles("run"),
7368
7368
  close: async () => {
7369
+ await Promise.all(pool.threads.map((w) => w.terminate()));
7369
7370
  }
7370
7371
  };
7371
7372
  }
@@ -7375,7 +7376,8 @@ function createChannel(ctx) {
7375
7376
  const workerPort = channel.port1;
7376
7377
  createBirpc(
7377
7378
  {
7378
- onWorkerExit(code) {
7379
+ async onWorkerExit(error, code) {
7380
+ await ctx.logger.printError(error, false, "Unexpected Exit");
7379
7381
  process.exit(code || 1);
7380
7382
  },
7381
7383
  snapshotSaved(snapshot) {
@@ -8572,7 +8574,8 @@ class JUnitReporter {
8572
8574
  if (task.mode === "skip" || task.mode === "todo")
8573
8575
  await this.logger.log("<skipped/>");
8574
8576
  if (((_a = task.result) == null ? void 0 : _a.state) === "fail") {
8575
- const promises = ((_b = task.result.errors) == null ? void 0 : _b.map(async (error) => {
8577
+ const errors = ((_b = task.result.errors) == null ? void 0 : _b.length) ? task.result.errors : [task.result.error];
8578
+ for (const error of errors) {
8576
8579
  await this.writeElement("failure", {
8577
8580
  message: error == null ? void 0 : error.message,
8578
8581
  type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
@@ -8581,8 +8584,7 @@ class JUnitReporter {
8581
8584
  return;
8582
8585
  await this.writeErrorDetails(error);
8583
8586
  });
8584
- })) || [];
8585
- await Promise.all(promises);
8587
+ }
8586
8588
  }
8587
8589
  });
8588
8590
  }
@@ -8666,6 +8668,17 @@ class TapFlatReporter extends TapReporter {
8666
8668
  }
8667
8669
  }
8668
8670
 
8671
+ class HangingProcessReporter {
8672
+ onInit() {
8673
+ const _require = createRequire(import.meta.url);
8674
+ this.whyRunning = _require("why-is-node-running");
8675
+ }
8676
+ onProcessTimeout() {
8677
+ var _a;
8678
+ (_a = this.whyRunning) == null ? void 0 : _a.call(this);
8679
+ }
8680
+ }
8681
+
8669
8682
  class JsonReporter {
8670
8683
  constructor() {
8671
8684
  this.start = 0;
@@ -8942,7 +8955,8 @@ const ReportersMap = {
8942
8955
  "json": JsonReporter$1,
8943
8956
  "tap": TapReporter,
8944
8957
  "tap-flat": TapFlatReporter,
8945
- "junit": JUnitReporter
8958
+ "junit": JUnitReporter,
8959
+ "hanging-process": HangingProcessReporter
8946
8960
  };
8947
8961
 
8948
8962
  async function loadCustomReporterModule(path, runner) {
@@ -9977,7 +9991,7 @@ createLogUpdate(process$1.stdout);
9977
9991
 
9978
9992
  createLogUpdate(process$1.stderr);
9979
9993
 
9980
- var version = "0.27.0";
9994
+ var version = "0.27.1";
9981
9995
 
9982
9996
  function formatLine(line, outputTruncateLength) {
9983
9997
  var _a;
@@ -10106,6 +10120,15 @@ async function printError(error, ctx, options = {}) {
10106
10120
  }
10107
10121
  });
10108
10122
  }
10123
+ const testPath = e.VITEST_TEST_PATH;
10124
+ const testName = e.VITEST_TEST_NAME;
10125
+ if (testPath && !testName)
10126
+ ctx.logger.error(c.red(`This error originated in "${c.bold(testPath)}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`));
10127
+ if (testName) {
10128
+ ctx.logger.error(c.red(`The latest test that migh've cause the error is "${c.bold(testName)}". It might mean one of the following:
10129
+ - The error was thrown, while Vitest was running this test.
10130
+ - This was the last recorder test before the error was thrown, if error originated after test finished its execution.`));
10131
+ }
10109
10132
  if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
10110
10133
  e.cause.name = `Caused by: ${e.cause.name}`;
10111
10134
  await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
@@ -10133,6 +10156,8 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
10133
10156
  "showDiff",
10134
10157
  "actual",
10135
10158
  "expected",
10159
+ "VITEST_TEST_NAME",
10160
+ "VITEST_TEST_PATH",
10136
10161
  ...Object.getOwnPropertyNames(Error.prototype),
10137
10162
  ...Object.getOwnPropertyNames(Object.prototype)
10138
10163
  ]);
@@ -10198,8 +10223,6 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
10198
10223
  const path = relative(ctx.config.root, frame.file);
10199
10224
  logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${frame.line}:${frame.column}`)].filter(Boolean).join(" ")}`));
10200
10225
  onStack == null ? void 0 : onStack(frame);
10201
- if (frame.file in ctx.state.filesMap)
10202
- break;
10203
10226
  }
10204
10227
  logger.error();
10205
10228
  const hasProperties = Object.keys(errorProperties).length > 0;
@@ -10564,7 +10587,7 @@ class Vitest {
10564
10587
  }
10565
10588
  async filterTestsBySource(tests) {
10566
10589
  if (this.config.changed && !this.config.related) {
10567
- const { VitestGit } = await import('./chunk-node-git.543e964a.js');
10590
+ const { VitestGit } = await import('./chunk-node-git.125c9008.js');
10568
10591
  const vitestGit = new VitestGit(this.config.root);
10569
10592
  const related2 = await vitestGit.findChangedFiles({
10570
10593
  changedSince: this.config.changed
@@ -10662,9 +10685,6 @@ class Vitest {
10662
10685
  }
10663
10686
  }
10664
10687
  async scheduleRerun(triggerId) {
10665
- const mod = this.server.moduleGraph.getModuleById(triggerId);
10666
- if (mod)
10667
- mod.lastHMRTimestamp = Date.now();
10668
10688
  const currentCount = this.restartsCount;
10669
10689
  safeClearTimeout(this._rerunTimer);
10670
10690
  await this.runningPromise;
@@ -10693,8 +10713,14 @@ class Vitest {
10693
10713
  }, WATCHER_DEBOUNCE);
10694
10714
  }
10695
10715
  registerWatcher() {
10716
+ const updateLastChanged = (id) => {
10717
+ const mod = this.server.moduleGraph.getModuleById(id);
10718
+ if (mod)
10719
+ mod.lastHMRTimestamp = Date.now();
10720
+ };
10696
10721
  const onChange = (id) => {
10697
10722
  id = slash$1(id);
10723
+ updateLastChanged(id);
10698
10724
  const needsRerun = this.handleFileChanged(id);
10699
10725
  if (needsRerun)
10700
10726
  this.scheduleRerun(id);
@@ -10712,6 +10738,7 @@ class Vitest {
10712
10738
  };
10713
10739
  const onAdd = async (id) => {
10714
10740
  id = slash$1(id);
10741
+ updateLastChanged(id);
10715
10742
  if (await this.isTargetFile(id)) {
10716
10743
  this.changedTests.add(id);
10717
10744
  await this.cache.stats.updateStats(id);
@@ -10774,8 +10801,10 @@ class Vitest {
10774
10801
  }
10775
10802
  async exit(force = false) {
10776
10803
  safeSetTimeout(() => {
10777
- console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
10778
- process.exit();
10804
+ this.report("onProcessTimeout").then(() => {
10805
+ console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
10806
+ process.exit();
10807
+ });
10779
10808
  }, this.config.teardownTimeout).unref();
10780
10809
  await this.close();
10781
10810
  if (force)
@@ -11154,7 +11183,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11154
11183
  this.meta.watchMode = false;
11155
11184
  },
11156
11185
  config(viteConfig) {
11157
- var _a, _b, _c;
11186
+ var _a, _b, _c, _d;
11158
11187
  const preOptions = deepMerge(
11159
11188
  {},
11160
11189
  configDefaults,
@@ -11195,6 +11224,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11195
11224
  else if (preOptions.browser)
11196
11225
  open = "/";
11197
11226
  const config = {
11227
+ root: ((_a = viteConfig.test) == null ? void 0 : _a.root) || options.root,
11198
11228
  esbuild: {
11199
11229
  sourcemap: "external",
11200
11230
  legalComments: "inline"
@@ -11215,10 +11245,10 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11215
11245
  preTransformRequests: false
11216
11246
  }
11217
11247
  };
11218
- const classNameStrategy = preOptions.css && ((_b = (_a = preOptions.css) == null ? void 0 : _a.modules) == null ? void 0 : _b.classNameStrategy);
11248
+ const classNameStrategy = preOptions.css && ((_c = (_b = preOptions.css) == null ? void 0 : _b.modules) == null ? void 0 : _c.classNameStrategy);
11219
11249
  if (classNameStrategy !== "scoped") {
11220
11250
  config.css ?? (config.css = {});
11221
- (_c = config.css).modules ?? (_c.modules = {});
11251
+ (_d = config.css).modules ?? (_d.modules = {});
11222
11252
  config.css.modules.generateScopedName = (name, filename) => {
11223
11253
  const root = getRoot();
11224
11254
  return generateScopedClassName(classNameStrategy, name, relative(root, filename));
@@ -11260,7 +11290,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11260
11290
  try {
11261
11291
  await ctx.setServer(options, server);
11262
11292
  if (options.api && options.watch)
11263
- (await import('./chunk-api-setup.16ac28c0.js')).setup(ctx);
11293
+ (await import('./chunk-api-setup.2be3cc38.js')).setup(ctx);
11264
11294
  } catch (err) {
11265
11295
  ctx.logger.printError(err, true);
11266
11296
  process.exit(1);
@@ -1,5 +1,5 @@
1
1
  import url from 'node:url';
2
- import g from 'path';
2
+ import k from 'path';
3
3
 
4
4
  function normalizeWindowsPath(input = "") {
5
5
  if (!input.includes("\\")) {
@@ -144,22 +144,22 @@ const toNamespacedPath = function(p) {
144
144
  return normalizeWindowsPath(p);
145
145
  };
146
146
  const extname = function(p) {
147
- return g.posix.extname(normalizeWindowsPath(p));
147
+ return k.posix.extname(normalizeWindowsPath(p));
148
148
  };
149
149
  const relative = function(from, to) {
150
- return g.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
150
+ return k.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
151
151
  };
152
152
  const dirname = function(p) {
153
- return g.posix.dirname(normalizeWindowsPath(p));
153
+ return k.posix.dirname(normalizeWindowsPath(p));
154
154
  };
155
155
  const format = function(p) {
156
- return normalizeWindowsPath(g.posix.format(p));
156
+ return normalizeWindowsPath(k.posix.format(p));
157
157
  };
158
158
  const basename = function(p, ext) {
159
- return g.posix.basename(normalizeWindowsPath(p), ext);
159
+ return k.posix.basename(normalizeWindowsPath(p), ext);
160
160
  };
161
161
  const parse = function(p) {
162
- return g.posix.parse(normalizeWindowsPath(p));
162
+ return k.posix.parse(normalizeWindowsPath(p));
163
163
  };
164
164
 
165
165
  const _path = /*#__PURE__*/Object.freeze({
@@ -1,6 +1,6 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.6df5a66b.js';
2
- import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.a1c85759.js';
3
- import { p as parseSingleStack } from './chunk-utils-source-map.60562959.js';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.4e2aa823.js';
2
+ import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.149ed990.js';
3
+ import { p as parseSingleStack } from './chunk-utils-source-map.4e9b891d.js';
4
4
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
5
5
  import util from 'util';
6
6
  import { s as spyOn, f as fn, i as isMockFunction, a as spies } from './vendor-index.723a074f.js';
@@ -1,6 +1,6 @@
1
1
  import { d as ansiStyles, e as eastAsianWidth } from './chunk-utils-timers.52534f96.js';
2
- import { b as resolve } from './chunk-utils-env.b861e3a0.js';
3
- import { j as notNullish } from './chunk-mock-date.a1c85759.js';
2
+ import { b as resolve } from './chunk-utils-env.f4a39d2c.js';
3
+ import { j as notNullish } from './chunk-mock-date.149ed990.js';
4
4
 
5
5
  /* eslint-disable yoda */
6
6
 
@@ -1,12 +1,12 @@
1
1
  import { fileURLToPath } from 'url';
2
2
  import c from 'picocolors';
3
- import { e as execa } from './vendor-index.b2fdde54.js';
4
- import { E as EXIT_CODE_RESTART } from './chunk-utils-env.b861e3a0.js';
3
+ import { e as execa } from './vendor-index.451e37bc.js';
4
+ import { E as EXIT_CODE_RESTART } from './chunk-utils-env.f4a39d2c.js';
5
5
  import 'node:buffer';
6
6
  import 'node:path';
7
7
  import 'node:child_process';
8
8
  import 'node:process';
9
- import './vendor-index.7a2cebfe.js';
9
+ import './vendor-index.e6c27006.js';
10
10
  import 'child_process';
11
11
  import 'path';
12
12
  import './vendor-_commonjsHelpers.addc3445.js';
@@ -51,10 +51,10 @@ async function main() {
51
51
  retries = +process.env.VITEST_SEGFAULT_RETRY;
52
52
  } else {
53
53
  for (let i = 0; i < args.length; i++) {
54
- if (args[i].startsWith("--segfault-retry=")) {
54
+ if (args[i].startsWith("--segfault-retry=") || args[i].startsWith("--segfaultRetry=")) {
55
55
  retries = +args[i].split("=")[1];
56
56
  break;
57
- } else if (args[i] === "--segfault-retry" && ((_a = args[i + 1]) == null ? void 0 : _a.match(/^\d+$/))) {
57
+ } else if ((args[i] === "--segfault-retry" || args[i] === "--segfaultRetry") && ((_a = args[i + 1]) == null ? void 0 : _a.match(/^\d+$/))) {
58
58
  retries = +args[i + 1];
59
59
  break;
60
60
  }
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
- import { n as normalize } from './chunk-utils-env.b861e3a0.js';
1
+ import { n as normalize } from './chunk-utils-env.f4a39d2c.js';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.700322bf.js';
4
+ import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.1a2dbf96.js';
5
5
  import 'node:url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.44413252.js';
8
8
  import 'local-pkg';
9
9
  import './chunk-env-node.b3664da2.js';
10
10
  import 'node:console';
11
- import './chunk-mock-date.a1c85759.js';
11
+ import './chunk-mock-date.149ed990.js';
12
12
  import 'node:path';
13
13
  import 'vite';
14
14
  import 'node:process';
@@ -22,10 +22,10 @@ import './vendor-_commonjsHelpers.addc3445.js';
22
22
  import 'vite-node/client';
23
23
  import 'vite-node/server';
24
24
  import 'node:fs/promises';
25
- import './vendor-index.b2fdde54.js';
25
+ import './vendor-index.451e37bc.js';
26
26
  import 'node:buffer';
27
27
  import 'node:child_process';
28
- import './vendor-index.7a2cebfe.js';
28
+ import './vendor-index.e6c27006.js';
29
29
  import 'child_process';
30
30
  import 'assert';
31
31
  import 'buffer';
@@ -38,7 +38,7 @@ import 'node:worker_threads';
38
38
  import 'tinypool';
39
39
  import './vendor-index.783e7f3e.js';
40
40
  import 'perf_hooks';
41
- import './chunk-utils-source-map.60562959.js';
41
+ import './chunk-utils-source-map.4e9b891d.js';
42
42
  import './chunk-utils-timers.52534f96.js';
43
43
  import 'crypto';
44
44
  import 'vite-node/utils';
@@ -50,7 +50,7 @@ import 'readline';
50
50
  import './vendor-index.9f20a9be.js';
51
51
 
52
52
  const cli = cac("vitest");
53
- cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputDiffMaxSize <length>", "object diff output max size (default: 10000)").option("--outputDiffMaxLines <length>", "max lines in diff output window (default: 50)").option("--outputTruncateLength <length>", "diff output line length (default: 80)").option("--outputDiffLines <lines>", "number of lines in single diff (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "enable coverage report").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--browser", "run tests in browser").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--logHeapUsage", "show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").option("--no-color", "Removes colors from the console output").option("--segfault-retry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").help();
53
+ cli.version(version).option("-r, --root <path>", "Root path").option("-c, --config <path>", "Path to config file").option("-u, --update", "Update snapshot").option("-w, --watch", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp pattern").option("--dir <path>", "Base directory to scan for the test files").option("--ui", "Enable UI").option("--open", "Open UI automatically (default: !process.env.CI))").option("--api [api]", "Serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "Enabled threads (default: true)").option("--silent", "Silent console output from tests").option("--isolate", "Isolate environment for each test file (default: true)").option("--reporter <name>", "Specify reporters").option("--outputDiffMaxSize <length>", "Object diff output max size (default: 10000)").option("--outputDiffMaxLines <length>", "Max lines in diff output window (default: 50)").option("--outputTruncateLength <length>", "Diff output line length (default: 80)").option("--outputDiffLines <lines>", "Number of lines in single diff (default: 15)").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser", "Run tests in browser").option("--environment <env>", "Specify runner environment (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").help();
54
54
  cli.command("run [...filters]").action(run);
55
55
  cli.command("related [...filters]").action(runRelated);
56
56
  cli.command("watch [...filters]").action(watch);
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, an as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-e1e1d1e5.js';
3
+ import { U as UserConfig$1, an as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-5617096e.js';
4
4
  import 'tinybench';
5
5
  import 'vite-node/client';
6
6
  import 'vite-node/server';
package/dist/entry.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import { promises } from 'node:fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-mock-date.a1c85759.js';
3
- import { v as vi } from './chunk-utils-import.2baa69a9.js';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-mock-date.149ed990.js';
3
+ import { v as vi } from './chunk-utils-import.16d9fb0d.js';
4
4
  import { a as envs } from './chunk-env-node.b3664da2.js';
5
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.731b2b04.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.56d71d30.js';
6
6
  import 'node:path';
7
7
  import 'picocolors';
8
8
  import 'local-pkg';
9
- import './chunk-utils-env.b861e3a0.js';
9
+ import './chunk-utils-env.f4a39d2c.js';
10
10
  import 'node:url';
11
11
  import 'path';
12
- import './chunk-runtime-chain.6df5a66b.js';
12
+ import './chunk-runtime-chain.4e2aa823.js';
13
13
  import 'util';
14
14
  import 'chai';
15
15
  import './vendor-_commonjsHelpers.addc3445.js';
16
16
  import './chunk-utils-timers.52534f96.js';
17
17
  import './vendor-index.723a074f.js';
18
18
  import 'tinyspy';
19
- import './chunk-utils-source-map.60562959.js';
20
- import './chunk-runtime-rpc.7f83c8a9.js';
19
+ import './chunk-utils-source-map.4e9b891d.js';
20
+ import './chunk-runtime-rpc.25cc9413.js';
21
21
  import 'fs';
22
22
  import 'node:console';
23
23
  import 'perf_hooks';
24
24
  import './chunk-integrations-coverage.44413252.js';
25
- import './chunk-runtime-error.fad2c32b.js';
25
+ import './chunk-runtime-error.97854396.js';
26
26
  import 'vite-node/source-map';
27
27
 
28
28
  function groupBy(collection, iteratee) {
@@ -1,4 +1,4 @@
1
- import { ae as Environment } from './types-e1e1d1e5.js';
1
+ import { ae as Environment } from './types-5617096e.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
4
  import 'vite-node/client';
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { w as SuiteAPI, v as TestAPI, av as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, q as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, r as Test } from './types-e1e1d1e5.js';
2
+ import { w as SuiteAPI, v as TestAPI, av as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, q as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, r as Test } from './types-5617096e.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;
@@ -234,7 +234,9 @@ type Mocked<T> = {
234
234
  type EnhancedSpy<TArgs extends any[] = any[], TReturns = any> = SpyInstance<TArgs, TReturns> & SpyImpl<TArgs, TReturns>;
235
235
  declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>;
236
236
  declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>;
237
- declare function spyOn<T, M extends (Methods<Required<T>> | Classes<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends (...args: infer A) => infer R | (new (...args: infer A) => infer R) ? SpyInstance<A, R> : never;
237
+ declare function spyOn<T, M extends (Classes<Required<T>> | Methods<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends ({
238
+ new (...args: infer A): infer R;
239
+ }) | ((...args: infer A) => infer R) ? SpyInstance<A, R> : never;
238
240
  declare function fn<TArgs extends any[] = any[], R = any>(): Mock<TArgs, R>;
239
241
  declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<TArgs, R>;
240
242