vitest 5.1.1 → 5.1.2

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.
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.9iqXE2gN.js';
2
2
  export { p as collectTests, a as processError, s as startTests } from './chunks/run.zBhXlcZQ.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.wwc_NYRJ.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.kEGtNVHG.js';
4
4
  export { s as SpyModule } from './chunks/spy.BO0hTE3G.js';
5
5
  export { f as format, i as inspect, s as stringify } from './chunks/display.Cj2h2zsY.js';
6
6
  export { g as getType } from './chunks/pathe.M-eThtNZ.zq3TM4NT.js';
@@ -1,6 +1,6 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import { s as spyModule } from './spy.BO0hTE3G.js';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.Da_szXbS.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.BSqmIH9v.js';
4
4
  import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.dGO4K2C0.js';
5
5
  import { n as nativeImports, g as getEvaluatedImports, c as collectDependencies } from './module-dependencies._2Eei3FO.js';
6
6
  import { Traces } from '../traces.js';
@@ -8,7 +8,7 @@ import { V as VitestEvaluatedModules } from './index.CAmut2NG.js';
8
8
  import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.C7Nn66Gy.js';
9
9
  import { performance as performance$1 } from 'node:perf_hooks';
10
10
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.9iqXE2gN.js';
11
- import { i as index, g as globalExpect, v as vi } from './index.DNcttN5a.js';
11
+ import { i as index, g as globalExpect, v as vi } from './index.D5jWOaqm.js';
12
12
  import { c as closeInspector } from './inspector.D6o1NPo1.js';
13
13
  import { s as startTests, p as publicCollect } from './run.zBhXlcZQ.js';
14
14
  import { createRequire, syncBuiltinESMExports } from 'node:module';
@@ -16,7 +16,7 @@ import timers from 'node:timers';
16
16
  import timersPromises from 'node:timers/promises';
17
17
  import util from 'node:util';
18
18
  import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.zq3TM4NT.js';
19
- import { s as setupCommonEnv, b as setupEnv } from './setup-common.wwc_NYRJ.js';
19
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.kEGtNVHG.js';
20
20
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
21
21
 
22
22
  // this should only be used in Node
@@ -59,7 +59,7 @@ function resolveAsset(mod, url) {
59
59
  mod.exports = url;
60
60
  }
61
61
  async function setupConsoleLogSpy() {
62
- const { createCustomConsole } = await import('./console.VJUxd1rM.js');
62
+ const { createCustomConsole } = await import('./console.DdxlsSsm.js');
63
63
  globalThis.console = createCustomConsole();
64
64
  }
65
65
 
