vitest 0.12.3 → 0.12.6

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 (25) hide show
  1. package/LICENSE.md +72 -0
  2. package/dist/{chunk-api-setup.ed61899f.js → chunk-api-setup.02588d9f.js} +4 -4
  3. package/dist/{chunk-constants.0567483c.js → chunk-constants.7180775c.js} +1 -1
  4. package/dist/{chunk-defaults.ecb46baf.js → chunk-defaults.9e0c233e.js} +1 -1
  5. package/dist/{chunk-install-pkg.73b84ae1.js → chunk-install-pkg.078f5345.js} +11 -9
  6. package/dist/chunk-integrations-globals.cf24723d.js +25 -0
  7. package/dist/{chunk-runtime-chain.221b8dcb.js → chunk-runtime-chain.5cae775c.js} +57 -21
  8. package/dist/{chunk-runtime-mocker.acd615bd.js → chunk-runtime-mocker.43db6608.js} +7 -6
  9. package/dist/{chunk-runtime-rpc.63398738.js → chunk-runtime-rpc.ad208eea.js} +1 -1
  10. package/dist/{chunk-utils-global.a5a8641f.js → chunk-utils-global.29e8a0a3.js} +29 -9
  11. package/dist/{chunk-utils-timers.f25e8f44.js → chunk-utils-timers.64f2cbe8.js} +3 -2
  12. package/dist/{chunk-vite-node-externalize.6124d286.js → chunk-vite-node-externalize.35ad761d.js} +90 -71
  13. package/dist/{chunk-vite-node-utils.1536f168.js → chunk-vite-node-utils.26c328fa.js} +1067 -3
  14. package/dist/cli.js +7 -8
  15. package/dist/entry.js +6 -10
  16. package/dist/index.d.ts +11 -3
  17. package/dist/index.js +4 -5
  18. package/dist/node.d.ts +9 -2
  19. package/dist/node.js +10 -11
  20. package/dist/{vendor-entry.3adaf0b2.js → vendor-entry.5c1e6d94.js} +23 -14
  21. package/dist/{vendor-index.40be925a.js → vendor-index.3ff91c47.js} +5 -5
  22. package/dist/worker.js +5 -5
  23. package/package.json +3 -3
  24. package/dist/chunk-integrations-globals.60fc66ef.js +0 -29
  25. package/dist/vendor-_commonjsHelpers.addc3445.js +0 -3
@@ -2,28 +2,27 @@ import { Buffer } from 'buffer';
2
2
  import path$a from 'path';
3
3
  import childProcess from 'child_process';
4
4
  import process$1 from 'process';
5
- import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.40be925a.js';
5
+ import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.3ff91c47.js';
6
6
  import url, { fileURLToPath, pathToFileURL } from 'url';
7
7
  import require$$0, { constants as constants$5, cpus, hostname } from 'os';
8
- import { j as join, f as basename, d as dirname, h as resolve, p as picocolors, s as slash$2, k as isAbsolute, l as relative, m as getTests, o as getFullName, q as hasFailed, u as hasFailedSnapshot, v as getSuites, t as toArray, w as normalize, n as noop$1, x as deepMerge, y as toNamespacedPath, g as getCallLastIndex, e as notNullish, z as ensurePackageInstalled, A as stdout } from './chunk-utils-global.a5a8641f.js';
8
+ import { c as commonjsGlobal, j as join, h as basename, d as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as isNode, q as getTests, u as getFullName, v as hasFailed, w as hasFailedSnapshot, x as getSuites, t as toArray, y as normalize, n as noop$1, z as deepMerge, A as toNamespacedPath, g as getCallLastIndex, f as notNullish, B as ensurePackageInstalled, C as stdout } from './chunk-utils-global.29e8a0a3.js';
9
9
  import { createServer, mergeConfig } from 'vite';
10
10
  import fs$8, { promises, existsSync, readFileSync } from 'fs';
11
- import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.0567483c.js';
11
+ import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.7180775c.js';
12
12
  import readline from 'readline';
