vitest 3.2.0-beta.3 → 3.2.0

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 (65) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +2 -2
  4. package/dist/chunks/{base.D4119yLM.js → base.Cg0miDlQ.js} +10 -14
  5. package/dist/chunks/{benchmark.Cf_PACH1.js → benchmark.CYdenmiT.js} +4 -6
  6. package/dist/chunks/{cac.DWaWHIIE.js → cac.6rXCxFY1.js} +66 -136
  7. package/dist/chunks/{cli-api.CnmEXkxs.js → cli-api.Cej3MBjA.js} +1250 -1335
  8. package/dist/chunks/{console.Cwr-MFPV.js → console.CtFJOzRO.js} +24 -45
  9. package/dist/chunks/{coverage.0iPg4Wrz.js → coverage.DVF1vEu8.js} +4 -12
  10. package/dist/chunks/{coverage.C73DaDgS.js → coverage.EIiagJJP.js} +484 -1003
  11. package/dist/chunks/{creator.C8WKy2eW.js → creator.GK6I-cL4.js} +29 -76
  12. package/dist/chunks/{date.ByMsSlOr.js → date.Bq6ZW5rf.js} +3 -8
  13. package/dist/chunks/{defaults.DpVH7vbg.js → defaults.B7q_naMc.js} +1 -1
  14. package/dist/chunks/{env.Dq0hM4Xv.js → env.D4Lgay0q.js} +1 -1
  15. package/dist/chunks/{execute.B3q-2LPV.js → execute.B7h3T_Hc.js} +104 -220
  16. package/dist/chunks/{git.DXfdBEfR.js → git.BVQ8w_Sw.js} +1 -3
  17. package/dist/chunks/{global.d.BNLIi6yo.d.ts → global.d.MAmajcmJ.d.ts} +2 -0
  18. package/dist/chunks/{globals.CI21aWXF.js → globals.DEHgCU4V.js} +5 -5
  19. package/dist/chunks/{index.Bter3jj9.js → index.BZ0g1JD2.js} +366 -628
  20. package/dist/chunks/{index.CbT4iuwc.js → index.BbB8_kAK.js} +22 -24
  21. package/dist/chunks/{index.JOzufsrU.js → index.CIyJn3t1.js} +37 -82
  22. package/dist/chunks/{index.DNgLEKsQ.js → index.CdQS2e2Q.js} +2 -2
  23. package/dist/chunks/{index.2jgTs_Q5.js → index.CmSc2RE5.js} +69 -107
  24. package/dist/chunks/{inspector.BFsh5KO0.js → inspector.C914Efll.js} +1 -1
  25. package/dist/chunks/{node.Be-ntJnD.js → node.fjCdwEIl.js} +1 -1
  26. package/dist/chunks/{reporters.d.Bt4IGtsa.d.ts → reporters.d.C1ogPriE.d.ts} +24 -4
  27. package/dist/chunks/{rpc.BKExFSRG.js → rpc.Iovn4oWe.js} +9 -19
  28. package/dist/chunks/{runBaseTests.B_M1TTsK.js → runBaseTests.Dd85QTll.js} +18 -31
  29. package/dist/chunks/{setup-common.CF-O-dZX.js → setup-common.Dd054P77.js} +15 -42
  30. package/dist/chunks/{typechecker.BgzF-6iO.js → typechecker.DRKU1-1g.js} +106 -186
  31. package/dist/chunks/{utils.DPCq3gzW.js → utils.CAioKnHs.js} +6 -14
  32. package/dist/chunks/{utils.BlI4TC7Y.js → utils.XdZDrNZV.js} +5 -13
  33. package/dist/chunks/{vi.pkoYCV6A.js → vi.bdSIJ99Y.js} +118 -267
  34. package/dist/chunks/{vite.d.B-Kx3KCF.d.ts → vite.d.DqE4-hhK.d.ts} +1 -1
  35. package/dist/chunks/{vm.DPYem2so.js → vm.BThCzidc.js} +98 -214
  36. package/dist/chunks/{worker.d.Bl1O4kuf.d.ts → worker.d.DvqK5Vmu.d.ts} +1 -1
  37. package/dist/chunks/{worker.d.BKbBp2ga.d.ts → worker.d.tQu2eJQy.d.ts} +3 -1
  38. package/dist/cli.js +4 -4
  39. package/dist/config.cjs +1 -1
  40. package/dist/config.d.ts +4 -4
  41. package/dist/config.js +2 -2
  42. package/dist/coverage.d.ts +2 -2
  43. package/dist/coverage.js +5 -5
  44. package/dist/environments.js +1 -1
  45. package/dist/execute.d.ts +1 -1
  46. package/dist/execute.js +1 -1
  47. package/dist/index.d.ts +11 -10
  48. package/dist/index.js +5 -5
  49. package/dist/node.d.ts +7 -7
  50. package/dist/node.js +12 -14
  51. package/dist/reporters.d.ts +2 -2
  52. package/dist/reporters.js +4 -4
  53. package/dist/runners.d.ts +5 -2
  54. package/dist/runners.js +51 -80
  55. package/dist/snapshot.js +2 -2
  56. package/dist/suite.js +2 -2
  57. package/dist/worker.js +36 -42
  58. package/dist/workers/forks.js +4 -4
  59. package/dist/workers/runVmTests.js +15 -21
  60. package/dist/workers/threads.js +4 -4
  61. package/dist/workers/vmForks.js +6 -6
  62. package/dist/workers/vmThreads.js +6 -6
  63. package/dist/workers.d.ts +2 -2
  64. package/dist/workers.js +10 -10
  65. package/package.json +16 -14