@@ -620,7 +620,7 @@ class CAC extends EventEmitter {
620
620
 
621
621
  const cac = (name = "") => new CAC(name);
622
622
 
623
- var version = "5.1.1";
623
+ var version = "5.1.2";
624
624
 
625
625
  const apiConfig = (port) => ({
626
626
  port: {
@@ -2383,7 +2383,7 @@ function normalizeCliOptions(cliFilters, argv) {
2383
2383
  }
2384
2384
  async function start(cliFilters, options) {
2385
2385
  try {
2386
- const { startVitest } = await import('./cli-api.D6E8EtSi.js').then(function (n) { return n.j; });
2386
+ const { startVitest } = await import('./cli-api.9v9AxcPO.js').then(function (n) { return n.j; });
2387
2387
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2388
2388
  if (!ctx.shouldKeepServer()) await ctx.exit();
2389
2389
  } catch (e) {
@@ -2397,7 +2397,7 @@ async function start(cliFilters, options) {
2397
2397
  }
2398
2398
  async function doctorCommand(cliFilters, options) {
2399
2399
  try {
2400
- const { doctor } = await import('./doctor.SRjZIZuA.js');
2400
+ const { doctor } = await import('./doctor.DBFXC86z.js');
2401
2401
  await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2402
2402
  process.exit();
2403
2403
  } catch (e) {
@@ -2414,12 +2414,12 @@ async function init(project) {
2414
2414
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2415
2415
  process.exit(1);
2416
2416
  }
2417
- const { create } = await import('./creator.CoOCr85O.js');
2417
+ const { create } = await import('./creator.B-BIoERb.js');
2418
2418
  await create();
2419
2419
  }
2420
2420
  async function collect(cliFilters, options) {
2421
2421
  try {
2422
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.D6E8EtSi.js').then(function (n) { return n.j; });
2422
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.9v9AxcPO.js').then(function (n) { return n.j; });
2423
2423
  const ctx = await prepareVitest({
2424
2424
  ...normalizeCliOptions(cliFilters, options),
2425
2425
  watch: false,
@@ -1,22 +1,23 @@
1
1
  import * as fs from 'node:fs';
2
2
  import fs__default, { promises, existsSync, writeFileSync, mkdirSync, readFileSync, statSync, readdirSync } from 'node:fs';
3
3
  import { r as resolveCoverageProviderModule, g as getCoverageFilesDirectory, C as CoverageProviderMap } from './coverage.jGCktcGP.js';
4
- import { o as parse, s as stringify, k as isFileServingAllowed, q as getSpecificationDocblock, t as resolveStaticMocks, u as getStaticMocks, f as createDebugger, v as resolveCoverageReporters, w as createIndexLocationsMap, x as getOutputFile, y as groupBy, z as generateCodeFrame, A as printStack, R as RangeLocationFilterProvidedError, I as IncludeTaskLocationDisabledError, C as LocationFilterFileNotFoundError, D as GitCommandError, G as GitNotFoundError, E as VitestResolver, M as ModuleTransformService, l as resolveConfig$1, H as createClusterServer, S as ServerModuleRunner, J as attachProjectsFromEntries, K as TestProject, N as resolveAndAttachProjects, O as RandomSequencer, b as FilesNotFoundError, Q as createPool, U as astCollectTests, W as createFailedFileTask, X as matchesProjectFilter, Y as nanoid, L as Logger, V as VitestPackageInstaller, P as PluginHarness, Z as stdout, p as prompt } from './index.ER9afepi.js';
4
+ import { o as parse, s as stringify, k as isFileServingAllowed, q as getSpecificationDocblock, t as resolveStaticMocks, u as getStaticMocks, f as createDebugger, v as resolveCoverageReporters, w as createIndexLocationsMap, x as getOutputFile, y as groupBy, z as generateCodeFrame, A as printStack, R as RangeLocationFilterProvidedError, I as IncludeTaskLocationDisabledError, C as LocationFilterFileNotFoundError, D as GitCommandError, G as GitNotFoundError, E as VitestResolver, M as ModuleTransformService, l as resolveConfig$1, H as createClusterServer, S as ServerModuleRunner, J as attachProjectsFromEntries, K as TestProject, N as resolveAndAttachProjects, O as RandomSequencer, b as FilesNotFoundError, Q as createPool, U as astCollectTests, W as createFailedFileTask, X as matchesProjectFilter, Y as nanoid, L as Logger, V as VitestPackageInstaller, P as PluginHarness, Z as stdout, p as prompt } from './index.6pLw0FLK.js';
5
5
  import { readFile, writeFile, rename, stat, unlink, rm, mkdir, readdir, copyFile } from 'node:fs/promises';
6
6
  import os__default, { tmpdir, hostname } from 'node:os';
7
7
  import { j as join, b as basename, d as dirname, i as isAbsolute, r as resolve, D as noop, e as createDefer, c as cleanUrl, a as relative, s as slash, F as sanitizeFilePath, t as toArray, x as ordinal, G as deepMerge, p as isPrimitive, k as extname, n as normalize$1, u as deepClone } from './pathe.M-eThtNZ.zq3TM4NT.js';
8
8
  import { T as TraceMap, o as originalPositionFor, p as parseStacktrace, e as parseErrorStacktrace, b as serializeValue } from './source-map.DPHGMWvM.js';
9
- import { v as version } from './cac.BK306qhQ.js';
9
+ import { v as version } from './cac.DnNTZKhD.js';
10
10
  import { performance as performance$1 } from 'node:perf_hooks';
11
11
  import { c as createBirpc } from './index.CAmut2NG.js';
12
12
  import require$$0$4 from 'events';
13
13
  import require$$1$1 from 'https';
14
14
  import require$$0 from 'http';
15
15
  import require$$3 from 'net';
16
- import require$$4 from 'tls';
16
+ import require$$4 from 'querystring';
17
+ import require$$5 from 'tls';
17
18
  import require$$1 from 'crypto';
18
19
  import require$$0$3 from 'stream';
19
- import require$$7 from 'url';
20
+ import require$$8 from 'url';
20
21
  import require$$0$1 from 'zlib';
21
22
  import require$$0$2 from 'buffer';
22
23
  import require$$2 from 'util';
@@ -1576,6 +1577,14 @@ function requireReceiver () {
1576
1577
  }
1577
1578
  }
1578
1579
 
1580
+ //
1581
+ // The mask is a view into the buffer the stream delivered, which is commonly
1582
+ // 64 KiB, and it is not needed once the payload above has been unmasked.
1583
+ // Leaving it set would pin that whole buffer until the next frame arrives,
1584
+ // which on an idle connection can be indefinitely.
1585
+ //
1586
+ this._mask = undefined;
1587
+
1579
1588
  if (this._opcode > 0x07) {
1580
1589
  this.controlMessage(data, cb);
1581
1590
  return;
@@ -2966,10 +2975,11 @@ function requireWebsocket () {
2966
2975
  const https = require$$1$1;
2967
2976
  const http = require$$0;
2968
2977
  const net = require$$3;
2969
- const tls = require$$4;
2978
+ const querystring = require$$4;
2979
+ const tls = require$$5;
2970
2980
  const { randomBytes, createHash } = require$$1;
2971
2981
  const { Duplex, Readable } = require$$0$3;
2972
- const { URL } = require$$7;
2982
+ const { URL } = require$$8;
2973
2983
 
2974
2984
  const PerMessageDeflate = requirePermessageDeflate();
2975
2985
  const Receiver = requireReceiver();
@@ -3058,12 +3068,19 @@ function requireWebsocket () {
3058
3068
  }
3059
3069
  }
3060
3070
 
3061
- initAsClient(this, address, protocols, options);
3071
+ options = initAsClient(this, address, protocols, options);
3062
3072
  } else {
3063
- this._autoPong = options.autoPong;
3064
- this._closeTimeout = options.closeTimeout;
3065
3073
  this._isServer = true;
3066
3074
  }
3075
+
3076
+ if (options.autoPong) {
3077
+ this._autoPong = true;
3078
+ this._autoPongComplete = () => autoPongComplete(this);
3079
+ this._pendingAutoPongs = 0;
3080
+ this._maxPendingAutoPongs = options.maxPendingAutoPongs | 0;
3081
+ }
3082
+
3083
+ this._closeTimeout = options.closeTimeout;
3067
3084
  }
3068
3085
 
3069
3086
  /**
@@ -3625,6 +3642,8 @@ function requireWebsocket () {
3625
3642
  * fragments
3626
3643
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3627
3644
  * size
3645
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
3646
+ * pending automatic pongs
3628
3647
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
3629
3648
  * allowed
3630
3649
  * @param {String} [options.origin] Value of the `Origin` or
@@ -3635,6 +3654,7 @@ function requireWebsocket () {
3635
3654
  * `Sec-WebSocket-Version` header
3636
3655
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
3637
3656
  * not to skip UTF-8 validation for text and close messages
3657
+ * @return {Object} The resolved options object used for initialization
3638
3658
  * @private
3639
3659
  */
3640
3660
  function initAsClient(websocket, address, protocols, options) {
@@ -3646,6 +3666,7 @@ function requireWebsocket () {
3646
3666
  maxBufferedChunks: 256 * 1024,
3647
3667
  maxFragments: 16 * 1024,
3648
3668
  maxPayload: 100 * 1024 * 1024,
3669
+ maxPendingAutoPongs: 60,
3649
3670
  skipUTF8Validation: false,
3650
3671
  perMessageDeflate: true,
3651
3672
  followRedirects: false,
@@ -3662,9 +3683,6 @@ function requireWebsocket () {
3662
3683
  port: undefined
3663
3684
  };
3664
3685
 
3665
- websocket._autoPong = opts.autoPong;
3666
- websocket._closeTimeout = opts.closeTimeout;
3667
-
3668
3686
  if (!protocolVersions.includes(opts.protocolVersion)) {
3669
3687
  throw new RangeError(
3670
3688
  `Unsupported protocol version: ${opts.protocolVersion} ` +
@@ -3684,10 +3702,9 @@ function requireWebsocket () {
3684
3702
  }
3685
3703
  }
3686
3704
 
3687
- if (parsedUrl.protocol === 'http:') {
3688
- parsedUrl.protocol = 'ws:';
3689
- } else if (parsedUrl.protocol === 'https:') {
3690
- parsedUrl.protocol = 'wss:';
3705
+ if (parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:') {
3706
+ parsedUrl = new URL(parsedUrl);
3707
+ parsedUrl.protocol = parsedUrl.protocol === 'http:' ? 'ws:' : 'wss:';
3691
3708
  }
3692
3709
 
3693
3710
  websocket._url = parsedUrl.href;
@@ -3775,7 +3792,10 @@ function requireWebsocket () {
3775
3792
  }
3776
3793
  }
3777
3794
  if (parsedUrl.username || parsedUrl.password) {
3778
- opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
3795
+ const username = querystring.unescape(parsedUrl.username);
3796
+ const password = querystring.unescape(parsedUrl.password);
3797
+
3798
+ opts.auth = `${username}:${password}`;
3779
3799
  }
3780
3800
 
3781
3801
  if (isIpcUrl) {
@@ -4020,6 +4040,8 @@ function requireWebsocket () {
4020
4040
  } else {
4021
4041
  req.end();
4022
4042
  }
4043
+
4044
+ return opts;
4023
4045
  }
4024
4046
 
4025
4047
  /**
@@ -4148,9 +4170,20 @@ function requireWebsocket () {
4148
4170
  const websocket = this[kWebSocket];
4149
4171
 
4150
4172
  websocket._closeFrameReceived = true;
4151
- websocket._closeMessage = reason;
4152
4173
  websocket._closeCode = code;
4153
4174
 
4175
+ //
4176
+ // The reason is a view into the buffer the socket delivered. Copy it so that
4177
+ // the `WebSocket` does not keep that buffer alive. The copy is not pooled
4178
+ // because a pooled one would keep the pool alive in the same way.
4179
+ //
4180
+ if (reason.length === 0) {
4181
+ websocket._closeMessage = EMPTY_BUFFER;
4182
+ } else {
4183
+ websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
4184
+ websocket._closeMessage.set(reason);
4185
+ }
4186
+
4154
4187
  if (websocket._socket[kWebSocket] === undefined) return;
4155
4188
 
4156
4189
  websocket._socket.removeListener('data', socketOnData);
@@ -4227,10 +4260,31 @@ function requireWebsocket () {
4227
4260
  function receiverOnPing(data) {
4228
4261
  const websocket = this[kWebSocket];
4229
4262
 
4230
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
4263
+ if (websocket._autoPong && websocket.readyState === WebSocket.OPEN) {
4264
+ if (
4265
+ websocket._maxPendingAutoPongs > 0 &&
4266
+ websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs
4267
+ ) {
4268
+ websocket.terminate();
4269
+ } else {
4270
+ websocket._pendingAutoPongs++;
4271
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
4272
+ }
4273
+ }
4274
+
4231
4275
  websocket.emit('ping', data);
4232
4276
  }
4233
4277
 
4278
+ /**
4279
+ * The callback for automatic pong responses.
4280
+ *
4281
+ * @param {WebSocket} websocket The WebSocket instance
4282
+ * @private
4283
+ */
4284
+ function autoPongComplete(websocket) {
4285
+ websocket._pendingAutoPongs--;
4286
+ }
4287
+
4234
4288
  /**
4235
4289
  * The listener of the `Receiver` `'pong'` event.
4236
4290
  *
@@ -4697,6 +4751,8 @@ function requireWebsocketServer () {
4697
4751
  * fragments
4698
4752
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
4699
4753
  * size
4754
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
4755
+ * pending automatic pongs
4700
4756
  * @param {Boolean} [options.noServer=false] Enable no server mode
4701
4757
  * @param {String} [options.path] Accept only connections matching this path
4702
4758
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -4720,6 +4776,7 @@ function requireWebsocketServer () {
4720
4776
  maxBufferedChunks: 256 * 1024,
4721
4777
  maxFragments: 16 * 1024,
4722
4778
  maxPayload: 100 * 1024 * 1024,
4779
+ maxPendingAutoPongs: 60,
4723
4780
  skipUTF8Validation: false,
4724
4781
  perMessageDeflate: false,
4725
4782
  handleProtocols: null,
@@ -12353,10 +12410,17 @@ var mime = new Mime(types)._freeze();
12353
12410
 
12354
12411
  class TestRun {
12355
12412
  vitest;
12413
+ externalSourceMaps = /* @__PURE__ */ new Map();
12414
+ // the first project that attached each file in this run
12415
+ attachmentProjects = /* @__PURE__ */ new Map();
12416
+ warnedProjectPairs = /* @__PURE__ */ new Set();
12356
12417
  constructor(vitest) {
12357
12418
  this.vitest = vitest;
12358
12419
  }
12359
12420
  async start(specifications) {
12421
+ this.externalSourceMaps.clear();
12422
+ this.attachmentProjects.clear();
12423
+ this.warnedProjectPairs.clear();
12360
12424
  const filepaths = specifications.map((spec) => spec.moduleId);
12361
12425
  this.vitest.state.collectPaths(filepaths);
12362
12426
  await this.vitest.report("onTestRunStart", [...specifications]);
@@ -12401,7 +12465,7 @@ class TestRun {
12401
12465
  for (const entry of entries) if (entry.stack && !entry.location) {
12402
12466
  const [stack] = isBrowser ? project.browser?.parseStacktrace(entry.stack, { firstOnly: true }) || [] : parseStacktrace(entry.stack, {
12403
12467
  firstOnly: true,
12404
- getSourceMap: (file) => getExternalSourceMap(project, file)
12468
+ getSourceMap: (file) => this.getExternalSourceMap(project, file)
12405
12469
  });
12406
12470
  if (stack) entry.location = {
12407
12471
  file: stack.file,
@@ -12453,17 +12517,32 @@ class TestRun {
12453
12517
  update.forEach(([taskId, result]) => {
12454
12518
  const task = this.vitest.state.idMap.get(taskId);
12455
12519
  const isBrowser = task && task.file.pool === "browser";
12456
- result?.errors?.forEach((error) => {
12520
+ // the worker sends all errors of the task again in each update
12521
+ const previous = task?.result;
12522
+ result?.errors?.forEach((error, i) => {
12457
12523
  if (isPrimitive(error)) return;
12524
+ const parsed = previous?.errors?.[i];
12525
+ if (error.stack && parsed?.stacks && parsed.stack === error.stack) {
12526
+ error.stacks = parsed.stacks;
12527
+ return;
12528
+ }
12458
12529
  const project = this.vitest.getProjectByName(task.file.projectName || "");
12459
12530
  if (isBrowser) error.stacks = project.browser?.parseErrorStacktrace(error, { frameFilter: project.config.onStackTrace }) || [];
12460
12531
  else error.stacks = parseErrorStacktrace(error, {
12461
12532
  frameFilter: project.config.onStackTrace,
12462
- getSourceMap: (file) => getExternalSourceMap(project, file)
12533
+ getSourceMap: (file) => this.getExternalSourceMap(project, file)
12463
12534
  });
12464
12535
  });
12465
12536
  });
12466
12537
  }
12538
+ getExternalSourceMap(project, file) {
12539
+ if (project.vite.moduleGraph.getModuleById(file)?.transformResult) return;
12540
+ if (!this.externalSourceMaps.has(file)) {
12541
+ const map = existsSync(file) ? extractSourcemapFromFile(readFileSync(file, "utf-8"), file)?.map : void 0;
12542
+ this.externalSourceMaps.set(file, map);
12543
+ }
12544
+ return this.externalSourceMaps.get(file);
12545
+ }
12467
12546
  async reportEvent(id, event, data) {
12468
12547
  const task = this.vitest.state.idMap.get(id);
12469
12548
  const entity = task && this.vitest.state.getReportedEntity(task);
@@ -12518,7 +12597,8 @@ class TestRun {
12518
12597
  if (path && !path.startsWith("http://") && !path.startsWith("https://")) {
12519
12598
  const currentPath = resolve(project.config.root, path);
12520
12599
  const hash = createHash("sha1").update(currentPath).digest("hex");
12521
- const newPath = resolve(project.config.attachmentsDir, `${filename ? `${sanitizeFilePath(filename)}-` : ""}${hash}${extname(currentPath)}`);
12600
+ const suffix = this.getProjectSuffix(project, currentPath);
12601
+ const newPath = resolve(project.config.attachmentsDir, `${filename ? `${sanitizeFilePath(filename)}-` : ""}${hash}${suffix}${extname(currentPath)}`);
12522
12602
  if (!existsSync(project.config.attachmentsDir)) await mkdir(project.config.attachmentsDir, { recursive: true });
12523
12603
  await copyFile(currentPath, newPath);
12524
12604
  attachment.path = newPath;
@@ -12526,6 +12606,22 @@ class TestRun {
12526
12606
  }
12527
12607
  return attachment;
12528
12608
  }
12609
+ // the copies of a file that other projects attach get the project name,
12610
+ // so each project keeps its own copy
12611
+ getProjectSuffix(project, path) {
12612
+ const firstProject = this.attachmentProjects.get(path);
12613
+ if (firstProject === void 0) {
12614
+ this.attachmentProjects.set(path, project.name);
12615
+ return "";
12616
+ }
12617
+ if (firstProject === project.name) return "";
12618
+ const pair = `${firstProject}\0${project.name}`;
12619
+ if (!this.warnedProjectPairs.has(pair)) {
12620
+ this.warnedProjectPairs.add(pair);
12621
+ this.vitest.logger.warn(withLabel("yellow", "Vitest", `The projects "${firstProject}" and "${project.name}" attach the same file "${relative(this.vitest.config.root, path)}", so they can overwrite each other's file. Save the file to a different path in each project.`));
12622
+ }
12623
+ return `-${sanitizeFilePath(project.name)}`;
12624
+ }
12529
12625
  async reportChildren(children) {
12530
12626
  for (const child of children) if (child.type === "test") {
12531
12627
  await this.vitest.report("onTestCaseReady", child);
@@ -12537,12 +12633,6 @@ class TestRun {
12537
12633
  }
12538
12634
  }
12539
12635
  }
12540
- function getExternalSourceMap(project, file) {
12541
- if (!project.vite.moduleGraph.getModuleById(file)?.transformResult && existsSync(file)) {
12542
- const code = readFileSync(file, "utf-8");
12543
- return extractSourcemapFromFile(code, file)?.map;
12544
- }
12545
- }
12546
12636
 
12547
12637
  class GitVCSProvider {
12548
12638
  root;
@@ -13558,7 +13648,17 @@ class Vitest {
13558
13648
  this.snapshot.clear();
13559
13649
  this.state.clearErrors();
13560
13650
  if (!this.isFirstRun && this._coverageOptions.cleanOnRerun) await this.coverageProvider?.clean();
13561
- await this.initializeGlobalSetup(specs);
13651
+ try {
13652
+ await this.initializeGlobalSetup(specs);
13653
+ } catch (err) {
13654
+ // record the error before `finally` ends the run, otherwise
13655
+ // reporters see no modules and print "No test files found"
13656
+ this.state.catchError(err, "Unhandled Error");
13657
+ return {
13658
+ testModules: [],
13659
+ unhandledErrors: this.state.getUnhandledErrors()
13660
+ };
13661
+ }
13562
13662
  try {
13563
13663
  const sorted = await this.getSequencer().sort(specs);
13564
13664
  await this.pool.runTests(sorted, invalidates);
@@ -85,7 +85,7 @@ function createCustomConsole(defaultState) {
85
85
  }
86
86
  const stdout = new Writable({ write(data, encoding, callback) {
87
87
  const s = state();
88
- const id = s?.current?.id || s?.current?.suite?.id || s.current?.file.id || getTaskIdByStack(s.config.root);
88
+ const id = s.current?.id || getTaskIdByStack(s.config.root);
89
89
  let timer = timers.get(id);
90
90
  if (timer) timer.stdoutTime = timer.stdoutTime || RealDate.now();
91
91
  else {
@@ -112,7 +112,7 @@ function createCustomConsole(defaultState) {
112
112
  } });
113
113
  const stderr = new Writable({ write(data, encoding, callback) {
114
114
  const s = state();
115
- const id = s?.current?.id || s?.current?.suite?.id || s.current?.file.id || getTaskIdByStack(s.config.root);
115
+ const id = s.current?.id || getTaskIdByStack(s.config.root);
116
116
  let timer = timers.get(id);
117
117
  if (timer) timer.stderrTime = timer.stderrTime || RealDate.now();
118
118
  else {
@@ -1,8 +1,8 @@
1
1
  import { existsSync, writeFileSync, readFileSync } from 'node:fs';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { resolve, dirname, relative } from 'node:path';
4
- import { detectPackageManager, installPackage } from './index.BoyTG_B7.js';
5
- import { p as prompt, n as findConfigFile } from './index.ER9afepi.js';
4
+ import { detectPackageManager, installPackage } from './dist.BoyTG_B7.js';
5
+ import { p as prompt, n as findConfigFile } from './index.6pLw0FLK.js';
6
6
  import { x } from 'tinyexec';
7
7
  import { $ } from './tinyrainbow.Do8I1XRG.js';
8
8
  import 'node:process';
@@ -50,7 +50,7 @@ import './coverage.jGCktcGP.js';
50
50
  import 'node:tty';
51
51
  import 'node:events';
52
52
  import 'node:worker_threads';
53
- import './cac.BK306qhQ.js';
53
+ import './cac.DnNTZKhD.js';
54
54
  import 'events';
55
55
  import 'readline';
56
56
 
@@ -100,7 +100,7 @@ function log(...args) {
100
100
  console.log(...args);
101
101
  }
102
102
  async function doctor(cliFilters, options) {
103
- const { prepareVitest } = await import('./cli-api.D6E8EtSi.js').then(function (n) { return n.j; });
103
+ const { prepareVitest } = await import('./cli-api.9v9AxcPO.js').then(function (n) { return n.j; });
104
104
  log();
105
105
  log($.inverse($.bold($.blue(" DOCTOR "))), "resolving the current configuration...");
106
106
  const ctx = await prepareVitest({
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from './constants.DLYM6cZY.js';
2
- import { i as index } from './index.DNcttN5a.js';
2
+ import { i as index } from './index.D5jWOaqm.js';
3
3
  import './run.zBhXlcZQ.js';
4
4
  import './index.Or9psEGe.js';
5
5
  import './tinyrainbow.Do8I1XRG.js';
@@ -46,7 +46,7 @@ import process$1 from 'node:process';
46
46
  import { isatty } from 'node:tty';
47
47
  import EventEmitter$1, { EventEmitter } from 'node:events';
48
48
  import { Worker } from 'node:worker_threads';
49
- import { v as version$1 } from './cac.BK306qhQ.js';
49
+ import { v as version$1 } from './cac.DnNTZKhD.js';
50
50
  import { g as getDefaultExportFromCjs } from './index.Or9psEGe.js';
51
51
  import require$$0 from 'readline';
52
52
  import require$$0$1 from 'events';
@@ -5533,7 +5533,9 @@ function startWatchdog(distPath) {
5533
5533
  });
5534
5534
  // must never keep the main process alive
5535
5535
  child.unref();
5536
- child.channel?.unref();
5536
+ // Bun has no `channel.unref`
5537
+ // Revert when https://github.com/oven-sh/bun/issues/33593 is done
5538
+ child.channel?.unref?.();
5537
5539
  // losing the watchdog only loses the cleanup, the test run is not affected
5538
5540
  child.on("error", () => {});
5539
5541
  child.once("exit", () => {
@@ -5598,7 +5600,6 @@ class ForksPoolWorker {
5598
5600
  serialization: "advanced"
5599
5601
  });
5600
5602
  this._fork.on("error", this.emitError);
5601
- watchProcess(this._fork, this.distPath);
5602
5603
  // `end: false`: the logger streams are shared by every worker, so one
5603
5604
  // ending worker stream must not end them for everyone else
5604
5605
  if (this._fork.stdout) {
@@ -5609,6 +5610,7 @@ class ForksPoolWorker {
5609
5610
  this.stderr.setMaxListeners(1 + this.stderr.getMaxListeners());
5610
5611
  this._fork.stderr.pipe(this.stderr, { end: false });
5611
5612
  }
5613
+ watchProcess(this._fork, this.distPath);
5612
5614
  }
5613
5615
  async stop() {
5614
5616
  const fork = this.fork;
@@ -6053,7 +6055,7 @@ class Pool {
6053
6055
  // Runner termination can also already start from task cancellation.
6054
6056
  if (!runner.isTerminated) {
6055
6057
  const id = setTimeout(() => this.logger.error(`[vitest-pool]: Timeout terminating ${task.worker} worker for test files ${formatFiles(task)}.`), this.options.teardownTimeout);
6056
- this.exitPromises.push(runner.stop({ force: resolver.isRejected }).then(() => clearTimeout(id)).catch((error) => this.logger.error(`[vitest-pool]: Failed to terminate ${task.worker} worker for test files ${formatFiles(task)}.`, error)));
6058
+ this.exitPromises.push(runner.stop({ force: resolver.isRejected }).finally(() => clearTimeout(id)).catch((error) => this.logger.error(`[vitest-pool]: Failed to terminate ${task.worker} worker for test files ${formatFiles(task)}.`, error)));
6057
6059
  }
6058
6060
  workerIds.set(poolId, true);
6059
6061
  }
@@ -8768,7 +8770,7 @@ class VitestPackageInstaller {
8768
8770
  });
8769
8771
  if (install) {
8770
8772
  const packageName = version ? `${dependency}@${version}` : dependency;
8771
- await (await import('./index.BoyTG_B7.js')).installPackage(packageName, { dev: true });
8773
+ await (await import('./dist.BoyTG_B7.js')).installPackage(packageName, { dev: true });
8772
8774
  // TODO: somehow it fails to load the package after installation, remove this when it's fixed
8773
8775
  process.stderr.write($.yellow(`\nPackage ${packageName} installed, re-run the command to start.\n`));
8774
8776
  process.exit();
@@ -9060,7 +9062,12 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
9060
9062
  }
9061
9063
  }
9062
9064
  // CLI options are merged into the test config
9063
- if (options.sinceLastRun) {
9065
+ const { sinceLastRun } = options;
9066
+ if (options.related && (resolved.changed || sinceLastRun)) {
9067
+ const flag = sinceLastRun ? "--since-last-run" : "--changed";
9068
+ throw new Error(`The "${flag}" flag cannot be used with "vitest related". Use "vitest run ${flag}" to run the tests affected by the changed files, or "vitest related <files>" to run the tests affected by the given files.`);
9069
+ }
9070
+ if (sinceLastRun) {
9064
9071
  if (resolved.cache === false) throw new Error("The \"--since-last-run\" flag requires the \"cache\" option to store the dependencies of the test files.");
9065
9072
  resolved.changed ||= true;
9066
9073
  resolved.experimental ??= {};
@@ -2,9 +2,9 @@ import * as chai from 'chai';
2
2
  import { createHook } from 'node:async_hooks';
3
3
  import { t as takeCoverageInsideWorker } from './coverage.9iqXE2gN.js';
4
4
  import { r as rpc } from './rpc.CNYWPa97.js';
5
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.wwc_NYRJ.js';
5
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.kEGtNVHG.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import { T as TestRunner } from './index.DNcttN5a.js';
7
+ import { T as TestRunner } from './index.D5jWOaqm.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -128,7 +128,8 @@ class SnapshotState {
128
128
  const name = keyToTestName(key);
129
129
  const count = this._counters.get(name);
130
130
  if (count > 0) {
131
- if (key in this._snapshotData || key in this._initialData) this._snapshotData[key] = this._initialData[key];
131
+ if (key in this._initialData) this._snapshotData[key] = this._initialData[key];
132
+ else delete this._snapshotData[key];
132
133
  this._counters.set(name, count - 1);
133
134
  }
134
135
  }
@@ -1043,7 +1044,8 @@ function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey) {
1043
1044
  function keys(obj, hasKey) {
1044
1045
  const keys = [];
1045
1046
  for (const key in obj) if (hasKey(obj, key)) keys.push(key);
1046
- return keys.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
1047
+ for (const symbol of Object.getOwnPropertySymbols(obj)) if (Object.getOwnPropertyDescriptor(obj, symbol).enumerable) keys.push(symbol);
1048
+ return keys;
1047
1049
  }
1048
1050
  function hasDefinedKey(obj, key) {
1049
1051
  return hasKey(obj, key) && obj[key] !== void 0;
@@ -1331,7 +1331,32 @@ interface Report {
1331
1331
  delete: (filename: string) => Promise<void>;
1332
1332
  }
1333
1333
 
1334
- //#region src/tree.d.ts
1334
+ type PathParser = (path: string) => path.ParsedPath;
1335
+ declare class Path {
1336
+ v: string[];
1337
+ readonly length: number;
1338
+ push: (...items: string[]) => number;
1339
+ pop: () => string | undefined;
1340
+ shift: () => string | undefined;
1341
+ unshift: (...items: string[]) => number;
1342
+ splice: (start: number, deleteCount?: number, ...items: string[]) => string[];
1343
+ constructor(strOrArray: string | string[]);
1344
+ toString(): string;
1345
+ hasParent(): boolean;
1346
+ parent(): Path;
1347
+ elements(): string[];
1348
+ name(): string;
1349
+ contains(other: Path): boolean;
1350
+ ancestorOf(other: Path): boolean;
1351
+ descendantOf(other: Path): boolean;
1352
+ commonPrefixPath(other: Path): Path;
1353
+ static compare(a: Path, b: Path): number;
1354
+ static tester: {
1355
+ setParserAndSep(p: PathParser, sep: string): void;
1356
+ reset(): void;
1357
+ };
1358
+ }
1359
+
1335
1360
  /**
1336
1361
  * A partial visitor only having the functions of interest to the caller.
1337
1362
  *
@@ -1391,34 +1416,6 @@ declare abstract class BaseNode {
1391
1416
  visit(visitor: Visitor<any>, state?: any): void;
1392
1417
  }
1393
1418
 
1394
- //#region src/path.d.ts
1395
- type PathParser = (path: string) => path.ParsedPath;
1396
- declare class Path {
1397
- v: string[];
1398
- readonly length: number;
1399
- push: (...items: string[]) => number;
1400
- pop: () => string | undefined;
1401
- shift: () => string | undefined;
1402
- unshift: (...items: string[]) => number;
1403
- splice: (start: number, deleteCount?: number, ...items: string[]) => string[];
1404
- constructor(strOrArray: string | string[]);
1405
- toString(): string;
1406
- hasParent(): boolean;
1407
- parent(): Path;
1408
- elements(): string[];
1409
- name(): string;
1410
- contains(other: Path): boolean;
1411
- ancestorOf(other: Path): boolean;
1412
- descendantOf(other: Path): boolean;
1413
- commonPrefixPath(other: Path): Path;
1414
- static compare(a: Path, b: Path): number;
1415
- static tester: {
1416
- setParserAndSep(p: PathParser, sep: string): void;
1417
- reset(): void;
1418
- };
1419
- }
1420
-
1421
- //#region src/coverage-summary.d.ts
1422
1419
  /**
1423
1420
  * Totals for a single coverage metric (statements, lines, functions, branches).
1424
1421
  * `pct` is a percentage number (0-100), or the string `"Unknown"` for a blank
@@ -1474,8 +1471,6 @@ declare class CoverageSummary {
1474
1471
  */
1475
1472
  isEmpty(): boolean;
1476
1473
  }
1477
- //#endregion
1478
- //#region src/file-coverage.d.ts
1479
1474
  /** a single location in a source file: 1-based line, 0-based column */
1480
1475
  interface Location {
1481
1476
  line: number;
@@ -1594,8 +1589,6 @@ declare class FileCoverage {
1594
1589
  */
1595
1590
  toSummary(): CoverageSummary;
1596
1591
  }
1597
- //#endregion
1598
- //#region src/coverage-map.d.ts
1599
1592
  /**
1600
1593
  * Raw, JSON-serializable data underlying a `CoverageMap`: `FileCoverage`
1601
1594
  * objects or their raw data keyed by file path. This can be the raw global
@@ -1655,7 +1648,6 @@ declare class CoverageMap {
1655
1648
  getCoverageSummary(): CoverageSummary;
1656
1649
  }
1657
1650
 
1658
- //#region src/summarizer-factory.d.ts
1659
1651
  /** names of the summarizer strategies supported by {@link SummarizerFactory} */
1660
1652
  type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";
1661
1653
  declare class ReportNode extends BaseNode {
@@ -1684,14 +1676,12 @@ interface ReportBaseOptions {
1684
1676
  summarizer?: Summarizers;
1685
1677
  }
1686
1678
 
1687
- //#region src/reports/clover/index.d.ts
1688
1679
  /** options accepted by {@link CloverReport} */
1689
1680
  interface CloverOptions {
1690
1681
  /** the file to write the report to, defaults to `clover.xml` */
1691
1682
  file?: string;
1692
1683
  }
1693
1684
 
1694
- //#region src/reports/cobertura/index.d.ts
1695
1685
  /** options accepted by {@link CoberturaReport} */
1696
1686
  interface CoberturaOptions {
1697
1687
  /** the file to write the report to, defaults to `cobertura-coverage.xml` */
@@ -1702,7 +1692,6 @@ interface CoberturaOptions {
1702
1692
  projectRoot?: string;
1703
1693
  }
1704
1694
 
1705
- //#region src/reports/html/index.d.ts
1706
1695
  /** maps report nodes to output paths, see the html report's `linkMapper` option */
1707
1696
  interface LinkMapper {
1708
1697
  getPath(node: ReportNode | string): string;
@@ -1729,28 +1718,24 @@ interface HtmlOptions {
1729
1718
  theme?: HtmlTheme;
1730
1719
  }
1731
1720
 
1732
- //#region src/reports/html-spa/index.d.ts
1733
1721
  /** options accepted by {@link HtmlSpaReport} */
1734
1722
  interface HtmlSpaOptions extends Omit<HtmlOptions, "theme"> {
1735
1723
  /** the metrics to show in the report UI, defaults to lines, branches and functions */
1736
1724
  metricsToShow?: ("lines" | "branches" | "functions" | "statements")[];
1737
1725
  }
1738
1726
 
1739
- //#region src/reports/json-summary/index.d.ts
1740
1727
  /** options accepted by {@link JsonSummaryReport} */
1741
1728
  interface JsonSummaryOptions {
1742
1729
  /** the file to write the report to, defaults to `coverage-summary.json` */
1743
1730
  file?: string;
1744
1731
  }
1745
1732
 
1746
- //#region src/reports/json/index.d.ts
1747
1733
  /** options accepted by {@link JsonReport} */
1748
1734
  interface JsonOptions$1 {
1749
1735
  /** the file to write the report to, defaults to `coverage-final.json` */
1750
1736
  file?: string;
1751
1737
  }
1752
1738
 
1753
- //#region src/reports/lcovonly/index.d.ts
1754
1739
  /** options accepted by {@link LcovOnlyReport} */
1755
1740
  interface LcovOnlyOptions {
1756
1741
  /** the file to write the report to, defaults to `lcov.info` */
@@ -1759,11 +1744,9 @@ interface LcovOnlyOptions {
1759
1744
  projectRoot?: string;
1760
1745
  }
1761
1746
 
1762
- //#region src/reports/lcov/index.d.ts
1763
1747
  /** options accepted by {@link LcovReport}, passed through to the lcovonly report */
1764
1748
  interface LcovOptions extends LcovOnlyOptions {}
1765
1749
 
1766
- //#region src/reports/teamcity/index.d.ts
1767
1750
  /** options accepted by {@link TeamcityReport} */
1768
1751
  interface TeamcityOptions {
1769
1752
  /** the file to write the report to, defaults to the console */
@@ -1772,21 +1755,18 @@ interface TeamcityOptions {
1772
1755
  blockName?: string;
1773
1756
  }
1774
1757
 
1775
- //#region src/reports/text-lcov/index.d.ts
1776
1758
  /** options accepted by {@link TextLcov}, `file` is always the console */
1777
1759
  interface TextLcovOptions {
1778
1760
  /** the project root used to relativize file paths, defaults to `process.cwd()` */
1779
1761
  projectRoot?: string;
1780
1762
  }
1781
1763
 
1782
- //#region src/reports/text-summary/index.d.ts
1783
1764
  /** options accepted by {@link TextSummaryReport} */
1784
1765
  interface TextSummaryOptions {
1785
1766
  /** the file to write the report to, defaults to the console */
1786
1767
  file?: string | null;
1787
1768
  }
1788
1769
 
1789
- //#region src/reports/text/index.d.ts
1790
1770
  /** options accepted by {@link TextReport} */
1791
1771
  interface TextOptions extends ReportBaseOptions {
1792
1772
  /** the file to write the report to, defaults to the console */
@@ -7,7 +7,7 @@ async function setupCommonEnv(config) {
7
7
  if (globalSetup) return;
8
8
  globalSetup = true;
9
9
  setSafeTimers();
10
- if (config.globals) (await import('./globals.Mxora3_v.js')).registerApiGlobally();
10
+ if (config.globals) (await import('./globals.Cz5RAf6U.js')).registerApiGlobally();
11
11
  }
12
12
  function setupDefines(config) {
13
13
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -3,7 +3,7 @@ import v8 from 'node:v8';
3
3
  import vm, { isContext, runInContext } from 'node:vm';
4
4
  import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.dGO4K2C0.js';
5
5
  import { distDir } from '../path.js';
6
- import { createCustomConsole } from './console.VJUxd1rM.js';
6
+ import { createCustomConsole } from './console.DdxlsSsm.js';
7
7
  import fs__default from 'node:fs';
8
8
  import { createRequire, Module, isBuiltin } from 'node:module';
9
9
  import { d as dirname, k as extname, b as basename, C as CSS_LANGS_RE, l as KNOWN_ASSET_RE, t as toArray, m as splitFileAndPostfix, n as normalize, o as isBareImport, r as resolve } from './pathe.M-eThtNZ.zq3TM4NT.js';
@@ -12,7 +12,7 @@ import { initSync, parse } from 'es-module-lexer';
12
12
  import { dirname as dirname$1 } from 'node:path';
13
13
  import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.C7Nn66Gy.js';
14
14
  import { getDefaultRequestStubs } from '../module-evaluator.js';
15
- import { b as setupEnv } from './setup-common.wwc_NYRJ.js';
15
+ import { b as setupEnv } from './setup-common.kEGtNVHG.js';
16
16
  import { p as provideWorkerState } from './utils.DYj33du9.js';
17
17
 
18
18
  /**
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.BK306qhQ.js';
1
+ import { c as createCLI } from './chunks/cac.DnNTZKhD.js';
2
2
  import './chunks/pathe.M-eThtNZ.zq3TM4NT.js';
3
3
  import 'events';
4
4
  import './chunks/tinyrainbow.Do8I1XRG.js';
package/dist/config.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { HookHandler, UserConfig, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.Du7hHZwb.js';
3
+ import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.Bx2wJglX.js';
4
4
  import { InlineConfig, ResolvedConfig, VitestPluginContext, CoverageOptions } from './node.js';
5
- export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.Du7hHZwb.js';
5
+ export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.Bx2wJglX.js';
6
6
  import { FakeTimersConfig } from './index.js';
7
7
  export { g as TestTagDefinition } from './chunks/config.d.BpJq6tRA.js';
8
8
  import 'node:stream';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.DNcttN5a.js';
1
+ export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.D5jWOaqm.js';
2
2
  export { V as EvaluatedModules } from './chunks/index.CAmut2NG.js';
3
3
  export { l as afterAll, n as afterEach, o as aroundAll, q as aroundEach, t as beforeAll, u as beforeEach, v as describe, w as it, x as onTestFailed, y as onTestFinished, e as recordArtifact, z as suite, A as test } from './chunks/run.zBhXlcZQ.js';
4
4
  export { expectTypeOf } from 'expect-type';
package/dist/node.d.ts CHANGED
@@ -3,8 +3,8 @@ import { UserConfig as UserConfig$1, ResolvedConfig as ResolvedConfig$1, Transfo
3
3
  export { vite as Vite };
4
4
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
5
5
  import { IncomingMessage } from 'node:http';
6
- import { R as ResolvedConfig, e as CliOptions, d as UserConfig, L as Logger, A as ApiConfig, P as PluginHarness, f as Vitest, g as ResolvedCoverageOptions, h as CoverageMap, i as TestSpecification, j as ReportContext, k as TestProject, l as VitestOptions, m as VitestRunMode, n as VCSProvider, o as VCSProviderOptions, p as PoolWorker, q as PoolOptions, r as WorkerRequest, s as TestSequencer } from './chunks/plugin.d.Du7hHZwb.js';
7
- export { M as AgentReporter, B as BaseCoverageOptions, t as BaseReporter, u as BenchmarkUserOptions, v as BrowserBuiltinProvider, w as BrowserCommand, x as BrowserCommandContext, y as BrowserConfigOptions, z as BrowserInstanceOption, D as BrowserModuleMocker, E as BrowserOrchestrator, G as BrowserProvider, H as BrowserProviderCloseOptions, J as BrowserProviderOption, K as BrowserScript, N as BrowserServerContribution, O as BrowserServerFactory, Q as BrowserServerState, S as BrowserServerStateSession, X as BrowserTraceViewOptions, Y as BuiltinEnvironment, Z as BuiltinReporterOptions, _ as BuiltinReporters, $ as CSSModuleScopeStrategy, a0 as CacheKeyIdGenerator, a1 as CacheKeyIdGeneratorContext, a2 as CachedTestFileResult, a3 as CoverageInstrumenter, a4 as CoverageIstanbulOptions, C as CoverageOptions, a5 as CoverageProvider, a6 as CoverageProviderModule, a7 as CoverageReporter, a8 as CoverageV8Options, a9 as CustomProviderOptions, aa as DefaultReporter, ab as DepsOptimizationOptions, ac as DotReporter, ad as EnvironmentOptions, ae as GithubActionsReporter, af as HTMLOptions, ag as HangingProcessReporter, I as InlineConfig, ah as InstrumenterOptions, ai as JUnitOptions, aj as JUnitReporter, ak as JsonAssertionResult, al as JsonOptions, am as JsonReporter, an as JsonTestResult, ao as JsonTestResults, M as MinimalReporter, ap as ModuleDependency, aq as ModuleDiagnostic, ar as ModulesResolver, as as OnServerRestartHandler, at as OnTestsRerunHandler, au as ParentProjectBrowser, av as Pool, aw as PoolRunnerInitializer, ax as PoolTask, ay as ProjectBrowser, az as ProjectConfig, aA as Report, aB as ReportedHookContext, aC as Reporter, aD as ReportersMap, aE as ResolveSnapshotPathHandler, aF as ResolveSnapshotPathHandlerContext, aG as ResolvedBrowserOptions, aH as ResolvedProjectConfig, aI as SerializedTestProject, aJ as SuiteNameTemplateVariables, aK as TapFlatReporter, aL as TapReporter, aM as TaskOptions, aN as TestAttempt, aO as TestAttemptState, aP as TestCase, aQ as TestCollection, aR as TestDiagnostic, aS as TestModule, aT as TestModuleState, aU as TestResult, aV as TestResultFailed, aW as TestResultPassed, aX as TestResultPending, aY as TestResultSkipped, aZ as TestRunEndReason, a_ as TestRunResult, a$ as TestSequencerConstructor, b0 as TestSpecificationOptions, b1 as TestState, b2 as TestSuite, b3 as TestSuiteState, b4 as ToMatchScreenshotComparators, b5 as ToMatchScreenshotOptions, b6 as TypecheckConfig, b7 as UIOptions, U as UserWorkspaceConfig, b8 as VerboseReporter, b9 as VitestEnvironment, ba as VitestPackageInstaller, V as VitestPluginContext, W as WatcherTriggerPattern, bb as WorkerResponse, bc as _BrowserNames, bd as experimental_getRunnerTask, be as startVitest } from './chunks/plugin.d.Du7hHZwb.js';
6
+ import { R as ResolvedConfig, e as CliOptions, d as UserConfig, L as Logger, A as ApiConfig, P as PluginHarness, f as Vitest, g as ResolvedCoverageOptions, h as CoverageMap, i as TestSpecification, j as ReportContext, k as TestProject, l as VitestOptions, m as VitestRunMode, n as VCSProvider, o as VCSProviderOptions, p as PoolWorker, q as PoolOptions, r as WorkerRequest, s as TestSequencer } from './chunks/plugin.d.Bx2wJglX.js';
7
+ export { M as AgentReporter, B as BaseCoverageOptions, t as BaseReporter, u as BenchmarkUserOptions, v as BrowserBuiltinProvider, w as BrowserCommand, x as BrowserCommandContext, y as BrowserConfigOptions, z as BrowserInstanceOption, D as BrowserModuleMocker, E as BrowserOrchestrator, G as BrowserProvider, H as BrowserProviderCloseOptions, J as BrowserProviderOption, K as BrowserScript, N as BrowserServerContribution, O as BrowserServerFactory, Q as BrowserServerState, S as BrowserServerStateSession, X as BrowserTraceViewOptions, Y as BuiltinEnvironment, Z as BuiltinReporterOptions, _ as BuiltinReporters, $ as CSSModuleScopeStrategy, a0 as CacheKeyIdGenerator, a1 as CacheKeyIdGeneratorContext, a2 as CachedTestFileResult, a3 as CoverageInstrumenter, a4 as CoverageIstanbulOptions, C as CoverageOptions, a5 as CoverageProvider, a6 as CoverageProviderModule, a7 as CoverageReporter, a8 as CoverageV8Options, a9 as CustomProviderOptions, aa as DefaultReporter, ab as DepsOptimizationOptions, ac as DotReporter, ad as EnvironmentOptions, ae as GithubActionsReporter, af as HTMLOptions, ag as HangingProcessReporter, I as InlineConfig, ah as InstrumenterOptions, ai as JUnitOptions, aj as JUnitReporter, ak as JsonAssertionResult, al as JsonOptions, am as JsonReporter, an as JsonTestResult, ao as JsonTestResults, M as MinimalReporter, ap as ModuleDependency, aq as ModuleDiagnostic, ar as ModulesResolver, as as OnServerRestartHandler, at as OnTestsRerunHandler, au as ParentProjectBrowser, av as Pool, aw as PoolRunnerInitializer, ax as PoolTask, ay as ProjectBrowser, az as ProjectConfig, aA as Report, aB as ReportedHookContext, aC as Reporter, aD as ReportersMap, aE as ResolveSnapshotPathHandler, aF as ResolveSnapshotPathHandlerContext, aG as ResolvedBrowserOptions, aH as ResolvedProjectConfig, aI as SerializedTestProject, aJ as SuiteNameTemplateVariables, aK as TapFlatReporter, aL as TapReporter, aM as TaskOptions, aN as TestAttempt, aO as TestAttemptState, aP as TestCase, aQ as TestCollection, aR as TestDiagnostic, aS as TestModule, aT as TestModuleState, aU as TestResult, aV as TestResultFailed, aW as TestResultPassed, aX as TestResultPending, aY as TestResultSkipped, aZ as TestRunEndReason, a_ as TestRunResult, a$ as TestSequencerConstructor, b0 as TestSpecificationOptions, b1 as TestState, b2 as TestSuite, b3 as TestSuiteState, b4 as ToMatchScreenshotComparators, b5 as ToMatchScreenshotOptions, b6 as TypecheckConfig, b7 as UIOptions, U as UserWorkspaceConfig, b8 as VerboseReporter, b9 as VitestEnvironment, ba as VitestPackageInstaller, V as VitestPluginContext, W as WatcherTriggerPattern, bb as WorkerResponse, bc as _BrowserNames, bd as experimental_getRunnerTask, be as startVitest } from './chunks/plugin.d.Bx2wJglX.js';
8
8
  import { EventEmitter } from 'events';
9
9
  import { A as Awaitable } from './chunks/config.d.BpJq6tRA.js';
10
10
  import { AfterSuiteRunMeta } from './index.js';
package/dist/node.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as vite from 'vite';
2
2
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
3
- import { V as Vitest } from './chunks/cli-api.D6E8EtSi.js';
4
- export { M as AgentReporter, B as BaseCoverageProvider, D as DefaultReporter, a as DotReporter, G as GitVCSProvider, b as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, c as JsonReporter, M as MinimalReporter, d as MtimeVCSProvider, R as ReportersMap, T as TapFlatReporter, e as TapReporter, f as VerboseReporter, g as createVitest, h as experimental_getRunnerTask, i as isValidApiRequest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.D6E8EtSi.js';
5
- export { B as BaseSequencer, a as BrowserConnectionError, F as ForksPoolWorker, G as GitNotFoundError, L as Logger, P as PluginHarness, b as TestsNotFoundError, T as ThreadsPoolWorker, c as TypecheckPoolWorker, V as VitestPackageInstaller, d as VmForksPoolWorker, e as VmThreadsPoolWorker, f as createDebugger, g as createMethodsRPC, h as createViteLogger, i as escapeTestName, j as getFilePoolName, k as isFileServingAllowed, r as resolveApiServerConfig, l as resolveConfig, m as resolveFsAllow } from './chunks/index.ER9afepi.js';
6
- export { c as createCLI, p as parseCLI } from './chunks/cac.BK306qhQ.js';
3
+ import { V as Vitest } from './chunks/cli-api.9v9AxcPO.js';
4
+ export { M as AgentReporter, B as BaseCoverageProvider, D as DefaultReporter, a as DotReporter, G as GitVCSProvider, b as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, c as JsonReporter, M as MinimalReporter, d as MtimeVCSProvider, R as ReportersMap, T as TapFlatReporter, e as TapReporter, f as VerboseReporter, g as createVitest, h as experimental_getRunnerTask, i as isValidApiRequest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.9v9AxcPO.js';
5
+ export { B as BaseSequencer, a as BrowserConnectionError, F as ForksPoolWorker, G as GitNotFoundError, L as Logger, P as PluginHarness, b as TestsNotFoundError, T as ThreadsPoolWorker, c as TypecheckPoolWorker, V as VitestPackageInstaller, d as VmForksPoolWorker, e as VmThreadsPoolWorker, f as createDebugger, g as createMethodsRPC, h as createViteLogger, i as escapeTestName, j as getFilePoolName, k as isFileServingAllowed, r as resolveApiServerConfig, l as resolveConfig, m as resolveFsAllow } from './chunks/index.6pLw0FLK.js';
6
+ export { c as createCLI, p as parseCLI } from './chunks/cac.DnNTZKhD.js';
7
7
  export { distDir, rootDir } from './path.js';
8
8
  export { generateFileHash } from './task-utils.js';
9
9
  export { w as disableDefaultColors } from './chunks/tinyrainbow.Do8I1XRG.js';
@@ -21,6 +21,7 @@ import 'events';
21
21
  import 'https';
22
22
  import 'http';
23
23
  import 'net';
24
+ import 'querystring';
24
25
  import 'tls';
25
26
  import 'crypto';
26
27
  import 'stream';
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- export { r as runBaseTests, s as setupEnvironment } from './chunks/base.C2su7_N0.js';
1
+ export { r as runBaseTests, s as setupEnvironment } from './chunks/base.DCg6Jh4N.js';
2
2
  export { i as init } from './chunks/init.dGO4K2C0.js';
3
3
  import 'node:vm';
4
4
  import './chunks/spy.BO0hTE3G.js';
5
- import './chunks/index.Da_szXbS.js';
5
+ import './chunks/index.BSqmIH9v.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import './chunks/coverage.9iqXE2gN.js';
@@ -15,9 +15,9 @@ import './chunks/tinyrainbow.Do8I1XRG.js';
15
15
  import './chunks/index.CAmut2NG.js';
16
16
  import 'vite/module-runner';
17
17
  import './chunks/utils.DYj33du9.js';
18
- import './chunks/setup-common.wwc_NYRJ.js';
18
+ import './chunks/setup-common.kEGtNVHG.js';
19
19
  import './chunks/plugins.BPruPOR8.js';
20
- import './chunks/index.DNcttN5a.js';
20
+ import './chunks/index.D5jWOaqm.js';
21
21
  import './chunks/run.zBhXlcZQ.js';
22
22
  import './chunks/display.Cj2h2zsY.js';
23
23
  import './task-utils.js';
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.C2su7_N0.js';
1
+ import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.DCg6Jh4N.js';
2
2
  import { w as workerInit } from '../chunks/init-forks.q4IoGYZe.js';
3
3
  import 'node:vm';
4
4
  import '../chunks/spy.BO0hTE3G.js';
5
- import '../chunks/index.Da_szXbS.js';
5
+ import '../chunks/index.BSqmIH9v.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.9iqXE2gN.js';
@@ -15,9 +15,9 @@ import '../chunks/tinyrainbow.Do8I1XRG.js';
15
15
  import '../chunks/index.CAmut2NG.js';
16
16
  import 'vite/module-runner';
17
17
  import '../chunks/utils.DYj33du9.js';
18
- import '../chunks/setup-common.wwc_NYRJ.js';
18
+ import '../chunks/setup-common.kEGtNVHG.js';
19
19
  import '../chunks/plugins.BPruPOR8.js';
20
- import '../chunks/index.DNcttN5a.js';
20
+ import '../chunks/index.D5jWOaqm.js';
21
21
  import '../chunks/run.zBhXlcZQ.js';
22
22
  import '../chunks/display.Cj2h2zsY.js';
23
23
  import '../task-utils.js';
@@ -4,13 +4,13 @@ import timers from 'node:timers';
4
4
  import timersPromises from 'node:timers/promises';
5
5
  import util from 'node:util';
6
6
  import { K as KNOWN_ASSET_TYPES } from '../chunks/pathe.M-eThtNZ.zq3TM4NT.js';
7
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.Da_szXbS.js';
7
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.BSqmIH9v.js';
8
8
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/coverage.9iqXE2gN.js';
9
- import { i as index, g as globalExpect } from '../chunks/index.DNcttN5a.js';
9
+ import { i as index, g as globalExpect } from '../chunks/index.D5jWOaqm.js';
10
10
  import { g as getEvaluatedImports, c as collectDependencies } from '../chunks/module-dependencies._2Eei3FO.js';
11
11
  import { c as closeInspector } from '../chunks/inspector.D6o1NPo1.js';
12
12
  import { s as startTests, p as publicCollect } from '../chunks/run.zBhXlcZQ.js';
13
- import { s as setupCommonEnv } from '../chunks/setup-common.wwc_NYRJ.js';
13
+ import { s as setupCommonEnv } from '../chunks/setup-common.kEGtNVHG.js';
14
14
  import { g as getWorkerState } from '../chunks/utils.DYj33du9.js';
15
15
  import 'chai';
16
16
  import 'node:async_hooks';
@@ -1,8 +1,8 @@
1
- import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.C2su7_N0.js';
1
+ import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.DCg6Jh4N.js';
2
2
  import { w as workerInit } from '../chunks/init-threads.Bf1Frg9S.js';
3
3
  import 'node:vm';
4
4
  import '../chunks/spy.BO0hTE3G.js';
5
- import '../chunks/index.Da_szXbS.js';
5
+ import '../chunks/index.BSqmIH9v.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.9iqXE2gN.js';
@@ -15,9 +15,9 @@ import '../chunks/tinyrainbow.Do8I1XRG.js';
15
15
  import '../chunks/index.CAmut2NG.js';
16
16
  import 'vite/module-runner';
17
17
  import '../chunks/utils.DYj33du9.js';
18
- import '../chunks/setup-common.wwc_NYRJ.js';
18
+ import '../chunks/setup-common.kEGtNVHG.js';
19
19
  import '../chunks/plugins.BPruPOR8.js';
20
- import '../chunks/index.DNcttN5a.js';
20
+ import '../chunks/index.D5jWOaqm.js';
21
21
  import '../chunks/run.zBhXlcZQ.js';
22
22
  import '../chunks/display.Cj2h2zsY.js';
23
23
  import '../task-utils.js';
@@ -1,5 +1,5 @@
1
1
  import { w as workerInit } from '../chunks/init-forks.q4IoGYZe.js';
2
- import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.agn4qnmT.js';
2
+ import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.DNr3Eju_.js';
3
3
  import '../chunks/init.dGO4K2C0.js';
4
4
  import 'node:fs';
5
5
  import 'node:module';
@@ -26,11 +26,11 @@ import '../chunks/tinyrainbow.Do8I1XRG.js';
26
26
  import '../chunks/rpc.CNYWPa97.js';
27
27
  import '../chunks/index.CAmut2NG.js';
28
28
  import 'node:v8';
29
- import '../chunks/console.VJUxd1rM.js';
29
+ import '../chunks/console.DdxlsSsm.js';
30
30
  import 'node:stream';
31
31
  import '../chunks/resolver.BzpmeQeT.js';
32
32
  import 'es-module-lexer';
33
- import '../chunks/setup-common.wwc_NYRJ.js';
33
+ import '../chunks/setup-common.kEGtNVHG.js';
34
34
  import '../chunks/plugins.BPruPOR8.js';
35
35
 
36
36
  workerInit({
@@ -1,5 +1,5 @@
1
1
  import { w as workerInit } from '../chunks/init-threads.Bf1Frg9S.js';
2
- import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.agn4qnmT.js';
2
+ import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.DNr3Eju_.js';
3
3
  import 'node:worker_threads';
4
4
  import '../chunks/init.dGO4K2C0.js';
5
5
  import 'node:fs';
@@ -27,11 +27,11 @@ import '../chunks/tinyrainbow.Do8I1XRG.js';
27
27
  import '../chunks/rpc.CNYWPa97.js';
28
28
  import '../chunks/index.CAmut2NG.js';
29
29
  import 'node:v8';
30
- import '../chunks/console.VJUxd1rM.js';
30
+ import '../chunks/console.DdxlsSsm.js';
31
31
  import 'node:stream';
32
32
  import '../chunks/resolver.BzpmeQeT.js';
33
33
  import 'es-module-lexer';
34
- import '../chunks/setup-common.wwc_NYRJ.js';
34
+ import '../chunks/setup-common.kEGtNVHG.js';
35
35
  import '../chunks/plugins.BPruPOR8.js';
36
36
 
37
37
  workerInit({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "5.1.1",
4
+ "version": "5.1.2",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -118,12 +118,12 @@
118
118
  "@edge-runtime/vm": "*",
119
119
  "@opentelemetry/api": "^1.9.0",
120
120
  "@types/node": "^22.0.0 || >=24.0.0",
121
- "@vitest/browser-playwright": "5.1.1",
122
- "@vitest/browser-preview": "5.1.1",
121
+ "@vitest/browser-playwright": "5.1.2",
122
+ "@vitest/browser-preview": "5.1.2",
123
123
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
124
- "@vitest/coverage-istanbul": "5.1.1",
125
- "@vitest/coverage-v8": "5.1.1",
126
- "@vitest/ui": "5.1.1",
124
+ "@vitest/coverage-istanbul": "5.1.2",
125
+ "@vitest/coverage-v8": "5.1.2",
126
+ "@vitest/ui": "5.1.2",
127
127
  "happy-dom": "*",
128
128
  "jsdom": "*",
129
129
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
@@ -168,7 +168,7 @@
168
168
  },
169
169
  "dependencies": {
170
170
  "@types/chai": "^5.2.2",
171
- "@vitest/mocker": "5.1.1",
171
+ "@vitest/mocker": "5.1.2",
172
172
  "chai": "^6.3.0",
173
173
  "es-module-lexer": "^2.3.2",
174
174
  "expect-type": "^1.4.0",
@@ -193,13 +193,13 @@
193
193
  "@types/picomatch": "^4.0.3",
194
194
  "@types/prompts": "^2.4.9",
195
195
  "@types/ws": "^8.18.2",
196
- "@vitest/expect": "5.1.1",
197
- "@vitest/istanbul-lib-coverage": "^2.1.0",
198
- "@vitest/istanbul-lib-report": "^2.1.0",
199
- "@vitest/pretty-format": "5.1.1",
200
- "@vitest/snapshot": "5.1.1",
201
- "@vitest/spy": "5.1.1",
202
- "@vitest/utils": "5.1.1",
196
+ "@vitest/expect": "5.1.2",
197
+ "@vitest/istanbul-lib-coverage": "^2.1.1",
198
+ "@vitest/istanbul-lib-report": "^2.1.1",
199
+ "@vitest/pretty-format": "5.1.2",
200
+ "@vitest/snapshot": "5.1.2",
201
+ "@vitest/spy": "5.1.2",
202
+ "@vitest/utils": "5.1.2",
203
203
  "acorn": "8.11.3",
204
204
  "acorn-walk": "^8.3.5",
205
205
  "birpc": "^4.2.0",
@@ -215,7 +215,7 @@
215
215
  "tinyhighlight": "^0.3.2",
216
216
  "tinyrainbow": "^3.2.0",
217
217
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0",
218
- "ws": "^8.22.1"
218
+ "ws": "^8.23.0"
219
219
  },
220
220
  "scripts": {
221
221
  "build": "premove dist && rollup -c",