vitest 0.26.3 → 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 (44) hide show
  1. package/LICENSE.md +15 -66
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +15 -15
  4. package/dist/{chunk-api-setup.47a09f0f.js → chunk-api-setup.2be3cc38.js} +60 -31
  5. package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
  6. package/dist/{chunk-integrations-coverage.befed097.js → chunk-integrations-coverage.44413252.js} +19 -1
  7. package/dist/chunk-integrations-globals.02f1259c.js +27 -0
  8. package/dist/{chunk-typecheck-constants.06e1fe5b.js → chunk-mock-date.149ed990.js} +19 -32
  9. package/dist/{chunk-node-git.a90c0582.js → chunk-node-git.125c9008.js} +3 -4
  10. package/dist/{chunk-runtime-chain.f51aa930.js → chunk-runtime-chain.4e2aa823.js} +1193 -1029
  11. package/dist/{chunk-runtime-error.f5c8aaf2.js → chunk-runtime-error.97854396.js} +2 -2
  12. package/dist/{chunk-runtime-mocker.887bf8c8.js → chunk-runtime-mocker.4755840f.js} +10 -8
  13. package/dist/{chunk-runtime-rpc.54d72169.js → chunk-runtime-rpc.25cc9413.js} +2 -2
  14. package/dist/{chunk-runtime-setup.a06d5c72.js → chunk-runtime-setup.56d71d30.js} +51 -52
  15. package/dist/{chunk-snapshot-manager.70695b70.js → chunk-snapshot-manager.1a2dbf96.js} +468 -302
  16. package/dist/{chunk-utils-env.3fdc1793.js → chunk-utils-env.f4a39d2c.js} +8 -70
  17. package/dist/{chunk-utils-import.e7f64637.js → chunk-utils-import.16d9fb0d.js} +22 -8
  18. package/dist/chunk-utils-source-map.4e9b891d.js +408 -0
  19. package/dist/{chunk-utils-timers.715da787.js → chunk-utils-timers.52534f96.js} +2977 -3458
  20. package/dist/cli-wrapper.js +15 -15
  21. package/dist/cli.js +15 -627
  22. package/dist/config.cjs +2 -1
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.js +2 -1
  25. package/dist/entry.js +14 -14
  26. package/dist/environments.d.ts +1 -1
  27. package/dist/{index-761e769b.d.ts → index-1cfc7f58.d.ts} +4 -2
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +12 -12
  30. package/dist/loader.js +9 -10
  31. package/dist/node.d.ts +2 -2
  32. package/dist/node.js +14 -12
  33. package/dist/spy.js +2 -102
  34. package/dist/suite.js +10 -10
  35. package/dist/{types-bae746aa.d.ts → types-5617096e.d.ts} +97 -77
  36. package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
  37. package/dist/vendor-index.723a074f.js +102 -0
  38. package/dist/vendor-index.b0346fe4.js +395 -0
  39. package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
  40. package/dist/worker.js +24 -19
  41. package/package.json +13 -8
  42. package/dist/chunk-integrations-globals.ee28730b.js +0 -27
  43. package/dist/chunk-utils-source-map.5278ee22.js +0 -86
  44. package/dist/vendor-index.2e96c50b.js +0 -215