package/LICENSE.md CHANGED
@@ -372,6 +372,35 @@ Repository: sindresorhus/locate-path
372
372
 
373
373
  ---------------------------------------
374
374
 
375
+ ## mime
376
+ License: MIT
377
+ By: Robert Kieffer
378
+ Repository: https://github.com/broofa/mime
379
+
380
+ > MIT License
381
+ >
382
+ > Copyright (c) 2023 Robert Kieffer
383
+ >
384
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
385
+ > of this software and associated documentation files (the "Software"), to deal
386
+ > in the Software without restriction, including without limitation the rights
387
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
388
+ > copies of the Software, and to permit persons to whom the Software is
389
+ > furnished to do so, subject to the following conditions:
390
+ >
391
+ > The above copyright notice and this permission notice shall be included in all
392
+ > copies or substantial portions of the Software.
393
+ >
394
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
395
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
396
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
397
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
398
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
399
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
400
+ > SOFTWARE.
401
+
402
+ ---------------------------------------
403
+
375
404
  ## mlly
376
405
  License: MIT
377
406
  Repository: unjs/mlly
package/dist/browser.d.ts CHANGED
@@ -12,7 +12,7 @@ import '@vitest/snapshot';
12
12
  import '@vitest/snapshot/environment';
13
13
  import 'vite-node/client';
14
14
  import 'vite-node';
15
- import './chunks/worker.d.BKbBp2ga.js';
15
+ import './chunks/worker.d.tQu2eJQy.js';
16
16
  import './chunks/environment.d.cL3nLXbE.js';
17
17
  import 'vitest/optional-types.js';
18
18
  import 'node:vm';
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
- export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.CF-O-dZX.js';
1
+ export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.Dd054P77.js';
2
2
  export { collectTests, processError, startTests } from '@vitest/runner';
3
3
  import * as spy from '@vitest/spy';
4
4
  export { spy as SpyModule };
5
5
  export { format, getSafeTimers, inspect, stringify } from '@vitest/utils';
6
6
  export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
7
- import './chunks/coverage.0iPg4Wrz.js';
7
+ import './chunks/coverage.DVF1vEu8.js';
8
8
  import '@vitest/snapshot';
@@ -1,14 +1,12 @@
1
1
  import { ModuleCacheMap } from 'vite-node/client';