13
- import require$$0$1 from 'util';
14
- import require$$0$2 from 'stream';
13
+ import require$$1 from 'util';
14
+ import require$$0$1 from 'stream';
15
15
  import require$$2 from 'events';
16
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
17
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.1536f168.js';
18
- import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.ecb46baf.js';
16
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, c as createDebug, t as toFilePath, w as withInlineSourcemap, b as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.26c328fa.js';
17
+ import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.9e0c233e.js';
19
18
  import { MessageChannel } from 'worker_threads';
20
19
  import { Tinypool } from 'tinypool';
21
20
  import { performance } from 'perf_hooks';
22
- import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.f25e8f44.js';
21
+ import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.64f2cbe8.js';
23
22
  import MagicString from './chunk-magic-string.d5e0e473.js';
24
23
  import { p as prompts } from './vendor-index.405e58ef.js';
25
24
 
26
- var version = "0.12.3";
25
+ var version = "0.12.6";
27
26
 
28
27
  function stripFinalNewline(input) {
29
28
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -2128,7 +2127,7 @@ var toRegexRange_1 = toRegexRange$1;
2128
2127
  * Licensed under the MIT License.
2129
2128
  */
2130
2129
 
2131
- const util$1 = require$$0$1;
2130
+ const util$1 = require$$1;
2132
2131
  const toRegexRange = toRegexRange_1;
2133
2132
 
2134
2133
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -5165,7 +5164,7 @@ var picomatch_1 = picomatch$1;
5165
5164
  module.exports = picomatch_1;
5166
5165
  } (picomatch$2));
5167
5166
 
5168
- const util = require$$0$1;
5167
+ const util = require$$1;
5169
5168
  const braces = braces_1;
5170
5169
  const picomatch = picomatch$2.exports;
5171
5170
  const utils$b = utils$f;
@@ -5809,7 +5808,7 @@ var stream$4 = {};
5809
5808
  * Copyright (c) 2014-2020 Teambition
5810
5809
  * Licensed under the MIT license.
5811
5810
  */
5812
- const Stream = require$$0$2;
5811
+ const Stream = require$$0$1;
5813
5812
  const PassThrough = Stream.PassThrough;
5814
5813
  const slice = Array.prototype.slice;
5815
5814
 
