vitest 2.1.5 → 2.2.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 (39) hide show
  1. package/dist/browser.d.ts +6 -6
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.BZZh4cSm.js → base.BS0HhLXd.js} +1 -1
  4. package/dist/chunks/{cac.DWAW3Uh5.js → cac.Z91LBqmg.js} +54 -5
  5. package/dist/chunks/{cli-api.BtqJwSCh.js → cli-api.DVJJMJHj.js} +20 -6
  6. package/dist/chunks/{config.Cy0C388Z.d.ts → config.CPguQ7J1.d.ts} +2 -1
  7. package/dist/chunks/{environment.LoooBwUu.d.ts → environment.CT0jpO-1.d.ts} +2 -1
  8. package/dist/chunks/{globals.D8ZVAdXd.js → globals.BCGEw6ON.js} +2 -2
  9. package/dist/chunks/{index.nEwtF0bu.js → index.BjjsHdBb.js} +1 -1
  10. package/dist/chunks/{index.ckWaX2gY.js → index.DD5eTY2y.js} +2 -8
  11. package/dist/chunks/{index.DsZFoqi9.js → index.DLRzErGF.js} +35 -15
  12. package/dist/chunks/{reporters.D7Jzd9GS.d.ts → reporters.B_9uUTGW.d.ts} +124 -8
  13. package/dist/chunks/{resolveConfig.RxKrDli4.js → resolveConfig.CQIc6fe7.js} +4 -2
  14. package/dist/chunks/{runBaseTests.3qpJUEJM.js → runBaseTests.B7hcVT-s.js} +4 -4
  15. package/dist/chunks/{setup-common.Dj6BZI3u.js → setup-common.BfGt8K-K.js} +4 -1
  16. package/dist/chunks/{vi.DgezovHB.js → vi.BlPttogV.js} +6 -1
  17. package/dist/chunks/{vite.C-N5BBZe.d.ts → vite.Bvms8Xir.d.ts} +1 -1
  18. package/dist/chunks/{worker.tN5KGIih.d.ts → worker.9VY11NZs.d.ts} +2 -2
  19. package/dist/chunks/{worker.B9FxPCaC.d.ts → worker.Qz1UB4Fv.d.ts} +1 -1
  20. package/dist/cli.js +1 -1
  21. package/dist/config.d.ts +5 -4
  22. package/dist/coverage.d.ts +4 -107
  23. package/dist/coverage.js +1 -1
  24. package/dist/environments.d.ts +2 -2
  25. package/dist/execute.d.ts +4 -3
  26. package/dist/index.d.ts +9 -9
  27. package/dist/index.js +2 -2
  28. package/dist/node.d.ts +10 -8
  29. package/dist/node.js +5 -5
  30. package/dist/reporters.d.ts +4 -3
  31. package/dist/reporters.js +1 -1
  32. package/dist/runners.d.ts +3 -1
  33. package/dist/runners.js +4 -1
  34. package/dist/workers/forks.js +1 -1
  35. package/dist/workers/runVmTests.js +4 -4
  36. package/dist/workers/threads.js +1 -1
  37. package/dist/workers.d.ts +5 -4
  38. package/dist/workers.js +1 -1
  39. package/package.json +11 -11
package/dist/browser.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { C as CoverageProvider, b as CoverageProviderModule } from './chunks/reporters.D7Jzd9GS.js';
2
- import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.Cy0C388Z.js';
1
+ import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.B_9uUTGW.js';
2
+ import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.CPguQ7J1.js';
3
3
  import * as spy$1 from '@vitest/spy';
4
- import { DiffOptions } from '@vitest/expect';
4
+ import * as _vitest_utils_diff from '@vitest/utils/diff';
5
5
  import { VitestExecutor } from './execute.js';
6
6
  export { collectTests, processError, startTests } from '@vitest/runner';
7
- import './chunks/environment.LoooBwUu.js';
7
+ import './chunks/environment.CT0jpO-1.js';
8
8
  import 'node:stream';
9
9
  import 'vite';
10
10
  import '@vitest/utils';
@@ -21,7 +21,7 @@ import 'tinybench';
21
21
  import '@vitest/snapshot/manager';
22
22
  import 'node:fs';
23
23
  import '@vitest/snapshot/environment';
24
- import './chunks/worker.tN5KGIih.js';
24
+ import './chunks/worker.9VY11NZs.js';
25
25
  import 'node:vm';
26
26
  import '@vitest/mocker';
27
27
  import './chunks/mocker.cRtM890J.js';
@@ -57,7 +57,7 @@ declare function takeCoverageInsideWorker(options: SerializedCoverageConfig | un
57
57
  declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader): Promise<unknown>;
58
58
 
59
59
  declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
60
- declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<DiffOptions | undefined>;
60
+ declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<_vitest_utils_diff.SerializedDiffOptions | undefined>;
61
61
  declare function loadSnapshotSerializers(config: SerializedConfig, executor: VitestExecutor): Promise<void>;
62
62
 