2
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B3q-2LPV.js';
3
- import { p as provideWorkerState } from './utils.BlI4TC7Y.js';
2
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B7h3T_Hc.js';
3
+ import { p as provideWorkerState } from './utils.XdZDrNZV.js';
4
4
 
5
5
  let _viteNode;
6
6
  const moduleCache = new ModuleCacheMap();
7
- const moduleExecutionInfo = new Map();
7
+ const moduleExecutionInfo = /* @__PURE__ */ new Map();
8
8
  async function startViteNode(options) {
9
- if (_viteNode) {
10
- return _viteNode;
11
- }
9
+ if (_viteNode) return _viteNode;
12
10
  _viteNode = await startVitestExecutor(options);
13
11
  return _viteNode;
14
12
  }
@@ -18,20 +16,18 @@ async function runBaseTests(method, state) {
18
16
  state.moduleCache = moduleCache;
19
17
  state.moduleExecutionInfo = moduleExecutionInfo;
20
18
  provideWorkerState(globalThis, state);
21
- if (ctx.invalidates) {
22
- ctx.invalidates.forEach((fsPath) => {
23
- moduleCache.delete(fsPath);
24
- moduleCache.delete(`mock:${fsPath}`);
25
- });
26
- }
19
+ if (ctx.invalidates) ctx.invalidates.forEach((fsPath) => {
20
+ moduleCache.delete(fsPath);
21
+ moduleCache.delete(`mock:${fsPath}`);
22
+ });
27
23
  ctx.files.forEach((i) => state.moduleCache.delete(typeof i === "string" ? i : i.filepath));
28
24
  const [executor, { run }] = await Promise.all([startViteNode({
29
25
  state,
30
26
  requestStubs: getDefaultRequestStubs()
31
- }), import('./runBaseTests.B_M1TTsK.js')]);
27
+ }), import('./runBaseTests.Dd85QTll.js')]);
32
28
  const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
33
29
  filepath: f,
34
- testLocations: undefined
30
+ testLocations: void 0
35
31
  } : f);
