vitest 4.1.4 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/browser.d.ts +4 -4
  2. package/dist/browser.js +2 -2
  3. package/dist/chunks/{base.Cv_yNPUJ.js → base.CgusHodA.js} +8 -8
  4. package/dist/chunks/{browser.d.C0zGu1u9.d.ts → browser.d.Bn-qMB1Y.d.ts} +2 -2
  5. package/dist/chunks/{cac.wyYWMVI-.js → cac.DSVGM2li.js} +18 -7
  6. package/dist/chunks/{cli-api.lDy4N9kC.js → cli-api.MLtHkHGf.js} +88 -23
  7. package/dist/chunks/{config.d.ChUh6-ad.d.ts → config.d.BgVe1oN5.d.ts} +12 -1
  8. package/dist/chunks/{coverage.Da5gzbsu.js → coverage.nIKqs-BM.js} +38 -8
  9. package/dist/chunks/{defaults.9aQKnqFk.js → defaults.pr789SUS.js} +1 -0
  10. package/dist/chunks/{global.d.D74z04P1.d.ts → global.d.DVsSRdQ5.d.ts} +1 -1
  11. package/dist/chunks/{globals.BVDtJR67.js → globals.BYX6Co2c.js} +2 -2
  12. package/dist/chunks/{index.C3MK_gXn.js → index.BSgubW8K.js} +2 -2
  13. package/dist/chunks/{index.C-zNJvRx.js → index.BcGySndd.js} +1 -1
  14. package/dist/chunks/{index.BCY_7LL2.js → index.CesbTg1C.js} +9 -9
  15. package/dist/chunks/{index.BMXTnDNz.js → index.yJ2D83a4.js} +32 -30
  16. package/dist/chunks/{init-forks.UV3ZQGQH.js → init-forks.DuteEWBS.js} +1 -1
  17. package/dist/chunks/{init-threads.D3eCsY76.js → init-threads.BSdvBCTO.js} +1 -1
  18. package/dist/chunks/{init.D98-gwRW.js → init.Dc7N0jh0.js} +1 -1
  19. package/dist/chunks/{nativeModuleMocker.BRN2oBJd.js → nativeModuleMocker.BKN7j4tC.js} +1 -1
  20. package/dist/chunks/{nativeModuleRunner.BIakptoF.js → nativeModuleRunner.WlMdOB52.js} +1 -1
  21. package/dist/chunks/{plugin.d.CEihBODF.d.ts → plugin.d.BkNgFMgP.d.ts} +1 -1
  22. package/dist/chunks/{reporters.d.BwkR0iL5.d.ts → reporters.d.GtfMm3Oa.d.ts} +206 -20
  23. package/dist/chunks/{rpc.d.BFMWpdph.d.ts → rpc.d.B_8sPU0w.d.ts} +2 -44
  24. package/dist/chunks/{setup-common.BDwxwUWG.js → setup-common.CYy2gJEr.js} +1 -1
  25. package/dist/chunks/{startVitestModuleRunner.bRl2_oI_.js → startVitestModuleRunner.vRT958-n.js} +2 -2
  26. package/dist/chunks/{test.D1JkM1w4.js → test.C8WyxAQk.js} +3 -2
  27. package/dist/chunks/traces.d.D2T_R8rx.d.ts +60 -0
  28. package/dist/chunks/{utils.BS4fH3nR.js → utils.DzYdXqCH.js} +2 -3
  29. package/dist/chunks/{vm.DVLYObm9.js → vm.CPtbsAeh.js} +5 -5
  30. package/dist/chunks/{worker.d.CckNUvI5.d.ts → worker.d.irleQtmS.d.ts} +2 -2
  31. package/dist/cli.js +1 -1
  32. package/dist/config.cjs +1 -0
  33. package/dist/config.d.ts +12 -10
  34. package/dist/config.js +1 -1
  35. package/dist/coverage.d.ts +9 -7
  36. package/dist/coverage.js +5 -4
  37. package/dist/index.d.ts +15 -12
  38. package/dist/index.js +2 -2
  39. package/dist/module-evaluator.d.ts +2 -2
  40. package/dist/node.d.ts +11 -10
  41. package/dist/node.js +11 -11
  42. package/dist/reporters.d.ts +9 -8
  43. package/dist/reporters.js +4 -4
  44. package/dist/runners.d.ts +2 -2
  45. package/dist/runners.js +1 -1
  46. package/dist/runtime.js +1 -1
  47. package/dist/worker.d.ts +4 -4
  48. package/dist/worker.js +9 -9
  49. package/dist/workers/forks.js +10 -10
  50. package/dist/workers/runVmTests.js +4 -4
  51. package/dist/workers/threads.js +10 -10
  52. package/dist/workers/vmForks.js +4 -4
  53. package/dist/workers/vmThreads.js +4 -4
  54. package/package.json +14 -14
  55. package/dist/chunks/traces.d.402V_yFI.d.ts +0 -18
package/dist/browser.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.ChUh6-ad.js';
1
+ import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.BgVe1oN5.js';
2
2
  import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
3
3
  import { SerializedDiffOptions } from '@vitest/utils/diff';
