@depup/vitest 4.1.3-depup.1 → 4.1.10-depup.8

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 (52) hide show
  1. package/README.md +13 -7
  2. package/changes.json +30 -6
  3. package/dist/browser.d.ts +2 -2
  4. package/dist/browser.js +1 -1
  5. package/dist/chunks/{base.C3wvLFNM.js → base.B6Opl8PE.js} +7 -7
  6. package/dist/chunks/{browser.d.C0zGu1u9.d.ts → browser.d.BcoexmFG.d.ts} +2 -2
  7. package/dist/chunks/{cac.Bb7YBzMA.js → cac.DdICfEr1.js} +6 -6
  8. package/dist/chunks/{cli-api.CaPRsymo.js → cli-api.BK8pd4xc.js} +54 -25
  9. package/dist/chunks/{config.d.ChUh6-ad.d.ts → config.d.A1h_Y6Jt.d.ts} +6 -1
  10. package/dist/chunks/{coverage.CwUlQe0s.js → coverage.DM_a_rWm.js} +25 -4
  11. package/dist/chunks/{global.d.D74z04P1.d.ts → global.d.DVsSRdQ5.d.ts} +1 -1
  12. package/dist/chunks/{globals.7B-4LHAF.js → globals.Dj1TGiMC.js} +2 -2
  13. package/dist/chunks/{index.Cj9kDiDi.js → index.DXx9Dtk7.js} +2 -2
  14. package/dist/chunks/{index.4L3g53iW.js → index.DdgEv5B1.js} +1 -1
  15. package/dist/chunks/{index.DICur-LY.js → index.UpGiHP7g.js} +36 -27
  16. package/dist/chunks/{init-forks.UV3ZQGQH.js → init-forks.H5ZuobOQ.js} +1 -1
  17. package/dist/chunks/{init-threads.D3eCsY76.js → init-threads.6kl1khcL.js} +1 -1
  18. package/dist/chunks/{init.D98-gwRW.js → init.k9zZ9sLh.js} +1 -1
  19. package/dist/chunks/{nativeModuleMocker.BRN2oBJd.js → nativeModuleMocker.BkNfQMkH.js} +1 -1
  20. package/dist/chunks/{plugin.d.BssAumYw.d.ts → plugin.d.DwFIiJ7i.d.ts} +1 -1
  21. package/dist/chunks/{reporters.d.yJ2fBir5.d.ts → reporters.d.DtoKVV2s.d.ts} +87 -20
  22. package/dist/chunks/{rpc.d.BFMWpdph.d.ts → rpc.d.B_8sPU0w.d.ts} +2 -44
  23. package/dist/chunks/{setup-common.NdrZGMhw.js → setup-common.DYx3LtFI.js} +1 -1
  24. package/dist/chunks/{startVitestModuleRunner.bRl2_oI_.js → startVitestModuleRunner.DB-7oCpn.js} +10 -5
  25. package/dist/chunks/{test.BmQO5GaM.js → test.DNmyFkvJ.js} +107 -20
  26. package/dist/chunks/traces.d.D2T_R8rx.d.ts +60 -0
  27. package/dist/chunks/{utils.DK8FXp4T.js → utils.BS4fH3nR.js} +1 -1
  28. package/dist/chunks/{vm.DVLYObm9.js → vm.CXMd5FHa.js} +2 -2
  29. package/dist/chunks/{worker.d.CckNUvI5.d.ts → worker.d.ZpHpO4yb.d.ts} +2 -2
  30. package/dist/cli.js +1 -1
  31. package/dist/config.d.ts +10 -10
  32. package/dist/coverage.d.ts +8 -7
  33. package/dist/coverage.js +2 -1
  34. package/dist/index.d.ts +36 -14
  35. package/dist/index.js +2 -2
  36. package/dist/module-evaluator.d.ts +2 -2
  37. package/dist/node.d.ts +10 -10
  38. package/dist/node.js +7 -7
  39. package/dist/reporters.d.ts +8 -8
  40. package/dist/reporters.js +3 -3
  41. package/dist/runners.d.ts +2 -2
  42. package/dist/runners.js +1 -1
  43. package/dist/runtime.js +1 -1
  44. package/dist/worker.d.ts +4 -4
  45. package/dist/worker.js +7 -7
  46. package/dist/workers/forks.js +8 -8
  47. package/dist/workers/runVmTests.js +4 -4
  48. package/dist/workers/threads.js +8 -8
  49. package/dist/workers/vmForks.js +4 -4
  50. package/dist/workers/vmThreads.js +4 -4
  51. package/package.json +55 -31
  52. package/dist/chunks/traces.d.402V_yFI.d.ts +0 -18