36
32
  await run(method, fileSpecs, ctx.config, {
37
33
  environment: state.environment,
@@ -1,10 +1,10 @@
1
1
  import { getCurrentSuite } from '@vitest/runner';
2
2
  import { createChainable } from '@vitest/runner/utils';
3
3
  import { noop } from '@vitest/utils';
4
- import { g as getWorkerState } from './utils.BlI4TC7Y.js';
4
+ import { g as getWorkerState } from './utils.XdZDrNZV.js';
5
5
 
6
- const benchFns = new WeakMap();
7
- const benchOptsMap = new WeakMap();
6
+ const benchFns = /* @__PURE__ */ new WeakMap();
7
+ const benchOptsMap = /* @__PURE__ */ new WeakMap();
8
8
  function getBenchOptions(key) {
9
9
  return benchOptsMap.get(key);
10
10
  }
@@ -12,9 +12,7 @@ function getBenchFn(key) {
12
12
  return benchFns.get(key);
13
13
  }
14
14
  const bench = createBenchmark(function(name, fn = noop, options = {}) {
15
- if (getWorkerState().config.mode !== "benchmark") {
16
- throw new Error("`bench()` is only available in benchmark mode.");
17
- }
15
+ if (getWorkerState().config.mode !== "benchmark") throw new Error("`bench()` is only available in benchmark mode.");
18
16
  const task = getCurrentSuite().task(formatName(name), {
19
17
  ...this,
20
18
  meta: { benchmark: true }
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import { normalize } from 'pathe';
4
4
  import c from 'tinyrainbow';
5
5
  import { a as defaultPort, d as defaultBrowserPort } from './constants.DnKduX2e.js';
6
- import { R as ReportersMap } from './index.Bter3jj9.js';
6
+ import { R as ReportersMap } from './index.BZ0g1JD2.js';
7
7
 
8
8
  function toArr(any) {
9
9
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
619
619
 
620
620
  const cac = (name = "") => new CAC(name);
621
621
 
622
- var version = "3.2.0-beta.3";
622
+ var version = "3.2.0";
623
623
 
624
624
  const apiConfig = (port) => ({
625
625
  port: {
@@ -661,15 +661,11 @@ const poolForksCommands = {
661
661
  execArgv: null
662
662
  };
663
663
  function watermarkTransform(value) {
664
- if (typeof value === "string") {
665
- return value.split(",").map(Number);
666
- }
664
+ if (typeof value === "string") return value.split(",").map(Number);
667
665
  return value;
668
666
  }
669
667
  function transformNestedBoolean(value) {
670
- if (typeof value === "boolean") {
671
- return { enabled: value };
672
- }
668
+ if (typeof value === "boolean") return { enabled: value };
673
669
  return value;
674
670
  }
675
671
  const cliOptionsConfig = {
@@ -712,7 +708,13 @@ const cliOptionsConfig = {
712
708
  },
713
709
  silent: {
714
710
  description: "Silent console output from tests. Use `'passed-only'` to see logs from failing tests only.",
715
- argument: "[value]"
711
+ argument: "[value]",
712
+ transform(value) {
713
+ if (value === "true" || value === "yes" || value === true) return true;
714
+ if (value === "false" || value === "no" || value === false) return false;
715
+ if (value === "passed-only") return value;
716
+ throw new TypeError(`Unexpected value "--silent=${value}". Use "--silent=true ${value}" instead.`);
717
+ }
716
718
  },
717
719
  hideSkippedTests: { description: "Hide logs for skipped tests" },
718
720
  reporters: {
@@ -855,18 +857,10 @@ const cliOptionsConfig = {
855
857
  description: "Run tests in the browser. Equivalent to `--browser.enabled` (default: `false`)",
856
858
  argument: "<name>",
857
859
  transform(browser) {
858
- if (typeof browser === "boolean") {
859
- return { enabled: browser };
860
- }
861
- if (browser === "true" || browser === "false") {
862
- return { enabled: browser === "true" };
863
- }
864
- if (browser === "yes" || browser === "no") {
865
- return { enabled: browser === "yes" };
866
- }
867
- if (typeof browser === "string") {
868
- return { name: browser };
869
- }
860
+ if (typeof browser === "boolean") return { enabled: browser };
861
+ if (browser === "true" || browser === "false") return { enabled: browser === "true" };
862
+ if (browser === "yes" || browser === "no") return { enabled: browser === "yes" };
863
+ if (typeof browser === "string") return { name: browser };
870
864
  return browser;
871
865
  },
872
866
  subcommands: {
@@ -1010,12 +1004,8 @@ const cliOptionsConfig = {
1010
1004
  description: "Enable Node.js inspector (default: `127.0.0.1:9229`)",
1011
1005
  argument: "[[host:]port]",
1012
1006
  transform(portOrEnabled) {
1013
- if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") {
1014
- return true;
1015
- }
1016
- if (portOrEnabled === "false" || portOrEnabled === "no") {
1017
- return false;
1018
- }
1007
+ if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") return true;
1008
+ if (portOrEnabled === "false" || portOrEnabled === "no") return false;
1019
1009
  return portOrEnabled;
1020
1010
  }
1021
1011
  },
@@ -1023,12 +1013,8 @@ const cliOptionsConfig = {
1023
1013
  description: "Enable Node.js inspector and break before the test starts",
1024
1014
  argument: "[[host:]port]",
1025
1015
  transform(portOrEnabled) {
1026
- if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") {
1027
- return true;
1028
- }
1029
- if (portOrEnabled === "false" || portOrEnabled === "no") {
1030
- return false;
1031
- }
1016
+ if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") return true;
1017
+ if (portOrEnabled === "false" || portOrEnabled === "no") return false;
1032
1018
  return portOrEnabled;
1033
1019
  }
1034
1020
  },
@@ -1152,12 +1138,8 @@ const cliOptionsConfig = {
1152
1138
  subcommands: { dir: null },
1153
1139
  default: true,
1154
1140
  transform(cache) {
1155
- if (typeof cache !== "boolean" && cache) {
1156
- throw new Error("--cache.dir is deprecated");
1157
- }
1158
- if (cache) {
1159
- return {};
1160
- }
1141
+ if (typeof cache !== "boolean" && cache) throw new Error("--cache.dir is deprecated");
1142
+ if (cache) return {};
1161
1143
  return cache;
1162
1144
  }
1163
1145
  },
@@ -1184,22 +1166,22 @@ const cliOptionsConfig = {
1184
1166
  }
1185
1167
  },
1186
1168
  transform(value) {
1187
- if (typeof value !== "object") {
1188
- throw new TypeError(`Unexpected value for --expect.poll: ${value}. If you need to configure timeout, use --expect.poll.timeout=<timeout>`);
1189
- }
1169
+ if (typeof value !== "object") throw new TypeError(`Unexpected value for --expect.poll: ${value}. If you need to configure timeout, use --expect.poll.timeout=<timeout>`);
1190
1170
  return value;
1191
1171
  }
1192
1172
  }
1193
1173
  },
1194
1174
  transform(value) {
1195
- if (typeof value !== "object") {
1196
- throw new TypeError(`Unexpected value for --expect: ${value}. If you need to configure expect options, use --expect.{name}=<value> syntax`);
1197
- }
1175
+ if (typeof value !== "object") throw new TypeError(`Unexpected value for --expect: ${value}. If you need to configure expect options, use --expect.{name}=<value> syntax`);
1198
1176
  return value;
1199
1177
  }
1200
1178
  },
1201
1179
  printConsoleTrace: { description: "Always print console stack traces" },
1202
1180
  includeTaskLocation: { description: "Collect test and suite locations in the `location` property" },
1181
+ attachmentsDir: {
1182
+ description: "The directory where attachments from `context.annotate` are stored in (default: `.vitest-attachments`)",
1183
+ argument: "<dir>"
1184
+ },
1203
1185
  run: { description: "Disable watch mode" },
1204
1186
  color: {
1205
1187
  description: "Removes colors from the console output",
@@ -1215,9 +1197,7 @@ const cliOptionsConfig = {
1215
1197
  description: "Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests",
1216
1198
  argument: "[path]",
1217
1199
  transform(value) {
1218
- if (!value || typeof value === "boolean") {
1219
- return ".vitest-reports";
1220
- }
1200
+ if (!value || typeof value === "boolean") return ".vitest-reports";
1221
1201
  return value;
1222
1202
  }
1223
1203
  },
@@ -1280,49 +1260,31 @@ const collectCliOptionsConfig = {
1280
1260
  function addCommand(cli, name, option) {
1281
1261
  const commandName = option.alias || name;
1282
1262
  let command = option.shorthand ? `-${option.shorthand}, --${commandName}` : `--${commandName}`;
1283
- if ("argument" in option) {
1284
- command += ` ${option.argument}`;
1285
- }
1263
+ if ("argument" in option) command += ` ${option.argument}`;
1286
1264
  function transform(value) {
1287
1265
  if (!option.array && Array.isArray(value)) {
1288
1266
  const received = value.map((s) => typeof s === "string" ? `"${s}"` : s).join(", ");
1289
1267
  throw new Error(`Expected a single value for option "${command}", received [${received}]`);
1290
1268
  }
1291
1269
  value = removeQuotes(value);
1292
- if (option.transform) {
1293
- return option.transform(value);
1294
- }
1295
- if (option.array) {
1296
- return toArray(value);
1297
- }
1298
- if (option.normalize) {
1299
- return normalize(String(value));
1300
- }
1270
+ if (option.transform) return option.transform(value);
1271
+ if (option.array) return toArray(value);
1272
+ if (option.normalize) return normalize(String(value));
1301
1273
  return value;
1302
1274
  }
1303
1275
  const hasSubcommands = "subcommands" in option && option.subcommands;
1304
1276
  if (option.description) {
1305
1277
  let description = option.description.replace(/\[.*\]\((.*)\)/, "$1").replace(/`/g, "");
1306
- if (hasSubcommands) {
1307
- description += `. Use '--help --${commandName}' for more info.`;
1308
- }
1278
+ if (hasSubcommands) description += `. Use '--help --${commandName}' for more info.`;
1309
1279
  cli.option(command, description, { type: transform });
1310
1280
  }
1311
- if (hasSubcommands) {
1312
- for (const commandName in option.subcommands) {
1313
- const subcommand = option.subcommands[commandName];
1314
- if (subcommand) {
1315
- addCommand(cli, `${name}.${commandName}`, subcommand);
1316
- }
1317
- }
1281
+ if (hasSubcommands) for (const commandName in option.subcommands) {
1282
+ const subcommand = option.subcommands[commandName];
1283
+ if (subcommand) addCommand(cli, `${name}.${commandName}`, subcommand);
1318
1284
  }
1319
1285
  }
1320
1286
  function addCliOptions(cli, options) {
1321
- for (const [optionName, option] of Object.entries(options)) {
1322
- if (option) {
1323
- addCommand(cli, optionName, option);
1324
- }
1325
- }
1287
+ for (const [optionName, option] of Object.entries(options)) if (option) addCommand(cli, optionName, option);
1326
1288
  }
1327
1289
  function createCLI(options = {}) {
1328
1290
  const cli = cac("vitest");
@@ -1330,13 +1292,9 @@ function createCLI(options = {}) {
1330
1292
  addCliOptions(cli, cliOptionsConfig);
1331
1293
  cli.help((info) => {
1332
1294
  const helpSection = info.find((current) => current.title?.startsWith("For more info, run any command"));
1333
- if (helpSection) {
1334
- helpSection.body += "\n $ vitest --help --expand-help";
1335
- }
1295
+ if (helpSection) helpSection.body += "\n $ vitest --help --expand-help";
1336
1296
  const options = info.find((current) => current.title === "Options");
1337
- if (typeof options !== "object") {
1338
- return info;
1339
- }
1297
+ if (typeof options !== "object") return info;
1340
1298
  const helpIndex = process.argv.findIndex((arg) => arg === "--help");
1341
1299
  const subcommands = process.argv.slice(helpIndex + 1);
1342
1300
  const defaultOutput = options.body.split("\n").filter((line) => /^\s+--\S+\./.test(line) === false).join("\n");
@@ -1345,16 +1303,12 @@ function createCLI(options = {}) {
1345
1303
  options.body = defaultOutput;
1346
1304
  return info;
1347
1305
  }
1348
- if (subcommands.length === 1 && (subcommands[0] === "--expand-help" || subcommands[0] === "--expandHelp")) {
1349
- return info;
1350
- }
1306
+ if (subcommands.length === 1 && (subcommands[0] === "--expand-help" || subcommands[0] === "--expandHelp")) return info;
1351
1307
  const subcommandMarker = "$SUB_COMMAND_MARKER$";
1352
1308
  const banner = info.find((current) => /^vitest\/\d+\.\d+\.\d+$/.test(current.body));
1353
1309
  function addBannerWarning(warning) {
1354
1310
  if (typeof banner?.body === "string") {
1355
- if (banner?.body.includes(warning)) {
1356
- return;
1357
- }
1311
+ if (banner?.body.includes(warning)) return;
1358
1312
  banner.body = `${banner.body}\n WARN: ${warning}`;
1359
1313
  }
1360
1314
  }
@@ -1367,9 +1321,7 @@ function createCLI(options = {}) {
1367
1321
  continue;
1368
1322
  }
1369
1323
  // Mark the help section for the subcommands
1370
- if (subcommand.startsWith("--")) {
1371
- options.body = options.body.split("\n").map((line) => line.trim().startsWith(subcommand) ? `${subcommandMarker}${line}` : line).join("\n");
1372
- }
1324
+ if (subcommand.startsWith("--")) options.body = options.body.split("\n").map((line) => line.trim().startsWith(subcommand) ? `${subcommandMarker}${line}` : line).join("\n");
1373
1325
  }
1374
1326
  // Filter based on the marked options to preserve the original sort order
1375
1327
  options.body = options.body.split("\n").map((line) => line.startsWith(subcommandMarker) ? line.split(subcommandMarker)[1] : "").filter((line) => line.length !== 0).join("\n");
@@ -1379,29 +1331,23 @@ function createCLI(options = {}) {
1379
1331
  }
1380
1332
  return info;
1381
1333
  });
1382
- cli.command("run [...filters]", undefined, options).action(run);
1383
- cli.command("related [...filters]", undefined, options).action(runRelated);
1384
- cli.command("watch [...filters]", undefined, options).action(watch);
1385
- cli.command("dev [...filters]", undefined, options).action(watch);
1386
- addCliOptions(cli.command("bench [...filters]", undefined, options).action(benchmark), benchCliOptionsConfig);
1387
- cli.command("init <project>", undefined, options).action(init);
1388
- addCliOptions(cli.command("list [...filters]", undefined, options).action((filters, options) => collect("test", filters, options)), collectCliOptionsConfig);
1389
- cli.command("[...filters]", undefined, options).action((filters, options) => start("test", filters, options));
1334
+ cli.command("run [...filters]", void 0, options).action(run);
1335
+ cli.command("related [...filters]", void 0, options).action(runRelated);
1336
+ cli.command("watch [...filters]", void 0, options).action(watch);
1337
+ cli.command("dev [...filters]", void 0, options).action(watch);
1338
+ addCliOptions(cli.command("bench [...filters]", void 0, options).action(benchmark), benchCliOptionsConfig);
1339
+ cli.command("init <project>", void 0, options).action(init);
1340
+ addCliOptions(cli.command("list [...filters]", void 0, options).action((filters, options) => collect("test", filters, options)), collectCliOptionsConfig);
1341
+ cli.command("[...filters]", void 0, options).action((filters, options) => start("test", filters, options));
1390
1342
  return cli;
1391
1343
  }
1392
1344
  function removeQuotes(str) {
1393
1345
  if (typeof str !== "string") {
1394
- if (Array.isArray(str)) {
1395
- return str.map(removeQuotes);
1396
- }
1346
+ if (Array.isArray(str)) return str.map(removeQuotes);
1397
1347
  return str;
1398
1348
  }
1399
- if (str.startsWith("\"") && str.endsWith("\"")) {
1400
- return str.slice(1, -1);
1401
- }
1402
- if (str.startsWith(`'`) && str.endsWith(`'`)) {
1403
- return str.slice(1, -1);
1404
- }
1349
+ if (str.startsWith("\"") && str.endsWith("\"")) return str.slice(1, -1);
1350
+ if (str.startsWith(`'`) && str.endsWith(`'`)) return str.slice(1, -1);
1405
1351
  return str;
1406
1352
  }
1407
1353
  function splitArgv(argv) {
@@ -1414,18 +1360,12 @@ function splitArgv(argv) {
1414
1360
  }
1415
1361
  function parseCLI(argv, config = {}) {
1416
1362
  const arrayArgs = typeof argv === "string" ? splitArgv(argv) : argv;
1417
- if (arrayArgs[0] !== "vitest") {
1418
- throw new Error(`Expected "vitest" as the first argument, received "${arrayArgs[0]}"`);
1419
- }
1363
+ if (arrayArgs[0] !== "vitest") throw new Error(`Expected "vitest" as the first argument, received "${arrayArgs[0]}"`);
1420
1364
  arrayArgs[0] = "/index.js";
1421
1365
  arrayArgs.unshift("node");
1422
1366
  let { args, options } = createCLI(config).parse(arrayArgs, { run: false });
1423
- if (arrayArgs[2] === "watch" || arrayArgs[2] === "dev") {
1424
- options.watch = true;
1425
- }
1426
- if (arrayArgs[2] === "run") {
1427
- options.run = true;
1428
- }
1367
+ if (arrayArgs[2] === "watch" || arrayArgs[2] === "dev") options.watch = true;
1368
+ if (arrayArgs[2] === "run") options.run = true;
1429
1369
  if (arrayArgs[2] === "related") {
1430
1370
  options.related = args;
1431
1371
  options.passWithNoTests ??= true;
@@ -1458,12 +1398,8 @@ function normalizeCliOptions(cliFilters, argv) {
1458
1398
  argv.cliExclude = toArray(argv.exclude);
1459
1399
  delete argv.exclude;
1460
1400
  }
1461
- if (cliFilters.some((filter) => filter.includes(":"))) {
1462
- argv.includeTaskLocation ??= true;
1463
- }
1464
- if (typeof argv.typecheck?.only === "boolean") {
1465
- argv.typecheck.enabled ??= true;
1466
- }
1401
+ if (cliFilters.some((filter) => filter.includes(":"))) argv.includeTaskLocation ??= true;
1402
+ if (typeof argv.typecheck?.only === "boolean") argv.typecheck.enabled ??= true;
1467
1403
  return argv;
1468
1404
  }
1469
1405
  async function start(mode, cliFilters, options) {
@@ -1471,19 +1407,15 @@ async function start(mode, cliFilters, options) {
1471
1407
  process.title = "node (vitest)";
1472
1408
  } catch {}
1473
1409
  try {
1474
- const { startVitest } = await import('./cli-api.CnmEXkxs.js').then(function (n) { return n.f; });
1410
+ const { startVitest } = await import('./cli-api.Cej3MBjA.js').then(function (n) { return n.f; });
1475
1411
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1476
- if (!ctx.shouldKeepServer()) {
1477
- await ctx.exit();
1478
- }
1412
+ if (!ctx.shouldKeepServer()) await ctx.exit();
1479
1413
  } catch (e) {
1480
- const { errorBanner } = await import('./index.Bter3jj9.js').then(function (n) { return n.u; });
1414
+ const { errorBanner } = await import('./index.BZ0g1JD2.js').then(function (n) { return n.u; });
1481
1415
  console.error(`\n${errorBanner("Startup Error")}`);
1482
1416
  console.error(e);
1483
1417
  console.error("\n\n");
1484
- if (process.exitCode == null) {
1485
- process.exitCode = 1;
1486
- }
1418
+ if (process.exitCode == null) process.exitCode = 1;
1487
1419
  process.exit();
1488
1420
  }
1489
1421
  }
@@ -1492,7 +1424,7 @@ async function init(project) {
1492
1424
  console.error(new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
1493
1425
  process.exit(1);
1494
1426
  }
1495
- const { create } = await import('./creator.C8WKy2eW.js');
1427
+ const { create } = await import('./creator.GK6I-cL4.js');
1496
1428
  await create();
1497
1429
  }
1498
1430
  async function collect(mode, cliFilters, options) {
@@ -1500,7 +1432,7 @@ async function collect(mode, cliFilters, options) {
1500
1432
  process.title = "node (vitest)";
1501
1433
  } catch {}
1502
1434
  try {
1503
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CnmEXkxs.js').then(function (n) { return n.f; });
1435
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Cej3MBjA.js').then(function (n) { return n.f; });
1504
1436
  const ctx = await prepareVitest(mode, {
1505
1437
  ...normalizeCliOptions(cliFilters, options),
1506
1438
  watch: false,
@@ -1522,13 +1454,11 @@ async function collect(mode, cliFilters, options) {
1522
1454
  }
1523
1455
  await ctx.close();
1524
1456
  } catch (e) {
1525
- const { errorBanner } = await import('./index.Bter3jj9.js').then(function (n) { return n.u; });
1457
+ const { errorBanner } = await import('./index.BZ0g1JD2.js').then(function (n) { return n.u; });
1526
1458
  console.error(`\n${errorBanner("Collect Error")}`);
1527
1459
  console.error(e);
1528
1460
  console.error("\n\n");
1529
- if (process.exitCode == null) {
1530
- process.exitCode = 1;
1531
- }
1461
+ if (process.exitCode == null) process.exitCode = 1;
1532
1462
  process.exit();
1533
1463
  }
1534
1464
  }