@@ -1,25 +1,26 @@
1
- import { j as join, c as basename, d as dirname, r as relative, b as resolve, e as distDir, f as rootDir, p as picocolors, g as isAbsolute, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.3fdc1793.js';
2
- import { p as pLimit, s as someTasksAreOnly, i as interpretTaskModes, g as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.befed097.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
+ 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 { T as TYPECHECK_SUITE, z as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, l as relativePath, B as getTests, f as getFullName, v as hasFailed, C as hasFailedSnapshot, D as getTypecheckTests, E as getSuites, F as isTypecheckTest, k as notNullish, q as shuffle, t as toArray, n as noop$1, G as deepMerge, b as getCallLastIndex, H as removeUndefinedValues, I as isWindows, J as stdout } from './chunk-typecheck-constants.06e1fe5b.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';
14
14
  import require$$2 from 'events';
15
15
  import require$$0$2, { existsSync as existsSync$1, readFileSync } from 'fs';
16
16
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
17
+ import c from 'picocolors';
17
18
  import { ViteNodeRunner } from 'vite-node/client';
18
19
  import { ViteNodeServer } from 'vite-node/server';
19
20
  import { writeFile, rm } from 'node:fs/promises';
20
- import { e as execa } from './vendor-index.b2fdde54.js';
21
+ import { e as execa } from './vendor-index.451e37bc.js';
21
22
  import { SourceMapConsumer } from 'source-map';
22
- import H from 'module';
23
+ import K, { createRequire } from 'module';
23
24
  import { parse as parse$4 } from 'acorn';
24
25
  import { ancestor } from 'acorn-walk';
25
26
  import { MessageChannel } from 'node:worker_threads';
@@ -27,20 +28,20 @@ import { cpus, hostname } from 'node:os';
27
28
  import { Tinypool } from 'tinypool';
28
29
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
29
30
  import { performance } from 'perf_hooks';
30
- import { c as stripAnsi, d as safeSetInterval, e as safeClearInterval, g as cliTruncate, s as safeSetTimeout, h as stringWidth, i as ansiStyles, j as sliceAnsi, a as stringify$5, u as unifiedDiff, b as safeClearTimeout } from './chunk-utils-timers.715da787.js';
31
- import { p as parseStacktrace, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.5278ee22.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
+ 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';
32
33
  import { resolveModule } from 'local-pkg';
33
34
  import { createHash } from 'crypto';
34
35
  import { slash as slash$2, cleanUrl } from 'vite-node/utils';
35
36
  import { o as onetime } from './vendor-index.9c919048.js';
36
- import { s as signalExit } from './vendor-index.7a2cebfe.js';
37
+ import { s as signalExit } from './vendor-index.e6c27006.js';
37
38
  import { createHash as createHash$1 } from 'node:crypto';
38
39
  import MagicString from './chunk-magic-string.3a794426.js';
39
40
  import { stripLiteral } from 'strip-literal';
40
41
  import require$$0$3 from 'readline';
41
42
  import { p as prompts } from './vendor-index.9f20a9be.js';
42
43
 
43
- var version$1 = "0.26.3";
44
+ var version$1 = "0.27.1";
44
45
 
45
46
  class EndError extends Error {
46
47
  constructor(value) {
@@ -246,7 +247,7 @@ var path$9 = {};
246
247
 
247
248
  Object.defineProperty(path$9, "__esModule", { value: true });
248
249
  path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
249
- const path$8 = g;
250
+ const path$8 = k;
250
251
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
251
252
  const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
252
253
  /**
@@ -452,7 +453,7 @@ var isGlob$1 = function isGlob(str, options) {
452
453
  };
453
454
 
454
455
  var isGlob = isGlob$1;
455
- var pathPosixDirname = g.posix.dirname;
456
+ var pathPosixDirname = k.posix.dirname;
456
457
  var isWin32 = require$$0.platform() === 'win32';
457
458
 
458
459
  var slash = '/';
@@ -1916,7 +1917,7 @@ var picomatch$2 = {exports: {}};
1916
1917
 
1917
1918
  var utils$f = {};
1918
1919
 
1919
- const path$7 = g;
1920
+ const path$7 = k;
1920
1921
  const WIN_SLASH = '\\\\/';
1921
1922
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1922
1923
 
@@ -2096,7 +2097,7 @@ var constants$3 = {
2096
2097
 
2097
2098
  (function (exports) {
2098
2099
 
2099
- const path = g;
2100
+ const path = k;
2100
2101
  const win32 = process.platform === 'win32';
2101
2102
  const {
2102
2103
  REGEX_BACKSLASH,
@@ -3640,7 +3641,7 @@ parse$1.fastpaths = (input, options) => {
3640
3641
 
3641
3642
  var parse_1 = parse$1;
3642
3643
 
3643
- const path$6 = g;
3644
+ const path$6 = k;
3644
3645
  const scan = scan_1;
3645
3646
  const parse = parse_1;
3646
3647
  const utils$c = utils$f;
@@ -4454,7 +4455,7 @@ var micromatch_1 = micromatch$1;
4454
4455
 
4455
4456
  Object.defineProperty(pattern$1, "__esModule", { value: true });
4456
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;
4457
- const path$5 = g;
4458
+ const path$5 = k;
4458
4459
  const globParent = globParent$1;
4459
4460
  const micromatch = micromatch_1;
4460
4461
  const GLOBSTAR = '**';
@@ -5373,7 +5374,7 @@ var fs$1 = {};
5373
5374
  } (fs$1));
5374
5375
 
5375
5376
  Object.defineProperty(settings$2, "__esModule", { value: true });
5376
- const path$3 = g;
5377
+ const path$3 = k;
5377
5378
  const fsStat$3 = out$1;
5378
5379
  const fs = fs$1;
5379
5380
  class Settings$1 {
@@ -6027,7 +6028,7 @@ sync$3.default = SyncProvider;
6027
6028
  var settings$1 = {};
6028
6029
 
6029
6030
  Object.defineProperty(settings$1, "__esModule", { value: true });
6030
- const path$2 = g;
6031
+ const path$2 = k;
6031
6032
  const fsScandir = out$2;
6032
6033
  class Settings {
6033
6034
  constructor(_options = {}) {
@@ -6089,7 +6090,7 @@ function getSettings(settingsOrOptions = {}) {
6089
6090
  var reader = {};
6090
6091
 
6091
6092
  Object.defineProperty(reader, "__esModule", { value: true });
6092
- const path$1 = g;
6093
+ const path$1 = k;
6093
6094
  const fsStat$2 = out$1;
6094
6095
  const utils$6 = utils$k;
6095
6096
  class Reader {
@@ -6483,7 +6484,7 @@ class EntryTransformer {
6483
6484
  entry.default = EntryTransformer;
6484
6485
 
6485
6486
  Object.defineProperty(provider, "__esModule", { value: true });
6486
- const path = g;
6487
+ const path = k;
6487
6488
  const deep_1 = deep;
6488
6489
  const entry_1 = entry$1;
6489
6490
  const error_1 = error;
@@ -6853,9 +6854,9 @@ function addSnapshotResult(summary, result) {
6853
6854
  summary.total += result.added + result.matched + result.unmatched + result.updated;
6854
6855
  }
6855
6856
 
6856
- 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+=`
6857
- `;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+=`
6858
- `),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}}
6859
6860
 
6860
6861
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
6861
6862
  const newLineRegExp = /\r?\n/;
@@ -6892,11 +6893,11 @@ async function makeTscErrorInfo(errInfo) {
6892
6893
  }
6893
6894
  ];
6894
6895
  }
6895
- async function getTsconfigPath(root, config) {
6896
+ async function getTsconfig(root, config) {
6896
6897
  var _a;
6897
- const tempConfigPath = path$a.join(root, "tsconfig.temp.json");
6898
+ const tempConfigPath = join(root, "tsconfig.temp.json");
6898
6899
  const configName = ((_a = config.tsconfig) == null ? void 0 : _a.includes("jsconfig.json")) ? "jsconfig.json" : void 0;
6899
- const tsconfig = ie(config.tsconfig || root, configName);
6900
+ const tsconfig = fn(config.tsconfig || root, configName);
6900
6901
  if (!tsconfig)
6901
6902
  throw new Error("no tsconfig.json found");
6902
6903
  try {
@@ -6904,13 +6905,13 @@ async function getTsconfigPath(root, config) {
6904
6905
  tmpTsConfig.compilerOptions = tmpTsConfig.compilerOptions || {};
6905
6906
  tmpTsConfig.compilerOptions.emitDeclarationOnly = false;
6906
6907
  tmpTsConfig.compilerOptions.incremental = true;
6907
- tmpTsConfig.compilerOptions.tsBuildInfoFile = path$a.join(
6908
+ tmpTsConfig.compilerOptions.tsBuildInfoFile = join(
6908
6909
  __dirname,
6909
6910
  "tsconfig.tmp.tsbuildinfo"
6910
6911
  );
6911
6912
  const tsconfigFinalContent = JSON.stringify(tmpTsConfig, null, 2);
6912
6913
  await writeFile(tempConfigPath, tsconfigFinalContent);
6913
- return tempConfigPath;
6914
+ return { path: tempConfigPath, config: tmpTsConfig };
6914
6915
  } catch (err) {
6915
6916
  throw new Error("failed to write tsconfig.temp.json", { cause: err });
6916
6917
  }
@@ -6966,18 +6967,16 @@ async function collectTests(ctx, filepath) {
6966
6967
  ecmaVersion: "latest",
6967
6968
  allowAwaitOutsideFunction: true
6968
6969
  });
6970
+ const testFilepath = relative(ctx.config.root, filepath);
6969
6971
  const file = {
6970
6972
  filepath,
6971
6973
  type: "suite",
6972
- id: filepath,
6973
- name: relative(ctx.config.root, filepath),
6974
+ id: generateHash(testFilepath),
6975
+ name: testFilepath,
6974
6976
  mode: "run",
6975
6977
  tasks: [],
6976
6978
  start: ast.start,
6977
- end: ast.end,
6978
- result: {
6979
- state: "pass"
6980
- }
6979
+ end: ast.end
6981
6980
  };
6982
6981
  const definitions = [];
6983
6982
  const getName = (callee) => {
@@ -7004,14 +7003,16 @@ async function collectTests(ctx, filepath) {
7004
7003
  return;
7005
7004
  const { arguments: [{ value: message }] } = node;
7006
7005
  const property = (_a = callee == null ? void 0 : callee.property) == null ? void 0 : _a.name;
7007
- const mode = !property || property === name ? "run" : property;
7008
- if (!["run", "skip", "todo", "only"].includes(mode))
7006
+ let mode = !property || property === name ? "run" : property;
7007
+ if (!["run", "skip", "todo", "only", "skipIf", "runIf"].includes(mode))
7009
7008
  throw new Error(`${name}.${mode} syntax is not supported when testing types`);
7009
+ if (mode === "skipIf" || mode === "runIf")
7010
+ mode = "skip";
7010
7011
  definitions.push({
7011
7012
  start: node.start,
7012
7013
  end: node.end,
7013
7014
  name: message,
7014
- type: name,
7015
+ type: name === "it" || name === "test" ? "test" : "suite",
7015
7016
  mode
7016
7017
  });
7017
7018
  }
@@ -7023,33 +7024,49 @@ async function collectTests(ctx, filepath) {
7023
7024
  lastSuite = suite.suite;
7024
7025
  return lastSuite;
7025
7026
  };
7026
- definitions.sort((a, b) => a.start - b.start).forEach((definition, idx) => {
7027
+ definitions.sort((a, b) => a.start - b.start).forEach((definition) => {
7027
7028
  const latestSuite = updateLatestSuite(definition.start);
7028
7029
  let mode = definition.mode;
7029
7030
  if (latestSuite.mode !== "run")
7030
7031
  mode = latestSuite.mode;
7031
- const state = mode === "run" ? "pass" : mode;
7032
+ if (definition.type === "suite") {
7033
+ const task2 = {
7034
+ type: definition.type,
7035
+ id: "",
7036
+ suite: latestSuite,
7037
+ file,
7038
+ tasks: [],
7039
+ mode,
7040
+ name: definition.name,
7041
+ end: definition.end,
7042
+ start: definition.start,
7043
+ meta: {
7044
+ typecheck: true
7045
+ }
7046
+ };
7047
+ definition.task = task2;
7048
+ latestSuite.tasks.push(task2);
7049
+ lastSuite = task2;
7050
+ return;
7051
+ }
7032
7052
  const task = {
7033
- type: "suite",
7034
- id: idx.toString(),
7053
+ type: definition.type,
7054
+ id: "",
7035
7055
  suite: latestSuite,
7036
7056
  file,
7037
- tasks: [],
7038
7057
  mode,
7058
+ context: {},
7039
7059
  name: definition.name,
7040
7060
  end: definition.end,
7041
7061
  start: definition.start,
7042
- result: {
7043
- state
7062
+ meta: {
7063
+ typecheck: true
7044
7064
  }
7045
7065
  };
7046
7066
  definition.task = task;
7047
7067
  latestSuite.tasks.push(task);
7048
- if (definition.type === "describe" || definition.type === "suite")
7049
- lastSuite = task;
7050
- else
7051
- Object.defineProperty(task, TYPECHECK_SUITE, { value: true });
7052
7068
  });
7069
+ calculateSuiteHash(file);
7053
7070
  const hasOnly = someTasksAreOnly(file);
7054
7071
  interpretTaskModes(file, ctx.config.testNamePattern, hasOnly, false, ctx.config.allowOnly);
7055
7072
  return {
@@ -7091,9 +7108,15 @@ class Typechecker {
7091
7108
  async collectFileTests(filepath) {
7092
7109
  return collectTests(this.ctx, filepath);
7093
7110
  }
7111
+ getFiles() {
7112
+ return this.files.filter((filename) => {
7113
+ const extension = extname(filename);
7114
+ return extension !== ".js" || this.allowJs;
7115
+ });
7116
+ }
7094
7117
  async collectTests() {
7095
7118
  const tests = (await Promise.all(
7096
- this.files.map((filepath) => this.collectFileTests(filepath))
7119
+ this.getFiles().map((filepath) => this.collectFileTests(filepath))
7097
7120
  )).reduce((acc, data) => {
7098
7121
  if (!data)
7099
7122
  return acc;
@@ -7105,7 +7128,7 @@ class Typechecker {
7105
7128
  }
7106
7129
  async prepareResults(output) {
7107
7130
  const typeErrors = await this.parseTscLikeOutput(output);
7108
- const testFiles = new Set(this.files);
7131
+ const testFiles = new Set(this.getFiles());
7109
7132
  if (!this._tests)
7110
7133
  this._tests = await this.collectTests();
7111
7134
  const sourceErrors = [];
@@ -7126,31 +7149,25 @@ class Typechecker {
7126
7149
  if (task.suite)
7127
7150
  markFailed(task.suite);
7128
7151
  };
7129
- errors.forEach(({ error, originalError }, idx) => {
7152
+ errors.forEach(({ error, originalError }) => {
7153
+ var _a;
7130
7154
  const originalPos = (mapConsumer == null ? void 0 : mapConsumer.generatedPositionFor({
7131
7155
  line: originalError.line,
7132
7156
  column: originalError.column,
7133
7157
  source: path
7134
7158
  })) || originalError;
7135
7159
  const index = indexMap.get(`${originalPos.line}:${originalPos.column}`);
7136
- const definition = index != null && sortedDefinitions.find((def) => def.start <= index && def.end >= index) || file;
7137
- const suite = "task" in definition ? definition.task : definition;
7160
+ const definition = index != null && sortedDefinitions.find((def) => def.start <= index && def.end >= index);
7161
+ const suite = definition ? definition.task : file;
7138
7162
  const state = suite.mode === "run" || suite.mode === "only" ? "fail" : suite.mode;
7139
- const task = {
7140
- type: "typecheck",
7141
- id: `${path}${idx.toString()}`,
7142
- name: `error expect ${idx + 1}`,
7143
- mode: suite.mode,
7144
- file,
7145
- suite,
7146
- result: {
7147
- state,
7148
- error: state === "fail" ? error : void 0
7149
- }
7163
+ const errors2 = ((_a = suite.result) == null ? void 0 : _a.errors) || [];
7164
+ suite.result = {
7165
+ state,
7166
+ errors: errors2
7150
7167
  };
7151
- if (state === "fail")
7152
- markFailed(suite);
7153
- suite.tasks.push(task);
7168
+ errors2.push(error);
7169
+ if (state === "fail" && suite.suite)
7170
+ markFailed(suite.suite);
7154
7171
  });
7155
7172
  });
7156
7173
  typeErrors.forEach((errors, path) => {
@@ -7203,11 +7220,18 @@ class Typechecker {
7203
7220
  const packageName = checker === "tsc" ? "typescript" : "vue-tsc";
7204
7221
  await ensurePackageInstalled(packageName, root);
7205
7222
  }
7223
+ async prepare() {
7224
+ const { root, typecheck } = this.ctx.config;
7225
+ await this.ensurePackageInstalled(root, typecheck.checker);
7226
+ const { config, path } = await getTsconfig(root, typecheck);
7227
+ this.tempConfigPath = path;
7228
+ this.allowJs = typecheck.allowJs || config.allowJs || false;
7229
+ }
7206
7230
  async start() {
7207
7231
  var _a, _b, _c;
7232
+ if (!this.tempConfigPath)
7233
+ throw new Error("tsconfig was not initialized");
7208
7234
  const { root, watch, typecheck } = this.ctx.config;
7209
- await this.ensurePackageInstalled(root, typecheck.checker);
7210
- this.tempConfigPath = await getTsconfigPath(root, typecheck);
7211
7235
  const args = ["--noEmit", "--pretty", "false", "-p", this.tempConfigPath];
7212
7236
  if (watch)
7213
7237
  args.push("--watch");
@@ -7248,7 +7272,6 @@ class Typechecker {
7248
7272
  await child;
7249
7273
  this._result = await this.prepareResults(output);
7250
7274
  await ((_c = this._onParseEnd) == null ? void 0 : _c.call(this, this._result));
7251
- await this.clear();
7252
7275
  }
7253
7276
  }
7254
7277
  getResult() {
@@ -7343,6 +7366,7 @@ function createPool(ctx) {
7343
7366
  return {
7344
7367
  runTests: runWithFiles("run"),
7345
7368
  close: async () => {
7369
+ await Promise.all(pool.threads.map((w) => w.terminate()));
7346
7370
  }
7347
7371
  };
7348
7372
  }
@@ -7352,7 +7376,8 @@ function createChannel(ctx) {
7352
7376
  const workerPort = channel.port1;
7353
7377
  createBirpc(
7354
7378
  {
7355
- onWorkerExit(code) {
7379
+ async onWorkerExit(error, code) {
7380
+ await ctx.logger.printError(error, false, "Unexpected Exit");
7356
7381
  process.exit(code || 1);
7357
7382
  },
7358
7383
  snapshotSaved(snapshot) {
@@ -7426,8 +7451,8 @@ const F_LONG_DASH = "\u23AF";
7426
7451
 
7427
7452
  const spinnerMap = /* @__PURE__ */ new WeakMap();
7428
7453
  const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
7429
- const pointer = picocolors.exports.yellow(F_POINTER);
7430
- const skipped = picocolors.exports.dim(picocolors.exports.gray(F_DOWN));
7454
+ const pointer = c.yellow(F_POINTER);
7455
+ const skipped = c.dim(c.gray(F_DOWN));
7431
7456
  function getCols(delta = 0) {
7432
7457
  var _a;
7433
7458
  let length = (_a = process.stdout) == null ? void 0 : _a.columns;
@@ -7458,44 +7483,50 @@ function formatTestPath(root, path) {
7458
7483
  const dir = dirname(path);
7459
7484
  const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
7460
7485
  const base = basename(path, ext);
7461
- return slash$1(picocolors.exports.dim(`${dir}/`) + picocolors.exports.bold(base)) + picocolors.exports.dim(ext);
7486
+ return slash$1(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
7462
7487
  }
7463
7488
  function renderSnapshotSummary(rootDir, snapshots) {
7464
7489
  const summary = [];
7465
7490
  if (snapshots.added)
7466
- summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.added} written`)));
7491
+ summary.push(c.bold(c.green(`${snapshots.added} written`)));
7467
7492
  if (snapshots.unmatched)
7468
- summary.push(picocolors.exports.bold(picocolors.exports.red(`${snapshots.unmatched} failed`)));
7493
+ summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
7469
7494
  if (snapshots.updated)
7470
- summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.updated} updated `)));
7495
+ summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
7471
7496
  if (snapshots.filesRemoved) {
7472
7497
  if (snapshots.didUpdate)
7473
- summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.filesRemoved} files removed `)));
7498
+ summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
7474
7499
  else
7475
- summary.push(picocolors.exports.bold(picocolors.exports.yellow(`${snapshots.filesRemoved} files obsolete `)));
7500
+ summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
7476
7501
  }
7477
7502
  if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
7478
7503
  const [head, ...tail] = snapshots.filesRemovedList;
7479
- summary.push(`${picocolors.exports.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
7504
+ summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
7480
7505
  tail.forEach((key) => {
7481
- summary.push(` ${picocolors.exports.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
7506
+ summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
7482
7507
  });
7483
7508
  }
7484
7509
  if (snapshots.unchecked) {
7485
7510
  if (snapshots.didUpdate)
7486
- summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.unchecked} removed`)));
7511
+ summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
7487
7512
  else
7488
- summary.push(picocolors.exports.bold(picocolors.exports.yellow(`${snapshots.unchecked} obsolete`)));
7513
+ summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
7489
7514
  snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
7490
- summary.push(`${picocolors.exports.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
7491
- uncheckedFile.keys.forEach((key) => summary.push(` ${picocolors.exports.gray(F_DOT)} ${key}`));
7515
+ summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
7516
+ uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
7492
7517
  });
7493
7518
  }
7494
7519
  return summary;
7495
7520
  }
7521
+ function countTestErrors(tasks) {
7522
+ return tasks.reduce((c2, i) => {
7523
+ var _a, _b;
7524
+ return c2 + (((_b = (_a = i.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.length) || 0);
7525
+ }, 0);
7526
+ }
7496
7527
  function getStateString(tasks, name = "tests", showTotal = true) {
7497
7528
  if (tasks.length === 0)
7498
- return picocolors.exports.dim(`no ${name}`);
7529
+ return c.dim(`no ${name}`);
7499
7530
  const passed = tasks.filter((i) => {
7500
7531
  var _a;
7501
7532
  return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
@@ -7507,17 +7538,17 @@ function getStateString(tasks, name = "tests", showTotal = true) {
7507
7538
  const skipped2 = tasks.filter((i) => i.mode === "skip");
7508
7539
  const todo = tasks.filter((i) => i.mode === "todo");
7509
7540
  return [
7510
- failed.length ? picocolors.exports.bold(picocolors.exports.red(`${failed.length} failed`)) : null,
7511
- passed.length ? picocolors.exports.bold(picocolors.exports.green(`${passed.length} passed`)) : null,
7512
- skipped2.length ? picocolors.exports.yellow(`${skipped2.length} skipped`) : null,
7513
- todo.length ? picocolors.exports.gray(`${todo.length} todo`) : null
7514
- ].filter(Boolean).join(picocolors.exports.dim(" | ")) + (showTotal ? picocolors.exports.gray(` (${tasks.length})`) : "");
7541
+ failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
7542
+ passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
7543
+ skipped2.length ? c.yellow(`${skipped2.length} skipped`) : null,
7544
+ todo.length ? c.gray(`${todo.length} todo`) : null
7545
+ ].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
7515
7546
  }
7516
7547
  function getStateSymbol(task) {
7517
7548
  if (task.mode === "skip" || task.mode === "todo")
7518
7549
  return skipped;
7519
7550
  if (!task.result)
7520
- return picocolors.exports.gray("\xB7");
7551
+ return c.gray("\xB7");
7521
7552
  if (task.result.state === "run") {
7522
7553
  if (task.type === "suite")
7523
7554
  return pointer;
@@ -7526,13 +7557,13 @@ function getStateSymbol(task) {
7526
7557
  spinner = elegantSpinner();
7527
7558
  spinnerMap.set(task, spinner);
7528
7559
  }
7529
- return picocolors.exports.yellow(spinner());
7560
+ return c.yellow(spinner());
7530
7561
  }
7531
7562
  if (task.result.state === "pass") {
7532
- return task.type === "benchmark" ? picocolors.exports.green(F_DOT) : picocolors.exports.green(F_CHECK);
7563
+ return task.type === "benchmark" ? c.green(F_DOT) : c.green(F_CHECK);
7533
7564
  }
7534
7565
  if (task.result.state === "fail") {
7535
- return task.type === "suite" ? pointer : picocolors.exports.red(F_CROSS);
7566
+ return task.type === "suite" ? pointer : c.red(F_CROSS);
7536
7567
  }
7537
7568
  return " ";
7538
7569
  }
@@ -7550,7 +7581,7 @@ function getHookStateSymbol(task, hookName) {
7550
7581
  spinner = elegantSpinner();
7551
7582
  spinnerMap2.set(hookName, spinner);
7552
7583
  }
7553
- return picocolors.exports.yellow(spinner());
7584
+ return c.yellow(spinner());
7554
7585
  }
7555
7586
  }
7556
7587
  const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -7569,24 +7600,24 @@ function formatProjectName(name, suffix = " ") {
7569
7600
  return "";
7570
7601
  const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
7571
7602
  const colors = [
7572
- picocolors.exports.blue,
7573
- picocolors.exports.yellow,
7574
- picocolors.exports.cyan,
7575
- picocolors.exports.green,
7576
- picocolors.exports.magenta
7603
+ c.blue,
7604
+ c.yellow,
7605
+ c.cyan,
7606
+ c.green,
7607
+ c.magenta
7577
7608
  ];
7578
7609
  return colors[index % colors.length](`|${name}|`) + suffix;
7579
7610
  }
7580
7611
 
7581
7612
  var _a;
7582
7613
  const BADGE_PADDING = " ";
7583
- const HELP_HINT = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("h")}${picocolors.exports.dim(" to show help")}`;
7584
- const HELP_UPDATE_SNAP = picocolors.exports.dim("press ") + picocolors.exports.bold(picocolors.exports.yellow("u")) + picocolors.exports.dim(" to update snapshot");
7585
- const HELP_QUITE = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("q")}${picocolors.exports.dim(" to quit")}`;
7614
+ const HELP_HINT = `${c.dim("press ")}${c.bold("h")}${c.dim(" to show help")}`;
7615
+ const HELP_UPDATE_SNAP = c.dim("press ") + c.bold(c.yellow("u")) + c.dim(" to update snapshot");
7616
+ const HELP_QUITE = `${c.dim("press ")}${c.bold("q")}${c.dim(" to quit")}`;
7586
7617
  const WAIT_FOR_CHANGE_PASS = `
7587
- ${picocolors.exports.bold(picocolors.exports.inverse(picocolors.exports.green(" PASS ")))}${picocolors.exports.green(" Waiting for file changes...")}`;
7618
+ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")}`;
7588
7619
  const WAIT_FOR_CHANGE_FAIL = `
7589
- ${picocolors.exports.bold(picocolors.exports.inverse(picocolors.exports.red(" FAIL ")))}${picocolors.exports.red(" Tests failed. Watching for file changes...")}`;
7620
+ ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(" Tests failed. Watching for file changes...")}`;
7590
7621
  const LAST_RUN_LOG_TIMEOUT = 1500;
7591
7622
  class BaseReporter {
7592
7623
  constructor() {
@@ -7621,7 +7652,7 @@ class BaseReporter {
7621
7652
  }
7622
7653
  }
7623
7654
  onTaskUpdate(packs) {
7624
- var _a2, _b, _c;
7655
+ var _a2, _b, _c, _d;
7625
7656
  if (this.isTTY)
7626
7657
  return;
7627
7658
  const logger = this.ctx.logger;
@@ -7634,22 +7665,24 @@ class BaseReporter {
7634
7665
  return ((_a3 = t.result) == null ? void 0 : _a3.state) === "fail";
7635
7666
  });
7636
7667
  const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
7637
- let state = picocolors.exports.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
7668
+ let state = c.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
7638
7669
  if (failed.length)
7639
- state += ` ${picocolors.exports.dim("|")} ${picocolors.exports.red(`${failed.length} failed`)}`;
7670
+ state += ` ${c.dim("|")} ${c.red(`${failed.length} failed`)}`;
7640
7671
  if (skipped.length)
7641
- state += ` ${picocolors.exports.dim("|")} ${picocolors.exports.yellow(`${skipped.length} skipped`)}`;
7642
- let suffix = picocolors.exports.dim(" (") + state + picocolors.exports.dim(")");
7672
+ state += ` ${c.dim("|")} ${c.yellow(`${skipped.length} skipped`)}`;
7673
+ let suffix = c.dim(" (") + state + c.dim(")");
7643
7674
  if (task.result.duration) {
7644
- const color = task.result.duration > this.ctx.config.slowTestThreshold ? picocolors.exports.yellow : picocolors.exports.gray;
7645
- suffix += color(` ${Math.round(task.result.duration)}${picocolors.exports.dim("ms")}`);
7675
+ const color = task.result.duration > this.ctx.config.slowTestThreshold ? c.yellow : c.gray;
7676
+ suffix += color(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
7646
7677
  }
7647
7678
  if (this.ctx.config.logHeapUsage && task.result.heap != null)
7648
- suffix += picocolors.exports.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
7679
+ suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
7649
7680
  logger.log(` ${getStateSymbol(task)} ${task.name} ${suffix}`);
7650
7681
  for (const test of failed) {
7651
- logger.log(picocolors.exports.red(` ${pointer} ${getFullName(test)}`));
7652
- logger.log(picocolors.exports.red(` ${F_RIGHT} ${(_c = test.result.error) == null ? void 0 : _c.message}`));
7682
+ logger.log(c.red(` ${pointer} ${getFullName(test)}`));
7683
+ (_d = (_c = test.result) == null ? void 0 : _c.errors) == null ? void 0 : _d.forEach((e) => {
7684
+ logger.log(c.red(` ${F_RIGHT} ${e == null ? void 0 : e.message}`));
7685
+ });
7653
7686
  }
7654
7687
  }
7655
7688
  }
@@ -7669,13 +7702,13 @@ class BaseReporter {
7669
7702
  hints.unshift(HELP_UPDATE_SNAP);
7670
7703
  else
7671
7704
  hints.push(HELP_QUITE);
7672
- this.ctx.logger.log(BADGE_PADDING + hints.join(picocolors.exports.dim(", ")));
7705
+ this.ctx.logger.log(BADGE_PADDING + hints.join(c.dim(", ")));
7673
7706
  if (this._lastRunCount) {
7674
7707
  const LAST_RUN_TEXT = `rerun x${this._lastRunCount}`;
7675
7708
  const LAST_RUN_TEXTS = [
7676
- picocolors.exports.blue(LAST_RUN_TEXT),
7677
- picocolors.exports.gray(LAST_RUN_TEXT),
7678
- picocolors.exports.dim(picocolors.exports.gray(LAST_RUN_TEXT))
7709
+ c.blue(LAST_RUN_TEXT),
7710
+ c.gray(LAST_RUN_TEXT),
7711
+ c.dim(c.gray(LAST_RUN_TEXT))
7679
7712
  ];
7680
7713
  this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[0]);
7681
7714
  this._lastRunTimeout = 0;
@@ -7703,8 +7736,8 @@ class BaseReporter {
7703
7736
  let reruns = this._filesInWatchMode.get(filepath) ?? 0;
7704
7737
  this._filesInWatchMode.set(filepath, ++reruns);
7705
7738
  });
7706
- const BADGE = picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" RERUN ")));
7707
- const TRIGGER = trigger ? picocolors.exports.dim(` ${this.relative(trigger)}`) : "";
7739
+ const BADGE = c.inverse(c.bold(c.blue(" RERUN ")));
7740
+ const TRIGGER = trigger ? c.dim(` ${this.relative(trigger)}`) : "";
7708
7741
  if (files.length > 1) {
7709
7742
  this.ctx.logger.clearFullScreen(`
7710
7743
  ${BADGE}${TRIGGER}
@@ -7714,7 +7747,7 @@ ${BADGE}${TRIGGER}
7714
7747
  const rerun = this._filesInWatchMode.get(files[0]) ?? 1;
7715
7748
  this._lastRunCount = rerun;
7716
7749
  this.ctx.logger.clearFullScreen(`
7717
- ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7750
+ ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
7718
7751
  `);
7719
7752
  }
7720
7753
  this._timeStart = new Date();
@@ -7724,7 +7757,7 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7724
7757
  if (!this.shouldLog(log))
7725
7758
  return;
7726
7759
  const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
7727
- this.ctx.logger.log(picocolors.exports.gray(log.type + picocolors.exports.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
7760
+ this.ctx.logger.log(c.gray(log.type + c.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
7728
7761
  process[log.type].write(`${log.content}
7729
7762
  `);
7730
7763
  }
@@ -7738,7 +7771,7 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7738
7771
  return true;
7739
7772
  }
7740
7773
  onServerRestart(reason) {
7741
- this.ctx.logger.log(picocolors.exports.bold(picocolors.exports.magenta(
7774
+ this.ctx.logger.log(c.bold(c.magenta(
7742
7775
  reason === "config" ? "\nRestarting due to config changes..." : "\nRestarting Vitest..."
7743
7776
  )));
7744
7777
  }
@@ -7750,7 +7783,7 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7750
7783
  await this.reportTestSummary(files);
7751
7784
  }
7752
7785
  async reportTestSummary(files) {
7753
- const tests = this.mode === "typecheck" ? getTypecheckTests(files) : getTests(files);
7786
+ const tests = getTests(files);
7754
7787
  const logger = this.ctx.logger;
7755
7788
  const executionTime = this.end - this.start;
7756
7789
  const collectTime = files.reduce((acc, test) => acc + Math.max(0, test.collectDuration || 0), 0);
@@ -7761,7 +7794,7 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7761
7794
  }, 0);
7762
7795
  const transformTime = Array.from(this.ctx.vitenode.fetchCache.values()).reduce((a, b) => a + ((b == null ? void 0 : b.duration) || 0), 0);
7763
7796
  const threadTime = collectTime + testsTime + setupTime;
7764
- const padTitle = (str) => picocolors.exports.dim(`${str.padStart(11)} `);
7797
+ const padTitle = (str) => c.dim(`${str.padStart(11)} `);
7765
7798
  const time = (time2) => {
7766
7799
  if (time2 > 1e3)
7767
7800
  return `${(time2 / 1e3).toFixed(2)}s`;
@@ -7778,8 +7811,11 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7778
7811
  logger.log(padTitle("Test Files"), getStateString(files));
7779
7812
  logger.log(padTitle("Tests"), getStateString(tests));
7780
7813
  if (this.mode === "typecheck") {
7781
- const typechecks = getTests(files).filter((t) => t.type === "typecheck");
7782
- logger.log(padTitle("Type Errors"), getStateString(typechecks, "errors", false));
7814
+ const failed = tests.filter((t) => {
7815
+ var _a2, _b, _c;
7816
+ return ((_a2 = t.meta) == null ? void 0 : _a2.typecheck) && ((_c = (_b = t.result) == null ? void 0 : _b.errors) == null ? void 0 : _c.length);
7817
+ });
7818
+ logger.log(padTitle("Type Errors"), failed.length ? c.bold(c.red(`${failed} failed`)) : c.dim("no errors"));
7783
7819
  }
7784
7820
  logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
7785
7821
  if (this.watchFilters)
@@ -7787,7 +7823,7 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7787
7823
  else if (this.mode === "typecheck")
7788
7824
  logger.log(padTitle("Duration"), time(executionTime));
7789
7825
  else
7790
- logger.log(padTitle("Duration"), time(executionTime) + picocolors.exports.dim(` (transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)})`));
7826
+ logger.log(padTitle("Duration"), time(executionTime) + c.dim(` (transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)})`));
7791
7827
  logger.log();
7792
7828
  }
7793
7829
  async printErrorsSummary(files) {
@@ -7796,24 +7832,23 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7796
7832
  const tests = getTests(files);
7797
7833
  const failedSuites = suites.filter((i) => {
7798
7834
  var _a2;
7799
- return (_a2 = i.result) == null ? void 0 : _a2.error;
7835
+ return (_a2 = i.result) == null ? void 0 : _a2.errors;
7800
7836
  });
7801
7837
  const failedTests = tests.filter((i) => {
7802
7838
  var _a2;
7803
7839
  return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
7804
7840
  });
7805
- const failedTotal = failedSuites.length + failedTests.length;
7841
+ const failedTotal = countTestErrors(failedSuites) + countTestErrors(failedTests);
7806
7842
  let current = 1;
7807
- const errorDivider = () => logger.error(`${picocolors.exports.red(picocolors.exports.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
7843
+ const errorDivider = () => logger.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
7808
7844
  `);
7809
7845
  if (failedSuites.length) {
7810
- logger.error(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` Failed Suites ${failedSuites.length} `)))));
7846
+ logger.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
7811
7847
  logger.error();
7812
7848
  await this.printTaskErrors(failedSuites, errorDivider);
7813
7849
  }
7814
7850
  if (failedTests.length) {
7815
- const message = this.mode === "typecheck" ? "Type Errors" : "Failed Tests";
7816
- logger.error(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` ${message} ${failedTests.length} `)))));
7851
+ logger.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
7817
7852
  logger.error();