package/README.md CHANGED
@@ -13,19 +13,25 @@ npm install @depup/vitest
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [vitest](https://www.npmjs.com/package/vitest) @ 4.1.3 |
17
- | Processed | 2026-04-07 |
16
+ | Original | [vitest](https://www.npmjs.com/package/vitest) @ 4.1.10 |
17
+ | Processed | 2026-07-21 |
18
18
  | Smoke test | passed |
19
- | Deps updated | 5 |
19
+ | Deps updated | 11 |
20
20
 
21
21
  ## Dependency Changes
22
22
 
23
23
  | Dependency | From | To |
24
24
  |------------|------|-----|
25
- | picomatch | ^4.0.3 | ^4.0.4 |
26
- | tinybench | ^2.9.0 | ^6.0.0 |
27
- | tinyexec | ^1.0.2 | ^1.1.1 |
28
- | vite | ^6.0.0 || ^7.0.0 || ^8.0.0 | ^8.0.7 |
25
+ | es-module-lexer | ^2.0.0 | ^2.3.1 |
26
+ | expect-type | ^1.3.0 | ^1.4.0 |
27
+ | magic-string | ^0.30.21 | ^1.0.0 |
28
+ | obug | ^2.1.1 | ^2.1.4 |
29
+ | picomatch | ^4.0.3 | ^4.0.5 |
30
+ | std-env | ^4.0.0-rc.1 | ^4.2.0 |
31
+ | tinybench | ^2.9.0 | ^6.0.2 |
32
+ | tinyexec | ^1.0.2 | ^1.2.4 |
33
+ | tinyglobby | ^0.2.15 | ^0.2.17 |
34
+ | vite | ^6.0.0 || ^7.0.0 || ^8.0.0 | ^8.1.5 |
29
35
  | why-is-node-running | ^2.3.0 | ^3.2.2 |
30
36
 
31
37
  ---
package/changes.json CHANGED
@@ -1,26 +1,50 @@
1
1
  {
2
2
  "bumped": {
3
+ "es-module-lexer": {
4
+ "from": "^2.0.0",
5
+ "to": "^2.3.1"
6
+ },
7
+ "expect-type": {
8
+ "from": "^1.3.0",
9
+ "to": "^1.4.0"
10
+ },
11
+ "magic-string": {
12
+ "from": "^0.30.21",
13
+ "to": "^1.0.0"
14
+ },
15
+ "obug": {
16
+ "from": "^2.1.1",
17
+ "to": "^2.1.4"
18
+ },
3
19
  "picomatch": {
4
20
  "from": "^4.0.3",
5
- "to": "^4.0.4"
21
+ "to": "^4.0.5"
22
+ },
23
+ "std-env": {
24
+ "from": "^4.0.0-rc.1",
25
+ "to": "^4.2.0"
6
26
  },
7
27
  "tinybench": {
8
28
  "from": "^2.9.0",
9
- "to": "^6.0.0"
29
+ "to": "^6.0.2"
10
30
  },
11
31
  "tinyexec": {
12
32
  "from": "^1.0.2",
13
- "to": "^1.1.1"
33
+ "to": "^1.2.4"
34
+ },
35
+ "tinyglobby": {
36
+ "from": "^0.2.15",
37
+ "to": "^0.2.17"
14
38
  },
15
39
  "vite": {
16
40
  "from": "^6.0.0 || ^7.0.0 || ^8.0.0",
17
- "to": "^8.0.7"
41
+ "to": "^8.1.5"
18
42
  },
19
43
  "why-is-node-running": {
20
44
  "from": "^2.3.0",
21
45
  "to": "^3.2.2"
22
46
  }
23
47
  },
24
- "timestamp": "2026-04-07T16:32:33.050Z",
25
- "totalUpdated": 5
48
+ "timestamp": "2026-07-21T16:26:13.824Z",
49
+ "totalUpdated": 11
26
50
  }
package/dist/browser.d.ts CHANGED
@@ -1,7 +1,7 @@
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.A1h_Y6Jt.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 };
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.NdrZGMhw.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.DYx3LtFI.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';
@@ -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.Cj9kDiDi.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.D98-gwRW.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DXx9Dtk7.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.k9zZ9sLh.js';
5
5
  import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.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.DB-7oCpn.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.NdrZGMhw.js';
12
- import { g as globalExpect, v as vi } from './test.BmQO5GaM.js';
11
+ import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.DYx3LtFI.js';
12
+ import { g as globalExpect, v as vi } from './test.DNmyFkvJ.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.4L3g53iW.js';
19
+ import { i as index } from './index.DdgEv5B1.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.BkNfQMkH.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.ZpHpO4yb.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.3";
624
+ var version = "4.1.10";
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
@@ -2336,11 +2336,11 @@ function normalizeCliOptions(cliFilters, argv) {
2336
2336
  }
2337
2337
  async function start(mode, cliFilters, options) {
2338
2338
  try {
2339
- const { startVitest } = await import('./cli-api.CaPRsymo.js').then(function (n) { return n.q; });
2339
+ const { startVitest } = await import('./cli-api.BK8pd4xc.js').then(function (n) { return n.q; });
2340
2340
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2341
2341
  if (!ctx.shouldKeepServer()) await ctx.exit();
2342
2342
  } catch (e) {
2343
- const { errorBanner } = await import('./utils.DK8FXp4T.js').then(function (n) { return n.u; });
2343
+ const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
2344
2344
  console.error(`\n${errorBanner("Startup Error")}`);
2345
2345
  console.error(e);
2346
2346
  console.error("\n\n");
@@ -2358,7 +2358,7 @@ async function init(project) {
2358
2358
  }
2359
2359
  async function collect(mode, cliFilters, options) {
2360
2360
  try {
2361
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CaPRsymo.js').then(function (n) { return n.q; });
2361
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BK8pd4xc.js').then(function (n) { return n.q; });
2362
2362
  const ctx = await prepareVitest(mode, {
2363
2363
  ...normalizeCliOptions(cliFilters, options),
2364
2364
  watch: false,
@@ -2380,7 +2380,7 @@ async function collect(mode, cliFilters, options) {
2380
2380
  } else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
2381
2381
  await ctx.close();
2382
2382
  } catch (e) {
2383
- const { errorBanner } = await import('./utils.DK8FXp4T.js').then(function (n) { return n.u; });
2383
+ const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
2384
2384
  console.error(`\n${errorBanner("Collect Error")}`);
2385
2385
  console.error(e);
2386
2386
  console.error("\n\n");
@@ -13,20 +13,20 @@ import nodeos__default, { tmpdir } from 'node:os';
13
13
  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
14
  import { SnapshotManager } from '@vitest/snapshot/manager';
15
15
  import { serializeValue } from '@vitest/utils/serialize';
16
- import { v as version$1 } from './cac.Bb7YBzMA.js';
16
+ import { v as version$1 } from './cac.DdICfEr1.js';
17
17
  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.DICur-LY.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.UpGiHP7g.js';
19
19
  import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
20
20
  import { T as Traces } from './traces.DT5aQ62U.js';
21
21
  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.CwUlQe0s.js';
22
+ import { h as hash, R as RandomSequencer, i as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, b as resolveApiServerConfig } from './coverage.DM_a_rWm.js';
23
23
  import { rm, readFile, writeFile, rename, stat, unlink, mkdir, copyFile } from 'node:fs/promises';
24
24
  import c from 'tinyrainbow';
25
25
  import { VitestModuleEvaluator } from '#module-evaluator';
26
26
  import { ModuleRunner } from 'vite/module-runner';
27
27
  import { Console } from 'node:console';
28
28
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers.D26ty3Ew.js';
29
- import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.DK8FXp4T.js';
29
+ import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.BS4fH3nR.js';
30
30
  import { createRequire, builtinModules, isBuiltin as isBuiltin$1 } from 'node:module';
31
31
  import url, { fileURLToPath, pathToFileURL } from 'node:url';
32
32
  import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
@@ -137,7 +137,7 @@ function astParseFile(filepath, code) {
137
137
  if (callee.type === "TaggedTemplateExpression") return getName(callee.tag);
138
138
  if (callee.type === "MemberExpression") {
139
139
  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);
140
+ 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
141
  // call as `__vite_ssr__.test.skip()` or `describe.concurrent.each()`
142
142
  return getName(callee.object);
143
143
  }
@@ -456,17 +456,29 @@ class BrowserSessions {
456
456
  destroySession(sessionId) {
457
457
  this.sessions.delete(sessionId);
458
458
  }
459
- createSession(sessionId, project, pool) {
460
- // this promise only waits for the WS connection with the orchestrator to be established
459
+ createSession(sessionId, project, pool, options) {
460
+ // this promise waits until the orchestrator is ready to accept RPC calls
461
461
  const defer = createDefer();
462
+ let isConnected = false;
463
+ let isReady = false;
462
464
  const timeout = setTimeout(() => {
463
465
  defer.reject(/* @__PURE__ */ new Error(`Failed to connect to the browser session "${sessionId}" [${project.name}] within the timeout.`));
464
466
  }, project.vitest.config.browser.connectTimeout ?? 6e4).unref();
467
+ const resolveIfReady = () => {
468
+ if (!isConnected || !isReady) return;
469
+ defer.resolve();
470
+ clearTimeout(timeout);
471
+ };
465
472
  this.sessions.set(sessionId, {
466
473
  project,
474
+ otelCarrier: options?.otelCarrier,
467
475
  connected: () => {
468
- defer.resolve();
469
- clearTimeout(timeout);
476
+ isConnected = true;
477
+ resolveIfReady();
478
+ },
479
+ ready: () => {
480
+ isReady = true;
481
+ resolveIfReady();
470
482
  },
471
483
  fail: (error) => {
472
484
  defer.resolve();
@@ -2320,7 +2332,7 @@ class VitestPackageInstaller {
2320
2332
  } catch {}
2321
2333
  }
2322
2334
  if (/* @__PURE__ */ isPackageExists(dependency, { paths: [root, __dirname$1] })) return true;
2323
- process.stderr.write(c.red(`${c.inverse(c.red(" MISSING DEPENDENCY "))} Cannot find dependency '${dependency}'\n\n`));
2335
+ process.stderr.write(withLabel("red", "MISSING DEPENDENCY", `Cannot find dependency '${dependency}'\n\n`));
2324
2336
  if (!isTTY) return false;
2325
2337
  const { install } = await (await import('./index.og1WyBLx.js').then(function (n) { return n.i; })).default({
2326
2338
  type: "confirm",
@@ -3009,6 +3021,7 @@ class PoolRunner {
3009
3021
  };
3010
3022
  emitUnexpectedExit = () => {
3011
3023
  const error = /* @__PURE__ */ new Error("Worker exited unexpectedly");
3024
+ this._state = RunnerState.STOPPED;
3012
3025
  this._eventEmitter.emit("error", error);
3013
3026
  };
3014
3027
  waitForStart() {
@@ -3436,14 +3449,18 @@ class Pool {
3436
3449
  if (task.memoryLimit && message.usedMemory) isMemoryLimitReached = message.usedMemory >= task.memoryLimit;
3437
3450
  if (message.error) this.options.state.catchError(message.error, "Test Run Error");
3438
3451
  runner.off("message", onFinished);
3452
+ runner.off("error", onTaskError);
3439
3453
  resolver.resolve();
3440
3454
  }
3441
3455
  };
3456
+ function onTaskError(error) {
3457
+ runner.off("message", onFinished);
3458
+ runner.off("error", onTaskError);
3459
+ resolver.reject(new Error(`[vitest-pool]: Worker ${task.worker} emitted error.`, { cause: error }));
3460
+ }
3442
3461
  runner.on("message", onFinished);
3462
+ runner.on("error", onTaskError);
3443
3463
  if (!runner.isStarted) {
3444
- runner.on("error", (error) => {
3445
- resolver.reject(new Error(`[vitest-pool]: Worker ${task.worker} emitted error.`, { cause: error }));
3446
- });
3447
3464
  const id = setTimeout(() => resolver.reject(/* @__PURE__ */ new Error(`[vitest-pool]: Timeout starting ${task.worker} runner.`)), WORKER_START_TIMEOUT);
3448
3465
  await runner.start({ workerId: task.context.workerId }).catch((error) => resolver.reject(new Error(`[vitest-pool]: Failed to start ${task.worker} worker for test files ${formatFiles(task)}.`, { cause: error }))).finally(() => clearTimeout(id));
3449
3466
  }
@@ -3456,7 +3473,7 @@ class Pool {
3456
3473
  await resolver.promise.catch((error) => span?.recordException(error)).finally(() => span?.end());
3457
3474
  const index = this.activeTasks.indexOf(activeTask);
3458
3475
  if (index !== -1) this.activeTasks.splice(index, 1);
3459
- if (!task.isolate && !isMemoryLimitReached && this.queue[0]?.task.isolate === false && isEqualRunner(runner, this.queue[0].task)) {
3476
+ if (!task.isolate && !runner.isTerminated && !isMemoryLimitReached && this.queue[0]?.task.isolate === false && isEqualRunner(runner, this.queue[0].task)) {
3460
3477
  this.sharedRunners.push(runner);
3461
3478
  return this.schedule();
3462
3479
  }
@@ -8971,7 +8988,7 @@ function setup(ctx, _server) {
8971
8988
  await ctx.rerunTask(id);
8972
8989
  },
8973
8990
  getConfig() {
8974
- return ctx.getRootProject().serializedConfig;
8991
+ return ctx.serializedRootConfig;
8975
8992
  },
8976
8993
  getResolvedProjectLabels() {
8977
8994
  return ctx.projects.map((p) => ({
@@ -9170,6 +9187,7 @@ function serializeConfig(project) {
9170
9187
  disableConsoleIntercept: config.disableConsoleIntercept,
9171
9188
  root: config.root,
9172
9189
  name: config.name,
9190
+ color: config.color,
9173
9191
  globals: config.globals,
9174
9192
  snapshotEnvironment: config.snapshotEnvironment,
9175
9193
  passWithNoTests: config.passWithNoTests,
@@ -10949,9 +10967,8 @@ class TestProject {
10949
10967
  const url = new URL("/__vitest_test__/", origin);
10950
10968
  url.searchParams.set("sessionId", sessionId);
10951
10969
  const otelCarrier = this.vitest._traces.getContextCarrier();
10952
- if (otelCarrier) url.searchParams.set("otelCarrier", JSON.stringify(otelCarrier));
10953
10970
  this.vitest._browserSessions.sessionIds.add(sessionId);
10954
- const sessionPromise = this.vitest._browserSessions.createSession(sessionId, this, pool);
10971
+ const sessionPromise = this.vitest._browserSessions.createSession(sessionId, this, pool, { otelCarrier });
10955
10972
  const pagePromise = this.browser.provider.openPage(sessionId, url.toString(), { parallel: pool.parallel ?? false });
10956
10973
  await Promise.all([sessionPromise, pagePromise]);
10957
10974
  }
@@ -11173,13 +11190,14 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
11173
11190
  const removeProjects = /* @__PURE__ */ new Set();
11174
11191
  resolvedProjects.forEach((project) => {
11175
11192
  if (!project.config.browser.enabled) return;
11193
+ const originalName = project.config.name;
11176
11194
  const instances = project.config.browser.instances || [];
11177
- if (instances.length === 0) {
11195
+ if (instances.length === 0 || vitest.isExcludedByProjectFilter(originalName)) {
11178
11196
  removeProjects.add(project);
11179
11197
  return;
11180
11198
  }
11181
- const originalName = project.config.name;
11182
- // if original name is in the --project=name filter, keep all instances
11199
+ // if original name matches a positive filter, keep all instances
11200
+ // otherwise, filter instances individually (user may target a specific instance name)
11183
11201
  const filteredInstances = vitest.matchesProjectFilter(originalName) ? instances : instances.filter((instance) => {
11184
11202
  const newName = instance.name;
11185
11203
  return vitest.matchesProjectFilter(newName);
@@ -13248,6 +13266,12 @@ class Vitest {
13248
13266
  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
13267
  return this.coreWorkspaceProject;
13250
13268
  }
13269
+ get serializedRootConfig() {
13270
+ return {
13271
+ ...this.getRootProject().serializedConfig,
13272
+ projects: this.projects.map((project) => project.serializedConfig)
13273
+ };
13274
+ }
13251
13275
  getProjectByName(name) {
13252
13276
  const project = this.projects.find((p) => p.name === name) || this.coreWorkspaceProject || this.projects[0];
13253
13277
  if (!project) throw new Error(`Project "${name}" was not found.`);
@@ -14025,6 +14049,15 @@ class Vitest {
14025
14049
  return wildcardPatternToRegExp(project).test(name);
14026
14050
  });
14027
14051
  }
14052
+ /** @internal */
14053
+ isExcludedByProjectFilter(name) {
14054
+ const projects = this._config?.project || this._cliOptions?.project;
14055
+ if (!projects || !projects.length) return false;
14056
+ return toArray(projects).some((project) => {
14057
+ if (!project.startsWith("!")) return false;
14058
+ return wildcardPatternToRegExp(project.slice(1)).test(name);
14059
+ });
14060
+ }
14028
14061
  }
14029
14062
  function assert(condition, property, name = property) {
14030
14063
  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}\`.`);
@@ -14051,7 +14084,7 @@ async function VitestPlugin(options = {}, vitest = new Vitest("test", deepClone(
14051
14084
  // preliminary merge of options to be able to create server options for vite
14052
14085
  // however to allow vitest plugins to modify vitest config values
14053
14086
  // this is repeated in configResolved where the config is final
14054
- const testConfig = deepMerge({}, configDefaults, removeUndefinedValues(viteConfig.test ?? {}), options);
14087
+ const testConfig = deepMerge({}, configDefaults, viteConfig.test ?? {}, options);
14055
14088
  testConfig.api = resolveApiServerConfig(testConfig, defaultPort);
14056
14089
  // store defines for globalThis to make them
14057
14090
  // reassignable when running in worker in src/runtime/setup.ts
@@ -14171,10 +14204,6 @@ async function VitestPlugin(options = {}, vitest = new Vitest("test", deepClone(
14171
14204
  ModuleRunnerTransform()
14172
14205
  ].filter(notNullish);
14173
14206
  }
14174
- function removeUndefinedValues(obj) {
14175
- for (const key in Object.keys(obj)) if (obj[key] === void 0) delete obj[key];
14176
- return obj;
14177
- }
14178
14207
 
14179
14208
  async function createVitest(mode, options, viteOverrides = {}, vitestOptions = {}) {
14180
14209
  const ctx = new Vitest(mode, deepClone(options), vitestOptions);
@@ -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;
@@ -216,6 +218,9 @@ interface SerializedCoverageConfig {
216
218
  enabled: boolean;
217
219
  customProviderModule: string | undefined;
218
220
  }
221
+ interface SerializedRootConfig extends SerializedConfig {
222
+ projects: SerializedConfig[];
223
+ }
219
224
  type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookTimeout" | "clearMocks" | "mockReset" | "restoreMocks" | "fakeTimers" | "maxConcurrency" | "expect" | "printConsoleTrace"> & {
220
225
  sequence?: {
221
226
  hooks?: SequenceHooks;
@@ -224,4 +229,4 @@ type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookT
224
229
  type RuntimeOptions = Partial<RuntimeConfig>;
225
230
  type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
226
231
 
227
- export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, RuntimeConfig as b };
232
+ export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, SerializedRootConfig as b, RuntimeConfig as c };
@@ -14,7 +14,8 @@ 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 { isCI, isAgent, provider } from 'std-env';
17
+ import { w as withLabel } from './utils.BS4fH3nR.js';
18
+ import { isAgent, isCI, provider } from 'std-env';
18
19
  import { r as resolveCoverageProviderModule } from './coverage.CTzCuANN.js';
19
20
 
20
21
  const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
@@ -155,7 +156,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
155
156
  const mode = vitest.mode;
156
157
  const logger = vitest.logger;
157
158
  if (options.dom) {
158
- if (viteConfig.test?.environment != null && viteConfig.test.environment !== "happy-dom") logger.console.warn(c.yellow(`${c.inverse(c.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
159
+ if (viteConfig.test?.environment != null && viteConfig.test.environment !== "happy-dom") logger.console.warn(withLabel("yellow", "Vitest", `Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
159
160
  options.environment = "happy-dom";
160
161
  }
161
162
  const resolved = {
@@ -296,6 +297,18 @@ function resolveConfig$1(vitest, options, viteConfig) {
296
297
  }
297
298
  }
298
299
  resolved.coverage.reporter = resolveCoverageReporters(resolved.coverage.reporter);
300
+ if (isAgent) {
301
+ // default to `skipFull` and add `text-summary` reporter when `text` reporter is used on agents
302
+ const text = resolved.coverage.reporter.find(([name]) => name === "text");
303
+ const textSummary = resolved.coverage.reporter.find(([name]) => name === "text-summary");
304
+ if (text) {
305
+ text[1] = {
306
+ skipFull: true,
307
+ ...text[1]
308
+ };
309
+ if (!textSummary) resolved.coverage.reporter.push(["text-summary", {}]);
310
+ }
311
+ }
299
312
  if (resolved.coverage.changed === void 0 && resolved.changed !== void 0) resolved.coverage.changed = resolved.changed;
300
313
  if (resolved.coverage.enabled && resolved.coverage.reportsDirectory) {
301
314
  const reportsDirectory = resolve(resolved.root, resolved.coverage.reportsDirectory);
@@ -712,6 +725,10 @@ Update your dependencies and make sure the versions match.`));
712
725
  this.coverageFiles = /* @__PURE__ */ new Map();
713
726
  this.pendingPromises = [];
714
727
  }
728
+ normalizeCoverageFileError(error) {
729
+ 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 });
730
+ return error;
731
+ }
715
732
  onAfterSuiteRun({ coverage, environment, projectName, testFiles }) {
716
733
  if (!coverage) return;
717
734
  let entry = this.coverageFiles.get(projectName || DEFAULT_PROJECT);
@@ -724,7 +741,9 @@ Update your dependencies and make sure the versions match.`));
724
741
  entry[environment] ??= {};
725
742
  // If there's a result from previous run, overwrite it
726
743
  entry[environment][testFilenames] = filename;
727
- const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8");
744
+ const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8").catch((error) => {
745
+ throw this.normalizeCoverageFileError(error);
746
+ });
728
747
  this.pendingPromises.push(promise);
729
748
  }
730
749
  async readCoverageFiles({ onFileRead, onFinished, onDebug }) {
@@ -741,7 +760,9 @@ Update your dependencies and make sure the versions match.`));
741
760
  onDebug(`Reading coverage results ${index}/${total}`);
742
761
  }
743
762
  await Promise.all(chunk.map(async (filename) => {
744
- const contents = await promises.readFile(filename, "utf-8");
763
+ const contents = await promises.readFile(filename, "utf-8").catch((error) => {
764
+ throw this.normalizeCoverageFileError(error);
765
+ });
745
766
  onFileRead(JSON.parse(contents));
746
767
  }));
747
768
  }
@@ -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.4L3g53iW.js';
3
- import './test.BmQO5GaM.js';
2
+ import { i as index } from './index.DdgEv5B1.js';
3
+ import './test.DNmyFkvJ.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.NdrZGMhw.js';
3
+ import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.DYx3LtFI.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.BmQO5GaM.js';
6
+ import { T as TestRunner, N as NodeBenchmarkRunner } from './test.DNmyFkvJ.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.BmQO5GaM.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.DNmyFkvJ.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';