4
- export { O as OTELCarrier, T as Traces } from './chunks/traces.d.402V_yFI.js';
4
+ export { O as OTELCarrier, T as Traces } from './chunks/traces.d.D2T_R8rx.js';
5
5
  export { collectTests, startTests } from '@vitest/runner';
6
6
  import * as _vitest_spy from '@vitest/spy';
7
7
  export { _vitest_spy as SpyModule };
8
- export { LoupeOptions, ParsedStack, StringifyOptions } from '@vitest/utils';
9
- export { browserFormat, format, inspect, stringify } from '@vitest/utils/display';
8
+ export { ParsedStack, StringifyOptions } from '@vitest/utils';
9
+ export { format, inspect, stringify } from '@vitest/utils/display';
10
10
  export { processError } from '@vitest/utils/error';
11
11
  export { getType } from '@vitest/utils/helpers';
12
12
  export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
package/dist/browser.js CHANGED
@@ -1,9 +1,9 @@
1
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.BDwxwUWG.js';
1
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.CYy2gJEr.js';
2
2
  export { T as Traces } from './chunks/traces.DT5aQ62U.js';
3
3
  export { collectTests, startTests } from '@vitest/runner';
4
4
  import * as spyModule from '@vitest/spy';
5
5
  export { spyModule as SpyModule };
6
- export { browserFormat, format, inspect, stringify } from '@vitest/utils/display';
6
+ export { format, inspect, stringify } from '@vitest/utils/display';
7
7
  export { processError } from '@vitest/utils/error';
8
8
  export { getType } from '@vitest/utils/helpers';
9
9
  export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
@@ -1,22 +1,22 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import * as spyModule from '@vitest/spy';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.C3MK_gXn.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.D98-gwRW.js';
5
- import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.BSgubW8K.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.Dc7N0jh0.js';
5
+ import { N as NativeModuleRunner } from './nativeModuleRunner.WlMdOB52.js';
6
6
  import { T as Traces } from './traces.DT5aQ62U.js';
7
7
  import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
8
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startVitestModuleRunner.bRl2_oI_.js';
8
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startVitestModuleRunner.vRT958-n.js';
9
9
  import { performance as performance$1 } from 'node:perf_hooks';
10
10
  import { startTests, collectTests } from '@vitest/runner';
11
- import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.BDwxwUWG.js';
12
- import { g as globalExpect, v as vi } from './test.D1JkM1w4.js';
11
+ import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.CYy2gJEr.js';
12
+ import { g as globalExpect, v as vi } from './test.C8WyxAQk.js';
13
13
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
14
14
  import { createRequire } from 'node:module';
15
15
  import timers from 'node:timers';
16
16
  import timersPromises from 'node:timers/promises';
17
17
  import util from 'node:util';
18
18
  import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
19
- import { i as index } from './index.C-zNJvRx.js';
19
+ import { i as index } from './index.BcGySndd.js';
20
20
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.BX5Fg8C4.js';
21
21
 
22
22
  // this should only be used in Node