7818
7853
  await this.printTaskErrors(failedTests, errorDivider);
7819
7854
  }
@@ -7827,47 +7862,48 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
7827
7862
  return ((_b = (_a2 = i.result) == null ? void 0 : _a2.benchmark) == null ? void 0 : _b.rank) === 1;
7828
7863
  });
7829
7864
  logger.log(`
7830
- ${picocolors.exports.cyan(picocolors.exports.inverse(picocolors.exports.bold(" BENCH ")))} ${picocolors.exports.cyan("Summary")}
7865
+ ${c.cyan(c.inverse(c.bold(" BENCH ")))} ${c.cyan("Summary")}
7831
7866
  `);
7832
7867
  for (const bench of topBenchs) {
7833
7868
  const group = bench.suite;
7834
7869
  if (!group)
7835
7870
  continue;
7836
7871
  const groupName = getFullName(group);
7837
- logger.log(` ${bench.name}${picocolors.exports.dim(` - ${groupName}`)}`);
7872
+ logger.log(` ${bench.name}${c.dim(` - ${groupName}`)}`);
7838
7873
  const siblings = group.tasks.filter((i) => {
7839
7874
  var _a2;
7840
7875
  return ((_a2 = i.result) == null ? void 0 : _a2.benchmark) && i !== bench;
7841
7876
  }).sort((a, b) => a.result.benchmark.rank - b.result.benchmark.rank);
7842
7877
  for (const sibling of siblings) {
7843
7878
  const number = `${(sibling.result.benchmark.mean / bench.result.benchmark.mean).toFixed(2)}x`;
7844
- logger.log(` ${picocolors.exports.green(number)} ${picocolors.exports.gray("faster than")} ${sibling.name}`);
7879
+ logger.log(` ${c.green(number)} ${c.gray("faster than")} ${sibling.name}`);
7845
7880
  }
7846
7881
  logger.log("");
7847
7882
  }