63
63
  export { spy as SpyModule, getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BoMDb1ip.js';
2
2
  export { s as SpyModule } from './chunks/spy.Cf_4R5Oe.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.Dj6BZI3u.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.BfGt8K-K.js';
4
4
  export { collectTests, processError, startTests } from '@vitest/runner';
5
5
  import '@vitest/spy';
6
6
  import '@vitest/snapshot';
@@ -24,7 +24,7 @@ async function runBaseTests(method, state) {
24
24
  ctx.files.forEach((i) => state.moduleCache.delete(i));
25
25
  const [executor, { run }] = await Promise.all([
26
26
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
27
- import('./runBaseTests.3qpJUEJM.js')
27
+ import('./runBaseTests.B7hcVT-s.js')
28
28
  ]);
29
29
  await run(
30
30
  method,
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "2.1.5";
621
+ var version = "2.2.0-beta.1";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -1121,9 +1121,58 @@ const cliOptionsConfig = {
1121
1121
  argument: "<times>"
1122
1122
  },
1123
1123
  diff: {
1124
- description: "Path to a diff config that will be used to generate diff interface",
1124
+ description: "DiffOptions object or a path to a module which exports DiffOptions object",
1125
1125
  argument: "<path>",
1126
- normalize: true
1126
+ subcommands: {
1127
+ aAnnotation: {
1128
+ description: "Annotation for expected lines (default: `Expected`)",
1129
+ argument: "<annotation>"
1130
+ },
1131
+ aIndicator: {
1132
+ description: "Indicator for expected lines (default: `-`)",
1133
+ argument: "<indicator>"
1134
+ },
1135
+ bAnnotation: {
1136
+ description: "Annotation for received lines (default: `Received`)",
1137
+ argument: "<annotation>"
1138
+ },
1139
+ bIndicator: {
1140
+ description: "Indicator for received lines (default: `+`)",
1141
+ argument: "<indicator>"
1142
+ },
1143
+ commonIndicator: {
1144
+ description: "Indicator for common lines (default: ` `)",
1145
+ argument: "<indicator>"
1146
+ },
1147
+ contextLines: {
1148
+ description: "Number of lines of context to show around each change (default: `5`)",
1149
+ argument: "<lines>"
1150
+ },
1151
+ emptyFirstOrLastLinePlaceholder: {
1152
+ description: 'Placeholder for an empty first or last line (default: `""`)',
1153
+ argument: "<placeholder>"
1154
+ },
1155
+ expand: {
1156
+ description: "Expand all common lines (default: `true`)"
1157
+ },
1158
+ includeChangeCounts: {
1159
+ description: "Include comparison counts in diff output (default: `false`)"
1160
+ },
1161
+ omitAnnotationLines: {
1162
+ description: "Omit annotation lines from the output (default: `false`)"
1163
+ },
1164
+ printBasicPrototype: {
1165
+ description: "Print basic prototype Object and Array (default: `true`)"
1166
+ },
1167
+ truncateThreshold: {
1168
+ description: "Number of lines to show before and after each change (default: `0`)",
1169
+ argument: "<threshold>"
1170
+ },
1171
+ truncateAnnotation: {
1172
+ description: "Annotation for truncated lines (default: `... Diff result is truncated`)",
1173
+ argument: "<annotation>"
1174
+ }
1175
+ }
1127
1176
  },
1128
1177
  exclude: {
1129
1178
  description: "Additional file globs to be excluded from test",
@@ -1502,7 +1551,7 @@ async function start(mode, cliFilters, options) {
1502
1551
  } catch {
1503
1552
  }
1504
1553
  try {
1505
- const { startVitest } = await import('./cli-api.BtqJwSCh.js').then(function (n) { return n.e; });
1554
+ const { startVitest } = await import('./cli-api.DVJJMJHj.js').then(function (n) { return n.e; });
1506
1555
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
1507
1556
  if (!ctx?.shouldKeepServer()) {
1508
1557
  await ctx?.exit();
@@ -1533,7 +1582,7 @@ async function collect(mode, cliFilters, options) {
1533
1582
  } catch {
1534
1583
  }
1535
1584
  try {
1536
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BtqJwSCh.js').then(function (n) { return n.e; });
1585
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DVJJMJHj.js').then(function (n) { return n.e; });
1537
1586
  const ctx = await prepareVitest(mode, {
1538
1587
  ...normalizeCliOptions(options),
1539
1588
  watch: false,
@@ -8,12 +8,12 @@ import { f as findUp, p as prompt } from './index.BJDntFik.js';
8
8
  import { searchForWorkspaceRoot, version, createServer, mergeConfig } from 'vite';
9
9
  import { A as API_PATH, c as configFiles, a as defaultBrowserPort, w as workspacesFiles, d as defaultPort } from './constants.fzPh7AOq.js';
10
10
  import { SnapshotManager } from '@vitest/snapshot/manager';
11
- import { i as isPackageExists, e as requireMicromatch, V as VitestCache, f as configDefaults, m as mm, b as resolveConfig, h as isBrowserEnabled, w as wildcardPatternToRegExp, g as getFilePoolName, j as createPool, a as resolveApiServerConfig, c as coverageConfigDefaults, s as stdout } from './resolveConfig.RxKrDli4.js';
11
+ import { i as isPackageExists, e as requireMicromatch, V as VitestCache, f as configDefaults, m as mm, b as resolveConfig, h as isBrowserEnabled, w as wildcardPatternToRegExp, g as getFilePoolName, j as createPool, a as resolveApiServerConfig, c as coverageConfigDefaults, s as stdout } from './resolveConfig.CQIc6fe7.js';
12
12
  import { ViteNodeRunner } from 'vite-node/client';
13
13
  import { ViteNodeServer } from 'vite-node/server';
14
- import { v as version$1 } from './cac.DWAW3Uh5.js';
14
+ import { v as version$1 } from './cac.Z91LBqmg.js';
15
15
  import { c as createBirpc } from './index.68735LiX.js';
16
- import { s as stringify, p as parse, R as ReportersMap, h as BenchmarkReportsMap, f as TestModule, g as TestSuite, e as TestCase, j as generateCodeFrame, i as TestProject, L as Logger, k as BlobReporter, r as readBlobs } from './index.DsZFoqi9.js';
16
+ import { s as stringify, p as parse, R as ReportersMap, h as BenchmarkReportsMap, f as TestModule, g as TestSuite, e as TestCase, j as generateCodeFrame, i as TestProject, L as Logger, k as BlobReporter, r as readBlobs } from './index.DLRzErGF.js';
17
17
  import require$$0$2 from 'stream';
18
18
  import require$$0 from 'zlib';
19
19
  import require$$0$1 from 'buffer';
@@ -5219,6 +5219,7 @@ class StateManager {
5219
5219
  task.mode = "skip";
5220
5220
  task.result ??= { state: "skip" };
5221
5221
  task.result.state = "skip";
5222
+ task.result.note = _err.note;
5222
5223
  }
5223
5224
  return;
5224
5225
  }
@@ -8559,6 +8560,7 @@ function serializeConfig(config, coreConfig, viteConfig) {
8559
8560
  pool: config.pool,
8560
8561
  expect: config.expect,
8561
8562
  snapshotSerializers: config.snapshotSerializers,
8563
+ // TODO: non serializable function?
8562
8564
  diff: config.diff,
8563
8565
  retry: config.retry,
8564
8566
  disableConsoleIntercept: config.disableConsoleIntercept,
@@ -9905,7 +9907,8 @@ class WorkspaceProject {
9905
9907
  for (const globalSetupFile of this._globalSetups) {
9906
9908
  const teardown = await globalSetupFile.setup?.({
9907
9909
  provide: (key, value) => this.provide(key, value),
9908
- config: this.config
9910
+ config: this.config,
9911
+ onTestsRerun: (cb) => this.ctx.onTestsRerun(cb)
9909
9912
  });
9910
9913
  if (teardown == null || !!globalSetupFile.teardown) {
9911
9914
  continue;
@@ -10417,6 +10420,7 @@ class Vitest {
10417
10420
  _onClose = [];
10418
10421
  _onSetServer = [];
10419
10422
  _onCancelListeners = [];
10423
+ _onUserTestsRerun = [];
10420
10424
  async setServer(options, server, cliOptions) {
10421
10425
  this.unregisterWatcher?.();
10422
10426
  clearTimeout(this._rerunTimer);
@@ -10431,6 +10435,7 @@ class Vitest {
10431
10435
  this.coverageProvider = void 0;
10432
10436
  this.runningPromise = void 0;
10433
10437
  this._cachedSpecs.clear();
10438
+ this._onUserTestsRerun = [];
10434
10439
  const resolved = resolveConfig(this.mode, options, server.config, this.logger);
10435
10440
  this.server = server;
10436
10441
  this.config = resolved;
@@ -10862,7 +10867,10 @@ class Vitest {
10862
10867
  const filteredFiles = await this.globTestFiles([this.filenamePattern]);
10863
10868
  files = files.filter((file) => filteredFiles.some((f) => f[1] === file));
10864
10869
  }
10865
- await this.report("onWatcherRerun", files, trigger);
10870
+ await Promise.all([
10871
+ this.report("onWatcherRerun", files, trigger),
10872
+ ...this._onUserTestsRerun.map((fn) => fn(files))
10873
+ ]);
10866
10874
  await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)), allTestsRun);
10867
10875
  await this.report("onWatcherStart", this.state.getFiles(files));
10868
10876
  }
@@ -10954,7 +10962,10 @@ class Vitest {
10954
10962
  this.changedTests.clear();
10955
10963
  const triggerIds = new Set(triggerId.map((id) => relative(this.config.root, id)));
10956
10964
  const triggerLabel = Array.from(triggerIds).join(", ");
10957
- await this.report("onWatcherRerun", files, triggerLabel);
10965
+ await Promise.all([
10966
+ this.report("onWatcherRerun", files, triggerLabel),
10967
+ ...this._onUserTestsRerun.map((fn) => fn(files))
10968
+ ]);
10958
10969
  await this.runFiles(files.flatMap((file) => this.getProjectsByTestFile(file)), false);
10959
10970
  await this.report("onWatcherStart", this.state.getFiles(files));
10960
10971
  }, WATCHER_DEBOUNCE);
@@ -11227,6 +11238,9 @@ class Vitest {
11227
11238
  onClose(fn) {
11228
11239
  this._onClose.push(fn);
11229
11240
  }
11241
+ onTestsRerun(fn) {
11242
+ this._onUserTestsRerun.push(fn);
11243
+ }
11230
11244
  }
11231
11245
 
11232
11246
  async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
@@ -2,6 +2,7 @@ import { PrettyFormatOptions } from '@vitest/pretty-format';
2
2
  import { SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
3
3
  import { SnapshotUpdateState } from '@vitest/snapshot';
4
4
  import { SnapshotEnvironment } from '@vitest/snapshot/environment';
5
+ import { SerializedDiffOptions } from '@vitest/utils/diff';
5
6
 
6
7
  /**
7
8
  * Names of clock methods that may be faked by install.
@@ -154,7 +155,7 @@ interface SerializedConfig {
154
155
  showDiff?: boolean;
155
156
  truncateThreshold?: number;
156
157
  } | undefined;
157
- diff: string | undefined;
158
+ diff: string | SerializedDiffOptions | undefined;
158
159
  retry: number;
159
160
  includeTaskLocation: boolean | undefined;
160
161
  inspect: boolean | string | undefined;
@@ -36,6 +36,7 @@ interface ModuleGraphData {
36
36
  inlined: string[];
37
37
  }
38
38
  type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
39
+ type OnTestsRerunHandler = (testFiles: string[]) => Promise<void> | void;
39
40
  interface ProvidedContext {
40
41
  }
41
42
 
@@ -171,4 +172,4 @@ interface ResolvedTestEnvironment {
171
172
  options: Record<string, any> | null;
172
173
  }
173
174
 
174
- export type { AfterSuiteRunMeta as A, Constructable as C, Environment as E, HappyDOMOptions as H, JSDOMOptions as J, ModuleGraphData as M, Nullable as N, OnServerRestartHandler as O, ProvidedContext as P, ResolvedTestEnvironment as R, TransformMode as T, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c, ArgumentsType as d, MutableArray as e, EnvironmentOptions as f, ModuleCache as g };
175
+ export type { AfterSuiteRunMeta as A, Constructable as C, Environment as E, HappyDOMOptions as H, JSDOMOptions as J, ModuleGraphData as M, Nullable as N, OnServerRestartHandler as O, ProvidedContext as P, ResolvedTestEnvironment as R, TransformMode as T, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c, ArgumentsType as d, MutableArray as e, EnvironmentOptions as f, ModuleCache as g, OnTestsRerunHandler as h };
@@ -1,6 +1,6 @@
1
1
  import { g as globalApis } from './constants.fzPh7AOq.js';
2
- import { V as VitestIndex } from './index.ckWaX2gY.js';
3
- import './vi.DgezovHB.js';
2
+ import { V as VitestIndex } from './index.DD5eTY2y.js';
3
+ import './vi.BlPttogV.js';
4
4
  import '@vitest/expect';
5
5
  import '@vitest/runner';
6
6
  import '@vitest/runner/utils';
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
3
3
  import { t as takeCoverageInsideWorker } from './coverage.BoMDb1ip.js';
4
4
  import { distDir } from '../path.js';
5
5
  import { r as rpc } from './rpc.C3q9uwRX.js';
6
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.Dj6BZI3u.js';
6
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.BfGt8K-K.js';
7
7
  import { g as getWorkerState } from './utils.C8RiOc4B.js';
8
8
 
9
9
  function setupChaiConfig(config) {
@@ -1,5 +1,4 @@
1
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DgezovHB.js';
2
- import { g as getWorkerState } from './utils.C8RiOc4B.js';
1
+ import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.BlPttogV.js';
3
2
  import { i as isFirstRun, a as runOnce } from './run-once.2ogXb3JV.js';
4
3
  import { b as bench } from './benchmark.Cdu9hjj4.js';
5
4
  import { expectTypeOf } from 'expect-type';
@@ -7,11 +6,6 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed,
7
6
  import * as chai from 'chai';
8
7
  import { assert, should } from 'chai';
9
8
 
10
- function inject(key) {
11
- const workerState = getWorkerState();
12
- return workerState.providedContext[key];
13
- }
14
-
15
9
  function getRunningMode() {
16
10
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
17
11
  }
@@ -51,4 +45,4 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
51
45
  vitest: vitest
52
46
  });
53
47
 
54
- export { VitestIndex as V, isWatchMode as a, assertType as b, getRunningMode as g, inject as i };
48
+ export { VitestIndex as V, assertType as a, getRunningMode as g, isWatchMode as i };
@@ -170,9 +170,22 @@ class TestCase extends ReportedTaskImplementation {
170
170
  return void 0;
171
171
  }
172
172
  const state = result.state === "fail" ? "failed" : result.state === "pass" ? "passed" : "skipped";
173
+ if (state === "skipped") {
174
+ return {
175
+ state,
176
+ note: result.note,
177
+ errors: void 0
178
+ };
179
+ }
180
+ if (state === "passed") {
181
+ return {
182
+ state,
183
+ errors: result.errors
184
+ };
185
+ }
173
186
  return {
174
187
  state,
175
- errors: result.errors
188
+ errors: result.errors || []
176
189
  };
177
190
  }
178
191
  /**
@@ -2403,8 +2416,10 @@ function isWide(x) {
2403
2416
  || x === 0x25FE
2404
2417
  || x === 0x2614
2405
2418
  || x === 0x2615
2419
+ || x >= 0x2630 && x <= 0x2637
2406
2420
  || x >= 0x2648 && x <= 0x2653
2407
2421
  || x === 0x267F
2422
+ || x >= 0x268A && x <= 0x268F
2408
2423
  || x === 0x2693
2409
2424
  || x === 0x26A1
2410
2425
  || x === 0x26AA
@@ -2445,11 +2460,10 @@ function isWide(x) {
2445
2460
  || x >= 0x3099 && x <= 0x30FF
2446
2461
  || x >= 0x3105 && x <= 0x312F
2447
2462
  || x >= 0x3131 && x <= 0x318E
2448
- || x >= 0x3190 && x <= 0x31E3
2463
+ || x >= 0x3190 && x <= 0x31E5
2449
2464
  || x >= 0x31EF && x <= 0x321E
2450
2465
  || x >= 0x3220 && x <= 0x3247
2451
- || x >= 0x3250 && x <= 0x4DBF
2452
- || x >= 0x4E00 && x <= 0xA48C
2466
+ || x >= 0x3250 && x <= 0xA48C
2453
2467
  || x >= 0xA490 && x <= 0xA4C6
2454
2468
  || x >= 0xA960 && x <= 0xA97C
2455
2469
  || x >= 0xAC00 && x <= 0xD7A3
@@ -2463,7 +2477,7 @@ function isWide(x) {
2463
2477
  || x === 0x16FF1
2464
2478
  || x >= 0x17000 && x <= 0x187F7
2465
2479
  || x >= 0x18800 && x <= 0x18CD5
2466
- || x >= 0x18D00 && x <= 0x18D08
2480
+ || x >= 0x18CFF && x <= 0x18D08
2467
2481
  || x >= 0x1AFF0 && x <= 0x1AFF3
2468
2482
  || x >= 0x1AFF5 && x <= 0x1AFFB
2469
2483
  || x === 0x1AFFD
@@ -2474,6 +2488,8 @@ function isWide(x) {
2474
2488
  || x === 0x1B155
2475
2489
  || x >= 0x1B164 && x <= 0x1B167
2476
2490
  || x >= 0x1B170 && x <= 0x1B2FB
2491
+ || x >= 0x1D300 && x <= 0x1D356
2492
+ || x >= 0x1D360 && x <= 0x1D376
2477
2493
  || x === 0x1F004
2478
2494
  || x === 0x1F0CF
2479
2495
  || x === 0x1F18E
@@ -2517,11 +2533,10 @@ function isWide(x) {
2517
2533
  || x >= 0x1F93C && x <= 0x1F945
2518
2534
  || x >= 0x1F947 && x <= 0x1F9FF
2519
2535
  || x >= 0x1FA70 && x <= 0x1FA7C
2520
- || x >= 0x1FA80 && x <= 0x1FA88
2521
- || x >= 0x1FA90 && x <= 0x1FABD
2522
- || x >= 0x1FABF && x <= 0x1FAC5
2523
- || x >= 0x1FACE && x <= 0x1FADB
2524
- || x >= 0x1FAE0 && x <= 0x1FAE8
2536
+ || x >= 0x1FA80 && x <= 0x1FA89
2537
+ || x >= 0x1FA8F && x <= 0x1FAC6
2538
+ || x >= 0x1FACE && x <= 0x1FADC
2539
+ || x >= 0x1FADF && x <= 0x1FAE9
2525
2540
  || x >= 0x1FAF0 && x <= 0x1FAF8
2526
2541
  || x >= 0x20000 && x <= 0x2FFFD
2527
2542
  || x >= 0x30000 && x <= 0x3FFFD;
@@ -3875,7 +3890,8 @@ function renderTree$1(tasks, options, level = 0, maxRows) {
3875
3890
  suffix += c.dim(` (${tests.length})`);
3876
3891
  }
3877
3892
  if (task.mode === "skip" || task.mode === "todo") {
3878
- suffix += ` ${c.dim(c.gray("[skipped]"))}`;
3893
+ const note = task.result?.note || "skipped";
3894
+ suffix += ` ${c.dim(c.gray(`[${note}]`))}`;
3879
3895
  }
3880
3896
  if (task.type === "test" && task.result?.repeatCount && task.result.repeatCount > 0) {
3881
3897
  suffix += c.yellow(` (repeat x${task.result.repeatCount})`);
@@ -4311,7 +4327,7 @@ class JsonReporter {
4311
4327
  this.ctx = ctx;
4312
4328
  this.start = Date.now();
4313
4329
  }
4314
- async logTasks(files) {
4330
+ async logTasks(files, coverageMap) {
4315
4331
  const suites = getSuites(files);
4316
4332
  const numTotalTestSuites = suites.length;
4317
4333
  const tests = getTests(files);
@@ -4394,12 +4410,13 @@ class JsonReporter {
4394
4410
  snapshot: this.ctx.snapshot.summary,
4395
4411
  startTime: this.start,
4396
4412
  success,
4397
- testResults
4413
+ testResults,
4414
+ coverageMap
4398
4415
  };
4399
4416
  await this.writeReport(JSON.stringify(result));
4400
4417
  }
4401
- async onFinished(files = this.ctx.state.getFiles()) {
4402
- await this.logTasks(files);
4418
+ async onFinished(files = this.ctx.state.getFiles(), _errors = [], coverageMap) {
4419
+ await this.logTasks(files, coverageMap);
4403
4420
  }
4404
4421
  /**
4405
4422
  * Writes the report to an output file if specified in the config,
@@ -4829,6 +4846,9 @@ class VerboseReporter extends DefaultReporter {
4829
4846
  ` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`
4830
4847
  );
4831
4848
  }
4849
+ if (task.result?.note) {
4850
+ title += c.dim(c.gray(` [${task.result.note}]`));
4851
+ }
4832
4852
  this.ctx.logger.log(title);
4833
4853
  if (task.result.state === "fail") {
4834
4854
  task.result.errors?.forEach((error) => {
@@ -1,13 +1,14 @@
1
1
  import * as _vitest_runner from '@vitest/runner';
2
2
  import { File, TaskResultPack, Task, Test, Suite, CancelReason, Custom, TaskMeta, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
3
- import { b as Awaitable, U as UserConsoleLog, P as ProvidedContext, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, d as ArgumentsType, O as OnServerRestartHandler } from './environment.LoooBwUu.js';
3
+ import { b as Awaitable, U as UserConsoleLog, P as ProvidedContext, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, d as ArgumentsType, O as OnServerRestartHandler, h as OnTestsRerunHandler } from './environment.CT0jpO-1.js';
4
4
  import { Writable } from 'node:stream';
5
5
  import * as vite from 'vite';
6
6
  import { ViteDevServer, TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv } from 'vite';
7
7
  import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, TestError, Arrayable } from '@vitest/utils';
8
- import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.Cy0C388Z.js';
8
+ import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.CPguQ7J1.js';
9
9
  import { PrettyFormatOptions } from '@vitest/pretty-format';
10
10
  import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
11
+ import { SerializedDiffOptions } from '@vitest/utils/diff';
11
12
  import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
12
13
  import * as chai from 'chai';
13
14
  import { StackTraceParserOptions } from '@vitest/utils/source-map';
@@ -805,6 +806,10 @@ interface TestResultSkipped {
805
806
  * Skipped tests have no errors.
806
807
  */
807
808
  errors: undefined;
809
+ /**
810
+ * A custom note.
811
+ */
812
+ note: string | undefined;
808
813
  }
809
814
  interface TestDiagnostic {
810
815
  /**
@@ -927,6 +932,110 @@ declare class HangingProcessReporter implements Reporter {
927
932
  onProcessTimeout(): void;
928
933
  }
929
934
 
935
+ interface CoverageSummaryData {
936
+ lines: Totals;
937
+ statements: Totals;
938
+ branches: Totals;
939
+ functions: Totals;
940
+ }
941
+
942
+ declare class CoverageSummary {
943
+ constructor(data: CoverageSummary | CoverageSummaryData);
944
+ merge(obj: CoverageSummary): CoverageSummary;
945
+ toJSON(): CoverageSummaryData;
946
+ isEmpty(): boolean;
947
+ data: CoverageSummaryData;
948
+ lines: Totals;
949
+ statements: Totals;
950
+ branches: Totals;
951
+ functions: Totals;
952
+ }
953
+
954
+ interface CoverageMapData {
955
+ [key: string]: FileCoverage | FileCoverageData;
956
+ }
957
+
958
+ declare class CoverageMap {
959
+ constructor(data: CoverageMapData | CoverageMap);
960
+ addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
961
+ files(): string[];
962
+ fileCoverageFor(filename: string): FileCoverage;
963
+ filter(callback: (key: string) => boolean): void;
964
+ getCoverageSummary(): CoverageSummary;
965
+ merge(data: CoverageMapData | CoverageMap): void;
966
+ toJSON(): CoverageMapData;
967
+ data: CoverageMapData;
968
+ }
969
+
970
+ interface Location {
971
+ line: number;
972
+ column: number;
973
+ }
974
+
975
+ interface Range {
976
+ start: Location;
977
+ end: Location;
978
+ }
979
+
980
+ interface BranchMapping {
981
+ loc: Range;
982
+ type: string;
983
+ locations: Range[];
984
+ line: number;
985
+ }
986
+
987
+ interface FunctionMapping {
988
+ name: string;
989
+ decl: Range;
990
+ loc: Range;
991
+ line: number;
992
+ }
993
+
994
+ interface FileCoverageData {
995
+ path: string;
996
+ statementMap: { [key: string]: Range };
997
+ fnMap: { [key: string]: FunctionMapping };
998
+ branchMap: { [key: string]: BranchMapping };
999
+ s: { [key: string]: number };
1000
+ f: { [key: string]: number };
1001
+ b: { [key: string]: number[] };
1002
+ }
1003
+
1004
+ interface Totals {
1005
+ total: number;
1006
+ covered: number;
1007
+ skipped: number;
1008
+ pct: number;
1009
+ }
1010
+
1011
+ interface Coverage {
1012
+ covered: number;
1013
+ total: number;
1014
+ coverage: number;
1015
+ }
1016
+
1017
+ declare class FileCoverage implements FileCoverageData {
1018
+ constructor(data: string | FileCoverage | FileCoverageData);
1019
+ merge(other: FileCoverageData): void;
1020
+ getBranchCoverageByLine(): { [line: number]: Coverage };
1021
+ getLineCoverage(): { [line: number]: number };
1022
+ getUncoveredLines(): number[];
1023
+ resetHits(): void;
1024
+ computeBranchTotals(): Totals;
1025
+ computeSimpleTotals(): Totals;
1026
+ toSummary(): CoverageSummary;
1027
+ toJSON(): object;
1028
+
1029
+ data: FileCoverageData;
1030
+ path: string;
1031
+ statementMap: { [key: string]: Range };
1032
+ fnMap: { [key: string]: FunctionMapping };
1033
+ branchMap: { [key: string]: BranchMapping };
1034
+ s: { [key: string]: number };
1035
+ f: { [key: string]: number };
1036
+ b: { [key: string]: number[] };
1037
+ }
1038
+
930
1039
  type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
931
1040
  type Milliseconds = number;
932
1041
  interface Callsite {
@@ -965,6 +1074,7 @@ interface JsonTestResults {
965
1074
  success: boolean;
966
1075
  testResults: Array<JsonTestResult>;
967
1076
  snapshot: SnapshotSummary;
1077
+ coverageMap?: CoverageMap | null | undefined;
968
1078
  }
969
1079
  interface JsonOptions$1 {
970
1080
  outputFile?: string;
@@ -975,8 +1085,8 @@ declare class JsonReporter implements Reporter {
975
1085
  options: JsonOptions$1;
976
1086
  constructor(options: JsonOptions$1);
977
1087
  onInit(ctx: Vitest): void;
978
- protected logTasks(files: File[]): Promise<void>;
979
- onFinished(files?: File[]): Promise<void>;
1088
+ protected logTasks(files: File[], coverageMap?: CoverageMap | null): Promise<void>;
1089
+ onFinished(files?: File[], _errors?: unknown[], coverageMap?: unknown): Promise<void>;
980
1090
  /**
981
1091
  * Writes the report to an output file if specified in the config,
982
1092
  * or logs it to the console otherwise.
@@ -1764,6 +1874,10 @@ interface DepsOptions {
1764
1874
  type InlineReporter = Reporter;
1765
1875
  type ReporterName = BuiltinReporters | 'html' | (string & {});
1766
1876
  type ReporterWithOptions<Name extends ReporterName = ReporterName> = Name extends keyof BuiltinReporterOptions ? BuiltinReporterOptions[Name] extends never ? [Name, object] : [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
1877
+ interface ResolveSnapshotPathHandlerContext {
1878
+ config: SerializedConfig;
1879
+ }
1880
+ type ResolveSnapshotPathHandler = (testPath: string, snapExtension: string, context: ResolveSnapshotPathHandlerContext) => string;
1767
1881
  interface InlineConfig {
1768
1882
  /**
1769
1883
  * Name of the project. Will be used to display in the reporter.
@@ -2049,7 +2163,7 @@ interface InlineConfig {
2049
2163
  /**
2050
2164
  * Path to a module which has a default export of diff config.
2051
2165
  */
2052
- diff?: string;
2166
+ diff?: string | SerializedDiffOptions;
2053
2167
  /**
2054
2168
  * Paths to snapshot serializer modules.
2055
2169
  */
@@ -2057,7 +2171,7 @@ interface InlineConfig {
2057
2171
  /**
2058
2172
  * Resolve custom snapshot path
2059
2173
  */
2060
- resolveSnapshotPath?: (path: string, extension: string) => string;
2174
+ resolveSnapshotPath?: ResolveSnapshotPathHandler;
2061
2175
  /**
2062
2176
  * Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
2063
2177
  */
@@ -2390,7 +2504,7 @@ interface UserConfig extends InlineConfig {
2390
2504
  interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude' | 'diff' | 'setupFiles' | 'snapshotEnvironment' | 'bail'> {
2391
2505
  mode: VitestRunMode;
2392
2506
  base?: string;
2393
- diff?: string;
2507
+ diff?: string | SerializedDiffOptions;
2394
2508
  bail?: number;
2395
2509
  setupFiles: string[];
2396
2510
  snapshotEnvironment?: string;
@@ -2685,6 +2799,7 @@ declare class Vitest {
2685
2799
  private _onClose;
2686
2800
  private _onSetServer;
2687
2801
  private _onCancelListeners;
2802
+ private _onUserTestsRerun;
2688
2803
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
2689
2804
  provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
2690
2805
  /**
@@ -2767,6 +2882,7 @@ declare class Vitest {
2767
2882
  onAfterSetServer(fn: OnServerRestartHandler): void;
2768
2883
  onCancel(fn: (reason: CancelReason) => void): void;
2769
2884
  onClose(fn: () => void): void;
2885
+ onTestsRerun(fn: OnTestsRerunHandler): void;
2770
2886
  }
2771
2887
 
2772
- export { type HTMLOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, VitestPackageInstaller as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, type ProcessPool as X, getFilePoolName as Y, TestProject as Z, type SerializedTestProject as _, type ReportContext as a, type JsonOptions$1 as a0, type JUnitOptions as a1, TestCase as a2, TestSuite as a3, type TaskOptions as a4, TestCollection as a5, type TestDiagnostic as a6, type TestResult as a7, type TestResultFailed as a8, type TestResultPassed as a9, VerboseReporter as aA, BaseReporter as aB, TestFile as aC, type FileDiagnostic as aD, ReportersMap as aE, type BuiltinReporters as aF, type BuiltinReporterOptions as aG, type JsonAssertionResult as aH, type JsonTestResult as aI, type JsonTestResults as aJ, BenchmarkReportsMap as aK, type BenchmarkBuiltinReporters as aL, type TestResultSkipped as aa, type TestSequencerConstructor as ab, TestSpecification as ac, type BrowserBuiltinProvider as ad, type BrowserCommand as ae, type BrowserCommandContext as af, type BrowserOrchestrator as ag, type BrowserProvider as ah, type BrowserProviderInitializationOptions as ai, type BrowserProviderModule as aj, type BrowserProviderOptions as ak, type BrowserServer as al, type BrowserServerState as am, type BrowserServerStateContext as an, type CDPSession as ao, type ResolvedBrowserOptions as ap, type ResolvedProjectConfig as aq, BasicReporter as ar, DefaultReporter as as, DotReporter as at, GithubActionsReporter as au, HangingProcessReporter as av, JsonReporter as aw, JUnitReporter as ax, TapFlatReporter as ay, TapReporter as az, type CoverageProviderModule as b, type CoverageV8Options as c, type UserProjectConfigFn as d, type UserProjectConfigExport as e, type VitestEnvironment as f, type RawErrsMap as g, type CollectLineNumbers as h, type CollectLines as i, type RootAndTarget as j, type Context as k, type CoverageReporter as l, type CoverageProviderName as m, type CoverageOptions as n, type CoverageIstanbulOptions as o, type CustomProviderOptions as p, type Reporter as q, type BrowserScript as r, type BrowserConfigOptions as s, type BuiltinEnvironment as t, type PoolOptions as u, type CSSModuleScopeStrategy as v, type VitestRunMode as w, type TransformModePatterns as x, type TypecheckConfig as y, type UserConfig as z };
2888
+ export { type SerializedTestProject as $, type ApiConfig as A, type BaseCoverageOptions as B, CoverageMap as C, type DepsOptimizationOptions as D, type UserConfig as E, type ResolvedConfig as F, type ProjectConfig as G, type BenchmarkUserOptions as H, type InlineConfig as I, type VitestOptions as J, WorkspaceProject as K, Logger as L, type TestSequencer as M, type WorkspaceSpec as N, TestModule as O, type Pool as P, type ModuleDiagnostic as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, VitestPackageInstaller as X, type ProcessPool as Y, getFilePoolName as Z, TestProject as _, type ReportContext as a, type HTMLOptions as a0, type JsonOptions$1 as a1, type JUnitOptions as a2, TestCase as a3, TestSuite as a4, type TaskOptions as a5, TestCollection as a6, type TestDiagnostic as a7, type TestResult as a8, type TestResultFailed as a9, JUnitReporter as aA, TapFlatReporter as aB, TapReporter as aC, VerboseReporter as aD, BaseReporter as aE, TestFile as aF, type FileDiagnostic as aG, ReportersMap as aH, type BuiltinReporters as aI, type BuiltinReporterOptions as aJ, type JsonAssertionResult as aK, type JsonTestResult as aL, type JsonTestResults as aM, BenchmarkReportsMap as aN, type BenchmarkBuiltinReporters as aO, type TestResultPassed as aa, type TestResultSkipped as ab, type TestSequencerConstructor as ac, TestSpecification as ad, type BrowserBuiltinProvider as ae, type BrowserCommand as af, type BrowserCommandContext as ag, type BrowserOrchestrator as ah, type BrowserProvider as ai, type BrowserProviderInitializationOptions as aj, type BrowserProviderModule as ak, type BrowserProviderOptions as al, type BrowserServer as am, type BrowserServerState as an, type BrowserServerStateContext as ao, type CDPSession as ap, type ResolvedBrowserOptions as aq, type ResolvedProjectConfig as ar, type ResolveSnapshotPathHandler as as, type ResolveSnapshotPathHandlerContext as at, BasicReporter as au, DefaultReporter as av, DotReporter as aw, GithubActionsReporter as ax, HangingProcessReporter as ay, JsonReporter as az, type CoverageProvider as b, type CoverageProviderModule as c, type CoverageV8Options as d, type UserProjectConfigFn as e, type UserProjectConfigExport as f, type VitestEnvironment as g, type RawErrsMap as h, type CollectLineNumbers as i, type CollectLines as j, type RootAndTarget as k, type Context as l, type CoverageReporter as m, type CoverageProviderName as n, type CoverageOptions as o, type CoverageIstanbulOptions as p, type CustomProviderOptions as q, type Reporter as r, type BrowserScript as s, type BrowserConfigOptions as t, type BuiltinEnvironment as u, type PoolOptions as v, type CSSModuleScopeStrategy as w, type VitestRunMode as x, type TransformModePatterns as y, type TypecheckConfig as z };