@@ -115,7 +115,7 @@ async function startModuleRunner(options) {
115
115
  let mocker;
116
116
  if (options.state.config.experimental.nodeLoader !== false) {
117
117
  // this additionally imports acorn/magic-string
118
- const { NativeModuleMocker } = await import('./nativeModuleMocker.BRN2oBJd.js');
118
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.BKN7j4tC.js');
119
119
  mocker = new NativeModuleMocker({
120
120
  async resolveId(id, importer) {
121
121
  // TODO: use import.meta.resolve instead
@@ -1,6 +1,6 @@
1
1
  import { FileSpecification } from '@vitest/runner';
2
- import { O as OTELCarrier } from './traces.d.402V_yFI.js';
3
- import { T as TestExecutionMethod } from './worker.d.CckNUvI5.js';
2
+ import { O as OTELCarrier } from './traces.d.D2T_R8rx.js';
3
+ import { T as TestExecutionMethod } from './worker.d.irleQtmS.js';
4
4
 
5
5
  type SerializedTestSpecification = [project: {
6
6
  name: string | undefined;
@@ -621,7 +621,7 @@ class CAC extends EventEmitter {
621
621
 
622
622
  const cac = (name = "") => new CAC(name);
623
623
 
624
- var version = "4.1.4";
624
+ var version = "5.0.0-beta.1";
625
625
 
626
626
  const apiConfig = (port) => ({
627
627
  port: {
@@ -701,7 +701,7 @@ const cliOptionsConfig = {
701
701
  hideSkippedTests: { description: "Hide logs for skipped tests" },
702
702
  reporters: {
703
703
  alias: "reporter",
704
- description: `Specify reporters (default, agent, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
704
+ description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
705
705
  argument: "<name>",
706
706
  subcommands: null,
707
707
  array: true
@@ -886,6 +886,16 @@ const cliOptionsConfig = {
886
886
  return { mode: value };
887
887
  }
888
888
  },
889
+ traceView: {
890
+ description: "Enable Vitest trace-view collection for browser tests (default: `false`)",
891
+ argument: "",
892
+ transform: transformNestedBoolean,
893
+ subcommands: {
894
+ enabled: { description: "Enable Vitest trace-view collection for browser tests (default: `false`)" },
895
+ recordCanvas: { description: "Capture canvas pixels in trace-view snapshots (default: `false`)" },
896
+ inlineImages: { description: "Inline loaded image pixels in trace-view snapshots (default: `false`)" }
897
+ }
898
+ },
889
899
  orchestratorScripts: null,
890
900
  commands: null,
891
901
  viewport: null,
@@ -1294,7 +1304,8 @@ const cliOptionsConfig = {
1294
1304
  staticParseConcurrency: null,
1295
1305
  projects: null,
1296
1306
  watchTriggerPatterns: null,
1297
- tags: null
1307
+ tags: null,
1308
+ taskTitleValueFormatTruncate: null
1298
1309
  };
1299
1310
  const benchCliOptionsConfig = {
1300
1311
  compare: {
@@ -2336,11 +2347,11 @@ function normalizeCliOptions(cliFilters, argv) {
2336
2347
  }
2337
2348
  async function start(mode, cliFilters, options) {
2338
2349
  try {
2339
- const { startVitest } = await import('./cli-api.lDy4N9kC.js').then(function (n) { return n.q; });
2350
+ const { startVitest } = await import('./cli-api.MLtHkHGf.js').then(function (n) { return n.q; });
2340
2351
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2341
2352
  if (!ctx.shouldKeepServer()) await ctx.exit();
2342
2353
  } catch (e) {
2343
- const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
2354
+ const { errorBanner } = await import('./utils.DzYdXqCH.js').then(function (n) { return n.u; });
2344
2355
  console.error(`\n${errorBanner("Startup Error")}`);
2345
2356
  console.error(e);
2346
2357
  console.error("\n\n");
@@ -2358,7 +2369,7 @@ async function init(project) {
2358
2369
  }
2359
2370
  async function collect(mode, cliFilters, options) {
2360
2371
  try {
2361
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.lDy4N9kC.js').then(function (n) { return n.q; });
2372
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.MLtHkHGf.js').then(function (n) { return n.q; });
2362
2373
  const ctx = await prepareVitest(mode, {
2363
2374
  ...normalizeCliOptions(cliFilters, options),
2364
2375
  watch: false,
@@ -2380,7 +2391,7 @@ async function collect(mode, cliFilters, options) {
2380
2391
  } else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
2381
2392
  await ctx.close();
2382
2393
  } catch (e) {
2383
- const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
2394
+ const { errorBanner } = await import('./utils.DzYdXqCH.js').then(function (n) { return n.u; });
2384
2395
  console.error(`\n${errorBanner("Collect Error")}`);
2385
2396
  console.error(e);
2386
2397
  console.error("\n\n");
@@ -1,10 +1,11 @@
1
- import fs, { promises, existsSync, mkdirSync, readFileSync, statSync, readdirSync, writeFileSync } from 'node:fs';
1
+ import * as fs from 'node:fs';
2
+ import fs__default, { promises, existsSync, mkdirSync, readFileSync, statSync, readdirSync, writeFileSync } from 'node:fs';
2
3
  import { relative, resolve, dirname, join, extname, normalize, basename, isAbsolute } from 'pathe';
3
4
  import { C as CoverageProviderMap } from './coverage.CTzCuANN.js';
4
5
  import path, { resolve as resolve$1 } from 'node:path';
5
6
  import { unique, createDefer, slash, withTrailingSlash, cleanUrl, wrapId, isExternalUrl, unwrapId, toArray, noop, deepMerge, nanoid, deepClone, isPrimitive, notNullish } from '@vitest/utils/helpers';
6
7
  import { a as any, p as prompt } from './index.og1WyBLx.js';
7
- import { i as isPackageExists, r as resolveModule } from './index.BCY_7LL2.js';
8
+ import { i as isPackageExists, r as resolveModule } from './index.CesbTg1C.js';
8
9
  import * as vite from 'vite';
9
10
  import { parseAst, searchForWorkspaceRoot, fetchModule, version, createServer, isFileLoadingAllowed, normalizePath, isRunnableDevEnvironment, mergeConfig } from 'vite';
10
11
  import { A as API_PATH, c as configFiles, d as defaultBrowserPort, b as defaultPort } from './constants.CPYnjOGj.js';
@@ -13,20 +14,20 @@ import nodeos__default, { tmpdir } from 'node:os';
13
14
  import { generateHash as generateHash$1, createTaskName, validateTags, calculateSuiteHash, hasFailed, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, createTagsFilter, someTasksAreOnly, interpretTaskModes, getTasks, isTestCase } from '@vitest/runner/utils';
14
15
  import { SnapshotManager } from '@vitest/snapshot/manager';
15
16
  import { serializeValue } from '@vitest/utils/serialize';
16
- import { v as version$1 } from './cac.wyYWMVI-.js';
17
+ import { v as version$1 } from './cac.DSVGM2li.js';
17
18
  import { rootDir, distDir } from '../path.js';
18
- import { f as createIndexLocationsMap, g as TraceMap, o as originalPositionFor, h as ancestor, s as stringify, p as parse, i as printError, j as Typechecker, k as generateCodeFrame, l as escapeRegExp, m as createDefinesScript, a as BenchmarkReportsMap, R as ReportersMap, n as groupBy, q as BlobReporter, r as readBlobs, t as convertTasksToEvents, H as HangingProcessReporter, w as wildcardPatternToRegExp, u as stdout } from './index.BMXTnDNz.js';
19
- import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
19
+ import { f as createIndexLocationsMap, g as TraceMap, o as originalPositionFor, h as ancestor, s as stringify, p as parse, i as printError, j as Typechecker, k as generateCodeFrame, l as escapeRegExp, m as createDefinesScript, a as BenchmarkReportsMap, R as ReportersMap, n as groupBy, q as BlobReporter, r as readBlobs, t as convertTasksToEvents, H as HangingProcessReporter, w as wildcardPatternToRegExp, u as stdout } from './index.yJ2D83a4.js';
20
+ import { N as NativeModuleRunner } from './nativeModuleRunner.WlMdOB52.js';
20
21
  import { T as Traces } from './traces.DT5aQ62U.js';
21
22
  import { createDebug } from 'obug';
22
- import { h as hash, R as RandomSequencer, i as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, b as resolveApiServerConfig } from './coverage.Da5gzbsu.js';
23
- import { rm, readFile, writeFile, rename, stat, unlink, mkdir, copyFile } from 'node:fs/promises';
23
+ import { h as hash, R as RandomSequencer, i as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, b as resolveApiServerConfig } from './coverage.nIKqs-BM.js';
24
+ import { rm, readFile, writeFile, rename, stat, unlink, readdir, mkdir, copyFile } from 'node:fs/promises';
24
25
  import c from 'tinyrainbow';
25
26
  import { VitestModuleEvaluator } from '#module-evaluator';
26
27
  import { ModuleRunner } from 'vite/module-runner';
27
28
  import { Console } from 'node:console';
28
29
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers.D26ty3Ew.js';
29
- import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.BS4fH3nR.js';
30
+ import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.DzYdXqCH.js';
30
31
  import { createRequire, builtinModules, isBuiltin as isBuiltin$1 } from 'node:module';
31
32
  import url, { fileURLToPath, pathToFileURL } from 'node:url';
32
33
  import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
@@ -50,7 +51,7 @@ import require$$0$2 from 'stream';
50
51
  import require$$7 from 'url';
51
52
  import require$$0 from 'zlib';
52
53
  import require$$0$1 from 'buffer';
53
- import { c as configDefaults } from './defaults.9aQKnqFk.js';
54
+ import { c as configDefaults } from './defaults.pr789SUS.js';
54
55
  import { isAgent } from 'std-env';
55
56
  import MagicString from 'magic-string';
56
57
  import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
@@ -137,7 +138,7 @@ function astParseFile(filepath, code) {
137
138
  if (callee.type === "TaggedTemplateExpression") return getName(callee.tag);
138
139
  if (callee.type === "MemberExpression") {
139
140
  if (callee.object?.type === "Identifier" && isVitestFunctionName(callee.object.name)) return callee.object?.name;
140
- if (callee.object?.name?.startsWith("__vite_ssr_") || callee.object?.object?.name?.startsWith("__vite_ssr_") && callee.object?.property?.name === "Vitest") return getName(callee.property);
141
+ if (callee.object?.name?.startsWith("__vite_ssr_") || callee.object?.name?.startsWith("__vi_import_") || callee.object?.object?.name?.startsWith("__vite_ssr_") && callee.object?.property?.name === "Vitest") return getName(callee.property);
141
142
  // call as `__vite_ssr__.test.skip()` or `describe.concurrent.each()`
142
143
  return getName(callee.object);
143
144
  }
@@ -491,8 +492,8 @@ class FilesStatsCache {
491
492
  await Promise.all(promises);
492
493
  }
493
494
  async updateStats(fsPath, key) {
494
- if (!fs.existsSync(fsPath)) return;
495
- const stats = await fs.promises.stat(fsPath);
495
+ if (!fs__default.existsSync(fsPath)) return;
496
+ const stats = await fs__default.promises.stat(fsPath);
496
497
  this.cache.set(key, { size: stats.size });
497
498
  }
498
499
  removeStats(fsPath) {
@@ -533,8 +534,8 @@ class ResultsCache {
533
534
  }
534
535
  async readFromCache() {
535
536
  if (!this.cachePath) return;
536
- if (!fs.existsSync(this.cachePath)) return;
537
- const resultsCache = await fs.promises.readFile(this.cachePath, "utf8");
537
+ if (!fs__default.existsSync(this.cachePath)) return;
538
+ const resultsCache = await fs__default.promises.readFile(this.cachePath, "utf8");
538
539
  const { results, version } = JSON.parse(resultsCache || "[]");
539
540
  const [major, minor] = version.split(".");
540
541
  // handling changed in 0.30.0
@@ -571,12 +572,12 @@ class ResultsCache {
571
572
  if (!this.cachePath) return;
572
573
  const results = Array.from(this.cache.entries());
573
574
  const cacheDirname = dirname(this.cachePath);
574
- if (!fs.existsSync(cacheDirname)) await fs.promises.mkdir(cacheDirname, { recursive: true });
575
+ if (!fs__default.existsSync(cacheDirname)) await fs__default.promises.mkdir(cacheDirname, { recursive: true });
575
576
  const cache = JSON.stringify({
576
577
  version: this.version,
577
578
  results
578
579
  });
579
- await fs.promises.writeFile(this.cachePath, cache);
580
+ await fs__default.promises.writeFile(this.cachePath, cache);
580
581
  }
581
582
  }
582
583
 
@@ -888,7 +889,7 @@ const lockfileFormats = [
888
889
  const lockfilePaths = lockfileFormats.map((l) => l.path);
889
890
  function getLockfileHash(root) {
890
891
  const lockfilePath = lookupFile(root, lockfilePaths);
891
- let content = lockfilePath ? fs.readFileSync(lockfilePath, "utf-8") : "";
892
+ let content = lockfilePath ? fs__default.readFileSync(lockfilePath, "utf-8") : "";
892
893
  if (lockfilePath) {
893
894
  const normalizedLockfilePath = lockfilePath.replaceAll("\\", "/");
894
895
  const lockfileFormat = lockfileFormats.find((f) => normalizedLockfilePath.endsWith(f.path));
@@ -920,7 +921,7 @@ function tryReadFileSync(file) {
920
921
  function tryStatSync(file) {
921
922
  try {
922
923
  // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
923
- return fs.statSync(file, { throwIfNoEntry: false });
924
+ return fs__default.statSync(file, { throwIfNoEntry: false });
924
925
  } catch {}
925
926
  }
926
927
 
@@ -8971,7 +8972,7 @@ function setup(ctx, _server) {
8971
8972
  await ctx.rerunTask(id);
8972
8973
  },
8973
8974
  getConfig() {
8974
- return ctx.getRootProject().serializedConfig;
8975
+ return ctx.serializedRootConfig;
8975
8976
  },
8976
8977
  getResolvedProjectLabels() {
8977
8978
  return ctx.projects.map((p) => ({
@@ -9145,6 +9146,7 @@ function serializeConfig(project) {
9145
9146
  bail: config.bail,
9146
9147
  defines: config.defines,
9147
9148
  chaiConfig: config.chaiConfig,
9149
+ taskTitleValueFormatTruncate: config.taskTitleValueFormatTruncate,
9148
9150
  setupFiles: config.setupFiles,
9149
9151
  allowOnly: config.allowOnly,
9150
9152
  testTimeout: config.testTimeout,
@@ -9170,6 +9172,7 @@ function serializeConfig(project) {
9170
9172
  disableConsoleIntercept: config.disableConsoleIntercept,
9171
9173
  root: config.root,
9172
9174
  name: config.name,
9175
+ color: config.color,
9173
9176
  globals: config.globals,
9174
9177
  snapshotEnvironment: config.snapshotEnvironment,
9175
9178
  passWithNoTests: config.passWithNoTests,
@@ -9232,7 +9235,8 @@ function serializeConfig(project) {
9232
9235
  },
9233
9236
  providerOptions: provider?.name === "playwright" ? { actionTimeout: provider?.options?.actionTimeout } : {},
9234
9237
  trackUnhandledErrors: browser.trackUnhandledErrors ?? true,
9235
- trace: browser.trace.mode
9238
+ trace: browser.trace.mode,
9239
+ traceView: browser.traceView
9236
9240
  };
9237
9241
  })(config.browser),
9238
9242
  standalone: config.standalone,
@@ -11173,13 +11177,14 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
11173
11177
  const removeProjects = /* @__PURE__ */ new Set();
11174
11178
  resolvedProjects.forEach((project) => {
11175
11179
  if (!project.config.browser.enabled) return;
11180
+ const originalName = project.config.name;
11176
11181
  const instances = project.config.browser.instances || [];
11177
- if (instances.length === 0) {
11182
+ if (instances.length === 0 || vitest.isExcludedByProjectFilter(originalName)) {
11178
11183
  removeProjects.add(project);
11179
11184
  return;
11180
11185
  }
11181
- const originalName = project.config.name;
11182
- // if original name is in the --project=name filter, keep all instances
11186
+ // if original name matches a positive filter, keep all instances
11187
+ // otherwise, filter instances individually (user may target a specific instance name)
11183
11188
  const filteredInstances = vitest.matchesProjectFilter(originalName) ? instances : instances.filter((instance) => {
11184
11189
  const newName = instance.name;
11185
11190
  return vitest.matchesProjectFilter(newName);
@@ -11336,6 +11341,45 @@ function getPotentialProjectNames(project) {
11336
11341
  return names;
11337
11342
  }
11338
11343
 
11344
+ function createReport(ctx, scope) {
11345
+ const root = ctx.config.root;
11346
+ const vitestDir = resolve$1(root, ".vitest");
11347
+ const reportDir = resolve$1(vitestDir, scope);
11348
+ if (!fs.existsSync(vitestDir)) fs.mkdirSync(vitestDir);
11349
+ if (!fs.existsSync(reportDir)) fs.mkdirSync(reportDir);
11350
+ return {
11351
+ root: reportDir,
11352
+ async clean(force = false) {
11353
+ if (fs.existsSync(reportDir)) {
11354
+ // Do not delete results when run with --merge-reports, unless forced to.
11355
+ // In test runs with --shard, it's possible that users do some other handling for
11356
+ // the reports after 'vitest --merge-reports' run. For example upload all the '.vitest/attachments'.
11357
+ if (ctx.config.mergeReports && !force) return;
11358
+ await rm(reportDir, {
11359
+ recursive: true,
11360
+ force: true
11361
+ });
11362
+ }
11363
+ await mkdir(reportDir);
11364
+ },
11365
+ async readFile(filename, encoding = "utf8") {
11366
+ return await readFile(resolve$1(vitestDir, scope, filename), encoding);
11367
+ },
11368
+ async readdir() {
11369
+ return await readdir(resolve$1(vitestDir, scope));
11370
+ },
11371
+ async writeFile(filename, content, encoding = "utf8") {
11372
+ await writeFile(resolve$1(vitestDir, scope, filename), content, encoding);
11373
+ },
11374
+ async delete(filename) {
11375
+ await rm(resolve$1(vitestDir, scope, filename), {
11376
+ recursive: true,
11377
+ force: true
11378
+ });
11379
+ }
11380
+ };
11381
+ }
11382
+
11339
11383
  async function loadCustomReporterModule(path, runner) {
11340
11384
  let customReporterModule;
11341
11385
  try {
@@ -13248,6 +13292,12 @@ class Vitest {
13248
13292
  if (!this.coreWorkspaceProject) throw new Error(`Root project is not initialized. This means that the Vite server was not established yet and the the workspace config is not resolved.`);
13249
13293
  return this.coreWorkspaceProject;
13250
13294
  }
13295
+ get serializedRootConfig() {
13296
+ return {
13297
+ ...this.getRootProject().serializedConfig,
13298
+ projects: this.projects.map((project) => project.serializedConfig)
13299
+ };
13300
+ }
13251
13301
  getProjectByName(name) {
13252
13302
  const project = this.projects.find((p) => p.name === name) || this.coreWorkspaceProject || this.projects[0];
13253
13303
  if (!project) throw new Error(`Project "${name}" was not found.`);
@@ -14025,6 +14075,21 @@ class Vitest {
14025
14075
  return wildcardPatternToRegExp(project).test(name);
14026
14076
  });
14027
14077
  }
14078
+ /** @internal */
14079
+ isExcludedByProjectFilter(name) {
14080
+ const projects = this._config?.project || this._cliOptions?.project;
14081
+ if (!projects || !projects.length) return false;
14082
+ return toArray(projects).some((project) => {
14083
+ if (!project.startsWith("!")) return false;
14084
+ return wildcardPatternToRegExp(project.slice(1)).test(name);
14085
+ });
14086
+ }
14087
+ /**
14088
+ * Create a report that's scoped to a specific reporter directory.
14089
+ */
14090
+ createReport(scope) {
14091
+ return createReport(this, scope);
14092
+ }
14028
14093
  }
14029
14094
  function assert(condition, property, name = property) {
14030
14095
  if (!condition) throw new Error(`The ${name} was not set. It means that \`vitest.${property}\` was called before the Vite server was established. Await the Vitest promise before accessing \`vitest.${property}\`.`);
@@ -2,6 +2,7 @@ import { PrettyFormatOptions } from '@vitest/pretty-format';
2
2
  import { SequenceHooks, SequenceSetupFiles, SerializableRetry, TestTagDefinition } from '@vitest/runner';
3
3
  import { SnapshotUpdateState, SnapshotEnvironment } from '@vitest/snapshot';
4
4
  import { SerializedDiffOptions } from '@vitest/utils/diff';
5
+ import { L as LabelColor } from './traces.d.D2T_R8rx.js';
5
6
 
6
7
  /**
7
8
  * Names of clock methods that may be faked by install.
@@ -69,6 +70,7 @@ interface FakeTimerInstallOpts {
69
70
  */
70
71
  interface SerializedConfig {
71
72
  name: string | undefined;
73
+ color?: LabelColor;
72
74
  globals: boolean;
73
75
  base: string | undefined;
74
76
  snapshotEnvironment?: string;
@@ -137,6 +139,7 @@ interface SerializedConfig {
137
139
  showDiff?: boolean;
138
140
  truncateThreshold?: number;
139
141
  } | undefined;
142
+ taskTitleValueFormatTruncate: number;
140
143
  api: {
141
144
  allowExec: boolean | undefined;
142
145
  allowWrite: boolean | undefined;
@@ -173,6 +176,11 @@ interface SerializedConfig {
173
176
  actionTimeout?: number;
174
177
  };
175
178
  trace: BrowserTraceViewMode;
179
+ traceView: {
180
+ enabled: boolean;
181
+ recordCanvas: boolean;
182
+ inlineImages: boolean;
183
+ };
176
184
  trackUnhandledErrors: boolean;
177
185
  detailsPanelPosition: "right" | "bottom";
178
186
  };
@@ -216,6 +224,9 @@ interface SerializedCoverageConfig {
216
224
  enabled: boolean;
217
225
  customProviderModule: string | undefined;
218
226
  }
227
+ interface SerializedRootConfig extends SerializedConfig {
228
+ projects: SerializedConfig[];
229
+ }
219
230
  type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookTimeout" | "clearMocks" | "mockReset" | "restoreMocks" | "fakeTimers" | "maxConcurrency" | "expect" | "printConsoleTrace"> & {
220
231
  sequence?: {
221
232
  hooks?: SequenceHooks;
@@ -224,4 +235,4 @@ type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookT
224
235
  type RuntimeOptions = Partial<RuntimeConfig>;
225
236
  type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
226
237
 
227
- export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, RuntimeConfig as b };
238
+ export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, SerializedRootConfig as b, RuntimeConfig as c };
@@ -5,16 +5,16 @@ import { pathToFileURL, fileURLToPath } from 'node:url';
5
5
  import { slash, shuffle, toArray, cleanUrl } from '@vitest/utils/helpers';
6
6
  import { resolve, relative, normalize, join } from 'pathe';
7
7
  import pm from 'picomatch';
8
- import { glob } from 'tinyglobby';
8
+ import { isDynamicPattern, glob } from 'tinyglobby';
9
9
  import c from 'tinyrainbow';
10
- import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.9aQKnqFk.js';
10
+ import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.pr789SUS.js';
11
11
  import crypto from 'node:crypto';
12
- import { r as resolveModule } from './index.BCY_7LL2.js';
12
+ import { r as resolveModule } from './index.CesbTg1C.js';
13
13
  import { mergeConfig } from 'vite';
14
14
  import { c as configFiles, d as defaultBrowserPort, a as defaultInspectPort, b as defaultPort } from './constants.CPYnjOGj.js';
15
15
  import './env.D4Lgay0q.js';
16
16
  import nodeos__default from 'node:os';
17
- import { w as withLabel } from './utils.BS4fH3nR.js';
17
+ import { w as withLabel } from './utils.DzYdXqCH.js';
18
18
  import { isAgent, isCI, provider } from 'std-env';
19
19
  import { r as resolveCoverageProviderModule } from './coverage.CTzCuANN.js';
20
20
 
@@ -339,6 +339,11 @@ function resolveConfig$1(vitest, options, viteConfig) {
339
339
  resolved.deps.web.transformGlobPattern ??= [];
340
340
  resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root));
341
341
  resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root));
342
+ if (resolved.coverage.include) resolved.coverage.include = resolved.coverage.include.map((pattern) => {
343
+ if (isDynamicPattern(pattern)) return pattern;
344
+ // Convert patterns like ["src", "packages/server"] to ["src/**", "packages/server/**"]
345
+ return pattern.endsWith("/") ? `${pattern}**` : `${pattern}/**`;
346
+ });
342
347
  // Add hard-coded default coverage exclusions. These cannot be overridden by user config.
343
348
  // Override original exclude array for cases where user re-uses same object in test.exclude.
344
349
  resolved.coverage.exclude = [
@@ -524,11 +529,23 @@ function resolveConfig$1(vitest, options, viteConfig) {
524
529
  if (resolved.browser.ui) resolved.includeTaskLocation ??= true;
525
530
  } else if (resolved.ui) resolved.includeTaskLocation ??= true;
526
531
  if (typeof resolved.browser.trace === "string" || !resolved.browser.trace) resolved.browser.trace = { mode: resolved.browser.trace || "off" };
532
+ const traceView = resolved.browser.traceView;
533
+ resolved.browser.traceView = typeof traceView === "object" ? {
534
+ enabled: traceView.enabled ?? false,
535
+ recordCanvas: traceView.recordCanvas ?? false,
536
+ inlineImages: traceView.inlineImages ?? false
537
+ } : {
538
+ enabled: traceView ?? false,
539
+ recordCanvas: false,
540
+ inlineImages: false
541
+ };
542
+ if (resolved.browser.enabled && resolved.browser.traceView.enabled) resolved.browser.detailsPanelPosition = "bottom";
527
543
  if (resolved.browser.trace.tracesDir != null) resolved.browser.trace.tracesDir = resolvePath(resolved.browser.trace.tracesDir, resolved.root);
528
544
  if (toArray(resolved.reporters).some((reporter) => {
529
545
  if (Array.isArray(reporter)) return reporter[0] === "html";
530
546
  return false;
531
547
  })) resolved.includeTaskLocation ??= true;
548
+ else if (resolved.browser.enabled && resolved.browser.traceView.enabled && !resolved.watch) logger.console.warn(c.yellow(withLabel("yellow", "Vitest", "--browser.traceView is enabled without the HTML reporter.")));
532
549
  resolved.server ??= {};
533
550
  resolved.server.deps ??= {};
534
551
  if (resolved.server.debug?.dump || process.env.VITEST_DEBUG_DUMP) {
@@ -669,10 +686,15 @@ Update your dependencies and make sure the versions match.`));
669
686
  this.globCache.set(filename, false);
670
687
  return false;
671
688
  }
689
+ const matchingRoot = roots.find((root) => filename.startsWith(`${slash(root)}/`) || filename === slash(root));
690
+ const relativeFilename = matchingRoot ? relative(matchingRoot, filename) : filename;
691
+ if (pm.isMatch(relativeFilename, this.options.exclude, { dot: true })) {
692
+ this.globCache.set(filename, false);
693
+ return false;
694
+ }
672
695
  // By default `coverage.include` matches all files, except "coverage.exclude"
673
696
  const glob = this.options.include || "**";
674
- let included = pm.isMatch(filename, glob, {
675
- contains: true,
697
+ let included = pm.isMatch(relativeFilename, glob, {
676
698
  dot: true,
677
699
  ignore: this.options.exclude
678
700
  });
@@ -725,6 +747,10 @@ Update your dependencies and make sure the versions match.`));
725
747
  this.coverageFiles = /* @__PURE__ */ new Map();
726
748
  this.pendingPromises = [];
727
749
  }
750
+ normalizeCoverageFileError(error) {
751
+ if (error instanceof Error && "code" in error && error.code === "ENOENT" && !existsSync(this.coverageFilesDirectory)) return new Error(`Something removed the coverage directory "${this.coverageFilesDirectory}" Vitest created earlier. Make sure you are not running multiple Vitests with the same "coverage.reportsDirectory" at the same time.`, { cause: error });
752
+ return error;
753
+ }
728
754
  onAfterSuiteRun({ coverage, environment, projectName, testFiles }) {
729
755
  if (!coverage) return;
730
756
  let entry = this.coverageFiles.get(projectName || DEFAULT_PROJECT);
@@ -737,7 +763,9 @@ Update your dependencies and make sure the versions match.`));
737
763
  entry[environment] ??= {};
738
764
  // If there's a result from previous run, overwrite it
739
765
  entry[environment][testFilenames] = filename;
740
- const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8");
766
+ const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8").catch((error) => {
767
+ throw this.normalizeCoverageFileError(error);
768
+ });
741
769
  this.pendingPromises.push(promise);
742
770
  }
743
771
  async readCoverageFiles({ onFileRead, onFinished, onDebug }) {
@@ -754,7 +782,9 @@ Update your dependencies and make sure the versions match.`));
754
782
  onDebug(`Reading coverage results ${index}/${total}`);
755
783
  }
756
784
  await Promise.all(chunk.map(async (filename) => {
757
- const contents = await promises.readFile(filename, "utf-8");
785
+ const contents = await promises.readFile(filename, "utf-8").catch((error) => {
786
+ throw this.normalizeCoverageFileError(error);
787
+ });
758
788
  onFileRead(JSON.parse(contents));
759
789
  }));
760
790
  }
@@ -76,6 +76,7 @@ const configDefaults = Object.freeze({
76
76
  exclude: defaultExclude
77
77
  },
78
78
  slowTestThreshold: 300,
79
+ taskTitleValueFormatTruncate: 40,
79
80
  disableConsoleIntercept: false,
80
81
  detectAsyncLeaks: false
81
82
  });
@@ -3,7 +3,7 @@ import { Plugin } from '@vitest/pretty-format';
3
3
  import { Test } from '@vitest/runner';
4
4
  import { SnapshotState } from '@vitest/snapshot';
5
5
  import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
6
- import { U as UserConsoleLog } from './rpc.d.BFMWpdph.js';
6
+ import { U as UserConsoleLog } from './traces.d.D2T_R8rx.js';
7
7
 
8
8
  interface SnapshotMatcher<T> {
9
9
  <U extends { [P in keyof T] : any }>(snapshot: Partial<U>, hint?: string): void;
@@ -1,6 +1,6 @@
1
1
  import { g as globalApis } from './constants.CPYnjOGj.js';
2
- import { i as index } from './index.C-zNJvRx.js';
3
- import './test.D1JkM1w4.js';
2
+ import { i as index } from './index.BcGySndd.js';
3
+ import './test.C8WyxAQk.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/utils/helpers';
6
6
  import '@vitest/utils/timers';
@@ -1,9 +1,9 @@
1
1
  import { chai } from '@vitest/expect';
2
2
  import { createHook } from 'node:async_hooks';
3
- import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.BDwxwUWG.js';
3
+ import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.CYy2gJEr.js';
4
4
  import { r as rpc } from './rpc.MzXet3jl.js';
5
5
  import { g as getWorkerState } from './utils.BX5Fg8C4.js';
6
- import { T as TestRunner, N as NodeBenchmarkRunner } from './test.D1JkM1w4.js';
6
+ import { T as TestRunner, N as NodeBenchmarkRunner } from './test.C8WyxAQk.js';
7
7
 
8
8
  function setupChaiConfig(config) {
9
9
  Object.assign(chai.config, config);
@@ -1,4 +1,4 @@
1
- import { v as vi, N as NodeBenchmarkRunner, S as Snapshots, T as TestRunner, a as assert, c as createExpect, g as globalExpect, i as inject, s as should, b as vitest } from './test.D1JkM1w4.js';
1
+ import { v as vi, N as NodeBenchmarkRunner, S as Snapshots, T as TestRunner, a as assert, c as createExpect, g as globalExpect, i as inject, s as should, b as vitest } from './test.C8WyxAQk.js';
2
2
  import { b as bench } from './benchmark.CX_oY03V.js';
3
3
  import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
4
4
  import { expectTypeOf } from 'expect-type';