7848
7883
  }
7849
7884
  async printTaskErrors(tasks, errorDivider) {
7850
- var _a2, _b;
7885
+ var _a2, _b, _c;
7851
7886
  const errorsQueue = [];
7852
7887
  for (const task of tasks) {
7853
- const error = (_a2 = task.result) == null ? void 0 : _a2.error;
7854
- const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
7855
- var _a3;
7856
- return ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
7888
+ (_b = (_a2 = task.result) == null ? void 0 : _a2.errors) == null ? void 0 : _b.forEach((error) => {
7889
+ const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
7890
+ var _a3;
7891
+ return ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
7892
+ });
7893
+ if (errorItem)
7894
+ errorItem[1].push(task);
7895
+ else
7896
+ errorsQueue.push([error, [task]]);
7857
7897
  });
7858
- if (errorItem)
7859
- errorItem[1].push(task);
7860
- else
7861
- errorsQueue.push([error, [task]]);
7862
7898
  }
7863
7899
  for (const [error, tasks2] of errorsQueue) {
7864
7900
  for (const task of tasks2) {
7865
7901
  const filepath = (task == null ? void 0 : task.filepath) || "";
7866
- const projectName = (task == null ? void 0 : task.projectName) || ((_b = task.file) == null ? void 0 : _b.projectName);
7902
+ const projectName = (task == null ? void 0 : task.projectName) || ((_c = task.file) == null ? void 0 : _c.projectName);
7867
7903
  let name = getFullName(task);
7868
7904
  if (filepath)
7869
- name = `${name} ${picocolors.exports.dim(`[ ${this.relative(filepath)} ]`)}`;
7870
- this.ctx.logger.error(`${picocolors.exports.red(picocolors.exports.bold(picocolors.exports.inverse(" FAIL ")))} ${formatProjectName(projectName)}${name}`);
7905
+ name = `${name} ${c.dim(`[ ${this.relative(filepath)} ]`)}`;
7906
+ this.ctx.logger.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${formatProjectName(projectName)}${name}`);
7871
7907
  }
7872
7908
  await this.ctx.logger.printError(error);
7873
7909
  errorDivider();
@@ -7893,7 +7929,7 @@ function formatFilepath$1(path) {
7893
7929
  if (firstDot < 0)
7894
7930
  firstDot = basename.length;
7895
7931
  firstDot += lastSlash;
7896
- return picocolors.exports.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + picocolors.exports.dim(path.slice(firstDot));
7932
+ return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
7897
7933
  }
7898
7934
  function formatNumber$1(number) {
7899
7935
  const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
@@ -7903,7 +7939,7 @@ function renderHookState(task, hookName, level = 0) {
7903
7939
  var _a, _b;
7904
7940
  const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
7905
7941
  if (state && state === "run")
7906
- return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${picocolors.exports.dim(`[ ${hookName} ]`)}`;
7942
+ return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${c.dim(`[ ${hookName} ]`)}`;
7907
7943
  return "";
7908
7944
  }
7909
7945
  function renderBenchmarkItems$1(result) {
@@ -7932,16 +7968,16 @@ function renderBenchmark$1(task, tasks) {
7932
7968
  });
7933
7969
  return [
7934
7970
  padded[0],
7935
- picocolors.exports.dim(" "),
7936
- picocolors.exports.blue(padded[1]),
7937
- picocolors.exports.dim(" ops/sec "),
7938
- picocolors.exports.cyan(padded[3]),
7939
- picocolors.exports.dim(` (${padded[4]} samples)`),
7940
- result.rank === 1 ? picocolors.exports.bold(picocolors.exports.green(" fastest")) : result.rank === benchs.length && benchs.length > 2 ? picocolors.exports.bold(picocolors.exports.gray(" slowest")) : ""
7971
+ c.dim(" "),
7972
+ c.blue(padded[1]),
7973
+ c.dim(" ops/sec "),
7974
+ c.cyan(padded[3]),
7975
+ c.dim(` (${padded[4]} samples)`),
7976
+ result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benchs.length && benchs.length > 2 ? c.bold(c.gray(" slowest")) : ""
7941
7977
  ].join("");
7942
7978
  }
7943
7979
  function renderTree$1(tasks, options, level = 0) {
7944
- var _a, _b, _c, _d, _e, _f;
7980
+ var _a, _b, _c, _d, _e, _f, _g;
7945
7981
  let output = [];
7946
7982
  for (const task of tasks) {
7947
7983
  let suffix = "";
@@ -7949,26 +7985,26 @@ function renderTree$1(tasks, options, level = 0) {
7949
7985
  if (level === 0 && task.type === "suite" && task.projectName)
7950
7986
  prefix += formatProjectName(task.projectName);
7951
7987
  if (task.type === "test" && ((_a = task.result) == null ? void 0 : _a.retryCount) && task.result.retryCount > 1)
7952
- suffix += picocolors.exports.yellow(` (retry x${task.result.retryCount})`);
7953
- if (task.type === "suite" && !isTypecheckTest(task)) {
7954
- const tests = options.mode === "typecheck" ? getTypecheckTests(task) : getTests(task);
7955
- suffix += picocolors.exports.dim(` (${tests.length})`);
7988
+ suffix += c.yellow(` (retry x${task.result.retryCount})`);
7989
+ if (task.type === "suite" && !((_b = task.meta) == null ? void 0 : _b.typecheck)) {
7990
+ const tests = getTests(task);
7991
+ suffix += c.dim(` (${tests.length})`);
7956
7992
  }
7957
7993
  if (task.mode === "skip" || task.mode === "todo")
7958
- suffix += ` ${picocolors.exports.dim(picocolors.exports.gray("[skipped]"))}`;
7959
- if (((_b = task.result) == null ? void 0 : _b.duration) != null) {
7994
+ suffix += ` ${c.dim(c.gray("[skipped]"))}`;
7995
+ if (((_c = task.result) == null ? void 0 : _c.duration) != null) {
7960
7996
  if (task.result.duration > DURATION_LONG$1)
7961
- suffix += picocolors.exports.yellow(` ${Math.round(task.result.duration)}${picocolors.exports.dim("ms")}`);
7997
+ suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
7962
7998
  }
7963
- if (options.showHeap && ((_c = task.result) == null ? void 0 : _c.heap) != null)
7964
- suffix += picocolors.exports.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
7999
+ if (options.showHeap && ((_d = task.result) == null ? void 0 : _d.heap) != null)
8000
+ suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
7965
8001
  let name = task.name;
7966
8002
  if (level === 0)
7967
8003
  name = formatFilepath$1(name);
7968
8004
  const padding = " ".repeat(level);
7969
8005
  const body = task.type === "benchmark" ? renderBenchmark$1(task, tasks) : name;
7970
8006
  output.push(padding + prefix + body + suffix);
7971
- if (((_d = task.result) == null ? void 0 : _d.state) !== "pass" && outputMap$1.get(task) != null) {
8007
+ if (((_e = task.result) == null ? void 0 : _e.state) !== "pass" && outputMap$1.get(task) != null) {
7972
8008
  let data = outputMap$1.get(task);
7973
8009
  if (typeof data === "string") {
7974
8010
  data = stripAnsi(data.trim().split("\n").filter(Boolean).pop());
@@ -7977,13 +8013,13 @@ function renderTree$1(tasks, options, level = 0) {
7977
8013
  }
7978
8014
  if (data != null) {
7979
8015
  const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
7980
- output.push(` ${picocolors.exports.gray(cliTruncate(out, getCols(-3)))}`);
8016
+ output.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
7981
8017
  }
7982
8018
  }
7983
8019
  output = output.concat(renderHookState(task, "beforeAll", level + 1));
7984
8020
  output = output.concat(renderHookState(task, "beforeEach", level + 1));
7985
8021
  if (task.type === "suite" && task.tasks.length > 0) {
7986
- if (((_e = task.result) == null ? void 0 : _e.state) === "fail" || ((_f = task.result) == null ? void 0 : _f.state) === "run" || options.renderSucceed)
8022
+ if (((_f = task.result) == null ? void 0 : _f.state) === "fail" || ((_g = task.result) == null ? void 0 : _g.state) === "run" || options.renderSucceed)
7987
8023
  output = output.concat(renderTree$1(task.tasks, options, level + 1));
7988
8024
  }
7989
8025
  output = output.concat(renderHookState(task, "afterAll", level + 1));
@@ -8032,7 +8068,7 @@ class DefaultReporter extends BaseReporter {
8032
8068
  }
8033
8069
  async onTestRemoved(trigger) {
8034
8070
  await this.stopListRender();
8035
- this.ctx.logger.clearScreen(picocolors.exports.yellow("Test removed...") + (trigger ? picocolors.exports.dim(` [ ${this.relative(trigger)} ]
8071
+ this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
8036
8072
  `) : ""), true);
8037
8073
  const files = this.ctx.state.getFiles(this.watchFilters);
8038
8074
  createListRenderer(files, this.rendererOptions).stop();
@@ -8079,10 +8115,10 @@ class DefaultReporter extends BaseReporter {
8079
8115
  }
8080
8116
  }
8081
8117
 
8082
- const check = picocolors.exports.green("\xB7");
8083
- const cross = picocolors.exports.red("x");
8084
- const pending = picocolors.exports.yellow("*");
8085
- const skip = picocolors.exports.dim(picocolors.exports.gray("-"));
8118
+ const check = c.green("\xB7");
8119
+ const cross = c.red("x");
8120
+ const pending = c.yellow("*");
8121
+ const skip = c.dim(c.gray("-"));
8086
8122
  function render(tasks) {
8087
8123
  const all = getTests(tasks);
8088
8124
  return all.map((i) => {
@@ -8194,14 +8230,14 @@ class JsonReporter$1 {
8194
8230
  this.start = Date.now();
8195
8231
  }
8196
8232
  async logTasks(files) {
8197
- var _a, _b;
8233
+ var _a, _b, _c;
8198
8234
  const suites = getSuites(files);
8199
8235
  const numTotalTestSuites = suites.length;
8200
8236
  const tests = getTests(files);
8201
8237
  const numTotalTests = tests.length;
8202
8238
  const numFailedTestSuites = suites.filter((s) => {
8203
8239
  var _a2;
8204
- return (_a2 = s.result) == null ? void 0 : _a2.error;
8240
+ return (_a2 = s.result) == null ? void 0 : _a2.errors;
8205
8241
  }).length;
8206
8242
  const numPassedTestSuites = numTotalTestSuites - numFailedTestSuites;
8207
8243
  const numPendingTestSuites = suites.filter((s) => {
@@ -8233,7 +8269,7 @@ class JsonReporter$1 {
8233
8269
  return Math.max(prev, (((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? 0) + (((_b2 = next.result) == null ? void 0 : _b2.duration) ?? 0));
8234
8270
  }, startTime);
8235
8271
  const assertionResults = await Promise.all(tests2.map(async (t) => {
8236
- var _a2, _b2, _c, _d;
8272
+ var _a2, _b2, _c2, _d;
8237
8273
  const ancestorTitles = [];
8238
8274
  let iter = t.suite;
8239
8275
  while (iter) {
@@ -8247,7 +8283,7 @@ class JsonReporter$1 {
8247
8283
  status: StatusMap[((_a2 = t.result) == null ? void 0 : _a2.state) || t.mode] || "skipped",
8248
8284
  title: t.name,
8249
8285
  duration: (_b2 = t.result) == null ? void 0 : _b2.duration,
8250
- failureMessages: ((_d = (_c = t.result) == null ? void 0 : _c.error) == null ? void 0 : _d.message) == null ? [] : [t.result.error.message],
8286
+ failureMessages: ((_d = (_c2 = t.result) == null ? void 0 : _c2.errors) == null ? void 0 : _d.map((e) => e.message)) || [],
8251
8287
  location: await this.getFailureLocation(t)
8252
8288
  };
8253
8289
  }));
@@ -8265,7 +8301,7 @@ class JsonReporter$1 {
8265
8301
  var _a2;
8266
8302
  return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
8267
8303
  }) ? "failed" : "passed",
8268
- message: ((_b = (_a = file.result) == null ? void 0 : _a.error) == null ? void 0 : _b.message) ?? "",
8304
+ message: ((_c = (_b = (_a = file.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0]) == null ? void 0 : _c.message) ?? "",
8269
8305
  name: file.filepath
8270
8306
  });
8271
8307
  }
@@ -8302,8 +8338,8 @@ class JsonReporter$1 {
8302
8338
  }
8303
8339
  }
8304
8340
  async getFailureLocation(test) {
8305
- var _a;
8306
- const error = (_a = test.result) == null ? void 0 : _a.error;
8341
+ var _a, _b;
8342
+ const error = (_b = (_a = test.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0];
8307
8343
  if (!error)
8308
8344
  return;
8309
8345
  const stack = parseStacktrace(error);
@@ -8328,10 +8364,13 @@ class VerboseReporter extends DefaultReporter {
8328
8364
  if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
8329
8365
  let title = ` ${getStateSymbol(task)} ${getFullName(task)}`;
8330
8366
  if (this.ctx.config.logHeapUsage && task.result.heap != null)
8331
- title += picocolors.exports.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
8367
+ title += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
8332
8368
  this.ctx.logger.log(title);
8333
- if (task.result.state === "fail")
8334
- this.ctx.logger.log(picocolors.exports.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
8369
+ if (task.result.state === "fail") {
8370
+ (_c = task.result.errors) == null ? void 0 : _c.forEach((error) => {
8371
+ this.ctx.logger.log(c.red(` ${F_RIGHT} ${error == null ? void 0 : error.message}`));
8372
+ });
8373
+ }
8335
8374
  }
8336
8375
  }
8337
8376
  }
@@ -8397,22 +8436,23 @@ class TapReporter {
8397
8436
  this.logger.log("}");
8398
8437
  } else {
8399
8438
  this.logger.log(`${ok} ${id} - ${tapString(task.name)}${comment}`);
8400
- if (((_b = task.result) == null ? void 0 : _b.state) === "fail" && task.result.error) {
8401
- this.logger.indent();
8402
- const error = task.result.error;
8403
- const stacks = parseStacktrace(error);
8404
- const stack = stacks[0];
8405
- this.logger.log("---");
8406
- this.logger.log("error:");
8439
+ if (((_b = task.result) == null ? void 0 : _b.state) === "fail" && task.result.errors) {
8407
8440
  this.logger.indent();
8408
- this.logErrorDetails(error);
8409
- this.logger.unindent();
8410
- if (stack)
8411
- this.logger.log(`at: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
8412
- if (error.showDiff) {
8413
- this.logger.log(`actual: ${yamlString(error.actual)}`);
8414
- this.logger.log(`expected: ${yamlString(error.expected)}`);
8415
- }
8441
+ task.result.errors.forEach((error) => {
8442
+ const stacks = parseStacktrace(error);
8443
+ const stack = stacks[0];
8444
+ this.logger.log("---");
8445
+ this.logger.log("error:");
8446
+ this.logger.indent();
8447
+ this.logErrorDetails(error);
8448
+ this.logger.unindent();
8449
+ if (stack)
8450
+ this.logger.log(`at: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
8451
+ if (error.showDiff) {
8452
+ this.logger.log(`actual: ${yamlString(error.actual)}`);
8453
+ this.logger.log(`expected: ${yamlString(error.expected)}`);
8454
+ }
8455
+ });
8416
8456
  this.logger.log("...");
8417
8457
  this.logger.unindent();
8418
8458
  }
@@ -8528,21 +8568,23 @@ class JUnitReporter {
8528
8568
  name: task.name,
8529
8569
  time: getDuration(task)
8530
8570
  }, async () => {
8531
- var _a;
8571
+ var _a, _b;
8532
8572
  await this.writeLogs(task, "out");
8533
8573
  await this.writeLogs(task, "err");
8534
8574
  if (task.mode === "skip" || task.mode === "todo")
8535
8575
  await this.logger.log("<skipped/>");
8536
8576
  if (((_a = task.result) == null ? void 0 : _a.state) === "fail") {
8537
- const error = task.result.error;
8538
- await this.writeElement("failure", {
8539
- message: error == null ? void 0 : error.message,
8540
- type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
8541
- }, async () => {
8542
- if (!error)
8543
- return;
8544
- await this.writeErrorDetails(error);
8545
- });
8577
+ const errors = ((_b = task.result.errors) == null ? void 0 : _b.length) ? task.result.errors : [task.result.error];
8578
+ for (const error of errors) {
8579
+ await this.writeElement("failure", {
8580
+ message: error == null ? void 0 : error.message,
8581
+ type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
8582
+ }, async () => {
8583
+ if (!error)
8584
+ return;
8585
+ await this.writeErrorDetails(error);
8586
+ });
8587
+ }
8546
8588
  }
8547
8589
  });
8548
8590
  }
@@ -8626,6 +8668,17 @@ class TapFlatReporter extends TapReporter {
8626
8668
  }
8627
8669
  }
8628
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
+
8629
8682
  class JsonReporter {
8630
8683
  constructor() {
8631
8684
  this.start = 0;
@@ -8692,7 +8745,7 @@ function formatFilepath(path) {
8692
8745
  if (firstDot < 0)
8693
8746
  firstDot = basename.length;
8694
8747
  firstDot += lastSlash;
8695
- return picocolors.exports.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + picocolors.exports.dim(path.slice(firstDot));
8748
+ return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
8696
8749
  }
8697
8750
  function formatNumber(number) {
8698
8751
  const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
@@ -8708,7 +8761,7 @@ function renderTableHead(tasks) {
8708
8761
  return `${" ".repeat(3)}${tableHead.map((i, idx) => {
8709
8762
  const width = Math.max(...allItems.map((i2) => i2[idx].length));
8710
8763
  return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
8711
- }).map(picocolors.exports.bold).join(" ")}`;
8764
+ }).map(c.bold).join(" ")}`;
8712
8765
  }
8713
8766
  function renderBenchmarkItems(result) {
8714
8767
  return [
@@ -8742,17 +8795,17 @@ function renderBenchmark(task, tasks) {
8742
8795
  });
8743
8796
  return [
8744
8797
  padded[0],
8745
- picocolors.exports.blue(padded[1]),
8746
- picocolors.exports.cyan(padded[2]),
8747
- picocolors.exports.cyan(padded[3]),
8748
- picocolors.exports.cyan(padded[4]),
8749
- picocolors.exports.cyan(padded[5]),
8750
- picocolors.exports.cyan(padded[6]),
8751
- picocolors.exports.cyan(padded[7]),
8752
- picocolors.exports.cyan(padded[8]),
8753
- picocolors.exports.dim(padded[9]),
8754
- picocolors.exports.dim(padded[10]),
8755
- result.rank === 1 ? picocolors.exports.bold(picocolors.exports.green(" fastest")) : result.rank === benchs.length && benchs.length > 2 ? picocolors.exports.bold(picocolors.exports.gray(" slowest")) : ""
8798
+ c.blue(padded[1]),
8799
+ c.cyan(padded[2]),
8800
+ c.cyan(padded[3]),
8801
+ c.cyan(padded[4]),
8802
+ c.cyan(padded[5]),
8803
+ c.cyan(padded[6]),
8804
+ c.cyan(padded[7]),
8805
+ c.cyan(padded[8]),
8806
+ c.dim(padded[9]),
8807
+ c.dim(padded[10]),
8808
+ result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benchs.length && benchs.length > 2 ? c.bold(c.gray(" slowest")) : ""
8756
8809
  ].join(" ");
8757
8810
  }
8758
8811
  function renderTree(tasks, options, level = 0) {
@@ -8768,15 +8821,15 @@ ${padding}`;
8768
8821
  prefix += ` ${getStateSymbol(task)} `;
8769
8822
  let suffix = "";
8770
8823
  if (task.type === "suite")
8771
- suffix += picocolors.exports.dim(` (${getTests(task).length})`);
8824
+ suffix += c.dim(` (${getTests(task).length})`);
8772
8825
  if (task.mode === "skip" || task.mode === "todo")
8773
- suffix += ` ${picocolors.exports.dim(picocolors.exports.gray("[skipped]"))}`;
8826
+ suffix += ` ${c.dim(c.gray("[skipped]"))}`;
8774
8827
  if (((_a = task.result) == null ? void 0 : _a.duration) != null) {
8775
8828
  if (task.result.duration > DURATION_LONG)
8776
- suffix += picocolors.exports.yellow(` ${Math.round(task.result.duration)}${picocolors.exports.dim("ms")}`);
8829
+ suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
8777
8830
  }
8778
8831
  if (options.showHeap && ((_b = task.result) == null ? void 0 : _b.heap) != null)
8779
- suffix += picocolors.exports.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
8832
+ suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
8780
8833
  let name = task.name;
8781
8834
  if (level === 0)
8782
8835
  name = formatFilepath(name);
@@ -8791,7 +8844,7 @@ ${padding}`;
8791
8844
  }
8792
8845
  if (data != null) {
8793
8846
  const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
8794
- output.push(` ${picocolors.exports.gray(cliTruncate(out, getCols(-3)))}`);
8847
+ output.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
8795
8848
  }
8796
8849
  }
8797
8850
  if (task.type === "suite" && task.tasks.length > 0) {
@@ -8843,7 +8896,7 @@ class TableReporter extends BaseReporter {
8843
8896
  }
8844
8897
  async onTestRemoved(trigger) {
8845
8898
  await this.stopListRender();
8846
- this.ctx.logger.clearScreen(picocolors.exports.yellow("Test removed...") + (trigger ? picocolors.exports.dim(` [ ${this.relative(trigger)} ]
8899
+ this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
8847
8900
  `) : ""), true);
8848
8901
  const files = this.ctx.state.getFiles(this.watchFilters);
8849
8902
  createTableRenderer(files, this.rendererOptions).stop();
@@ -8902,7 +8955,8 @@ const ReportersMap = {
8902
8955
  "json": JsonReporter$1,
8903
8956
  "tap": TapReporter,
8904
8957
  "tap-flat": TapFlatReporter,
8905
- "junit": JUnitReporter
8958
+ "junit": JUnitReporter,
8959
+ "hanging-process": HangingProcessReporter
8906
8960
  };
8907
8961
 
8908
8962
  async function loadCustomReporterModule(path, runner) {
@@ -9073,10 +9127,11 @@ const defaultCoverageExcludes = [
9073
9127
  "**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
9074
9128
  ];
9075
9129
  const coverageConfigDefaults = {
9130
+ all: false,
9076
9131
  provider: "c8",
9077
9132
  enabled: false,
9078
9133
  clean: true,
9079
- cleanOnRerun: false,
9134
+ cleanOnRerun: true,
9080
9135
  reportsDirectory: "./coverage",
9081
9136
  excludeNodeModules: true,
9082
9137
  exclude: defaultCoverageExcludes,
@@ -9338,8 +9393,8 @@ function resolveConfig(mode, options, viteConfig) {
9338
9393
  if (options.dom) {
9339
9394
  if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
9340
9395
  console.warn(
9341
- picocolors.exports.yellow(
9342
- `${picocolors.exports.inverse(picocolors.exports.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`
9396
+ c.yellow(
9397
+ `${c.inverse(c.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`
9343
9398
  )
9344
9399
  );
9345
9400
  }
@@ -9419,10 +9474,8 @@ function resolveConfig(mode, options, viteConfig) {
9419
9474
  if (options.related)
9420
9475
  resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
9421
9476
  if (mode !== "benchmark") {
9422
- resolved.reporters = Array.from(/* @__PURE__ */ new Set([
9423
- ...toArray(resolved.reporters),
9424
- ...toArray(resolved.reporter)
9425
- ])).filter(Boolean);
9477
+ const reporters = resolved.reporter ?? resolved.reporters;
9478
+ resolved.reporters = Array.from(new Set(toArray(reporters))).filter(Boolean);
9426
9479
  }
9427
9480
  if (!resolved.reporters.length)
9428
9481
  resolved.reporters.push("default");
@@ -9938,7 +9991,100 @@ createLogUpdate(process$1.stdout);
9938
9991
 
9939
9992
  createLogUpdate(process$1.stderr);
9940
9993
 
9941
- var version = "0.26.3";
9994
+ var version = "0.27.1";
9995
+
9996
+ function formatLine(line, outputTruncateLength) {
9997
+ var _a;
9998
+ return cliTruncate(line, (outputTruncateLength ?? (((_a = process.stdout) == null ? void 0 : _a.columns) || 80)) - 4);
9999
+ }
10000
+ function unifiedDiff(actual, expected, options = {}) {
10001
+ if (actual === expected)
10002
+ return "";
10003
+ const { outputTruncateLength, outputDiffLines, outputDiffMaxLines, noColor, showLegend = true } = options;
10004
+ const indent = " ";
10005
+ const diffLimit = outputDiffLines || 15;
10006
+ const diffMaxLines = outputDiffMaxLines || 50;
10007
+ const counts = {
10008
+ "+": 0,
10009
+ "-": 0
10010
+ };
10011
+ let previousState = null;
10012
+ let previousCount = 0;
10013
+ const str = (str2) => str2;
10014
+ const dim = noColor ? str : c.dim;
10015
+ const green = noColor ? str : c.green;
10016
+ const red = noColor ? str : c.red;
10017
+ function preprocess(line) {
10018
+ if (!line || line.match(/\\ No newline/))
10019
+ return;
10020
+ const char = line[0];
10021
+ if ("-+".includes(char)) {
10022
+ if (previousState !== char) {
10023
+ previousState = char;
10024
+ previousCount = 0;
10025
+ }
10026
+ previousCount++;
10027
+ counts[char]++;
10028
+ if (previousCount === diffLimit)
10029
+ return dim(`${char} ...`);
10030
+ else if (previousCount > diffLimit)
10031
+ return;
10032
+ }
10033
+ return line;
10034
+ }
10035
+ const msg = createPatch("string", expected, actual);
10036
+ let lines = msg.split("\n").slice(5).map(preprocess).filter(Boolean);
10037
+ let moreLines = 0;
10038
+ const isCompact = counts["+"] === 1 && counts["-"] === 1 && lines.length === 2;
10039
+ if (lines.length > diffMaxLines) {
10040
+ const firstDiff = lines.findIndex((line) => line[0] === "-" || line[0] === "+");
10041
+ const displayLines = lines.slice(firstDiff - 2, diffMaxLines);
10042
+ const lastDisplayedIndex = firstDiff - 2 + diffMaxLines;
10043
+ if (lastDisplayedIndex < lines.length)
10044
+ moreLines = lines.length - lastDisplayedIndex;
10045
+ lines = displayLines;
10046
+ }
10047
+ let formatted = lines.map((line) => {
10048
+ line = line.replace(/\\"/g, '"');
10049
+ if (line[0] === "-") {
10050
+ line = formatLine(line.slice(1), outputTruncateLength);
10051
+ if (isCompact)
10052
+ return green(line);
10053
+ return green(`- ${formatLine(line, outputTruncateLength)}`);
10054
+ }
10055
+ if (line[0] === "+") {
10056
+ line = formatLine(line.slice(1), outputTruncateLength);
10057
+ if (isCompact)
10058
+ return red(line);
10059
+ return red(`+ ${formatLine(line, outputTruncateLength)}`);
10060
+ }
10061
+ if (line.match(/@@/))
10062
+ return "--";
10063
+ return ` ${line}`;
10064
+ });
10065
+ if (moreLines)
10066
+ formatted.push(dim(`... ${moreLines} more lines`));
10067
+ if (showLegend) {
10068
+ if (isCompact) {
10069
+ formatted = [
10070
+ `${green("- Expected")} ${formatted[0]}`,
10071
+ `${red("+ Received")} ${formatted[1]}`
10072
+ ];
10073
+ } else {
10074
+ if (formatted[0].includes('"'))
10075
+ formatted[0] = formatted[0].replace('"', "");
10076
+ const last = formatted.length - 1;
10077
+ if (formatted[last].endsWith('"'))
10078
+ formatted[last] = formatted[last].slice(0, formatted[last].length - 1);
10079
+ formatted.unshift(
10080
+ green(`- Expected - ${counts["-"]}`),
10081
+ red(`+ Received + ${counts["+"]}`),
10082
+ ""
10083
+ );
10084
+ }
10085
+ }
10086
+ return formatted.map((i) => i ? indent + i : i).join("\n");
10087
+ }
9942
10088
 
9943
10089
  async function printError(error, ctx, options = {}) {
9944
10090
  const { showCodeFrame = true, fullStack = false, type } = options;
@@ -9965,15 +10111,24 @@ async function printError(error, ctx, options = {}) {
9965
10111
  printErrorType(type, ctx);
9966
10112
  printErrorMessage(e, ctx.logger);
9967
10113
  if (e.frame) {
9968
- ctx.logger.error(picocolors.exports.yellow(e.frame));
10114
+ ctx.logger.error(c.yellow(e.frame));
9969
10115
  } else {
9970
10116
  printStack(ctx, stacks, nearest, errorProperties, (s) => {
9971
10117
  if (showCodeFrame && s === nearest && nearest) {
9972
10118
  const sourceCode = readFileSync(nearest.file, "utf-8");
9973
- ctx.logger.error(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, s.line, s.column)));
10119
+ ctx.logger.error(c.yellow(generateCodeFrame(sourceCode, 4, s.line, s.column)));
9974
10120
  }
9975
10121
  });
9976
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
+ }
9977
10132
  if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
9978
10133
  e.cause.name = `Caused by: ${e.cause.name}`;
9979
10134
  await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
@@ -9989,7 +10144,7 @@ async function printError(error, ctx, options = {}) {
9989
10144
  }
9990
10145
  function printErrorType(type, ctx) {
9991
10146
  ctx.logger.error(`
9992
- ${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` ${type} `))))}`);
10147
+ ${c.red(divider(c.bold(c.inverse(` ${type} `))))}`);
9993
10148
  }
9994
10149
  const skipErrorProperties = /* @__PURE__ */ new Set([
9995
10150
  "nameStr",
@@ -10001,6 +10156,8 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
10001
10156
  "showDiff",
10002
10157
  "actual",
10003
10158
  "expected",
10159
+ "VITEST_TEST_NAME",
10160
+ "VITEST_TEST_PATH",
10004
10161
  ...Object.getOwnPropertyNames(Error.prototype),
10005
10162
  ...Object.getOwnPropertyNames(Object.prototype)
10006
10163
  ]);
@@ -10027,16 +10184,16 @@ function handleImportOutsideModuleError(stack, ctx) {
10027
10184
  name = name.split("/").slice(0, 2).join("/");
10028
10185
  else
10029
10186
  name = name.split("/")[0];
10030
- ctx.logger.error(picocolors.exports.yellow(
10031
- `Module ${path} seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package ${picocolors.exports.bold(`"${name}"`)} asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
10187
+ ctx.logger.error(c.yellow(
10188
+ `Module ${path} seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package ${c.bold(`"${name}"`)} asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
10032
10189
 
10033
10190
  As a temporary workaround you can try to inline the package by updating your config:
10034
10191
 
10035
- ` + picocolors.exports.gray(picocolors.exports.dim("// vitest.config.js")) + "\n" + picocolors.exports.green(`export default {
10192
+ ` + c.gray(c.dim("// vitest.config.js")) + "\n" + c.green(`export default {
10036
10193
  test: {
10037
10194
  deps: {
10038
10195
  inline: [
10039
- ${picocolors.exports.yellow(picocolors.exports.bold(`"${name}"`))}
10196
+ ${c.yellow(c.bold(`"${name}"`))}
10040
10197
  ]
10041
10198
  }
10042
10199
  }
@@ -10046,8 +10203,8 @@ As a temporary workaround you can try to inline the package by updating your con
10046
10203
  }
10047
10204
  function displayDiff(actual, expected, console, options = {}) {
10048
10205
  const diff = unifiedDiff(actual, expected, options);
10049
- const dim = options.noColor ? (s) => s : picocolors.exports.dim;
10050
- const black = options.noColor ? (s) => s : picocolors.exports.black;
10206
+ const dim = options.noColor ? (s) => s : c.dim;
10207
+ const black = options.noColor ? (s) => s : c.black;
10051
10208
  if (diff)
10052
10209
  console.error(diff + "\n");
10053
10210
  else if (actual && expected && actual !== '"undefined"' && expected !== '"undefined"')
@@ -10055,26 +10212,24 @@ function displayDiff(actual, expected, console, options = {}) {
10055
10212
  }
10056
10213
  function printErrorMessage(error, logger) {
10057
10214
  const errorName = error.name || error.nameStr || "Unknown Error";
10058
- logger.error(picocolors.exports.red(`${picocolors.exports.bold(errorName)}: ${error.message}`));
10215
+ logger.error(c.red(`${c.bold(errorName)}: ${error.message}`));
10059
10216
  }
10060
10217
  function printStack(ctx, stack, highlight, errorProperties, onStack) {
10061
10218
  if (!stack.length)
10062
10219
  return;
10063
10220
  const logger = ctx.logger;
10064
10221
  for (const frame of stack) {
10065
- const color = frame === highlight ? picocolors.exports.yellow : picocolors.exports.gray;
10222
+ const color = frame === highlight ? c.yellow : c.gray;
10066
10223
  const path = relative(ctx.config.root, frame.file);
10067
- logger.error(color(` ${picocolors.exports.dim(F_POINTER)} ${[frame.method, picocolors.exports.dim(`${path}:${frame.line}:${frame.column}`)].filter(Boolean).join(" ")}`));
10224
+ logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${frame.line}:${frame.column}`)].filter(Boolean).join(" ")}`));
10068
10225
  onStack == null ? void 0 : onStack(frame);
10069
- if (frame.file in ctx.state.filesMap)
10070
- break;
10071
10226
  }
10072
10227
  logger.error();
10073
10228
  const hasProperties = Object.keys(errorProperties).length > 0;
10074
10229
  if (hasProperties) {
10075
- logger.error(picocolors.exports.red(picocolors.exports.dim(divider())));
10230
+ logger.error(c.red(c.dim(divider())));
10076
10231
  const propertiesString = stringify$5(errorProperties, 10, { printBasicPrototype: false });
10077
- logger.error(picocolors.exports.red(picocolors.exports.bold("Serialized Error:")), picocolors.exports.gray(propertiesString));
10232
+ logger.error(c.red(c.bold("Serialized Error:")), c.gray(propertiesString));
10078
10233
  }
10079
10234
  }
10080
10235
  function generateCodeFrame(source, indent = 0, lineNumber, columnNumber, range = 2) {
@@ -10086,7 +10241,7 @@ function generateCodeFrame(source, indent = 0, lineNumber, columnNumber, range =
10086
10241
  let res = [];
10087
10242
  const columns = ((_a = process.stdout) == null ? void 0 : _a.columns) || 80;
10088
10243
  function lineNo(no = "") {
10089
- return picocolors.exports.gray(`${String(no).padStart(3, " ")}| `);
10244
+ return c.gray(`${String(no).padStart(3, " ")}| `);
10090
10245
  }
10091
10246
  for (let i = 0; i < lines.length; i++) {
10092
10247
  count += lines[i].length + 1;
@@ -10101,11 +10256,11 @@ function generateCodeFrame(source, indent = 0, lineNumber, columnNumber, range =
10101
10256
  if (j === i) {
10102
10257
  const pad = start - (count - lineLength);
10103
10258
  const length = Math.max(1, end > count ? lineLength - pad : end - start);
10104
- res.push(lineNo() + " ".repeat(pad) + picocolors.exports.red("^".repeat(length)));
10259
+ res.push(lineNo() + " ".repeat(pad) + c.red("^".repeat(length)));
10105
10260
  } else if (j > i) {
10106
10261
  if (end > count) {
10107
10262
  const length = Math.max(1, Math.min(end - count, lineLength));
10108
- res.push(lineNo() + picocolors.exports.red("^".repeat(length)));
10263
+ res.push(lineNo() + c.red("^".repeat(length)));
10109
10264
  }
10110
10265
  count += lineLength + 1;
10111
10266
  }
@@ -10170,62 +10325,62 @@ class Logger {
10170
10325
  }
10171
10326
  printNoTestFound(filters) {
10172
10327
  const config = this.ctx.config;
10173
- const comma = picocolors.exports.dim(", ");
10328
+ const comma = c.dim(", ");
10174
10329
  if (filters == null ? void 0 : filters.length)
10175
- this.console.error(picocolors.exports.dim("filter: ") + picocolors.exports.yellow(filters.join(comma)));
10330
+ this.console.error(c.dim("filter: ") + c.yellow(filters.join(comma)));
10176
10331
  if (config.include)
10177
- this.console.error(picocolors.exports.dim("include: ") + picocolors.exports.yellow(config.include.join(comma)));
10332
+ this.console.error(c.dim("include: ") + c.yellow(config.include.join(comma)));
10178
10333
  if (config.exclude)
10179
- this.console.error(picocolors.exports.dim("exclude: ") + picocolors.exports.yellow(config.exclude.join(comma)));
10334
+ this.console.error(c.dim("exclude: ") + c.yellow(config.exclude.join(comma)));
10180
10335
  if (config.watchExclude)
10181
- this.console.error(picocolors.exports.dim("watch exclude: ") + picocolors.exports.yellow(config.watchExclude.join(comma)));
10336
+ this.console.error(c.dim("watch exclude: ") + c.yellow(config.watchExclude.join(comma)));
10182
10337
  if (config.passWithNoTests)
10183
10338
  this.log(`No ${config.mode} files found, exiting with code 0
10184
10339
  `);
10185
10340
  else
10186
- this.error(picocolors.exports.red(`
10341
+ this.error(c.red(`
10187
10342
  No ${config.mode} files found, exiting with code 1`));
10188
10343
  }
10189
10344
  printBanner() {
10190
10345
  var _a, _b, _c;
10191
10346
  this.log();
10192
- const versionTest = this.ctx.config.watch ? picocolors.exports.blue(`v${version}`) : picocolors.exports.cyan(`v${version}`);
10193
- const mode = this.ctx.config.watch ? picocolors.exports.blue(" DEV ") : picocolors.exports.cyan(" RUN ");
10194
- this.log(`${picocolors.exports.inverse(picocolors.exports.bold(mode))} ${versionTest} ${picocolors.exports.gray(this.ctx.config.root)}`);
10347
+ const versionTest = this.ctx.config.watch ? c.blue(`v${version}`) : c.cyan(`v${version}`);
10348
+ const mode = this.ctx.config.watch ? c.blue(" DEV ") : c.cyan(" RUN ");
10349
+ this.log(`${c.inverse(c.bold(mode))} ${versionTest} ${c.gray(this.ctx.config.root)}`);
10195
10350
  if (this.ctx.config.browser)
10196
- this.log(picocolors.exports.dim(picocolors.exports.green(` Browser runner started at http://${((_a = this.ctx.config.api) == null ? void 0 : _a.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}`)));
10351
+ this.log(c.dim(c.green(` Browser runner started at http://${((_a = this.ctx.config.api) == null ? void 0 : _a.host) || "localhost"}:${c.bold(`${this.ctx.server.config.server.port}`)}`)));
10197
10352
  else if (this.ctx.config.ui)
10198
- this.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((_b = this.ctx.config.api) == null ? void 0 : _b.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}${this.ctx.config.uiBase}`)));
10353
+ this.log(c.dim(c.green(` UI started at http://${((_b = this.ctx.config.api) == null ? void 0 : _b.host) || "localhost"}:${c.bold(`${this.ctx.server.config.server.port}`)}${this.ctx.config.uiBase}`)));
10199
10354
  else if (this.ctx.config.api)
10200
- this.log(picocolors.exports.dim(picocolors.exports.green(` API started at http://${((_c = this.ctx.config.api) == null ? void 0 : _c.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.config.api.port}`)}`)));
10355
+ this.log(c.dim(c.green(` API started at http://${((_c = this.ctx.config.api) == null ? void 0 : _c.host) || "localhost"}:${c.bold(`${this.ctx.config.api.port}`)}`)));
10201
10356
  if (this.ctx.coverageProvider)
10202
- this.log(picocolors.exports.dim(" Coverage enabled with ") + picocolors.exports.yellow(this.ctx.coverageProvider.name));
10357
+ this.log(c.dim(" Coverage enabled with ") + c.yellow(this.ctx.coverageProvider.name));
10203
10358
  this.log();
10204
10359
  }
10205
10360
  async printUnhandledErrors(errors) {
10206
- const errorMessage = picocolors.exports.red(picocolors.exports.bold(
10361
+ const errorMessage = c.red(c.bold(
10207
10362
  `
10208
10363
  Vitest caught ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run.
10209
10364
  This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.`
10210
10365
  ));
10211
- this.log(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Errors ")))));
10366
+ this.log(c.red(divider(c.bold(c.inverse(" Unhandled Errors ")))));
10212
10367
  this.log(errorMessage);
10213
10368
  await Promise.all(errors.map(async (err) => {
10214
10369
  await this.printError(err, true, err.type || "Unhandled Error");
10215
10370
  }));
10216
- this.log(picocolors.exports.red(divider()));
10371
+ this.log(c.red(divider()));
10217
10372
  }
10218
10373
  async printSourceTypeErrors(errors) {
10219
- const errorMessage = picocolors.exports.red(picocolors.exports.bold(
10374
+ const errorMessage = c.red(c.bold(
10220
10375
  `
10221
10376
  Vitest found ${errors.length} error${errors.length > 1 ? "s" : ""} not related to your test files.`
10222
10377
  ));
10223
- this.log(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Source Errors ")))));
10378
+ this.log(c.red(divider(c.bold(c.inverse(" Source Errors ")))));
10224
10379
  this.log(errorMessage);
10225
10380
  await Promise.all(errors.map(async (err) => {
10226
10381
  await this.printError(err, true);
10227
10382
  }));
10228
- this.log(picocolors.exports.red(divider()));
10383
+ this.log(c.red(divider()));
10229
10384
  }
10230
10385
  }
10231
10386
 
@@ -10263,7 +10418,7 @@ class Vitest {
10263
10418
  this.state = new StateManager();
10264
10419
  this.cache = new VitestCache();
10265
10420
  this.snapshot = new SnapshotManager({ ...resolved.snapshotOptions });
10266
- if (this.config.watch)
10421
+ if (this.config.watch && this.mode !== "typecheck")
10267
10422
  this.registerWatcher();
10268
10423
  this.vitenode = new ViteNodeServer(server, this.config);
10269
10424
  const node = this.vitenode;
@@ -10333,8 +10488,9 @@ class Vitest {
10333
10488
  this.configOverride || {}
10334
10489
  );
10335
10490
  }
10336
- async typecheck(filters) {
10337
- const testsFilesList = await this.globTestFiles(filters);
10491
+ async typecheck(filters = []) {
10492
+ const { include, exclude } = this.config.typecheck;
10493
+ const testsFilesList = await this.globFiles(filters, include, exclude);
10338
10494
  const checker = new Typechecker(this, testsFilesList);
10339
10495
  this.typechecker = checker;
10340
10496
  checker.onParseEnd(async ({ files, sourceErrors }) => {
@@ -10375,6 +10531,7 @@ class Vitest {
10375
10531
  await this.report("onTaskUpdate", checker.getTestPacks());
10376
10532
  await this.report("onCollected");
10377
10533
  });
10534
+ await checker.prepare();
10378
10535
  await checker.collectTests();
10379
10536
  await checker.start();
10380
10537
  }
@@ -10403,7 +10560,7 @@ class Vitest {
10403
10560
  await Promise.all(files.map((file) => this.cache.stats.updateStats(file)));
10404
10561
  await this.runFiles(files);
10405
10562
  if (this.coverageProvider) {
10406
- this.logger.log(picocolors.exports.blue(" % ") + picocolors.exports.dim("Coverage report from ") + picocolors.exports.yellow(this.coverageProvider.name));
10563
+ this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
10407
10564
  await this.coverageProvider.reportCoverage();
10408
10565
  }
10409
10566
  if (this.config.watch && !this.config.browser)
@@ -10430,13 +10587,13 @@ class Vitest {
10430
10587
  }
10431
10588
  async filterTestsBySource(tests) {
10432
10589
  if (this.config.changed && !this.config.related) {
10433
- const { VitestGit } = await import('./chunk-node-git.a90c0582.js');
10590
+ const { VitestGit } = await import('./chunk-node-git.125c9008.js');
10434
10591
  const vitestGit = new VitestGit(this.config.root);
10435
10592
  const related2 = await vitestGit.findChangedFiles({
10436
10593
  changedSince: this.config.changed
10437
10594
  });
10438
10595
  if (!related2) {
10439
- this.logger.error(picocolors.exports.red("Could not find Git root. Have you initialized git with `git init`?\n"));
10596
+ this.logger.error(c.red("Could not find Git root. Have you initialized git with `git init`?\n"));
10440
10597
  process.exit(1);
10441
10598
  }
10442
10599
  this.config.related = Array.from(new Set(related2));
@@ -10528,9 +10685,6 @@ class Vitest {
10528
10685
  }
10529
10686
  }
10530
10687
  async scheduleRerun(triggerId) {
10531
- const mod = this.server.moduleGraph.getModuleById(triggerId);
10532
- if (mod)
10533
- mod.lastHMRTimestamp = Date.now();
10534
10688
  const currentCount = this.restartsCount;
10535
10689
  safeClearTimeout(this._rerunTimer);
10536
10690
  await this.runningPromise;
@@ -10559,8 +10713,14 @@ class Vitest {
10559
10713
  }, WATCHER_DEBOUNCE);
10560
10714
  }
10561
10715
  registerWatcher() {
10716
+ const updateLastChanged = (id) => {
10717
+ const mod = this.server.moduleGraph.getModuleById(id);
10718
+ if (mod)
10719
+ mod.lastHMRTimestamp = Date.now();
10720
+ };
10562
10721
  const onChange = (id) => {
10563
10722
  id = slash$1(id);
10723
+ updateLastChanged(id);
10564
10724
  const needsRerun = this.handleFileChanged(id);
10565
10725
  if (needsRerun)
10566
10726
  this.scheduleRerun(id);
@@ -10578,6 +10738,7 @@ class Vitest {
10578
10738
  };
10579
10739
  const onAdd = async (id) => {
10580
10740
  id = slash$1(id);
10741
+ updateLastChanged(id);
10581
10742
  if (await this.isTargetFile(id)) {
10582
10743
  this.changedTests.add(id);
10583
10744
  await this.cache.stats.updateStats(id);
@@ -10640,8 +10801,10 @@ class Vitest {
10640
10801
  }
10641
10802
  async exit(force = false) {
10642
10803
  safeSetTimeout(() => {
10643
- console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
10644
- process.exit();
10804
+ this.report("onProcessTimeout").then(() => {
10805
+ console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
10806
+ process.exit();
10807
+ });
10645
10808
  }, this.config.teardownTimeout).unref();
10646
10809
  await this.close();
10647
10810
  if (force)
@@ -10656,8 +10819,7 @@ class Vitest {
10656
10819
  );
10657
10820
  }));
10658
10821
  }
10659
- async globTestFiles(filters = []) {
10660
- const { include, exclude, includeSource } = this.config;
10822
+ async globFiles(filters, include, exclude) {
10661
10823
  const globOptions = {
10662
10824
  absolute: true,
10663
10825
  dot: true,
@@ -10669,10 +10831,13 @@ class Vitest {
10669
10831
  filters = filters.map((f) => toNamespacedPath(f));
10670
10832
  if (filters.length)
10671
10833
  testFiles = testFiles.filter((i) => filters.some((f) => i.includes(f)));
10834
+ return testFiles;
10835
+ }
10836
+ async globTestFiles(filters = []) {
10837
+ const { include, exclude, includeSource } = this.config;
10838
+ const testFiles = await this.globFiles(filters, include, exclude);
10672
10839
  if (includeSource) {
10673
- let files = await out(includeSource, globOptions);
10674
- if (filters.length)
10675
- files = files.filter((i) => filters.some((f) => i.includes(f)));
10840
+ const files = await this.globFiles(filters, includeSource, exclude);
10676
10841
  await Promise.all(files.map(async (file) => {
10677
10842
  try {
10678
10843
  const code = await promises.readFile(file, "utf-8");
@@ -10798,7 +10963,7 @@ const GlobalSetupPlugin = (ctx) => {
10798
10963
  }
10799
10964
  } catch (e) {
10800
10965
  ctx.logger.error(`
10801
- ${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Error during global setup "))))}`);
10966
+ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
10802
10967
  await ctx.logger.printError(e);
10803
10968
  process.exit(1);
10804
10969
  }
@@ -10981,7 +11146,7 @@ function CSSEnablerPlugin(ctx) {
10981
11146
  })`;
10982
11147
  return { code };
10983
11148
  }
10984
- return { code: "" };
11149
+ return { code: 'export default ""' };
10985
11150
  }
10986
11151
  }
10987
11152
  ];
@@ -11018,7 +11183,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11018
11183
  this.meta.watchMode = false;
11019
11184
  },
11020
11185
  config(viteConfig) {
11021
- var _a, _b, _c;
11186
+ var _a, _b, _c, _d;
11022
11187
  const preOptions = deepMerge(
11023
11188
  {},
11024
11189
  configDefaults,
@@ -11059,6 +11224,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11059
11224
  else if (preOptions.browser)
11060
11225
  open = "/";
11061
11226
  const config = {
11227
+ root: ((_a = viteConfig.test) == null ? void 0 : _a.root) || options.root,
11062
11228
  esbuild: {
11063
11229
  sourcemap: "external",
11064
11230
  legalComments: "inline"
@@ -11079,10 +11245,10 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11079
11245
  preTransformRequests: false
11080
11246
  }
11081
11247
  };
11082
- 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);
11083
11249
  if (classNameStrategy !== "scoped") {
11084
11250
  config.css ?? (config.css = {});
11085
- (_c = config.css).modules ?? (_c.modules = {});
11251
+ (_d = config.css).modules ?? (_d.modules = {});
11086
11252
  config.css.modules.generateScopedName = (name, filename) => {
11087
11253
  const root = getRoot();
11088
11254
  return generateScopedClassName(classNameStrategy, name, relative(root, filename));
@@ -11124,7 +11290,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11124
11290
  try {
11125
11291
  await ctx.setServer(options, server);
11126
11292
  if (options.api && options.watch)
11127
- (await import('./chunk-api-setup.47a09f0f.js')).setup(ctx);
11293
+ (await import('./chunk-api-setup.2be3cc38.js')).setup(ctx);
11128
11294
  } catch (err) {
11129
11295
  ctx.logger.printError(err, true);
11130
11296
  process.exit(1);
@@ -11173,8 +11339,8 @@ const keys = [
11173
11339
  function printShortcutsHelp() {
11174
11340
  stdout().write(
11175
11341
  `
11176
- ${picocolors.exports.bold(" Watch Usage")}
11177
- ${keys.map((i) => picocolors.exports.dim(" press ") + picocolors.exports.reset(picocolors.exports.bold(i[0])) + picocolors.exports.dim(` to ${i[1]}`)).join("\n")}
11342
+ ${c.bold(" Watch Usage")}
11343
+ ${keys.map((i) => c.dim(" press ") + c.reset(c.bold(i[0])) + c.dim(` to ${i[1]}`)).join("\n")}
11178
11344
  `
11179
11345
  );
11180
11346
  }