@@ -7093,7 +7092,7 @@ function callSuccessCallback(callback, entries) {
7093
7092
  var stream$1 = {};
7094
7093
 
7095
7094
  Object.defineProperty(stream$1, "__esModule", { value: true });
7096
- const stream_1$5 = require$$0$2;
7095
+ const stream_1$5 = require$$0$1;
7097
7096
  const async_1$2 = async$2;
7098
7097
  class StreamProvider {
7099
7098
  constructor(_root, _settings) {
@@ -7301,7 +7300,7 @@ class Reader {
7301
7300
  reader.default = Reader;
7302
7301
 
7303
7302
  Object.defineProperty(stream$2, "__esModule", { value: true });
7304
- const stream_1$3 = require$$0$2;
7303
+ const stream_1$3 = require$$0$1;
7305
7304
  const fsStat$1 = out$3;
7306
7305
  const fsWalk$1 = out$2;
7307
7306
  const reader_1$1 = reader;
@@ -7699,7 +7698,7 @@ async$6.default = ProviderAsync;
7699
7698
  var stream = {};
7700
7699
 
7701
7700
  Object.defineProperty(stream, "__esModule", { value: true });
7702
- const stream_1$1 = require$$0$2;
7701
+ const stream_1$1 = require$$0$1;
7703
7702
  const stream_2 = stream$2;
7704
7703
  const provider_1$1 = provider;
7705
7704
  class ProviderStream extends provider_1$1.default {
@@ -8012,8 +8011,8 @@ function patchWindowsImportPath(path) {
8012
8011
  }
8013
8012
 
8014
8013
  var __defProp$5 = Object.defineProperty;
8015
- var __defProps$4 = Object.defineProperties;
8016
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8014
+ var __defProps$5 = Object.defineProperties;
8015
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8017
8016
  var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8018
8017
  var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8019
8018
  var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
@@ -8029,7 +8028,8 @@ var __spreadValues$5 = (a, b) => {
8029
8028
  }
8030
8029
  return a;
8031
8030
  };
8032
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8031
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8032
+ const debugRequest = createDebug("vite-node:server:request");
8033
8033
  const RealDate = Date;
8034
8034
  class ViteNodeServer {
8035
8035
  constructor(server, options = {}) {
@@ -8050,7 +8050,7 @@ class ViteNodeServer {
8050
8050
  async fetchModule(id) {
8051
8051
  if (!this.fetchPromiseMap.has(id)) {
8052
8052
  this.fetchPromiseMap.set(id, this._fetchModule(id).then((r) => {
8053
- return this.options.sourcemap !== true ? __spreadProps$4(__spreadValues$5({}, r), { map: void 0 }) : r;
8053
+ return this.options.sourcemap !== true ? __spreadProps$5(__spreadValues$5({}, r), { map: void 0 }) : r;
8054
8054
  }).finally(() => {
8055
8055
  this.fetchPromiseMap.delete(id);
8056
8056
  }));
@@ -8098,6 +8098,7 @@ class ViteNodeServer {
8098
8098
  return result;
8099
8099
  }
8100
8100
  async _transformRequest(id) {
8101
+ debugRequest(id);
8101
8102
  let result = null;
8102
8103
  if (this.getTransformMode(id) === "web") {
8103
8104
  result = await this.server.transformRequest(id);
@@ -8189,7 +8190,7 @@ function createFakePool(ctx) {
8189
8190
  const { workerPort, port } = createChannel(ctx);
8190
8191
  const data = {
8191
8192
  port: workerPort,
8192
- config: ctx.getConfig(),
8193
+ config: ctx.getSerializableConfig(),
8193
8194
  files,
8194
8195
  invalidates,
8195
8196
  id: 1
@@ -8221,11 +8222,12 @@ function createWorkerPool(ctx) {
8221
8222
  const runWithFiles = (name) => {
8222
8223
  return async (files, invalidates) => {
8223
8224
  let id = 0;
8225
+ const config = ctx.getSerializableConfig();
8224
8226
  await Promise.all(files.map(async (file) => {
8225
8227
  const { workerPort, port } = createChannel(ctx);
8226
8228
  const data = {
8227
8229
  port: workerPort,
8228
- config: ctx.getConfig(),
8230
+ config,
8229
8231
  files: [file],
8230
8232
  invalidates,
8231
8233
  id: ++id
@@ -8314,7 +8316,8 @@ const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
8314
8316
  const pointer = picocolors.exports.yellow(F_POINTER);
8315
8317
  const skipped = picocolors.exports.dim(picocolors.exports.gray(F_DOWN));
8316
8318
  function getCols(delta = 0) {
8317
- let length = process.stdout.columns;
8319
+ var _a;
8320
+ let length = (_a = process.stdout) == null ? void 0 : _a.columns;
8318
8321
  if (!length || isNaN(length))
8319
8322
  length = 30;
8320
8323
  return Math.max(length + delta, 0);
@@ -8445,6 +8448,7 @@ function elegantSpinner() {
8445
8448
  };
8446
8449
  }
8447
8450
 
8451
+ var _a;
8448
8452
  const BADGE_PADDING = " ";
8449
8453
  const HELP_HINT = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("h")}${picocolors.exports.dim(" to show help")}`;
8450
8454
  const HELP_UPDATE_SNAP = picocolors.exports.dim("press ") + picocolors.exports.bold(picocolors.exports.yellow("u")) + picocolors.exports.dim(" to update snapshot");
@@ -8458,19 +8462,19 @@ class BaseReporter {
8458
8462
  constructor() {
8459
8463
  this.start = 0;
8460
8464
  this.end = 0;
8461
- this.isTTY = process.stdout.isTTY && !process.env.CI;
8465
+ this.isTTY = isNode && ((_a = process.stdout) == null ? void 0 : _a.isTTY) && !process.env.CI;
8462
8466
  this.ctx = void 0;
8463
8467
  this.registerUnhandledRejection();
8464
8468
  }
8465
8469
  onInit(ctx) {
8466
- var _a, _b;
8470
+ var _a2, _b;
8467
8471
  this.ctx = ctx;
8468
8472
  this.ctx.log();
8469
8473
  const versionTest = this.ctx.config.watch ? picocolors.exports.blue(`v${version}`) : picocolors.exports.cyan(`v${version}`);
8470
8474
  const mode = this.ctx.config.watch ? picocolors.exports.blue(" DEV ") : picocolors.exports.cyan(" RUN ");
8471
8475
  this.ctx.log(`${picocolors.exports.inverse(picocolors.exports.bold(mode))} ${versionTest} ${picocolors.exports.gray(this.ctx.config.root)}`);
8472
8476
  if (this.ctx.config.ui)
8473
- this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((_a = this.ctx.config.api) == null ? void 0 : _a.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}`)));
8477
+ this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((_a2 = this.ctx.config.api) == null ? void 0 : _a2.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}`)));
8474
8478
  else if (this.ctx.config.api)
8475
8479
  this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` API started at http://${((_b = this.ctx.config.api) == null ? void 0 : _b.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.config.api.port}`)}`)));
8476
8480
  this.ctx.log();
@@ -8496,16 +8500,16 @@ Please, resolve all the errors to make sure your tests are not affected.`));
8496
8500
  }
8497
8501
  }
8498
8502
  onTaskUpdate(packs) {
8499
- var _a, _b, _c;
8503
+ var _a2, _b, _c;
8500
8504
  if (this.isTTY)
8501
8505
  return;
8502
8506
  for (const pack of packs) {
8503
8507
  const task = this.ctx.state.idMap.get(pack[0]);
8504
- if (task && "filepath" in task && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
8508
+ if (task && "filepath" in task && ((_a2 = task.result) == null ? void 0 : _a2.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
8505
8509
  const tests = getTests(task);
8506
8510
  const failed = tests.filter((t) => {
8507
- var _a2;
8508
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
8511
+ var _a3;
8512
+ return ((_a3 = t.result) == null ? void 0 : _a3.state) === "fail";
8509
8513
  });
8510
8514
  const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
8511
8515
  let state = picocolors.exports.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
@@ -8553,13 +8557,22 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
8553
8557
  this.start = performance.now();
8554
8558
  }
8555
8559
  onUserConsoleLog(log) {
8556
- if (this.ctx.config.silent)
8560
+ if (!this.shouldLog(log))
8557
8561
  return;
8558
8562
  const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
8559
8563
  this.ctx.log(picocolors.exports.gray(log.type + picocolors.exports.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
8560
8564
  process[log.type].write(`${log.content}
8561
8565
  `);
8562
8566
  }
8567
+ shouldLog(log) {
8568
+ var _a2, _b;
8569
+ if (this.ctx.config.silent)
8570
+ return false;
8571
+ const shouldIgnore = (_b = (_a2 = this.ctx.config).onConsoleLog) == null ? void 0 : _b.call(_a2, log.content, log.type);
8572
+ if (shouldIgnore === false)
8573
+ return shouldIgnore;
8574
+ return true;
8575
+ }
8563
8576
  onServerRestart() {
8564
8577
  this.ctx.log(picocolors.exports.cyan("Restarted due to config changes..."));
8565
8578
  }
@@ -8567,12 +8580,12 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
8567
8580
  const suites = getSuites(files);
8568
8581
  const tests = getTests(files);
8569
8582
  const failedSuites = suites.filter((i) => {
8570
- var _a;
8571
- return (_a = i.result) == null ? void 0 : _a.error;
8583
+ var _a2;
8584
+ return (_a2 = i.result) == null ? void 0 : _a2.error;
8572
8585
  });
8573
8586
  const failedTests = tests.filter((i) => {
8574
- var _a;
8575
- return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
8587
+ var _a2;
8588
+ return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
8576
8589
  });
8577
8590
  const failedTotal = failedSuites.length + failedTests.length;
8578
8591
  let current = 1;
@@ -8590,8 +8603,8 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
8590
8603
  }
8591
8604
  const executionTime = this.end - this.start;
8592
8605
  const threadTime = files.reduce((acc, test) => {
8593
- var _a;
8594
- return acc + Math.max(0, ((_a = test.result) == null ? void 0 : _a.duration) || 0) + Math.max(0, test.collectDuration || 0);
8606
+ var _a2;
8607
+ return acc + Math.max(0, ((_a2 = test.result) == null ? void 0 : _a2.duration) || 0) + Math.max(0, test.collectDuration || 0);
8595
8608
  }, 0);
8596
8609
  const padTitle = (str) => picocolors.exports.dim(`${str.padStart(10)} `);
8597
8610
  const time = (time2) => {
@@ -8614,13 +8627,13 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
8614
8627
  this.ctx.log();
8615
8628
  }
8616
8629
  async printTaskErrors(tasks, errorDivider) {
8617
- var _a;
8630
+ var _a2;
8618
8631
  const errorsQueue = [];
8619
8632
  for (const task of tasks) {
8620
- const error = (_a = task.result) == null ? void 0 : _a.error;
8633
+ const error = (_a2 = task.result) == null ? void 0 : _a2.error;
8621
8634
  const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
8622
- var _a2;
8623
- return ((_a2 = i[0]) == null ? void 0 : _a2.stackStr) === error.stackStr;
8635
+ var _a3;
8636
+ return ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
8624
8637
  });
8625
8638
  if (errorItem)
8626
8639
  errorItem[1].push(task);
@@ -8637,6 +8650,7 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
8637
8650
  }
8638
8651
  await this.ctx.printError(error);
8639
8652
  errorDivider();
8653
+ await Promise.resolve();
8640
8654
  }
8641
8655
  }
8642
8656
  registerUnhandledRejection() {
@@ -9278,6 +9292,8 @@ class DefaultReporter extends BaseReporter {
9278
9292
  }
9279
9293
  onUserConsoleLog(log) {
9280
9294
  var _a;
9295
+ if (!this.shouldLog(log))
9296
+ return;
9281
9297
  (_a = this.renderer) == null ? void 0 : _a.clear();
9282
9298
  super.onUserConsoleLog(log);
9283
9299
  }
@@ -9619,8 +9635,8 @@ class TapReporter {
9619
9635
  }
9620
9636
 
9621
9637
  var __defProp$4 = Object.defineProperty;
9622
- var __defProps$3 = Object.defineProperties;
9623
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
9638
+ var __defProps$4 = Object.defineProperties;
9639
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
9624
9640
  var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9625
9641
  var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9626
9642
  var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
@@ -9636,13 +9652,13 @@ var __spreadValues$4 = (a, b) => {
9636
9652
  }
9637
9653
  return a;
9638
9654
  };
9639
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9655
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
9640
9656
  function flattenTasks$1(task, baseName = "") {
9641
9657
  const base = baseName ? `${baseName} > ` : "";
9642
9658
  if (task.type === "suite") {
9643
9659
  return task.tasks.flatMap((child) => flattenTasks$1(child, `${base}${task.name}`));
9644
9660
  } else {
9645
- return [__spreadProps$3(__spreadValues$4({}, task), {
9661
+ return [__spreadProps$4(__spreadValues$4({}, task), {
9646
9662
  name: `${base}${task.name}`
9647
9663
  })];
9648
9664
  }
@@ -9760,7 +9776,7 @@ class JUnitReporter {
9760
9776
  failures: 0,
9761
9777
  skipped: 0
9762
9778
  });
9763
- return __spreadProps$3(__spreadValues$4({}, file), {
9779
+ return __spreadProps$4(__spreadValues$4({}, file), {
9764
9780
  tasks,
9765
9781
  stats
9766
9782
  });
@@ -9787,8 +9803,8 @@ class JUnitReporter {
9787
9803
  }
9788
9804
 
9789
9805
  var __defProp$3 = Object.defineProperty;
9790
- var __defProps$2 = Object.defineProperties;
9791
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9806
+ var __defProps$3 = Object.defineProperties;
9807
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
9792
9808
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9793
9809
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9794
9810
  var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
@@ -9804,13 +9820,13 @@ var __spreadValues$3 = (a, b) => {
9804
9820
  }
9805
9821
  return a;
9806
9822
  };
9807
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9823
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9808
9824
  function flattenTasks(task, baseName = "") {
9809
9825
  const base = baseName ? `${baseName} > ` : "";
9810
9826
  if (task.type === "suite" && task.tasks.length > 0) {
9811
9827
  return task.tasks.flatMap((child) => flattenTasks(child, `${base}${task.name}`));
9812
9828
  } else {
9813
- return [__spreadProps$2(__spreadValues$3({}, task), {
9829
+ return [__spreadProps$3(__spreadValues$3({}, task), {
9814
9830
  name: `${base}${task.name}`
9815
9831
  })];
9816
9832
  }
@@ -9927,8 +9943,8 @@ class StateManager {
9927
9943
  }
9928
9944
 
9929
9945
  var __defProp$2 = Object.defineProperty;
9930
- var __defProps$1 = Object.defineProperties;
9931
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
9946
+ var __defProps$2 = Object.defineProperties;
9947
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9932
9948
  var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9933
9949
  var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9934
9950
  var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
@@ -9944,7 +9960,7 @@ var __spreadValues$2 = (a, b) => {
9944
9960
  }
9945
9961
  return a;
9946
9962
  };
9947
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
9963
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9948
9964
  const extraInlineDeps = [
9949
9965
  /^(?!.*(?:node_modules)).*\.mjs$/,
9950
9966
  /^(?!.*(?:node_modules)).*\.cjs\.js$/,
@@ -9987,7 +10003,7 @@ function resolveConfig(options, viteConfig) {
9987
10003
  }
9988
10004
  options.environment = "happy-dom";
9989
10005
  }
9990
- const resolved = __spreadProps$1(__spreadValues$2(__spreadValues$2({}, configDefaults), options), {
10006
+ const resolved = __spreadProps$2(__spreadValues$2(__spreadValues$2({}, configDefaults), options), {
9991
10007
  root: viteConfig.root
9992
10008
  });
9993
10009
  if (viteConfig.base !== "/")
@@ -10103,7 +10119,7 @@ function handleImportOutsideModuleError(stack, ctx) {
10103
10119
  name = name.split("/").slice(0, 2).join("/");
10104
10120
  else
10105
10121
  name = name.split("/")[0];
10106
- ctx.console.error(picocolors.exports.yellow(`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.
10122
+ ctx.error(picocolors.exports.yellow(`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.
10107
10123
 
10108
10124
  As a temporary workaround you can try to inline the package by updating your config:
10109
10125
 
@@ -10147,12 +10163,13 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
10147
10163
  }
10148
10164
  }
10149
10165
  function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
10166
+ var _a;
10150
10167
  start = posToNumber(source, start);
10151
10168
  end = end || start;
10152
10169
  const lines = source.split(lineSplitRE);
10153
10170
  let count = 0;
10154
10171
  let res = [];
10155
- const columns = process.stdout.columns || 80;
10172
+ const columns = ((_a = process.stdout) == null ? void 0 : _a.columns) || 80;
10156
10173
  function lineNo(no = "") {
10157
10174
  return picocolors.exports.gray(`${String(no).padStart(3, " ")}| `);
10158
10175
  }
@@ -10246,6 +10263,8 @@ class VitestGit {
10246
10263
  }
10247
10264
 
10248
10265
  var __defProp$1 = Object.defineProperty;
10266
+ var __defProps$1 = Object.defineProperties;
10267
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
10249
10268
  var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
10250
10269
  var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
10251
10270
  var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
@@ -10261,6 +10280,7 @@ var __spreadValues$1 = (a, b) => {
10261
10280
  }
10262
10281
  return a;
10263
10282
  };
10283
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
10264
10284
  const WATCHER_DEBOUNCE = 100;
10265
10285
  const CLOSE_TIMEOUT = 1e3;
10266
10286
  class Vitest {
@@ -10314,18 +10334,14 @@ class Vitest {
10314
10334
  if (resolved.coverage.enabled)
10315
10335
  await cleanCoverage(resolved.coverage, resolved.coverage.clean);
10316
10336
  }
10317
- getConfig() {
10318
- const hasCustomReporter = toArray(this.config.reporters).some((reporter) => typeof reporter !== "string");
10319
- if (this.config.snapshotOptions.resolveSnapshotPath)
10320
- this.config.snapshotOptions.resolveSnapshotPath = void 0;
10321
- if (!hasCustomReporter && !this.configOverride)
10322
- return this.config;
10323
- const config = deepMerge({}, this.config);
10324
- if (this.configOverride)
10325
- deepMerge(config, this.configOverride);
10326
- if (hasCustomReporter)
10327
- config.reporters = [];
10328
- return config;
10337
+ getSerializableConfig() {
10338
+ return deepMerge(__spreadProps$1(__spreadValues$1({}, this.config), {
10339
+ reporters: [],
10340
+ snapshotOptions: __spreadProps$1(__spreadValues$1({}, this.config.snapshotOptions), {
10341
+ resolveSnapshotPath: void 0
10342
+ }),
10343
+ onConsoleLog: void 0
10344
+ }), this.configOverride || {});
10329
10345
  }
10330
10346
  async start(filters) {
10331
10347
  await this.report("onInit", this);
@@ -10429,7 +10445,7 @@ class Vitest {
10429
10445
  this.config.testNamePattern = pattern ? new RegExp(pattern) : void 0;
10430
10446
  await this.rerunFiles(files, trigger);
10431
10447
  }
10432
- async returnFailed() {
10448
+ async rerunFailed() {
10433
10449
  await this.rerunFiles(this.state.getFailedFilepaths(), "rerun failed");
10434
10450
  }
10435
10451
  async updateSnapshot(files) {
@@ -10455,9 +10471,10 @@ class Vitest {
10455
10471
  this.console.error(...args);
10456
10472
  }
10457
10473
  clearScreen() {
10474
+ var _a;
10458
10475
  if (this.server.config.clearScreen === false)
10459
10476
  return;
10460
- const repeatCount = process.stdout.rows - 2;
10477
+ const repeatCount = (((_a = process.stdout) == null ? void 0 : _a.rows) ?? 0) - 2;
10461
10478
  const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
10462
10479
  this.console.log(blank);
10463
10480
  readline.cursorTo(process.stdout, 0, 0);
@@ -10936,7 +10953,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10936
10953
  await ctx.setServer(options, server);
10937
10954
  haveStarted = true;
10938
10955
  if (options.api && options.watch)
10939
- (await import('./chunk-api-setup.ed61899f.js')).setup(ctx);
10956
+ (await import('./chunk-api-setup.02588d9f.js')).setup(ctx);
10940
10957
  if (!options.watch)
10941
10958
  await server.watcher.close();
10942
10959
  }
@@ -10993,6 +11010,8 @@ function registerConsoleShortcuts(ctx) {
10993
11010
  return ctx.updateSnapshot();
10994
11011
  if (name === "a" || name === "return")
10995
11012
  return ctx.rerunFiles(void 0, "rerun all");
11013
+ if (name === "f")
11014
+ return ctx.rerunFailed();
10996
11015
  if (name === "t")
10997
11016
  return inputNamePattern();
10998
11017
  if (name === "q")