vitest 0.34.2 → 0.34.3

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 (38) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +1 -1
  3. package/dist/child.js +2 -2
  4. package/dist/{chunk-api-setup.cc5282f7.js → chunk-api-setup.3b016b1c.js} +1 -1
  5. package/dist/{chunk-install-pkg.7e19b3a0.js → chunk-install-pkg.a036014e.js} +4 -3
  6. package/dist/{chunk-integrations-globals.522ae1ae.js → chunk-integrations-globals.7f4b17bf.js} +3 -3
  7. package/dist/cli.js +9 -8
  8. package/dist/config.cjs +3 -1
  9. package/dist/config.d.ts +3 -3
  10. package/dist/config.js +3 -1
  11. package/dist/coverage.d.ts +3 -3
  12. package/dist/entry-vm.js +3 -3
  13. package/dist/entry.js +3 -3
  14. package/dist/environments.d.ts +3 -3
  15. package/dist/environments.js +1 -1
  16. package/dist/execute.d.ts +3 -3
  17. package/dist/execute.js +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +4 -4
  20. package/dist/loader.js +1 -1
  21. package/dist/node.d.ts +4 -4
  22. package/dist/node.js +4 -3
  23. package/dist/{types-63abf2e0.d.ts → reporters-2ff87305.d.ts} +10 -4
  24. package/dist/reporters.d.ts +16 -0
  25. package/dist/reporters.js +16 -0
  26. package/dist/runners.d.ts +3 -3
  27. package/dist/runners.js +2 -2
  28. package/dist/{vendor-environments.37f266a9.js → vendor-environments.8eb4d407.js} +15 -4
  29. package/dist/{vendor-execute.4fc8203a.js → vendor-execute.a63e187f.js} +8 -6
  30. package/dist/{vendor-index.087d1af7.js → vendor-index.29282562.js} +1 -1
  31. package/dist/{vendor-index.b5efbd68.js → vendor-index.7178e7a2.js} +1 -1
  32. package/dist/{vendor-node.7b1bd3c5.js → vendor-node.5ce5f335.js} +87 -2615
  33. package/dist/vendor-reporters.f6975b8d.js +2584 -0
  34. package/dist/{vendor-vi.f8055ff2.js → vendor-vi.597d9e06.js} +1 -1
  35. package/dist/vm.js +2 -2
  36. package/dist/worker.js +2 -2
  37. package/package.json +11 -7
  38. package/reporters.d.ts +1 -0
@@ -1,5 +1,5 @@
1
- import { resolve, relative, isAbsolute, dirname, basename, normalize, join, extname, toNamespacedPath } from 'pathe';
2
- import { loadConfigFromFile, version as version$2, searchForWorkspaceRoot, createServer, mergeConfig } from 'vite';
1
+ import { resolve, relative, dirname, normalize, basename, join, extname, toNamespacedPath } from 'pathe';
2
+ import { loadConfigFromFile, searchForWorkspaceRoot, version as version$2, createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'node:path';
4
4
  import url, { fileURLToPath, pathToFileURL } from 'node:url';
5
5
  import process$1 from 'node:process';
@@ -17,7 +17,7 @@ import { slash as slash$2, normalizeRequestId, cleanUrl } from 'vite-node/utils'
17
17
  import { ViteNodeRunner } from 'vite-node/client';
18
18
  import { SnapshotManager } from '@vitest/snapshot/manager';
19
19
  import { ViteNodeServer } from 'vite-node/server';
20
- import { a as isNode, r as relativePath, b as removeUndefinedValues, c as isWindows } from './vendor-index.087d1af7.js';
20
+ import { r as removeUndefinedValues, a as isWindows } from './vendor-index.29282562.js';
21
21
  import { g as getCoverageProvider, C as CoverageProviderMap } from './vendor-coverage.78040316.js';
22
22
  import { d as distDir, r as rootDir } from './vendor-paths.84fc7a99.js';
23
23
  import v8 from 'node:v8';
@@ -25,25 +25,23 @@ import { fork } from 'node:child_process';
25
25
  import { c as createBirpc } from './vendor-index.b271ebe4.js';
26
26
  import { g as groupBy, A as AggregateErrorPonyfill, s as slash$1, t as toArray, i as isPrimitive, d as deepMerge, n as noop$1, a as stdout } from './vendor-base.9c08bbd0.js';
27
27
  import { MessageChannel } from 'node:worker_threads';
28
- import { cpus, hostname, totalmem } from 'node:os';
28
+ import { cpus, totalmem } from 'node:os';
29
29
  import Tinypool from 'tinypool';
30
- import { createDefer, getSafeTimers, notNullish, shuffle, inspect, positionToOffset, lineSplitRE } from '@vitest/utils';
30
+ import { createDefer, shuffle, inspect, positionToOffset, lineSplitRE, notNullish } from '@vitest/utils';
31
31
  import { isPackageExists, resolveModule } from 'local-pkg';
32
32
  import { isCI } from 'std-env';
33
- import { performance } from 'node:perf_hooks';
34
- import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.f9d75aed.js';
35
- import { getTests, hasFailed, getSuites, generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks } from '@vitest/runner/utils';
36
- import { parseErrorStacktrace, TraceMap, generatedPositionFor } from '@vitest/utils/source-map';
37
- import { createRequire, builtinModules } from 'node:module';
33
+ import { R as ReportersMap, B as BenchmarkReportsMap, s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, d as divider, F as F_POINTER, e as cliTruncate } from './vendor-reporters.f6975b8d.js';
38
34
  import { createHash } from 'node:crypto';
39
35
  import { o as onExit, e as execa } from './vendor-index.1f85e5f1.js';
36
+ import { TraceMap, generatedPositionFor, parseErrorStacktrace } from '@vitest/utils/source-map';
40
37
  import { writeFile, rm } from 'node:fs/promises';
41
38
  import ue from 'module';
42
39
  import { parse as parse$4 } from 'acorn';
43
40
  import { ancestor, simple, findNodeAround } from 'acorn-walk';
41
+ import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
44
42
  import MagicString from 'magic-string';
45
43
  import { stripLiteral } from 'strip-literal';
46
- import { g as getEnvPackageName } from './vendor-environments.37f266a9.js';
44
+ import { g as getEnvPackageName } from './vendor-environments.8eb4d407.js';
47
45
  import readline from 'node:readline';
48
46
  import require$$0$2 from 'readline';
49
47
 
@@ -62,7 +60,7 @@ function _mergeNamespaces(n, m) {
62
60
  return Object.freeze(n);
63
61
  }
64
62
 
65
- var version$1 = "0.34.2";
63
+ var version$1 = "0.34.3";
66
64
 
67
65
  const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
68
66
  async function ensurePackageInstalled(dependency, root) {
@@ -81,7 +79,7 @@ async function ensurePackageInstalled(dependency, root) {
81
79
  message: c.reset(`Do you want to install ${c.green(dependency)}?`)
82
80
  });
83
81
  if (install) {
84
- await (await import('./chunk-install-pkg.7e19b3a0.js')).installPackage(dependency, { dev: true });
82
+ await (await import('./chunk-install-pkg.a036014e.js')).installPackage(dependency, { dev: true });
85
83
  process.stderr.write(c.yellow(`
86
84
  Package ${dependency} installed, re-run the command to start.
87
85
  `));
@@ -7687,2559 +7685,6 @@ function createPool(ctx) {
7687
7685
  };
7688
7686
  }
7689
7687
 
7690
- const F_RIGHT = "\u2192";
7691
- const F_DOWN = "\u2193";
7692
- const F_DOWN_RIGHT = "\u21B3";
7693
- const F_POINTER = "\u276F";
7694
- const F_DOT = "\xB7";
7695
- const F_CHECK = "\u2713";
7696
- const F_CROSS = "\xD7";
7697
- const F_LONG_DASH = "\u23AF";
7698
-
7699
- function ansiRegex({onlyFirst = false} = {}) {
7700
- const pattern = [
7701
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
7702
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
7703
- ].join('|');
7704
-
7705
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
7706
- }
7707
-
7708
- const regex = ansiRegex();
7709
-
7710
- function stripAnsi(string) {
7711
- if (typeof string !== 'string') {
7712
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
7713
- }
7714
-
7715
- // Even though the regex is global, we don't need to reset the `.lastIndex`
7716
- // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
7717
- // and doing it manually has a performance penalty.
7718
- return string.replace(regex, '');
7719
- }
7720
-
7721
- const spinnerMap = /* @__PURE__ */ new WeakMap();
7722
- const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
7723
- const pointer = c.yellow(F_POINTER);
7724
- const skipped = c.dim(c.gray(F_DOWN));
7725
- function getCols(delta = 0) {
7726
- var _a;
7727
- let length = (_a = process.stdout) == null ? void 0 : _a.columns;
7728
- if (!length || Number.isNaN(length))
7729
- length = 30;
7730
- return Math.max(length + delta, 0);
7731
- }
7732
- function divider(text, left, right) {
7733
- const cols = getCols();
7734
- if (text) {
7735
- const textLength = stripAnsi(text).length;
7736
- if (left == null && right != null) {
7737
- left = cols - textLength - right;
7738
- } else {
7739
- left = left ?? Math.floor((cols - textLength) / 2);
7740
- right = cols - textLength - left;
7741
- }
7742
- left = Math.max(0, left);
7743
- right = Math.max(0, right);
7744
- return `${F_LONG_DASH.repeat(left)}${text}${F_LONG_DASH.repeat(right)}`;
7745
- }
7746
- return F_LONG_DASH.repeat(cols);
7747
- }
7748
- function formatTestPath(root, path) {
7749
- var _a;
7750
- if (isAbsolute(path))
7751
- path = relative(root, path);
7752
- const dir = dirname(path);
7753
- const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
7754
- const base = basename(path, ext);
7755
- return slash$1(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
7756
- }
7757
- function renderSnapshotSummary(rootDir, snapshots) {
7758
- const summary = [];
7759
- if (snapshots.added)
7760
- summary.push(c.bold(c.green(`${snapshots.added} written`)));
7761
- if (snapshots.unmatched)
7762
- summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
7763
- if (snapshots.updated)
7764
- summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
7765
- if (snapshots.filesRemoved) {
7766
- if (snapshots.didUpdate)
7767
- summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
7768
- else
7769
- summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
7770
- }
7771
- if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
7772
- const [head, ...tail] = snapshots.filesRemovedList;
7773
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
7774
- tail.forEach((key) => {
7775
- summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
7776
- });
7777
- }
7778
- if (snapshots.unchecked) {
7779
- if (snapshots.didUpdate)
7780
- summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
7781
- else
7782
- summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
7783
- snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
7784
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
7785
- uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
7786
- });
7787
- }
7788
- return summary;
7789
- }
7790
- function countTestErrors(tasks) {
7791
- return tasks.reduce((c2, i) => {
7792
- var _a, _b;
7793
- return c2 + (((_b = (_a = i.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.length) || 0);
7794
- }, 0);
7795
- }
7796
- function getStateString(tasks, name = "tests", showTotal = true) {
7797
- if (tasks.length === 0)
7798
- return c.dim(`no ${name}`);
7799
- const passed = tasks.filter((i) => {
7800
- var _a;
7801
- return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
7802
- });
7803
- const failed = tasks.filter((i) => {
7804
- var _a;
7805
- return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
7806
- });
7807
- const skipped2 = tasks.filter((i) => i.mode === "skip");
7808
- const todo = tasks.filter((i) => i.mode === "todo");
7809
- return [
7810
- failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
7811
- passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
7812
- skipped2.length ? c.yellow(`${skipped2.length} skipped`) : null,
7813
- todo.length ? c.gray(`${todo.length} todo`) : null
7814
- ].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
7815
- }
7816
- function getStateSymbol(task) {
7817
- var _a;
7818
- if (task.mode === "skip" || task.mode === "todo")
7819
- return skipped;
7820
- if (!task.result)
7821
- return c.gray("\xB7");
7822
- if (task.result.state === "run") {
7823
- if (task.type === "suite")
7824
- return pointer;
7825
- let spinner = spinnerMap.get(task);
7826
- if (!spinner) {
7827
- spinner = elegantSpinner();
7828
- spinnerMap.set(task, spinner);
7829
- }
7830
- return c.yellow(spinner());
7831
- }
7832
- if (task.result.state === "pass") {
7833
- return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? c.green(F_DOT) : c.green(F_CHECK);
7834
- }
7835
- if (task.result.state === "fail") {
7836
- return task.type === "suite" ? pointer : c.red(F_CROSS);
7837
- }
7838
- return " ";
7839
- }
7840
- function getHookStateSymbol(task, hookName) {
7841
- var _a, _b;
7842
- const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
7843
- if (state && state === "run") {
7844
- let spinnerMap2 = hookSpinnerMap.get(task);
7845
- if (!spinnerMap2) {
7846
- spinnerMap2 = /* @__PURE__ */ new Map();
7847
- hookSpinnerMap.set(task, spinnerMap2);
7848
- }
7849
- let spinner = spinnerMap2.get(hookName);
7850
- if (!spinner) {
7851
- spinner = elegantSpinner();
7852
- spinnerMap2.set(hookName, spinner);
7853
- }
7854
- return c.yellow(spinner());
7855
- }
7856
- }
7857
- const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
7858
- function elegantSpinner() {
7859
- let index = 0;
7860
- return () => {
7861
- index = ++index % spinnerFrames.length;
7862
- return spinnerFrames[index];
7863
- };
7864
- }
7865
- function formatTimeString(date) {
7866
- return date.toTimeString().split(" ")[0];
7867
- }
7868
- function formatProjectName(name, suffix = " ") {
7869
- if (!name)
7870
- return "";
7871
- const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
7872
- const colors = [
7873
- c.blue,
7874
- c.yellow,
7875
- c.cyan,
7876
- c.green,
7877
- c.magenta
7878
- ];
7879
- return colors[index % colors.length](`|${name}|`) + suffix;
7880
- }
7881
-
7882
- var _a;
7883
- const BADGE_PADDING = " ";
7884
- const HELP_HINT = `${c.dim("press ")}${c.bold("h")}${c.dim(" to show help")}`;
7885
- const HELP_UPDATE_SNAP = c.dim("press ") + c.bold(c.yellow("u")) + c.dim(" to update snapshot");
7886
- const HELP_QUITE = `${c.dim("press ")}${c.bold("q")}${c.dim(" to quit")}`;
7887
- const WAIT_FOR_CHANGE_PASS = `
7888
- ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")}`;
7889
- const WAIT_FOR_CHANGE_FAIL = `
7890
- ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(" Tests failed. Watching for file changes...")}`;
7891
- const WAIT_FOR_CHANGE_CANCELLED = `
7892
- ${c.bold(c.inverse(c.red(" CANCELLED ")))}${c.red(" Test run cancelled. Watching for file changes...")}`;
7893
- const LAST_RUN_LOG_TIMEOUT = 1500;
7894
- class BaseReporter {
7895
- start = 0;
7896
- end = 0;
7897
- watchFilters;
7898
- isTTY = isNode && ((_a = process.stdout) == null ? void 0 : _a.isTTY) && !isCI;
7899
- ctx = void 0;
7900
- _filesInWatchMode = /* @__PURE__ */ new Map();
7901
- _lastRunTimeout = 0;
7902
- _lastRunTimer;
7903
- _lastRunCount = 0;
7904
- _timeStart = /* @__PURE__ */ new Date();
7905
- constructor() {
7906
- this.registerUnhandledRejection();
7907
- }
7908
- get mode() {
7909
- return this.ctx.config.mode;
7910
- }
7911
- onInit(ctx) {
7912
- this.ctx = ctx;
7913
- ctx.logger.printBanner();
7914
- this.start = performance.now();
7915
- }
7916
- relative(path) {
7917
- return relativePath(this.ctx.config.root, path);
7918
- }
7919
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
7920
- this.end = performance.now();
7921
- await this.reportSummary(files, errors);
7922
- if (errors.length) {
7923
- if (!this.ctx.config.dangerouslyIgnoreUnhandledErrors)
7924
- process.exitCode = 1;
7925
- }
7926
- }
7927
- onTaskUpdate(packs) {
7928
- var _a2, _b, _c, _d;
7929
- if (this.isTTY)
7930
- return;
7931
- const logger = this.ctx.logger;
7932
- for (const pack of packs) {
7933
- const task = this.ctx.state.idMap.get(pack[0]);
7934
- if (task && "filepath" in task && ((_a2 = task.result) == null ? void 0 : _a2.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
7935
- const tests = getTests(task);
7936
- const failed = tests.filter((t) => {
7937
- var _a3;
7938
- return ((_a3 = t.result) == null ? void 0 : _a3.state) === "fail";
7939
- });
7940
- const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
7941
- let state = c.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
7942
- if (failed.length)
7943
- state += ` ${c.dim("|")} ${c.red(`${failed.length} failed`)}`;
7944
- if (skipped.length)
7945
- state += ` ${c.dim("|")} ${c.yellow(`${skipped.length} skipped`)}`;
7946
- let suffix = c.dim(" (") + state + c.dim(")");
7947
- if (task.result.duration) {
7948
- const color = task.result.duration > this.ctx.config.slowTestThreshold ? c.yellow : c.gray;
7949
- suffix += color(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
7950
- }
7951
- if (this.ctx.config.logHeapUsage && task.result.heap != null)
7952
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
7953
- let title = ` ${getStateSymbol(task)} `;
7954
- if (task.projectName)
7955
- title += formatProjectName(task.projectName);
7956
- title += `${task.name} ${suffix}`;
7957
- logger.log(title);
7958
- for (const test of failed) {
7959
- logger.log(c.red(` ${pointer} ${getFullName(test, c.dim(" > "))}`));
7960
- (_d = (_c = test.result) == null ? void 0 : _c.errors) == null ? void 0 : _d.forEach((e) => {
7961
- logger.log(c.red(` ${F_RIGHT} ${e == null ? void 0 : e.message}`));
7962
- });
7963
- }
7964
- }
7965
- }
7966
- }
7967
- async onWatcherStart(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
7968
- this.resetLastRunLog();
7969
- const failed = errors.length > 0 || hasFailed(files);
7970
- const failedSnap = hasFailedSnapshot(files);
7971
- const cancelled = this.ctx.isCancelling;
7972
- if (failed)
7973
- this.ctx.logger.log(WAIT_FOR_CHANGE_FAIL);
7974
- else if (cancelled)
7975
- this.ctx.logger.log(WAIT_FOR_CHANGE_CANCELLED);
7976
- else
7977
- this.ctx.logger.log(WAIT_FOR_CHANGE_PASS);
7978
- const hints = [];
7979
- if (this.mode !== "typecheck")
7980
- hints.push(HELP_HINT);
7981
- if (failedSnap)
7982
- hints.unshift(HELP_UPDATE_SNAP);
7983
- else
7984
- hints.push(HELP_QUITE);
7985
- this.ctx.logger.log(BADGE_PADDING + hints.join(c.dim(", ")));
7986
- if (this._lastRunCount) {
7987
- const LAST_RUN_TEXT = `rerun x${this._lastRunCount}`;
7988
- const LAST_RUN_TEXTS = [
7989
- c.blue(LAST_RUN_TEXT),
7990
- c.gray(LAST_RUN_TEXT),
7991
- c.dim(c.gray(LAST_RUN_TEXT))
7992
- ];
7993
- this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[0]);
7994
- this._lastRunTimeout = 0;
7995
- const { setInterval } = getSafeTimers();
7996
- this._lastRunTimer = setInterval(
7997
- () => {
7998
- this._lastRunTimeout += 1;
7999
- if (this._lastRunTimeout >= LAST_RUN_TEXTS.length)
8000
- this.resetLastRunLog();
8001
- else
8002
- this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[this._lastRunTimeout]);
8003
- },
8004
- LAST_RUN_LOG_TIMEOUT / LAST_RUN_TEXTS.length
8005
- );
8006
- }
8007
- }
8008
- resetLastRunLog() {
8009
- const { clearInterval } = getSafeTimers();
8010
- clearInterval(this._lastRunTimer);
8011
- this._lastRunTimer = void 0;
8012
- this.ctx.logger.logUpdate.clear();
8013
- }
8014
- async onWatcherRerun(files, trigger) {
8015
- this.resetLastRunLog();
8016
- this.watchFilters = files;
8017
- files.forEach((filepath) => {
8018
- let reruns = this._filesInWatchMode.get(filepath) ?? 0;
8019
- this._filesInWatchMode.set(filepath, ++reruns);
8020
- });
8021
- const BADGE = c.inverse(c.bold(c.blue(" RERUN ")));
8022
- const TRIGGER = trigger ? c.dim(` ${this.relative(trigger)}`) : "";
8023
- const FILENAME_PATTERN = this.ctx.filenamePattern ? `${BADGE_PADDING} ${c.dim("Filename pattern: ")}${c.blue(this.ctx.filenamePattern)}
8024
- ` : "";
8025
- const TESTNAME_PATTERN = this.ctx.configOverride.testNamePattern ? `${BADGE_PADDING} ${c.dim("Test name pattern: ")}${c.blue(String(this.ctx.configOverride.testNamePattern))}
8026
- ` : "";
8027
- if (files.length > 1) {
8028
- this.ctx.logger.clearFullScreen(`
8029
- ${BADGE}${TRIGGER}
8030
- ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
8031
- this._lastRunCount = 0;
8032
- } else if (files.length === 1) {
8033
- const rerun = this._filesInWatchMode.get(files[0]) ?? 1;
8034
- this._lastRunCount = rerun;
8035
- this.ctx.logger.clearFullScreen(`
8036
- ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
8037
- ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
8038
- }
8039
- this._timeStart = /* @__PURE__ */ new Date();
8040
- this.start = performance.now();
8041
- }
8042
- onUserConsoleLog(log) {
8043
- if (!this.shouldLog(log))
8044
- return;
8045
- const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
8046
- const header = c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : "unknown test"}`));
8047
- process[log.type].write(`${header}
8048
- ${log.content}
8049
- `);
8050
- }
8051
- shouldLog(log) {
8052
- var _a2, _b;
8053
- if (this.ctx.config.silent)
8054
- return false;
8055
- const shouldLog = (_b = (_a2 = this.ctx.config).onConsoleLog) == null ? void 0 : _b.call(_a2, log.content, log.type);
8056
- if (shouldLog === false)
8057
- return shouldLog;
8058
- return true;
8059
- }
8060
- onServerRestart(reason) {
8061
- this.ctx.logger.log(c.bold(c.magenta(
8062
- reason === "config" ? "\nRestarting due to config changes..." : "\nRestarting Vitest..."
8063
- )));
8064
- }
8065
- async reportSummary(files, errors) {
8066
- await this.printErrorsSummary(files, errors);
8067
- if (this.mode === "benchmark")
8068
- await this.reportBenchmarkSummary(files);
8069
- else
8070
- await this.reportTestSummary(files, errors);
8071
- }
8072
- async reportTestSummary(files, errors) {
8073
- const tests = getTests(files);
8074
- const logger = this.ctx.logger;
8075
- const executionTime = this.end - this.start;
8076
- const collectTime = files.reduce((acc, test) => acc + Math.max(0, test.collectDuration || 0), 0);
8077
- const setupTime = files.reduce((acc, test) => acc + Math.max(0, test.setupDuration || 0), 0);
8078
- const testsTime = files.reduce((acc, test) => {
8079
- var _a2;
8080
- return acc + Math.max(0, ((_a2 = test.result) == null ? void 0 : _a2.duration) || 0);
8081
- }, 0);
8082
- const transformTime = this.ctx.projects.flatMap((w) => Array.from(w.vitenode.fetchCache.values()).map((i) => i.duration || 0)).reduce((a, b) => a + b, 0);
8083
- const environmentTime = files.reduce((acc, file) => acc + Math.max(0, file.environmentLoad || 0), 0);
8084
- const prepareTime = files.reduce((acc, file) => acc + Math.max(0, file.prepareDuration || 0), 0);
8085
- const threadTime = collectTime + testsTime + setupTime;
8086
- const padTitle = (str) => c.dim(`${str.padStart(11)} `);
8087
- const time = (time2) => {
8088
- if (time2 > 1e3)
8089
- return `${(time2 / 1e3).toFixed(2)}s`;
8090
- return `${Math.round(time2)}ms`;
8091
- };
8092
- const snapshotOutput = renderSnapshotSummary(this.ctx.config.root, this.ctx.snapshot.summary);
8093
- if (snapshotOutput.length) {
8094
- logger.log(snapshotOutput.map(
8095
- (t, i) => i === 0 ? `${padTitle("Snapshots")} ${t}` : `${padTitle("")} ${t}`
8096
- ).join("\n"));
8097
- if (snapshotOutput.length > 1)
8098
- logger.log();
8099
- }
8100
- logger.log(padTitle("Test Files"), getStateString(files));
8101
- logger.log(padTitle("Tests"), getStateString(tests));
8102
- if (this.mode === "typecheck") {
8103
- const failed = tests.filter((t) => {
8104
- var _a2, _b, _c;
8105
- return ((_a2 = t.meta) == null ? void 0 : _a2.typecheck) && ((_c = (_b = t.result) == null ? void 0 : _b.errors) == null ? void 0 : _c.length);
8106
- });
8107
- logger.log(padTitle("Type Errors"), failed.length ? c.bold(c.red(`${failed.length} failed`)) : c.dim("no errors"));
8108
- }
8109
- if (errors.length)
8110
- logger.log(padTitle("Errors"), c.bold(c.red(`${errors.length} error${errors.length > 1 ? "s" : ""}`)));
8111
- logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
8112
- if (this.watchFilters)
8113
- logger.log(padTitle("Duration"), time(threadTime));
8114
- else if (this.mode === "typecheck")
8115
- logger.log(padTitle("Duration"), time(executionTime));
8116
- else
8117
- logger.log(padTitle("Duration"), time(executionTime) + c.dim(` (transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)}, environment ${time(environmentTime)}, prepare ${time(prepareTime)})`));
8118
- logger.log();
8119
- }
8120
- async printErrorsSummary(files, errors) {
8121
- const logger = this.ctx.logger;
8122
- const suites = getSuites(files);
8123
- const tests = getTests(files);
8124
- const failedSuites = suites.filter((i) => {
8125
- var _a2;
8126
- return (_a2 = i.result) == null ? void 0 : _a2.errors;
8127
- });
8128
- const failedTests = tests.filter((i) => {
8129
- var _a2;
8130
- return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
8131
- });
8132
- const failedTotal = countTestErrors(failedSuites) + countTestErrors(failedTests);
8133
- let current = 1;
8134
- const errorDivider = () => logger.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
8135
- `);
8136
- if (failedSuites.length) {
8137
- logger.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
8138
- logger.error();
8139
- await this.printTaskErrors(failedSuites, errorDivider);
8140
- }
8141
- if (failedTests.length) {
8142
- logger.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
8143
- logger.error();
8144
- await this.printTaskErrors(failedTests, errorDivider);
8145
- }
8146
- if (errors.length) {
8147
- await logger.printUnhandledErrors(errors);
8148
- logger.error();
8149
- }
8150
- return tests;
8151
- }
8152
- async reportBenchmarkSummary(files) {
8153
- const logger = this.ctx.logger;
8154
- const benches = getTests(files);
8155
- const topBenches = benches.filter((i) => {
8156
- var _a2, _b;
8157
- return ((_b = (_a2 = i.result) == null ? void 0 : _a2.benchmark) == null ? void 0 : _b.rank) === 1;
8158
- });
8159
- logger.log(`
8160
- ${c.cyan(c.inverse(c.bold(" BENCH ")))} ${c.cyan("Summary")}
8161
- `);
8162
- for (const bench of topBenches) {
8163
- const group = bench.suite;
8164
- if (!group)
8165
- continue;
8166
- const groupName = getFullName(group, c.dim(" > "));
8167
- logger.log(` ${bench.name}${c.dim(` - ${groupName}`)}`);
8168
- const siblings = group.tasks.filter((i) => {
8169
- var _a2;
8170
- return ((_a2 = i.result) == null ? void 0 : _a2.benchmark) && i !== bench;
8171
- }).sort((a, b) => a.result.benchmark.rank - b.result.benchmark.rank);
8172
- for (const sibling of siblings) {
8173
- const number = `${(sibling.result.benchmark.mean / bench.result.benchmark.mean).toFixed(2)}x`;
8174
- logger.log(` ${c.green(number)} ${c.gray("faster than")} ${sibling.name}`);
8175
- }
8176
- logger.log("");
8177
- }
8178
- }
8179
- async printTaskErrors(tasks, errorDivider) {
8180
- var _a2, _b, _c;
8181
- const errorsQueue = [];
8182
- for (const task of tasks) {
8183
- (_b = (_a2 = task.result) == null ? void 0 : _a2.errors) == null ? void 0 : _b.forEach((error) => {
8184
- const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
8185
- var _a3, _b2, _c2, _d;
8186
- const hasStr = ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
8187
- if (!hasStr)
8188
- return false;
8189
- const currentProjectName = (task == null ? void 0 : task.projectName) || ((_b2 = task.file) == null ? void 0 : _b2.projectName);
8190
- const projectName = ((_c2 = i[1][0]) == null ? void 0 : _c2.projectName) || ((_d = i[1][0].file) == null ? void 0 : _d.projectName);
8191
- return projectName === currentProjectName;
8192
- });
8193
- if (errorItem)
8194
- errorItem[1].push(task);
8195
- else
8196
- errorsQueue.push([error, [task]]);
8197
- });
8198
- }
8199
- for (const [error, tasks2] of errorsQueue) {
8200
- for (const task of tasks2) {
8201
- const filepath = (task == null ? void 0 : task.filepath) || "";
8202
- const projectName = (task == null ? void 0 : task.projectName) || ((_c = task.file) == null ? void 0 : _c.projectName);
8203
- let name = getFullName(task, c.dim(" > "));
8204
- if (filepath)
8205
- name = `${name} ${c.dim(`[ ${this.relative(filepath)} ]`)}`;
8206
- this.ctx.logger.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${formatProjectName(projectName)}${name}`);
8207
- }
8208
- const project = this.ctx.getProjectByTaskId(tasks2[0].id);
8209
- await this.ctx.logger.printError(error, { project });
8210
- errorDivider();
8211
- await Promise.resolve();
8212
- }
8213
- }
8214
- registerUnhandledRejection() {
8215
- process.on("unhandledRejection", async (err) => {
8216
- process.exitCode = 1;
8217
- await this.ctx.logger.printError(err, { fullStack: true, type: "Unhandled Rejection" });
8218
- this.ctx.logger.error("\n\n");
8219
- process.exit(1);
8220
- });
8221
- }
8222
- }
8223
-
8224
- class BasicReporter extends BaseReporter {
8225
- isTTY = false;
8226
- reportSummary(files, errors) {
8227
- this.ctx.logger.log();
8228
- return super.reportSummary(files, errors);
8229
- }
8230
- }
8231
-
8232
- /* eslint-disable yoda */
8233
-
8234
- function isFullwidthCodePoint(codePoint) {
8235
- if (!Number.isInteger(codePoint)) {
8236
- return false;
8237
- }
8238
-
8239
- // Code points are derived from:
8240
- // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
8241
- return codePoint >= 0x1100 && (
8242
- codePoint <= 0x115F || // Hangul Jamo
8243
- codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
8244
- codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
8245
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
8246
- (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
8247
- // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
8248
- (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
8249
- // CJK Unified Ideographs .. Yi Radicals
8250
- (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
8251
- // Hangul Jamo Extended-A
8252
- (0xA960 <= codePoint && codePoint <= 0xA97C) ||
8253
- // Hangul Syllables
8254
- (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
8255
- // CJK Compatibility Ideographs
8256
- (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
8257
- // Vertical Forms
8258
- (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
8259
- // CJK Compatibility Forms .. Small Form Variants
8260
- (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
8261
- // Halfwidth and Fullwidth Forms
8262
- (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
8263
- (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
8264
- // Kana Supplement
8265
- (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
8266
- // Enclosed Ideographic Supplement
8267
- (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
8268
- // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
8269
- (0x20000 <= codePoint && codePoint <= 0x3FFFD)
8270
- );
8271
- }
8272
-
8273
- const ANSI_BACKGROUND_OFFSET = 10;
8274
-
8275
- const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
8276
-
8277
- const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
8278
-
8279
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
8280
-
8281
- const styles = {
8282
- modifier: {
8283
- reset: [0, 0],
8284
- // 21 isn't widely supported and 22 does the same thing
8285
- bold: [1, 22],
8286
- dim: [2, 22],
8287
- italic: [3, 23],
8288
- underline: [4, 24],
8289
- overline: [53, 55],
8290
- inverse: [7, 27],
8291
- hidden: [8, 28],
8292
- strikethrough: [9, 29],
8293
- },
8294
- color: {
8295
- black: [30, 39],
8296
- red: [31, 39],
8297
- green: [32, 39],
8298
- yellow: [33, 39],
8299
- blue: [34, 39],
8300
- magenta: [35, 39],
8301
- cyan: [36, 39],
8302
- white: [37, 39],
8303
-
8304
- // Bright color
8305
- blackBright: [90, 39],
8306
- gray: [90, 39], // Alias of `blackBright`
8307
- grey: [90, 39], // Alias of `blackBright`
8308
- redBright: [91, 39],
8309
- greenBright: [92, 39],
8310
- yellowBright: [93, 39],
8311
- blueBright: [94, 39],
8312
- magentaBright: [95, 39],
8313
- cyanBright: [96, 39],
8314
- whiteBright: [97, 39],
8315
- },
8316
- bgColor: {
8317
- bgBlack: [40, 49],
8318
- bgRed: [41, 49],
8319
- bgGreen: [42, 49],
8320
- bgYellow: [43, 49],
8321
- bgBlue: [44, 49],
8322
- bgMagenta: [45, 49],
8323
- bgCyan: [46, 49],
8324
- bgWhite: [47, 49],
8325
-
8326
- // Bright color
8327
- bgBlackBright: [100, 49],
8328
- bgGray: [100, 49], // Alias of `bgBlackBright`
8329
- bgGrey: [100, 49], // Alias of `bgBlackBright`
8330
- bgRedBright: [101, 49],
8331
- bgGreenBright: [102, 49],
8332
- bgYellowBright: [103, 49],
8333
- bgBlueBright: [104, 49],
8334
- bgMagentaBright: [105, 49],
8335
- bgCyanBright: [106, 49],
8336
- bgWhiteBright: [107, 49],
8337
- },
8338
- };
8339
-
8340
- Object.keys(styles.modifier);
8341
- const foregroundColorNames = Object.keys(styles.color);
8342
- const backgroundColorNames = Object.keys(styles.bgColor);
8343
- [...foregroundColorNames, ...backgroundColorNames];
8344
-
8345
- function assembleStyles() {
8346
- const codes = new Map();
8347
-
8348
- for (const [groupName, group] of Object.entries(styles)) {
8349
- for (const [styleName, style] of Object.entries(group)) {
8350
- styles[styleName] = {
8351
- open: `\u001B[${style[0]}m`,
8352
- close: `\u001B[${style[1]}m`,
8353
- };
8354
-
8355
- group[styleName] = styles[styleName];
8356
-
8357
- codes.set(style[0], style[1]);
8358
- }
8359
-
8360
- Object.defineProperty(styles, groupName, {
8361
- value: group,
8362
- enumerable: false,
8363
- });
8364
- }
8365
-
8366
- Object.defineProperty(styles, 'codes', {
8367
- value: codes,
8368
- enumerable: false,
8369
- });
8370
-
8371
- styles.color.close = '\u001B[39m';
8372
- styles.bgColor.close = '\u001B[49m';
8373
-
8374
- styles.color.ansi = wrapAnsi16();
8375
- styles.color.ansi256 = wrapAnsi256();
8376
- styles.color.ansi16m = wrapAnsi16m();
8377
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
8378
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
8379
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
8380
-
8381
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
8382
- Object.defineProperties(styles, {
8383
- rgbToAnsi256: {
8384
- value: (red, green, blue) => {
8385
- // We use the extended greyscale palette here, with the exception of
8386
- // black and white. normal palette only has 4 greyscale shades.
8387
- if (red === green && green === blue) {
8388
- if (red < 8) {
8389
- return 16;
8390
- }
8391
-
8392
- if (red > 248) {
8393
- return 231;
8394
- }
8395
-
8396
- return Math.round(((red - 8) / 247) * 24) + 232;
8397
- }
8398
-
8399
- return 16
8400
- + (36 * Math.round(red / 255 * 5))
8401
- + (6 * Math.round(green / 255 * 5))
8402
- + Math.round(blue / 255 * 5);
8403
- },
8404
- enumerable: false,
8405
- },
8406
- hexToRgb: {
8407
- value: hex => {
8408
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
8409
- if (!matches) {
8410
- return [0, 0, 0];
8411
- }
8412
-
8413
- let [colorString] = matches;
8414
-
8415
- if (colorString.length === 3) {
8416
- colorString = [...colorString].map(character => character + character).join('');
8417
- }
8418
-
8419
- const integer = Number.parseInt(colorString, 16);
8420
-
8421
- return [
8422
- /* eslint-disable no-bitwise */
8423
- (integer >> 16) & 0xFF,
8424
- (integer >> 8) & 0xFF,
8425
- integer & 0xFF,
8426
- /* eslint-enable no-bitwise */
8427
- ];
8428
- },
8429
- enumerable: false,
8430
- },
8431
- hexToAnsi256: {
8432
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
8433
- enumerable: false,
8434
- },
8435
- ansi256ToAnsi: {
8436
- value: code => {
8437
- if (code < 8) {
8438
- return 30 + code;
8439
- }
8440
-
8441
- if (code < 16) {
8442
- return 90 + (code - 8);
8443
- }
8444
-
8445
- let red;
8446
- let green;
8447
- let blue;
8448
-
8449
- if (code >= 232) {
8450
- red = (((code - 232) * 10) + 8) / 255;
8451
- green = red;
8452
- blue = red;
8453
- } else {
8454
- code -= 16;
8455
-
8456
- const remainder = code % 36;
8457
-
8458
- red = Math.floor(code / 36) / 5;
8459
- green = Math.floor(remainder / 6) / 5;
8460
- blue = (remainder % 6) / 5;
8461
- }
8462
-
8463
- const value = Math.max(red, green, blue) * 2;
8464
-
8465
- if (value === 0) {
8466
- return 30;
8467
- }
8468
-
8469
- // eslint-disable-next-line no-bitwise
8470
- let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
8471
-
8472
- if (value === 2) {
8473
- result += 60;
8474
- }
8475
-
8476
- return result;
8477
- },
8478
- enumerable: false,
8479
- },
8480
- rgbToAnsi: {
8481
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
8482
- enumerable: false,
8483
- },
8484
- hexToAnsi: {
8485
- value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
8486
- enumerable: false,
8487
- },
8488
- });
8489
-
8490
- return styles;
8491
- }
8492
-
8493
- const ansiStyles = assembleStyles();
8494
-
8495
- const astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
8496
-
8497
- const ESCAPES$1 = [
8498
- '\u001B',
8499
- '\u009B'
8500
- ];
8501
-
8502
- const wrapAnsi$1 = code => `${ESCAPES$1[0]}[${code}m`;
8503
-
8504
- const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
8505
- let output = [];
8506
- ansiCodes = [...ansiCodes];
8507
-
8508
- for (let ansiCode of ansiCodes) {
8509
- const ansiCodeOrigin = ansiCode;
8510
- if (ansiCode.includes(';')) {
8511
- ansiCode = ansiCode.split(';')[0][0] + '0';
8512
- }
8513
-
8514
- const item = ansiStyles.codes.get(Number.parseInt(ansiCode, 10));
8515
- if (item) {
8516
- const indexEscape = ansiCodes.indexOf(item.toString());
8517
- if (indexEscape === -1) {
8518
- output.push(wrapAnsi$1(isEscapes ? item : ansiCodeOrigin));
8519
- } else {
8520
- ansiCodes.splice(indexEscape, 1);
8521
- }
8522
- } else if (isEscapes) {
8523
- output.push(wrapAnsi$1(0));
8524
- break;
8525
- } else {
8526
- output.push(wrapAnsi$1(ansiCodeOrigin));
8527
- }
8528
- }
8529
-
8530
- if (isEscapes) {
8531
- output = output.filter((element, index) => output.indexOf(element) === index);
8532
-
8533
- if (endAnsiCode !== undefined) {
8534
- const fistEscapeCode = wrapAnsi$1(ansiStyles.codes.get(Number.parseInt(endAnsiCode, 10)));
8535
- // TODO: Remove the use of `.reduce` here.
8536
- // eslint-disable-next-line unicorn/no-array-reduce
8537
- output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
8538
- }
8539
- }
8540
-
8541
- return output.join('');
8542
- };
8543
-
8544
- function sliceAnsi(string, begin, end) {
8545
- const characters = [...string];
8546
- const ansiCodes = [];
8547
-
8548
- let stringEnd = typeof end === 'number' ? end : characters.length;
8549
- let isInsideEscape = false;
8550
- let ansiCode;
8551
- let visible = 0;
8552
- let output = '';
8553
-
8554
- for (const [index, character] of characters.entries()) {
8555
- let leftEscape = false;
8556
-
8557
- if (ESCAPES$1.includes(character)) {
8558
- const code = /\d[^m]*/.exec(string.slice(index, index + 18));
8559
- ansiCode = code && code.length > 0 ? code[0] : undefined;
8560
-
8561
- if (visible < stringEnd) {
8562
- isInsideEscape = true;
8563
-
8564
- if (ansiCode !== undefined) {
8565
- ansiCodes.push(ansiCode);
8566
- }
8567
- }
8568
- } else if (isInsideEscape && character === 'm') {
8569
- isInsideEscape = false;
8570
- leftEscape = true;
8571
- }
8572
-
8573
- if (!isInsideEscape && !leftEscape) {
8574
- visible++;
8575
- }
8576
-
8577
- if (!astralRegex.test(character) && isFullwidthCodePoint(character.codePointAt())) {
8578
- visible++;
8579
-
8580
- if (typeof end !== 'number') {
8581
- stringEnd++;
8582
- }
8583
- }
8584
-
8585
- if (visible > begin && visible <= stringEnd) {
8586
- output += character;
8587
- } else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
8588
- output = checkAnsi(ansiCodes);
8589
- } else if (visible >= stringEnd) {
8590
- output += checkAnsi(ansiCodes, true, ansiCode);
8591
- break;
8592
- }
8593
- }
8594
-
8595
- return output;
8596
- }
8597
-
8598
- var eastasianwidth = {exports: {}};
8599
-
8600
- (function (module) {
8601
- var eaw = {};
8602
-
8603
- {
8604
- module.exports = eaw;
8605
- }
8606
-
8607
- eaw.eastAsianWidth = function(character) {
8608
- var x = character.charCodeAt(0);
8609
- var y = (character.length == 2) ? character.charCodeAt(1) : 0;
8610
- var codePoint = x;
8611
- if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
8612
- x &= 0x3FF;
8613
- y &= 0x3FF;
8614
- codePoint = (x << 10) | y;
8615
- codePoint += 0x10000;
8616
- }
8617
-
8618
- if ((0x3000 == codePoint) ||
8619
- (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
8620
- (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
8621
- return 'F';
8622
- }
8623
- if ((0x20A9 == codePoint) ||
8624
- (0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
8625
- (0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
8626
- (0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
8627
- (0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
8628
- (0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
8629
- (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
8630
- return 'H';
8631
- }
8632
- if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
8633
- (0x11A3 <= codePoint && codePoint <= 0x11A7) ||
8634
- (0x11FA <= codePoint && codePoint <= 0x11FF) ||
8635
- (0x2329 <= codePoint && codePoint <= 0x232A) ||
8636
- (0x2E80 <= codePoint && codePoint <= 0x2E99) ||
8637
- (0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
8638
- (0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
8639
- (0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
8640
- (0x3001 <= codePoint && codePoint <= 0x303E) ||
8641
- (0x3041 <= codePoint && codePoint <= 0x3096) ||
8642
- (0x3099 <= codePoint && codePoint <= 0x30FF) ||
8643
- (0x3105 <= codePoint && codePoint <= 0x312D) ||
8644
- (0x3131 <= codePoint && codePoint <= 0x318E) ||
8645
- (0x3190 <= codePoint && codePoint <= 0x31BA) ||
8646
- (0x31C0 <= codePoint && codePoint <= 0x31E3) ||
8647
- (0x31F0 <= codePoint && codePoint <= 0x321E) ||
8648
- (0x3220 <= codePoint && codePoint <= 0x3247) ||
8649
- (0x3250 <= codePoint && codePoint <= 0x32FE) ||
8650
- (0x3300 <= codePoint && codePoint <= 0x4DBF) ||
8651
- (0x4E00 <= codePoint && codePoint <= 0xA48C) ||
8652
- (0xA490 <= codePoint && codePoint <= 0xA4C6) ||
8653
- (0xA960 <= codePoint && codePoint <= 0xA97C) ||
8654
- (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
8655
- (0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
8656
- (0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
8657
- (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
8658
- (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
8659
- (0xFE30 <= codePoint && codePoint <= 0xFE52) ||
8660
- (0xFE54 <= codePoint && codePoint <= 0xFE66) ||
8661
- (0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
8662
- (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
8663
- (0x1F200 <= codePoint && codePoint <= 0x1F202) ||
8664
- (0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
8665
- (0x1F240 <= codePoint && codePoint <= 0x1F248) ||
8666
- (0x1F250 <= codePoint && codePoint <= 0x1F251) ||
8667
- (0x20000 <= codePoint && codePoint <= 0x2F73F) ||
8668
- (0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
8669
- (0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
8670
- return 'W';
8671
- }
8672
- if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
8673
- (0x00A2 <= codePoint && codePoint <= 0x00A3) ||
8674
- (0x00A5 <= codePoint && codePoint <= 0x00A6) ||
8675
- (0x00AC == codePoint) ||
8676
- (0x00AF == codePoint) ||
8677
- (0x27E6 <= codePoint && codePoint <= 0x27ED) ||
8678
- (0x2985 <= codePoint && codePoint <= 0x2986)) {
8679
- return 'Na';
8680
- }
8681
- if ((0x00A1 == codePoint) ||
8682
- (0x00A4 == codePoint) ||
8683
- (0x00A7 <= codePoint && codePoint <= 0x00A8) ||
8684
- (0x00AA == codePoint) ||
8685
- (0x00AD <= codePoint && codePoint <= 0x00AE) ||
8686
- (0x00B0 <= codePoint && codePoint <= 0x00B4) ||
8687
- (0x00B6 <= codePoint && codePoint <= 0x00BA) ||
8688
- (0x00BC <= codePoint && codePoint <= 0x00BF) ||
8689
- (0x00C6 == codePoint) ||
8690
- (0x00D0 == codePoint) ||
8691
- (0x00D7 <= codePoint && codePoint <= 0x00D8) ||
8692
- (0x00DE <= codePoint && codePoint <= 0x00E1) ||
8693
- (0x00E6 == codePoint) ||
8694
- (0x00E8 <= codePoint && codePoint <= 0x00EA) ||
8695
- (0x00EC <= codePoint && codePoint <= 0x00ED) ||
8696
- (0x00F0 == codePoint) ||
8697
- (0x00F2 <= codePoint && codePoint <= 0x00F3) ||
8698
- (0x00F7 <= codePoint && codePoint <= 0x00FA) ||
8699
- (0x00FC == codePoint) ||
8700
- (0x00FE == codePoint) ||
8701
- (0x0101 == codePoint) ||
8702
- (0x0111 == codePoint) ||
8703
- (0x0113 == codePoint) ||
8704
- (0x011B == codePoint) ||
8705
- (0x0126 <= codePoint && codePoint <= 0x0127) ||
8706
- (0x012B == codePoint) ||
8707
- (0x0131 <= codePoint && codePoint <= 0x0133) ||
8708
- (0x0138 == codePoint) ||
8709
- (0x013F <= codePoint && codePoint <= 0x0142) ||
8710
- (0x0144 == codePoint) ||
8711
- (0x0148 <= codePoint && codePoint <= 0x014B) ||
8712
- (0x014D == codePoint) ||
8713
- (0x0152 <= codePoint && codePoint <= 0x0153) ||
8714
- (0x0166 <= codePoint && codePoint <= 0x0167) ||
8715
- (0x016B == codePoint) ||
8716
- (0x01CE == codePoint) ||
8717
- (0x01D0 == codePoint) ||
8718
- (0x01D2 == codePoint) ||
8719
- (0x01D4 == codePoint) ||
8720
- (0x01D6 == codePoint) ||
8721
- (0x01D8 == codePoint) ||
8722
- (0x01DA == codePoint) ||
8723
- (0x01DC == codePoint) ||
8724
- (0x0251 == codePoint) ||
8725
- (0x0261 == codePoint) ||
8726
- (0x02C4 == codePoint) ||
8727
- (0x02C7 == codePoint) ||
8728
- (0x02C9 <= codePoint && codePoint <= 0x02CB) ||
8729
- (0x02CD == codePoint) ||
8730
- (0x02D0 == codePoint) ||
8731
- (0x02D8 <= codePoint && codePoint <= 0x02DB) ||
8732
- (0x02DD == codePoint) ||
8733
- (0x02DF == codePoint) ||
8734
- (0x0300 <= codePoint && codePoint <= 0x036F) ||
8735
- (0x0391 <= codePoint && codePoint <= 0x03A1) ||
8736
- (0x03A3 <= codePoint && codePoint <= 0x03A9) ||
8737
- (0x03B1 <= codePoint && codePoint <= 0x03C1) ||
8738
- (0x03C3 <= codePoint && codePoint <= 0x03C9) ||
8739
- (0x0401 == codePoint) ||
8740
- (0x0410 <= codePoint && codePoint <= 0x044F) ||
8741
- (0x0451 == codePoint) ||
8742
- (0x2010 == codePoint) ||
8743
- (0x2013 <= codePoint && codePoint <= 0x2016) ||
8744
- (0x2018 <= codePoint && codePoint <= 0x2019) ||
8745
- (0x201C <= codePoint && codePoint <= 0x201D) ||
8746
- (0x2020 <= codePoint && codePoint <= 0x2022) ||
8747
- (0x2024 <= codePoint && codePoint <= 0x2027) ||
8748
- (0x2030 == codePoint) ||
8749
- (0x2032 <= codePoint && codePoint <= 0x2033) ||
8750
- (0x2035 == codePoint) ||
8751
- (0x203B == codePoint) ||
8752
- (0x203E == codePoint) ||
8753
- (0x2074 == codePoint) ||
8754
- (0x207F == codePoint) ||
8755
- (0x2081 <= codePoint && codePoint <= 0x2084) ||
8756
- (0x20AC == codePoint) ||
8757
- (0x2103 == codePoint) ||
8758
- (0x2105 == codePoint) ||
8759
- (0x2109 == codePoint) ||
8760
- (0x2113 == codePoint) ||
8761
- (0x2116 == codePoint) ||
8762
- (0x2121 <= codePoint && codePoint <= 0x2122) ||
8763
- (0x2126 == codePoint) ||
8764
- (0x212B == codePoint) ||
8765
- (0x2153 <= codePoint && codePoint <= 0x2154) ||
8766
- (0x215B <= codePoint && codePoint <= 0x215E) ||
8767
- (0x2160 <= codePoint && codePoint <= 0x216B) ||
8768
- (0x2170 <= codePoint && codePoint <= 0x2179) ||
8769
- (0x2189 == codePoint) ||
8770
- (0x2190 <= codePoint && codePoint <= 0x2199) ||
8771
- (0x21B8 <= codePoint && codePoint <= 0x21B9) ||
8772
- (0x21D2 == codePoint) ||
8773
- (0x21D4 == codePoint) ||
8774
- (0x21E7 == codePoint) ||
8775
- (0x2200 == codePoint) ||
8776
- (0x2202 <= codePoint && codePoint <= 0x2203) ||
8777
- (0x2207 <= codePoint && codePoint <= 0x2208) ||
8778
- (0x220B == codePoint) ||
8779
- (0x220F == codePoint) ||
8780
- (0x2211 == codePoint) ||
8781
- (0x2215 == codePoint) ||
8782
- (0x221A == codePoint) ||
8783
- (0x221D <= codePoint && codePoint <= 0x2220) ||
8784
- (0x2223 == codePoint) ||
8785
- (0x2225 == codePoint) ||
8786
- (0x2227 <= codePoint && codePoint <= 0x222C) ||
8787
- (0x222E == codePoint) ||
8788
- (0x2234 <= codePoint && codePoint <= 0x2237) ||
8789
- (0x223C <= codePoint && codePoint <= 0x223D) ||
8790
- (0x2248 == codePoint) ||
8791
- (0x224C == codePoint) ||
8792
- (0x2252 == codePoint) ||
8793
- (0x2260 <= codePoint && codePoint <= 0x2261) ||
8794
- (0x2264 <= codePoint && codePoint <= 0x2267) ||
8795
- (0x226A <= codePoint && codePoint <= 0x226B) ||
8796
- (0x226E <= codePoint && codePoint <= 0x226F) ||
8797
- (0x2282 <= codePoint && codePoint <= 0x2283) ||
8798
- (0x2286 <= codePoint && codePoint <= 0x2287) ||
8799
- (0x2295 == codePoint) ||
8800
- (0x2299 == codePoint) ||
8801
- (0x22A5 == codePoint) ||
8802
- (0x22BF == codePoint) ||
8803
- (0x2312 == codePoint) ||
8804
- (0x2460 <= codePoint && codePoint <= 0x24E9) ||
8805
- (0x24EB <= codePoint && codePoint <= 0x254B) ||
8806
- (0x2550 <= codePoint && codePoint <= 0x2573) ||
8807
- (0x2580 <= codePoint && codePoint <= 0x258F) ||
8808
- (0x2592 <= codePoint && codePoint <= 0x2595) ||
8809
- (0x25A0 <= codePoint && codePoint <= 0x25A1) ||
8810
- (0x25A3 <= codePoint && codePoint <= 0x25A9) ||
8811
- (0x25B2 <= codePoint && codePoint <= 0x25B3) ||
8812
- (0x25B6 <= codePoint && codePoint <= 0x25B7) ||
8813
- (0x25BC <= codePoint && codePoint <= 0x25BD) ||
8814
- (0x25C0 <= codePoint && codePoint <= 0x25C1) ||
8815
- (0x25C6 <= codePoint && codePoint <= 0x25C8) ||
8816
- (0x25CB == codePoint) ||
8817
- (0x25CE <= codePoint && codePoint <= 0x25D1) ||
8818
- (0x25E2 <= codePoint && codePoint <= 0x25E5) ||
8819
- (0x25EF == codePoint) ||
8820
- (0x2605 <= codePoint && codePoint <= 0x2606) ||
8821
- (0x2609 == codePoint) ||
8822
- (0x260E <= codePoint && codePoint <= 0x260F) ||
8823
- (0x2614 <= codePoint && codePoint <= 0x2615) ||
8824
- (0x261C == codePoint) ||
8825
- (0x261E == codePoint) ||
8826
- (0x2640 == codePoint) ||
8827
- (0x2642 == codePoint) ||
8828
- (0x2660 <= codePoint && codePoint <= 0x2661) ||
8829
- (0x2663 <= codePoint && codePoint <= 0x2665) ||
8830
- (0x2667 <= codePoint && codePoint <= 0x266A) ||
8831
- (0x266C <= codePoint && codePoint <= 0x266D) ||
8832
- (0x266F == codePoint) ||
8833
- (0x269E <= codePoint && codePoint <= 0x269F) ||
8834
- (0x26BE <= codePoint && codePoint <= 0x26BF) ||
8835
- (0x26C4 <= codePoint && codePoint <= 0x26CD) ||
8836
- (0x26CF <= codePoint && codePoint <= 0x26E1) ||
8837
- (0x26E3 == codePoint) ||
8838
- (0x26E8 <= codePoint && codePoint <= 0x26FF) ||
8839
- (0x273D == codePoint) ||
8840
- (0x2757 == codePoint) ||
8841
- (0x2776 <= codePoint && codePoint <= 0x277F) ||
8842
- (0x2B55 <= codePoint && codePoint <= 0x2B59) ||
8843
- (0x3248 <= codePoint && codePoint <= 0x324F) ||
8844
- (0xE000 <= codePoint && codePoint <= 0xF8FF) ||
8845
- (0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
8846
- (0xFFFD == codePoint) ||
8847
- (0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
8848
- (0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
8849
- (0x1F130 <= codePoint && codePoint <= 0x1F169) ||
8850
- (0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
8851
- (0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
8852
- (0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
8853
- (0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
8854
- return 'A';
8855
- }
8856
-
8857
- return 'N';
8858
- };
8859
-
8860
- eaw.characterLength = function(character) {
8861
- var code = this.eastAsianWidth(character);
8862
- if (code == 'F' || code == 'W' || code == 'A') {
8863
- return 2;
8864
- } else {
8865
- return 1;
8866
- }
8867
- };
8868
-
8869
- // Split a string considering surrogate-pairs.
8870
- function stringToArray(string) {
8871
- return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
8872
- }
8873
-
8874
- eaw.length = function(string) {
8875
- var characters = stringToArray(string);
8876
- var len = 0;
8877
- for (var i = 0; i < characters.length; i++) {
8878
- len = len + this.characterLength(characters[i]);
8879
- }
8880
- return len;
8881
- };
8882
-
8883
- eaw.slice = function(text, start, end) {
8884
- textLen = eaw.length(text);
8885
- start = start ? start : 0;
8886
- end = end ? end : 1;
8887
- if (start < 0) {
8888
- start = textLen + start;
8889
- }
8890
- if (end < 0) {
8891
- end = textLen + end;
8892
- }
8893
- var result = '';
8894
- var eawLen = 0;
8895
- var chars = stringToArray(text);
8896
- for (var i = 0; i < chars.length; i++) {
8897
- var char = chars[i];
8898
- var charLen = eaw.length(char);
8899
- if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
8900
- if (eawLen + charLen <= end) {
8901
- result += char;
8902
- } else {
8903
- break;
8904
- }
8905
- }
8906
- eawLen += charLen;
8907
- }
8908
- return result;
8909
- };
8910
- } (eastasianwidth));
8911
-
8912
- var eastasianwidthExports = eastasianwidth.exports;
8913
- var eastAsianWidth = /*@__PURE__*/getDefaultExportFromCjs(eastasianwidthExports);
8914
-
8915
- var emojiRegex = function () {
8916
- // https://mths.be/emoji
8917
- return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
8918
- };
8919
-
8920
- var emojiRegex$1 = /*@__PURE__*/getDefaultExportFromCjs(emojiRegex);
8921
-
8922
- function stringWidth(string, options = {}) {
8923
- if (typeof string !== 'string' || string.length === 0) {
8924
- return 0;
8925
- }
8926
-
8927
- options = {
8928
- ambiguousIsNarrow: true,
8929
- ...options
8930
- };
8931
-
8932
- string = stripAnsi(string);
8933
-
8934
- if (string.length === 0) {
8935
- return 0;
8936
- }
8937
-
8938
- string = string.replace(emojiRegex$1(), ' ');
8939
-
8940
- const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
8941
- let width = 0;
8942
-
8943
- for (const character of string) {
8944
- const codePoint = character.codePointAt(0);
8945
-
8946
- // Ignore control characters
8947
- if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
8948
- continue;
8949
- }
8950
-
8951
- // Ignore combining characters
8952
- if (codePoint >= 0x300 && codePoint <= 0x36F) {
8953
- continue;
8954
- }
8955
-
8956
- const code = eastAsianWidth.eastAsianWidth(character);
8957
- switch (code) {
8958
- case 'F':
8959
- case 'W':
8960
- width += 2;
8961
- break;
8962
- case 'A':
8963
- width += ambiguousCharacterWidth;
8964
- break;
8965
- default:
8966
- width += 1;
8967
- }
8968
- }
8969
-
8970
- return width;
8971
- }
8972
-
8973
- function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
8974
- if (string.charAt(wantedIndex) === ' ') {
8975
- return wantedIndex;
8976
- }
8977
-
8978
- for (let index = 1; index <= 3; index++) {
8979
- if (shouldSearchRight) {
8980
- if (string.charAt(wantedIndex + index) === ' ') {
8981
- return wantedIndex + index;
8982
- }
8983
- } else if (string.charAt(wantedIndex - index) === ' ') {
8984
- return wantedIndex - index;
8985
- }
8986
- }
8987
-
8988
- return wantedIndex;
8989
- }
8990
-
8991
- function cliTruncate(text, columns, options) {
8992
- options = {
8993
- position: 'end',
8994
- preferTruncationOnSpace: false,
8995
- truncationCharacter: '…',
8996
- ...options,
8997
- };
8998
-
8999
- const {position, space, preferTruncationOnSpace} = options;
9000
- let {truncationCharacter} = options;
9001
-
9002
- if (typeof text !== 'string') {
9003
- throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
9004
- }
9005
-
9006
- if (typeof columns !== 'number') {
9007
- throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
9008
- }
9009
-
9010
- if (columns < 1) {
9011
- return '';
9012
- }
9013
-
9014
- if (columns === 1) {
9015
- return truncationCharacter;
9016
- }
9017
-
9018
- const length = stringWidth(text);
9019
-
9020
- if (length <= columns) {
9021
- return text;
9022
- }
9023
-
9024
- if (position === 'start') {
9025
- if (preferTruncationOnSpace) {
9026
- const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
9027
- return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
9028
- }
9029
-
9030
- if (space === true) {
9031
- truncationCharacter += ' ';
9032
- }
9033
-
9034
- return truncationCharacter + sliceAnsi(text, length - columns + stringWidth(truncationCharacter), length);
9035
- }
9036
-
9037
- if (position === 'middle') {
9038
- if (space === true) {
9039
- truncationCharacter = ` ${truncationCharacter} `;
9040
- }
9041
-
9042
- const half = Math.floor(columns / 2);
9043
-
9044
- if (preferTruncationOnSpace) {
9045
- const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
9046
- const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
9047
- return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
9048
- }
9049
-
9050
- return (
9051
- sliceAnsi(text, 0, half)
9052
- + truncationCharacter
9053
- + sliceAnsi(text, length - (columns - half) + stringWidth(truncationCharacter), length)
9054
- );
9055
- }
9056
-
9057
- if (position === 'end') {
9058
- if (preferTruncationOnSpace) {
9059
- const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
9060
- return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
9061
- }
9062
-
9063
- if (space === true) {
9064
- truncationCharacter = ` ${truncationCharacter}`;
9065
- }
9066
-
9067
- return sliceAnsi(text, 0, columns - stringWidth(truncationCharacter)) + truncationCharacter;
9068
- }
9069
-
9070
- throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
9071
- }
9072
-
9073
- const DURATION_LONG$1 = 300;
9074
- const outputMap$1 = /* @__PURE__ */ new WeakMap();
9075
- function formatFilepath$1(path) {
9076
- const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
9077
- const basename = path.slice(lastSlash);
9078
- let firstDot = basename.indexOf(".");
9079
- if (firstDot < 0)
9080
- firstDot = basename.length;
9081
- firstDot += lastSlash;
9082
- return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
9083
- }
9084
- function formatNumber$1(number) {
9085
- const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
9086
- return res[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ",") + (res[1] ? `.${res[1]}` : "");
9087
- }
9088
- function renderHookState(task, hookName, level = 0) {
9089
- var _a, _b;
9090
- const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
9091
- if (state && state === "run")
9092
- return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${c.dim(`[ ${hookName} ]`)}`;
9093
- return "";
9094
- }
9095
- function renderBenchmarkItems$1(result) {
9096
- return [
9097
- result.name,
9098
- formatNumber$1(result.hz || 0),
9099
- formatNumber$1(result.p99 || 0),
9100
- `\xB1${result.rme.toFixed(2)}%`,
9101
- result.samples.length.toString()
9102
- ];
9103
- }
9104
- function renderBenchmark$1(task, tasks) {
9105
- var _a;
9106
- const result = (_a = task.result) == null ? void 0 : _a.benchmark;
9107
- if (!result)
9108
- return task.name;
9109
- const benches = tasks.map((i) => {
9110
- var _a2, _b;
9111
- return ((_a2 = i.meta) == null ? void 0 : _a2.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
9112
- }).filter(notNullish);
9113
- const allItems = benches.map(renderBenchmarkItems$1);
9114
- const items = renderBenchmarkItems$1(result);
9115
- const padded = items.map((i, idx) => {
9116
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
9117
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
9118
- });
9119
- return [
9120
- padded[0],
9121
- // name
9122
- c.dim(" "),
9123
- c.blue(padded[1]),
9124
- c.dim(" ops/sec "),
9125
- c.cyan(padded[3]),
9126
- c.dim(` (${padded[4]} samples)`),
9127
- result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
9128
- ].join("");
9129
- }
9130
- function renderTree$1(tasks, options, level = 0, maxRows) {
9131
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
9132
- const output = [];
9133
- let currentRowCount = 0;
9134
- for (const task of [...tasks].reverse()) {
9135
- const taskOutput = [];
9136
- let suffix = "";
9137
- let prefix = ` ${getStateSymbol(task)} `;
9138
- if (level === 0 && task.type === "suite" && task.projectName)
9139
- prefix += formatProjectName(task.projectName);
9140
- if (task.type === "test" && ((_a = task.result) == null ? void 0 : _a.retryCount) && task.result.retryCount > 0)
9141
- suffix += c.yellow(` (retry x${task.result.retryCount})`);
9142
- if (task.type === "suite" && !((_b = task.meta) == null ? void 0 : _b.typecheck)) {
9143
- const tests = getTests(task);
9144
- suffix += c.dim(` (${tests.length})`);
9145
- }
9146
- if (task.mode === "skip" || task.mode === "todo")
9147
- suffix += ` ${c.dim(c.gray("[skipped]"))}`;
9148
- if (task.type === "test" && ((_c = task.result) == null ? void 0 : _c.repeatCount) && task.result.repeatCount > 0)
9149
- suffix += c.yellow(` (repeat x${task.result.repeatCount})`);
9150
- if (((_d = task.result) == null ? void 0 : _d.duration) != null) {
9151
- if (task.result.duration > DURATION_LONG$1)
9152
- suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
9153
- }
9154
- if (options.showHeap && ((_e = task.result) == null ? void 0 : _e.heap) != null)
9155
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
9156
- let name = task.name;
9157
- if (level === 0)
9158
- name = formatFilepath$1(name);
9159
- const padding = " ".repeat(level);
9160
- const body = ((_f = task.meta) == null ? void 0 : _f.benchmark) ? renderBenchmark$1(task, tasks) : name;
9161
- taskOutput.push(padding + prefix + body + suffix);
9162
- if (((_g = task.result) == null ? void 0 : _g.state) !== "pass" && outputMap$1.get(task) != null) {
9163
- let data = outputMap$1.get(task);
9164
- if (typeof data === "string") {
9165
- data = stripAnsi(data.trim().split("\n").filter(Boolean).pop());
9166
- if (data === "")
9167
- data = void 0;
9168
- }
9169
- if (data != null) {
9170
- const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
9171
- taskOutput.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
9172
- }
9173
- }
9174
- taskOutput.push(renderHookState(task, "beforeAll", level + 1));
9175
- taskOutput.push(renderHookState(task, "beforeEach", level + 1));
9176
- if (task.type === "suite" && task.tasks.length > 0) {
9177
- if (((_h = task.result) == null ? void 0 : _h.state) === "fail" || ((_i = task.result) == null ? void 0 : _i.state) === "run" || options.renderSucceed) {
9178
- if (options.logger.ctx.config.hideSkippedTests) {
9179
- const filteredTasks = task.tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
9180
- taskOutput.push(renderTree$1(filteredTasks, options, level + 1, maxRows));
9181
- } else {
9182
- taskOutput.push(renderTree$1(task.tasks, options, level + 1, maxRows));
9183
- }
9184
- }
9185
- }
9186
- taskOutput.push(renderHookState(task, "afterAll", level + 1));
9187
- taskOutput.push(renderHookState(task, "afterEach", level + 1));
9188
- const rows = taskOutput.filter(Boolean);
9189
- output.push(rows.join("\n"));
9190
- currentRowCount += rows.length;
9191
- if (maxRows && currentRowCount >= maxRows)
9192
- break;
9193
- }
9194
- return output.reverse().join("\n");
9195
- }
9196
- function createListRenderer(_tasks, options) {
9197
- let tasks = _tasks;
9198
- let timer;
9199
- const log = options.logger.logUpdate;
9200
- function update() {
9201
- if (options.logger.ctx.config.hideSkippedTests) {
9202
- const filteredTasks = tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
9203
- log(renderTree$1(
9204
- filteredTasks,
9205
- options,
9206
- 0,
9207
- // log-update already limits the amount of printed rows to fit the current terminal
9208
- // but we can optimize performance by doing it ourselves
9209
- process.stdout.rows
9210
- ));
9211
- } else {
9212
- log(renderTree$1(
9213
- tasks,
9214
- options,
9215
- 0,
9216
- // log-update already limits the amount of printed rows to fit the current terminal
9217
- // but we can optimize performance by doing it ourselves
9218
- process.stdout.rows
9219
- ));
9220
- }
9221
- }
9222
- return {
9223
- start() {
9224
- if (timer)
9225
- return this;
9226
- timer = setInterval(update, 16);
9227
- return this;
9228
- },
9229
- update(_tasks2) {
9230
- tasks = _tasks2;
9231
- return this;
9232
- },
9233
- async stop() {
9234
- if (timer) {
9235
- clearInterval(timer);
9236
- timer = void 0;
9237
- }
9238
- log.clear();
9239
- if (options.logger.ctx.config.hideSkippedTests) {
9240
- const filteredTasks = tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
9241
- options.logger.log(renderTree$1(filteredTasks, options));
9242
- } else {
9243
- options.logger.log(renderTree$1(tasks, options));
9244
- }
9245
- return this;
9246
- },
9247
- clear() {
9248
- log.clear();
9249
- }
9250
- };
9251
- }
9252
-
9253
- class DefaultReporter extends BaseReporter {
9254
- renderer;
9255
- rendererOptions = {};
9256
- renderSucceedDefault;
9257
- onPathsCollected(paths = []) {
9258
- if (this.isTTY) {
9259
- if (this.renderSucceedDefault === void 0)
9260
- this.renderSucceedDefault = !!this.rendererOptions.renderSucceed;
9261
- if (this.renderSucceedDefault !== true)
9262
- this.rendererOptions.renderSucceed = paths.length <= 1;
9263
- }
9264
- }
9265
- async onTestRemoved(trigger) {
9266
- await this.stopListRender();
9267
- this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
9268
- `) : ""), true);
9269
- const files = this.ctx.state.getFiles(this.watchFilters);
9270
- createListRenderer(files, this.rendererOptions).stop();
9271
- this.ctx.logger.log();
9272
- await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
9273
- super.onWatcherStart();
9274
- }
9275
- onCollected() {
9276
- if (this.isTTY) {
9277
- this.rendererOptions.logger = this.ctx.logger;
9278
- this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
9279
- this.rendererOptions.mode = this.mode;
9280
- const files = this.ctx.state.getFiles(this.watchFilters);
9281
- if (!this.renderer)
9282
- this.renderer = createListRenderer(files, this.rendererOptions).start();
9283
- else
9284
- this.renderer.update(files);
9285
- }
9286
- }
9287
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
9288
- await this.stopListRender();
9289
- this.ctx.logger.log();
9290
- await super.onFinished(files, errors);
9291
- }
9292
- async onWatcherStart(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
9293
- await this.stopListRender();
9294
- await super.onWatcherStart(files, errors);
9295
- }
9296
- async stopListRender() {
9297
- var _a;
9298
- await ((_a = this.renderer) == null ? void 0 : _a.stop());
9299
- this.renderer = void 0;
9300
- }
9301
- async onWatcherRerun(files, trigger) {
9302
- await this.stopListRender();
9303
- await super.onWatcherRerun(files, trigger);
9304
- }
9305
- onUserConsoleLog(log) {
9306
- var _a;
9307
- if (!this.shouldLog(log))
9308
- return;
9309
- (_a = this.renderer) == null ? void 0 : _a.clear();
9310
- super.onUserConsoleLog(log);
9311
- }
9312
- }
9313
-
9314
- const check = { char: "\xB7", color: c.green };
9315
- const cross = { char: "x", color: c.red };
9316
- const pending = { char: "*", color: c.yellow };
9317
- const skip = { char: "-", color: (char) => c.dim(c.gray(char)) };
9318
- function getIcon(task) {
9319
- var _a;
9320
- if (task.mode === "skip" || task.mode === "todo")
9321
- return skip;
9322
- switch ((_a = task.result) == null ? void 0 : _a.state) {
9323
- case "pass":
9324
- return check;
9325
- case "fail":
9326
- return cross;
9327
- default:
9328
- return pending;
9329
- }
9330
- }
9331
- function render(tasks, width) {
9332
- const all = getTests(tasks);
9333
- let currentIcon = pending;
9334
- let currentTasks = 0;
9335
- let previousLineWidth = 0;
9336
- let output = "";
9337
- const addOutput = () => {
9338
- const { char, color } = currentIcon;
9339
- const availableWidth = width - previousLineWidth;
9340
- if (availableWidth > currentTasks) {
9341
- output += color(char.repeat(currentTasks));
9342
- previousLineWidth += currentTasks;
9343
- } else {
9344
- let buf = `${char.repeat(availableWidth)}
9345
- `;
9346
- const remaining = currentTasks - availableWidth;
9347
- const fullRows = Math.floor(remaining / width);
9348
- buf += `${char.repeat(width)}
9349
- `.repeat(fullRows);
9350
- const partialRow = remaining % width;
9351
- if (partialRow > 0) {
9352
- buf += char.repeat(partialRow);
9353
- previousLineWidth = partialRow;
9354
- } else {
9355
- previousLineWidth = 0;
9356
- }
9357
- output += color(buf);
9358
- }
9359
- };
9360
- for (const task of all) {
9361
- const icon = getIcon(task);
9362
- if (icon === currentIcon) {
9363
- currentTasks++;
9364
- continue;
9365
- }
9366
- addOutput();
9367
- currentTasks = 1;
9368
- currentIcon = icon;
9369
- }
9370
- addOutput();
9371
- return output;
9372
- }
9373
- function createDotRenderer(_tasks, options) {
9374
- let tasks = _tasks;
9375
- let timer;
9376
- const { logUpdate: log, outputStream } = options.logger;
9377
- function update() {
9378
- log(render(tasks, outputStream.columns));
9379
- }
9380
- return {
9381
- start() {
9382
- if (timer)
9383
- return this;
9384
- timer = setInterval(update, 16);
9385
- return this;
9386
- },
9387
- update(_tasks2) {
9388
- tasks = _tasks2;
9389
- return this;
9390
- },
9391
- async stop() {
9392
- if (timer) {
9393
- clearInterval(timer);
9394
- timer = void 0;
9395
- }
9396
- log.clear();
9397
- options.logger.log(render(tasks, outputStream.columns));
9398
- return this;
9399
- },
9400
- clear() {
9401
- log.clear();
9402
- }
9403
- };
9404
- }
9405
-
9406
- class DotReporter extends BaseReporter {
9407
- renderer;
9408
- onCollected() {
9409
- if (this.isTTY) {
9410
- const files = this.ctx.state.getFiles(this.watchFilters);
9411
- if (!this.renderer)
9412
- this.renderer = createDotRenderer(files, { logger: this.ctx.logger }).start();
9413
- else
9414
- this.renderer.update(files);
9415
- }
9416
- }
9417
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
9418
- await this.stopListRender();
9419
- this.ctx.logger.log();
9420
- await super.onFinished(files, errors);
9421
- }
9422
- async onWatcherStart() {
9423
- await this.stopListRender();
9424
- super.onWatcherStart();
9425
- }
9426
- async stopListRender() {
9427
- var _a;
9428
- (_a = this.renderer) == null ? void 0 : _a.stop();
9429
- this.renderer = void 0;
9430
- await new Promise((resolve) => setTimeout(resolve, 10));
9431
- }
9432
- async onWatcherRerun(files, trigger) {
9433
- await this.stopListRender();
9434
- await super.onWatcherRerun(files, trigger);
9435
- }
9436
- onUserConsoleLog(log) {
9437
- var _a;
9438
- (_a = this.renderer) == null ? void 0 : _a.clear();
9439
- super.onUserConsoleLog(log);
9440
- }
9441
- }
9442
-
9443
- function getOutputFile(config, reporter) {
9444
- if (!(config == null ? void 0 : config.outputFile))
9445
- return;
9446
- if (typeof config.outputFile === "string")
9447
- return config.outputFile;
9448
- return config.outputFile[reporter];
9449
- }
9450
-
9451
- const StatusMap = {
9452
- fail: "failed",
9453
- only: "pending",
9454
- pass: "passed",
9455
- run: "pending",
9456
- skip: "skipped",
9457
- todo: "todo"
9458
- };
9459
- let JsonReporter$1 = class JsonReporter {
9460
- start = 0;
9461
- ctx;
9462
- onInit(ctx) {
9463
- this.ctx = ctx;
9464
- this.start = Date.now();
9465
- }
9466
- async logTasks(files) {
9467
- var _a, _b, _c;
9468
- const suites = getSuites(files);
9469
- const numTotalTestSuites = suites.length;
9470
- const tests = getTests(files);
9471
- const numTotalTests = tests.length;
9472
- const numFailedTestSuites = suites.filter((s) => {
9473
- var _a2;
9474
- return (_a2 = s.result) == null ? void 0 : _a2.errors;
9475
- }).length;
9476
- const numPassedTestSuites = numTotalTestSuites - numFailedTestSuites;
9477
- const numPendingTestSuites = suites.filter((s) => {
9478
- var _a2;
9479
- return ((_a2 = s.result) == null ? void 0 : _a2.state) === "run";
9480
- }).length;
9481
- const numFailedTests = tests.filter((t) => {
9482
- var _a2;
9483
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
9484
- }).length;
9485
- const numPassedTests = numTotalTests - numFailedTests;
9486
- const numPendingTests = tests.filter((t) => {
9487
- var _a2;
9488
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
9489
- }).length;
9490
- const numTodoTests = tests.filter((t) => t.mode === "todo").length;
9491
- const testResults = [];
9492
- const success = numFailedTestSuites === 0 && numFailedTests === 0;
9493
- for (const file of files) {
9494
- const tests2 = getTests([file]);
9495
- let startTime = tests2.reduce((prev, next) => {
9496
- var _a2;
9497
- return Math.min(prev, ((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? Number.POSITIVE_INFINITY);
9498
- }, Number.POSITIVE_INFINITY);
9499
- if (startTime === Number.POSITIVE_INFINITY)
9500
- startTime = this.start;
9501
- const endTime = tests2.reduce((prev, next) => {
9502
- var _a2, _b2;
9503
- return Math.max(prev, (((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? 0) + (((_b2 = next.result) == null ? void 0 : _b2.duration) ?? 0));
9504
- }, startTime);
9505
- const assertionResults = await Promise.all(tests2.map(async (t) => {
9506
- var _a2, _b2, _c2, _d;
9507
- const ancestorTitles = [];
9508
- let iter = t.suite;
9509
- while (iter) {
9510
- ancestorTitles.push(iter.name);
9511
- iter = iter.suite;
9512
- }
9513
- ancestorTitles.reverse();
9514
- return {
9515
- ancestorTitles,
9516
- fullName: ancestorTitles.length > 0 ? `${ancestorTitles.join(" ")} ${t.name}` : t.name,
9517
- status: StatusMap[((_a2 = t.result) == null ? void 0 : _a2.state) || t.mode] || "skipped",
9518
- title: t.name,
9519
- duration: (_b2 = t.result) == null ? void 0 : _b2.duration,
9520
- failureMessages: ((_d = (_c2 = t.result) == null ? void 0 : _c2.errors) == null ? void 0 : _d.map((e) => e.message)) || [],
9521
- location: await this.getFailureLocation(t)
9522
- };
9523
- }));
9524
- if (tests2.some((t) => {
9525
- var _a2;
9526
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
9527
- })) {
9528
- this.ctx.logger.warn("WARNING: Some tests are still running when generating the JSON report.This is likely an internal bug in Vitest.Please report it to https://github.com/vitest-dev/vitest/issues");
9529
- }
9530
- testResults.push({
9531
- assertionResults,
9532
- startTime,
9533
- endTime,
9534
- status: tests2.some((t) => {
9535
- var _a2;
9536
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
9537
- }) ? "failed" : "passed",
9538
- message: ((_c = (_b = (_a = file.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0]) == null ? void 0 : _c.message) ?? "",
9539
- name: file.filepath
9540
- });
9541
- }
9542
- const result = {
9543
- numTotalTestSuites,
9544
- numPassedTestSuites,
9545
- numFailedTestSuites,
9546
- numPendingTestSuites,
9547
- numTotalTests,
9548
- numPassedTests,
9549
- numFailedTests,
9550
- numPendingTests,
9551
- numTodoTests,
9552
- startTime: this.start,
9553
- success,
9554
- testResults
9555
- };
9556
- await this.writeReport(JSON.stringify(result, null, 2));
9557
- }
9558
- async onFinished(files = this.ctx.state.getFiles()) {
9559
- await this.logTasks(files);
9560
- }
9561
- /**
9562
- * Writes the report to an output file if specified in the config,
9563
- * or logs it to the console otherwise.
9564
- * @param report
9565
- */
9566
- async writeReport(report) {
9567
- const outputFile = getOutputFile(this.ctx.config, "json");
9568
- if (outputFile) {
9569
- const reportFile = resolve(this.ctx.config.root, outputFile);
9570
- const outputDirectory = dirname(reportFile);
9571
- if (!existsSync(outputDirectory))
9572
- await promises.mkdir(outputDirectory, { recursive: true });
9573
- await promises.writeFile(reportFile, report, "utf-8");
9574
- this.ctx.logger.log(`JSON report written to ${reportFile}`);
9575
- } else {
9576
- this.ctx.logger.log(report);
9577
- }
9578
- }
9579
- async getFailureLocation(test) {
9580
- var _a, _b;
9581
- const error = (_b = (_a = test.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0];
9582
- if (!error)
9583
- return;
9584
- const project = this.ctx.getProjectByTaskId(test.id);
9585
- const stack = parseErrorStacktrace(error, {
9586
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file)
9587
- });
9588
- const frame = stack[0];
9589
- if (!frame)
9590
- return;
9591
- return { line: frame.line, column: frame.column };
9592
- }
9593
- };
9594
-
9595
- class VerboseReporter extends DefaultReporter {
9596
- constructor() {
9597
- super();
9598
- this.rendererOptions.renderSucceed = true;
9599
- }
9600
- onTaskUpdate(packs) {
9601
- var _a, _b, _c, _d;
9602
- if (this.isTTY)
9603
- return;
9604
- for (const pack of packs) {
9605
- const task = this.ctx.state.idMap.get(pack[0]);
9606
- if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
9607
- let title = ` ${getStateSymbol(task)} `;
9608
- if ((_c = task.suite) == null ? void 0 : _c.projectName)
9609
- title += formatProjectName(task.suite.projectName);
9610
- title += getFullName(task, c.dim(" > "));
9611
- if (this.ctx.config.logHeapUsage && task.result.heap != null)
9612
- title += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
9613
- this.ctx.logger.log(title);
9614
- if (task.result.state === "fail") {
9615
- (_d = task.result.errors) == null ? void 0 : _d.forEach((error) => {
9616
- this.ctx.logger.log(c.red(` ${F_RIGHT} ${error == null ? void 0 : error.message}`));
9617
- });
9618
- }
9619
- }
9620
- }
9621
- }
9622
- }
9623
-
9624
- class IndentedLogger {
9625
- constructor(baseLog) {
9626
- this.baseLog = baseLog;
9627
- }
9628
- currentIndent = "";
9629
- indent() {
9630
- this.currentIndent += " ";
9631
- }
9632
- unindent() {
9633
- this.currentIndent = this.currentIndent.substring(0, this.currentIndent.length - 4);
9634
- }
9635
- log(text) {
9636
- return this.baseLog(this.currentIndent + text);
9637
- }
9638
- }
9639
-
9640
- function yamlString(str) {
9641
- return `"${str.replace(/"/g, '\\"')}"`;
9642
- }
9643
- function tapString(str) {
9644
- return str.replace(/\\/g, "\\\\").replace(/#/g, "\\#").replace(/\n/g, " ");
9645
- }
9646
- class TapReporter {
9647
- ctx;
9648
- logger;
9649
- onInit(ctx) {
9650
- this.ctx = ctx;
9651
- this.logger = new IndentedLogger(ctx.logger.log.bind(ctx.logger));
9652
- }
9653
- static getComment(task) {
9654
- var _a;
9655
- if (task.mode === "skip")
9656
- return " # SKIP";
9657
- else if (task.mode === "todo")
9658
- return " # TODO";
9659
- else if (((_a = task.result) == null ? void 0 : _a.duration) != null)
9660
- return ` # time=${task.result.duration.toFixed(2)}ms`;
9661
- else
9662
- return "";
9663
- }
9664
- logErrorDetails(error, stack) {
9665
- this.logger.log(`name: ${yamlString(error.name)}`);
9666
- this.logger.log(`message: ${yamlString(error.message)}`);
9667
- if (stack) {
9668
- this.logger.log(`stack: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
9669
- }
9670
- }
9671
- logTasks(tasks) {
9672
- var _a, _b;
9673
- this.logger.log(`1..${tasks.length}`);
9674
- for (const [i, task] of tasks.entries()) {
9675
- const id = i + 1;
9676
- const ok = ((_a = task.result) == null ? void 0 : _a.state) === "pass" || task.mode === "skip" || task.mode === "todo" ? "ok" : "not ok";
9677
- const comment = TapReporter.getComment(task);
9678
- if (task.type === "suite" && task.tasks.length > 0) {
9679
- this.logger.log(`${ok} ${id} - ${tapString(task.name)}${comment} {`);
9680
- this.logger.indent();
9681
- this.logTasks(task.tasks);
9682
- this.logger.unindent();
9683
- this.logger.log("}");
9684
- } else {
9685
- this.logger.log(`${ok} ${id} - ${tapString(task.name)}${comment}`);
9686
- const project = this.ctx.getProjectByTaskId(task.id);
9687
- if (((_b = task.result) == null ? void 0 : _b.state) === "fail" && task.result.errors) {
9688
- this.logger.indent();
9689
- task.result.errors.forEach((error) => {
9690
- const stacks = parseErrorStacktrace(error, {
9691
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file)
9692
- });
9693
- const stack = stacks[0];
9694
- this.logger.log("---");
9695
- this.logger.log("error:");
9696
- this.logger.indent();
9697
- this.logErrorDetails(error);
9698
- this.logger.unindent();
9699
- if (stack)
9700
- this.logger.log(`at: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
9701
- if (error.showDiff) {
9702
- this.logger.log(`actual: ${yamlString(error.actual)}`);
9703
- this.logger.log(`expected: ${yamlString(error.expected)}`);
9704
- }
9705
- });
9706
- this.logger.log("...");
9707
- this.logger.unindent();
9708
- }
9709
- }
9710
- }
9711
- }
9712
- async onFinished(files = this.ctx.state.getFiles()) {
9713
- this.logger.log("TAP version 13");
9714
- this.logTasks(files);
9715
- }
9716
- }
9717
-
9718
- function flattenTasks$1(task, baseName = "") {
9719
- const base = baseName ? `${baseName} > ` : "";
9720
- if (task.type === "suite") {
9721
- return task.tasks.flatMap((child) => flattenTasks$1(child, `${base}${task.name}`));
9722
- } else {
9723
- return [{
9724
- ...task,
9725
- name: `${base}${task.name}`
9726
- }];
9727
- }
9728
- }
9729
- function removeInvalidXMLCharacters(value, removeDiscouragedChars) {
9730
- let regex = /((?:[\0-\x08\x0B\f\x0E-\x1F\uFFFD\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g;
9731
- value = String(value || "").replace(regex, "");
9732
- if (removeDiscouragedChars) {
9733
- regex = new RegExp(
9734
- "([\\x7F-\\x84]|[\\x86-\\x9F]|[\\uFDD0-\\uFDEF]|(?:\\uD83F[\\uDFFE\\uDFFF])|(?:\\uD87F[\\uDFFE\\uDFFF])|(?:\\uD8BF[\\uDFFE\\uDFFF])|(?:\\uD8FF[\\uDFFE\\uDFFF])|(?:\\uD93F[\\uDFFE\\uDFFF])|(?:\\uD97F[\\uDFFE\\uDFFF])|(?:\\uD9BF[\\uDFFE\\uDFFF])|(?:\\uD9FF[\\uDFFE\\uDFFF])|(?:\\uDA3F[\\uDFFE\\uDFFF])|(?:\\uDA7F[\\uDFFE\\uDFFF])|(?:\\uDABF[\\uDFFE\\uDFFF])|(?:\\uDAFF[\\uDFFE\\uDFFF])|(?:\\uDB3F[\\uDFFE\\uDFFF])|(?:\\uDB7F[\\uDFFE\\uDFFF])|(?:\\uDBBF[\\uDFFE\\uDFFF])|(?:\\uDBFF[\\uDFFE\\uDFFF])(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))",
9735
- "g"
9736
- );
9737
- value = value.replace(regex, "");
9738
- }
9739
- return value;
9740
- }
9741
- function escapeXML(value) {
9742
- return removeInvalidXMLCharacters(
9743
- String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;"),
9744
- true
9745
- );
9746
- }
9747
- function executionTime(durationMS) {
9748
- return (durationMS / 1e3).toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 10 });
9749
- }
9750
- function getDuration(task) {
9751
- var _a;
9752
- const duration = ((_a = task.result) == null ? void 0 : _a.duration) ?? 0;
9753
- return executionTime(duration);
9754
- }
9755
- class JUnitReporter {
9756
- ctx;
9757
- reportFile;
9758
- baseLog;
9759
- logger;
9760
- _timeStart = /* @__PURE__ */ new Date();
9761
- fileFd;
9762
- async onInit(ctx) {
9763
- this.ctx = ctx;
9764
- const outputFile = getOutputFile(this.ctx.config, "junit");
9765
- if (outputFile) {
9766
- this.reportFile = resolve(this.ctx.config.root, outputFile);
9767
- const outputDirectory = dirname(this.reportFile);
9768
- if (!existsSync(outputDirectory))
9769
- await promises.mkdir(outputDirectory, { recursive: true });
9770
- const fileFd = await promises.open(this.reportFile, "w+");
9771
- this.fileFd = fileFd;
9772
- this.baseLog = async (text) => {
9773
- if (!this.fileFd)
9774
- this.fileFd = await promises.open(this.reportFile, "w+");
9775
- await promises.writeFile(this.fileFd, `${text}
9776
- `);
9777
- };
9778
- } else {
9779
- this.baseLog = async (text) => this.ctx.logger.log(text);
9780
- }
9781
- this._timeStart = /* @__PURE__ */ new Date();
9782
- this.logger = new IndentedLogger(this.baseLog);
9783
- }
9784
- async writeElement(name, attrs, children) {
9785
- const pairs = [];
9786
- for (const key in attrs) {
9787
- const attr = attrs[key];
9788
- if (attr === void 0)
9789
- continue;
9790
- pairs.push(`${key}="${escapeXML(attr)}"`);
9791
- }
9792
- await this.logger.log(`<${name}${pairs.length ? ` ${pairs.join(" ")}` : ""}>`);
9793
- this.logger.indent();
9794
- await children.call(this);
9795
- this.logger.unindent();
9796
- await this.logger.log(`</${name}>`);
9797
- }
9798
- async writeErrorDetails(task, error) {
9799
- const errorName = error.name ?? error.nameStr ?? "Unknown Error";
9800
- const errorDetails = `${errorName}: ${error.message}`;
9801
- await this.baseLog(escapeXML(errorDetails));
9802
- const project = this.ctx.getProjectByTaskId(task.id);
9803
- const stack = parseErrorStacktrace(error, {
9804
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file)
9805
- });
9806
- for (const frame of stack) {
9807
- const path = relative(this.ctx.config.root, frame.file);
9808
- await this.baseLog(escapeXML(` ${F_POINTER} ${[frame.method, `${path}:${frame.line}:${frame.column}`].filter(Boolean).join(" ")}`));
9809
- if (frame.file in this.ctx.state.filesMap)
9810
- break;
9811
- }
9812
- }
9813
- async writeLogs(task, type) {
9814
- if (task.logs == null || task.logs.length === 0)
9815
- return;
9816
- const logType = type === "err" ? "stderr" : "stdout";
9817
- const logs = task.logs.filter((log) => log.type === logType);
9818
- if (logs.length === 0)
9819
- return;
9820
- await this.writeElement(`system-${type}`, {}, async () => {
9821
- for (const log of logs)
9822
- await this.baseLog(escapeXML(log.content));
9823
- });
9824
- }
9825
- async writeTasks(tasks, filename) {
9826
- for (const task of tasks) {
9827
- await this.writeElement("testcase", {
9828
- classname: process.env.VITEST_JUNIT_CLASSNAME ?? filename,
9829
- name: task.name,
9830
- time: getDuration(task)
9831
- }, async () => {
9832
- var _a, _b;
9833
- await this.writeLogs(task, "out");
9834
- await this.writeLogs(task, "err");
9835
- if (task.mode === "skip" || task.mode === "todo")
9836
- await this.logger.log("<skipped/>");
9837
- if (((_a = task.result) == null ? void 0 : _a.state) === "fail") {
9838
- const errors = ((_b = task.result.errors) == null ? void 0 : _b.length) ? task.result.errors : [task.result.error];
9839
- for (const error of errors) {
9840
- await this.writeElement("failure", {
9841
- message: error == null ? void 0 : error.message,
9842
- type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
9843
- }, async () => {
9844
- if (!error)
9845
- return;
9846
- await this.writeErrorDetails(task, error);
9847
- });
9848
- }
9849
- }
9850
- });
9851
- }
9852
- }
9853
- async onFinished(files = this.ctx.state.getFiles()) {
9854
- var _a;
9855
- await this.logger.log('<?xml version="1.0" encoding="UTF-8" ?>');
9856
- const transformed = files.map((file) => {
9857
- const tasks = file.tasks.flatMap((task) => flattenTasks$1(task));
9858
- const stats2 = tasks.reduce(
9859
- (stats3, task) => {
9860
- var _a2, _b;
9861
- return {
9862
- passed: stats3.passed + Number(((_a2 = task.result) == null ? void 0 : _a2.state) === "pass"),
9863
- failures: stats3.failures + Number(((_b = task.result) == null ? void 0 : _b.state) === "fail"),
9864
- skipped: stats3.skipped + Number(task.mode === "skip" || task.mode === "todo")
9865
- };
9866
- },
9867
- {
9868
- passed: 0,
9869
- failures: 0,
9870
- skipped: 0
9871
- }
9872
- );
9873
- return {
9874
- ...file,
9875
- tasks,
9876
- stats: stats2
9877
- };
9878
- });
9879
- const stats = transformed.reduce((stats2, file) => {
9880
- stats2.tests += file.tasks.length;
9881
- stats2.failures += file.stats.failures;
9882
- return stats2;
9883
- }, {
9884
- name: process.env.VITEST_JUNIT_SUITE_NAME || "vitest tests",
9885
- tests: 0,
9886
- failures: 0,
9887
- errors: 0,
9888
- // we cannot detect those
9889
- time: executionTime((/* @__PURE__ */ new Date()).getTime() - this._timeStart.getTime())
9890
- });
9891
- await this.writeElement("testsuites", stats, async () => {
9892
- for (const file of transformed) {
9893
- await this.writeElement("testsuite", {
9894
- name: file.name,
9895
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9896
- hostname: hostname(),
9897
- tests: file.tasks.length,
9898
- failures: file.stats.failures,
9899
- errors: 0,
9900
- // An errored test is one that had an unanticipated problem. We cannot detect those.
9901
- skipped: file.stats.skipped,
9902
- time: getDuration(file)
9903
- }, async () => {
9904
- await this.writeTasks(file.tasks, file.name);
9905
- });
9906
- }
9907
- });
9908
- if (this.reportFile)
9909
- this.ctx.logger.log(`JUNIT report written to ${this.reportFile}`);
9910
- await ((_a = this.fileFd) == null ? void 0 : _a.close());
9911
- this.fileFd = void 0;
9912
- }
9913
- }
9914
-
9915
- function flattenTasks(task, baseName = "") {
9916
- const base = baseName ? `${baseName} > ` : "";
9917
- if (task.type === "suite" && task.tasks.length > 0) {
9918
- return task.tasks.flatMap((child) => flattenTasks(child, `${base}${task.name}`));
9919
- } else {
9920
- return [{
9921
- ...task,
9922
- name: `${base}${task.name}`
9923
- }];
9924
- }
9925
- }
9926
- class TapFlatReporter extends TapReporter {
9927
- onInit(ctx) {
9928
- super.onInit(ctx);
9929
- }
9930
- async onFinished(files = this.ctx.state.getFiles()) {
9931
- this.ctx.logger.log("TAP version 13");
9932
- const flatTasks = files.flatMap((task) => flattenTasks(task));
9933
- this.logTasks(flatTasks);
9934
- }
9935
- }
9936
-
9937
- class HangingProcessReporter {
9938
- whyRunning;
9939
- onInit() {
9940
- const _require = createRequire(import.meta.url);
9941
- this.whyRunning = _require("why-is-node-running");
9942
- }
9943
- onProcessTimeout() {
9944
- var _a;
9945
- (_a = this.whyRunning) == null ? void 0 : _a.call(this);
9946
- }
9947
- }
9948
-
9949
- class JsonReporter {
9950
- start = 0;
9951
- ctx;
9952
- onInit(ctx) {
9953
- this.ctx = ctx;
9954
- }
9955
- async logTasks(files) {
9956
- var _a;
9957
- const suites = getSuites(files);
9958
- const numTotalTestSuites = suites.length;
9959
- const tests = getTests(files);
9960
- const numTotalTests = tests.length;
9961
- const testResults = {};
9962
- const outputFile = getOutputFile(this.ctx.config.benchmark, "json");
9963
- for (const file of files) {
9964
- const tests2 = getTests([file]);
9965
- for (const test of tests2) {
9966
- const res = (_a = test.result) == null ? void 0 : _a.benchmark;
9967
- if (!res || test.mode === "skip")
9968
- continue;
9969
- if (!outputFile)
9970
- res.samples = "ignore on terminal";
9971
- testResults[test.suite.name] = (testResults[test.suite.name] || []).concat(res);
9972
- }
9973
- if (tests2.some((t) => {
9974
- var _a2;
9975
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
9976
- })) {
9977
- this.ctx.logger.warn("WARNING: Some tests are still running when generating the json report.This is likely an internal bug in Vitest.Please report it to https://github.com/vitest-dev/vitest/issues");
9978
- }
9979
- }
9980
- const result = {
9981
- numTotalTestSuites,
9982
- numTotalTests,
9983
- testResults
9984
- };
9985
- await this.writeReport(JSON.stringify(result, null, 2));
9986
- }
9987
- async onFinished(files = this.ctx.state.getFiles()) {
9988
- await this.logTasks(files);
9989
- }
9990
- /**
9991
- * Writes the report to an output file if specified in the config,
9992
- * or logs it to the console otherwise.
9993
- * @param report
9994
- */
9995
- async writeReport(report) {
9996
- const outputFile = getOutputFile(this.ctx.config.benchmark, "json");
9997
- if (outputFile) {
9998
- const reportFile = resolve(this.ctx.config.root, outputFile);
9999
- const outputDirectory = dirname(reportFile);
10000
- if (!existsSync(outputDirectory))
10001
- await promises.mkdir(outputDirectory, { recursive: true });
10002
- await promises.writeFile(reportFile, report, "utf-8");
10003
- this.ctx.logger.log(`json report written to ${reportFile}`);
10004
- } else {
10005
- this.ctx.logger.log(report);
10006
- }
10007
- }
10008
- }
10009
-
10010
- const DURATION_LONG = 300;
10011
- const outputMap = /* @__PURE__ */ new WeakMap();
10012
- function formatFilepath(path) {
10013
- const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
10014
- const basename = path.slice(lastSlash);
10015
- let firstDot = basename.indexOf(".");
10016
- if (firstDot < 0)
10017
- firstDot = basename.length;
10018
- firstDot += lastSlash;
10019
- return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
10020
- }
10021
- function formatNumber(number) {
10022
- const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
10023
- return res[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ",") + (res[1] ? `.${res[1]}` : "");
10024
- }
10025
- const tableHead = ["name", "hz", "min", "max", "mean", "p75", "p99", "p995", "p999", "rme", "samples"];
10026
- function renderTableHead(tasks) {
10027
- const benches = tasks.map((i) => {
10028
- var _a, _b;
10029
- return ((_a = i.meta) == null ? void 0 : _a.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
10030
- }).filter(notNullish);
10031
- const allItems = benches.map(renderBenchmarkItems).concat([tableHead]);
10032
- return `${" ".repeat(3)}${tableHead.map((i, idx) => {
10033
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
10034
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
10035
- }).map(c.bold).join(" ")}`;
10036
- }
10037
- function renderBenchmarkItems(result) {
10038
- return [
10039
- result.name,
10040
- formatNumber(result.hz || 0),
10041
- formatNumber(result.min || 0),
10042
- formatNumber(result.max || 0),
10043
- formatNumber(result.mean || 0),
10044
- formatNumber(result.p75 || 0),
10045
- formatNumber(result.p99 || 0),
10046
- formatNumber(result.p995 || 0),
10047
- formatNumber(result.p999 || 0),
10048
- `\xB1${(result.rme || 0).toFixed(2)}%`,
10049
- result.samples.length.toString()
10050
- ];
10051
- }
10052
- function renderBenchmark(task, tasks) {
10053
- var _a;
10054
- const result = (_a = task.result) == null ? void 0 : _a.benchmark;
10055
- if (!result)
10056
- return task.name;
10057
- const benches = tasks.map((i) => {
10058
- var _a2, _b;
10059
- return ((_a2 = i.meta) == null ? void 0 : _a2.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
10060
- }).filter(notNullish);
10061
- const allItems = benches.map(renderBenchmarkItems).concat([tableHead]);
10062
- const items = renderBenchmarkItems(result);
10063
- const padded = items.map((i, idx) => {
10064
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
10065
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
10066
- });
10067
- return [
10068
- padded[0],
10069
- // name
10070
- c.blue(padded[1]),
10071
- // hz
10072
- c.cyan(padded[2]),
10073
- // min
10074
- c.cyan(padded[3]),
10075
- // max
10076
- c.cyan(padded[4]),
10077
- // mean
10078
- c.cyan(padded[5]),
10079
- // p75
10080
- c.cyan(padded[6]),
10081
- // p99
10082
- c.cyan(padded[7]),
10083
- // p995
10084
- c.cyan(padded[8]),
10085
- // p999
10086
- c.dim(padded[9]),
10087
- // rem
10088
- c.dim(padded[10]),
10089
- // sample
10090
- result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
10091
- ].join(" ");
10092
- }
10093
- function renderTree(tasks, options, level = 0) {
10094
- var _a, _b, _c, _d, _e, _f;
10095
- const output = [];
10096
- let idx = 0;
10097
- for (const task of tasks) {
10098
- const padding = " ".repeat(level ? 1 : 0);
10099
- let prefix = "";
10100
- if (idx === 0 && ((_a = task.meta) == null ? void 0 : _a.benchmark))
10101
- prefix += `${renderTableHead(tasks)}
10102
- ${padding}`;
10103
- prefix += ` ${getStateSymbol(task)} `;
10104
- let suffix = "";
10105
- if (task.type === "suite")
10106
- suffix += c.dim(` (${getTests(task).length})`);
10107
- if (task.mode === "skip" || task.mode === "todo")
10108
- suffix += ` ${c.dim(c.gray("[skipped]"))}`;
10109
- if (((_b = task.result) == null ? void 0 : _b.duration) != null) {
10110
- if (task.result.duration > DURATION_LONG)
10111
- suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
10112
- }
10113
- if (options.showHeap && ((_c = task.result) == null ? void 0 : _c.heap) != null)
10114
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
10115
- let name = task.name;
10116
- if (level === 0)
10117
- name = formatFilepath(name);
10118
- const body = ((_d = task.meta) == null ? void 0 : _d.benchmark) ? renderBenchmark(task, tasks) : name;
10119
- output.push(padding + prefix + body + suffix);
10120
- if (((_e = task.result) == null ? void 0 : _e.state) !== "pass" && outputMap.get(task) != null) {
10121
- let data = outputMap.get(task);
10122
- if (typeof data === "string") {
10123
- data = stripAnsi(data.trim().split("\n").filter(Boolean).pop());
10124
- if (data === "")
10125
- data = void 0;
10126
- }
10127
- if (data != null) {
10128
- const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
10129
- output.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
10130
- }
10131
- }
10132
- if (task.type === "suite" && task.tasks.length > 0) {
10133
- if ((_f = task.result) == null ? void 0 : _f.state)
10134
- output.push(renderTree(task.tasks, options, level + 1));
10135
- }
10136
- idx++;
10137
- }
10138
- return output.filter(Boolean).join("\n");
10139
- }
10140
- function createTableRenderer(_tasks, options) {
10141
- let tasks = _tasks;
10142
- let timer;
10143
- const log = options.logger.logUpdate;
10144
- function update() {
10145
- log(renderTree(tasks, options));
10146
- }
10147
- return {
10148
- start() {
10149
- if (timer)
10150
- return this;
10151
- timer = setInterval(update, 200);
10152
- return this;
10153
- },
10154
- update(_tasks2) {
10155
- tasks = _tasks2;
10156
- update();
10157
- return this;
10158
- },
10159
- async stop() {
10160
- if (timer) {
10161
- clearInterval(timer);
10162
- timer = void 0;
10163
- }
10164
- log.clear();
10165
- options.logger.log(renderTree(tasks, options));
10166
- return this;
10167
- },
10168
- clear() {
10169
- log.clear();
10170
- }
10171
- };
10172
- }
10173
-
10174
- class TableReporter extends BaseReporter {
10175
- renderer;
10176
- rendererOptions = {};
10177
- async onTestRemoved(trigger) {
10178
- await this.stopListRender();
10179
- this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
10180
- `) : ""), true);
10181
- const files = this.ctx.state.getFiles(this.watchFilters);
10182
- createTableRenderer(files, this.rendererOptions).stop();
10183
- this.ctx.logger.log();
10184
- await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
10185
- super.onWatcherStart();
10186
- }
10187
- onCollected() {
10188
- if (this.isTTY) {
10189
- this.rendererOptions.logger = this.ctx.logger;
10190
- this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
10191
- const files = this.ctx.state.getFiles(this.watchFilters);
10192
- if (!this.renderer)
10193
- this.renderer = createTableRenderer(files, this.rendererOptions).start();
10194
- else
10195
- this.renderer.update(files);
10196
- }
10197
- }
10198
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
10199
- await this.stopListRender();
10200
- this.ctx.logger.log();
10201
- await super.onFinished(files, errors);
10202
- }
10203
- async onWatcherStart() {
10204
- await this.stopListRender();
10205
- await super.onWatcherStart();
10206
- }
10207
- async stopListRender() {
10208
- var _a;
10209
- await ((_a = this.renderer) == null ? void 0 : _a.stop());
10210
- this.renderer = void 0;
10211
- }
10212
- async onWatcherRerun(files, trigger) {
10213
- await this.stopListRender();
10214
- await super.onWatcherRerun(files, trigger);
10215
- }
10216
- onUserConsoleLog(log) {
10217
- var _a;
10218
- if (!this.shouldLog(log))
10219
- return;
10220
- (_a = this.renderer) == null ? void 0 : _a.clear();
10221
- super.onUserConsoleLog(log);
10222
- }
10223
- }
10224
-
10225
- const BenchmarkReportsMap = {
10226
- default: TableReporter,
10227
- verbose: VerboseReporter,
10228
- json: JsonReporter
10229
- };
10230
-
10231
- const ReportersMap = {
10232
- "default": DefaultReporter,
10233
- "basic": BasicReporter,
10234
- "verbose": VerboseReporter,
10235
- "dot": DotReporter,
10236
- "json": JsonReporter$1,
10237
- "tap": TapReporter,
10238
- "tap-flat": TapFlatReporter,
10239
- "junit": JUnitReporter,
10240
- "hanging-process": HangingProcessReporter
10241
- };
10242
-
10243
7688
  async function loadCustomReporterModule(path, runner) {
10244
7689
  let customReporterModule;
10245
7690
  try {
@@ -10449,6 +7894,7 @@ const defaultCoverageExcludes = [
10449
7894
  "**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)",
10450
7895
  "**/__tests__/**",
10451
7896
  "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
7897
+ "**/vitest.{workspace,projects}.[jt]s?(on)",
10452
7898
  "**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
10453
7899
  ];
10454
7900
  const coverageConfigDefaults = {
@@ -10460,7 +7906,8 @@ const coverageConfigDefaults = {
10460
7906
  exclude: defaultCoverageExcludes,
10461
7907
  reportOnFailure: false,
10462
7908
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
10463
- extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
7909
+ extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
7910
+ allowExternal: false
10464
7911
  };
10465
7912
  const fakeTimersDefaults = {
10466
7913
  loopLimit: 1e4,
@@ -10791,7 +8238,7 @@ function resolveApiServerConfig(options) {
10791
8238
  return api;
10792
8239
  }
10793
8240
  function resolveConfig(mode, options, viteConfig) {
10794
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
8241
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
10795
8242
  if (options.dom) {
10796
8243
  if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
10797
8244
  console.warn(
@@ -10846,12 +8293,17 @@ function resolveConfig(mode, options, viteConfig) {
10846
8293
  });
10847
8294
  if (!resolved.deps.moduleDirectories.includes("/node_modules/"))
10848
8295
  resolved.deps.moduleDirectories.push("/node_modules/");
10849
- (_c = resolved.deps).web ?? (_c.web = {});
10850
- (_d = resolved.deps.web).transformAssets ?? (_d.transformAssets = true);
10851
- (_e = resolved.deps.web).transformCss ?? (_e.transformCss = true);
10852
- (_f = resolved.deps.web).transformGlobPattern ?? (_f.transformGlobPattern = []);
8296
+ (_c = resolved.deps).optimizer ?? (_c.optimizer = {});
8297
+ (_d = resolved.deps.optimizer).ssr ?? (_d.ssr = {});
8298
+ (_e = resolved.deps.optimizer.ssr).enabled ?? (_e.enabled = true);
8299
+ (_f = resolved.deps.optimizer).web ?? (_f.web = {});
8300
+ (_g = resolved.deps.optimizer.web).enabled ?? (_g.enabled = true);
8301
+ (_h = resolved.deps).web ?? (_h.web = {});
8302
+ (_i = resolved.deps.web).transformAssets ?? (_i.transformAssets = true);
8303
+ (_j = resolved.deps.web).transformCss ?? (_j.transformCss = true);
8304
+ (_k = resolved.deps.web).transformGlobPattern ?? (_k.transformGlobPattern = []);
10853
8305
  resolved.server ?? (resolved.server = {});
10854
- (_g = resolved.server).deps ?? (_g.deps = {});
8306
+ (_l = resolved.server).deps ?? (_l.deps = {});
10855
8307
  const deprecatedDepsOptions = ["inline", "external", "fallbackCJS"];
10856
8308
  deprecatedDepsOptions.forEach((option) => {
10857
8309
  if (resolved.deps[option] === void 0)
@@ -10874,11 +8326,11 @@ function resolveConfig(mode, options, viteConfig) {
10874
8326
  if ((ssrOptions == null ? void 0 : ssrOptions.noExternal) === true && resolved.server.deps.inline == null) {
10875
8327
  resolved.server.deps.inline = true;
10876
8328
  } else {
10877
- (_h = resolved.server.deps).inline ?? (_h.inline = []);
8329
+ (_m = resolved.server.deps).inline ?? (_m.inline = []);
10878
8330
  resolved.server.deps.inline.push(...extraInlineDeps);
10879
8331
  }
10880
8332
  }
10881
- (_i = resolved.server.deps).moduleDirectories ?? (_i.moduleDirectories = []);
8333
+ (_n = resolved.server.deps).moduleDirectories ?? (_n.moduleDirectories = []);
10882
8334
  resolved.server.deps.moduleDirectories.push(...resolved.deps.moduleDirectories);
10883
8335
  if (resolved.runner) {
10884
8336
  resolved.runner = resolveModule(resolved.runner, { paths: [resolved.root] }) ?? resolve(resolved.root, resolved.runner);
@@ -10942,7 +8394,7 @@ function resolveConfig(mode, options, viteConfig) {
10942
8394
  resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
10943
8395
  )
10944
8396
  );
10945
- resolved.coverage.exclude.push(...resolved.setupFiles.map((file) => relative(resolved.root, file)));
8397
+ resolved.coverage.exclude.push(...resolved.setupFiles.map((file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(resolved.root, file)}`));
10946
8398
  resolved.forceRerunTriggers = [
10947
8399
  ...resolved.forceRerunTriggers,
10948
8400
  ...resolved.setupFiles
@@ -10965,19 +8417,19 @@ function resolveConfig(mode, options, viteConfig) {
10965
8417
  resolved.passWithNoTests ?? (resolved.passWithNoTests = true);
10966
8418
  resolved.css ?? (resolved.css = {});
10967
8419
  if (typeof resolved.css === "object") {
10968
- (_j = resolved.css).modules ?? (_j.modules = {});
10969
- (_k = resolved.css.modules).classNameStrategy ?? (_k.classNameStrategy = "stable");
8420
+ (_o = resolved.css).modules ?? (_o.modules = {});
8421
+ (_p = resolved.css.modules).classNameStrategy ?? (_p.classNameStrategy = "stable");
10970
8422
  }
10971
8423
  resolved.cache ?? (resolved.cache = { dir: "" });
10972
8424
  if (resolved.cache)
10973
8425
  resolved.cache.dir = VitestCache.resolveCacheDir(resolved.root, resolved.cache.dir);
10974
8426
  resolved.sequence ?? (resolved.sequence = {});
10975
- if (!((_l = resolved.sequence) == null ? void 0 : _l.sequencer)) {
8427
+ if (!((_q = resolved.sequence) == null ? void 0 : _q.sequencer)) {
10976
8428
  resolved.sequence.sequencer = resolved.sequence.shuffle ? RandomSequencer : BaseSequencer;
10977
8429
  }
10978
- (_m = resolved.sequence).hooks ?? (_m.hooks = "parallel");
8430
+ (_r = resolved.sequence).hooks ?? (_r.hooks = "parallel");
10979
8431
  if (resolved.sequence.sequencer === RandomSequencer)
10980
- (_n = resolved.sequence).seed ?? (_n.seed = Date.now());
8432
+ (_s = resolved.sequence).seed ?? (_s.seed = Date.now());
10981
8433
  resolved.typecheck = {
10982
8434
  ...configDefaults.typecheck,
10983
8435
  ...resolved.typecheck
@@ -10988,9 +8440,9 @@ function resolveConfig(mode, options, viteConfig) {
10988
8440
  resolved.exclude = resolved.typecheck.exclude;
10989
8441
  }
10990
8442
  resolved.browser ?? (resolved.browser = {});
10991
- (_o = resolved.browser).enabled ?? (_o.enabled = false);
10992
- (_p = resolved.browser).headless ?? (_p.headless = isCI);
10993
- (_q = resolved.browser).slowHijackESM ?? (_q.slowHijackESM = true);
8443
+ (_t = resolved.browser).enabled ?? (_t.enabled = false);
8444
+ (_u = resolved.browser).headless ?? (_u.headless = isCI);
8445
+ (_v = resolved.browser).slowHijackESM ?? (_v.slowHijackESM = true);
10994
8446
  resolved.browser.api = resolveApiServerConfig(resolved.browser) || {
10995
8447
  port: defaultBrowserPort
10996
8448
  };
@@ -11555,7 +9007,7 @@ createLogUpdate(process$1.stdout);
11555
9007
 
11556
9008
  createLogUpdate(process$1.stderr);
11557
9009
 
11558
- var version = "0.34.2";
9010
+ var version = "0.34.3";
11559
9011
 
11560
9012
  const A=r=>r!==null&&typeof r=="object",a=(r,t)=>Object.assign(new Error(`[${r}]: ${t}`),{code:r}),_$1="ERR_INVALID_PACKAGE_CONFIG",E="ERR_INVALID_PACKAGE_TARGET",I="ERR_PACKAGE_PATH_NOT_EXPORTED",R$1=/^\d+$/,O=/^(\.{1,2}|node_modules)$/i,w=/\/|\\/;var h=(r=>(r.Export="exports",r.Import="imports",r))(h||{});const f=(r,t,e,o,c)=>{if(t==null)return [];if(typeof t=="string"){const[n,...i]=t.split(w);if(n===".."||i.some(l=>O.test(l)))throw a(E,`Invalid "${r}" target "${t}" defined in the package config`);return [c?t.replace(/\*/g,c):t]}if(Array.isArray(t))return t.flatMap(n=>f(r,n,e,o,c));if(A(t)){for(const n of Object.keys(t)){if(R$1.test(n))throw a(_$1,"Cannot contain numeric property keys");if(n==="default"||o.includes(n))return f(r,t[n],e,o,c)}return []}throw a(E,`Invalid "${r}" target "${t}"`)},s="*",m=(r,t)=>{const e=r.indexOf(s),o=t.indexOf(s);return e===o?t.length>r.length:o>e};function d$1(r,t){if(!t.includes(s)&&r.hasOwnProperty(t))return [t];let e,o;for(const c of Object.keys(r))if(c.includes(s)){const[n,i,l]=c.split(s);if(l===void 0&&t.startsWith(n)&&t.endsWith(i)){const g=t.slice(n.length,-i.length||void 0);g&&(!e||m(e,c))&&(e=c,o=g);}}return [e,o]}const p=r=>Object.keys(r).reduce((t,e)=>{const o=e===""||e[0]!==".";if(t===void 0||t===o)return o;throw a(_$1,'"exports" cannot contain some keys starting with "." and some not')},void 0),u=/^\w+:/,v=(r,t,e)=>{if(!r)throw new Error('"exports" is required');t=t===""?".":`./${t}`,(typeof r=="string"||Array.isArray(r)||A(r)&&p(r))&&(r={".":r});const[o,c]=d$1(r,t),n=f(h.Export,r[o],t,e,c);if(n.length===0)throw a(I,t==="."?'No "exports" main defined':`Package subpath '${t}' is not defined by "exports"`);for(const i of n)if(!i.startsWith("./")&&!u.test(i))throw a(E,`Invalid "exports" target "${i}" defined in the package config`);return n};
11561
9013
 
@@ -12535,10 +9987,10 @@ function resolveOptimizerConfig(_testOptions, viteOptions, testConfig) {
12535
9987
  var _a;
12536
9988
  const testOptions = _testOptions || {};
12537
9989
  const newConfig = {};
12538
- const [major, minor] = version$2.split(".").map(Number);
12539
- const allowed = major >= 5 || major === 4 && minor >= 3;
9990
+ const [major, minor, fix] = version$2.split(".").map(Number);
9991
+ const allowed = major >= 5 || major === 4 && minor >= 4 || major === 4 && minor === 3 && fix >= 2;
12540
9992
  if (!allowed && (testOptions == null ? void 0 : testOptions.enabled) === true)
12541
- console.warn(`Vitest: "deps.optimizer" is only available in Vite >= 4.3.0, current Vite version: ${version$2}`);
9993
+ console.warn(`Vitest: "deps.optimizer" is only available in Vite >= 4.3.2, current Vite version: ${version$2}`);
12542
9994
  else
12543
9995
  testOptions.enabled ?? (testOptions.enabled = true);
12544
9996
  if (!allowed || (testOptions == null ? void 0 : testOptions.enabled) !== true) {
@@ -12550,6 +10002,16 @@ function resolveOptimizerConfig(_testOptions, viteOptions, testConfig) {
12550
10002
  };
12551
10003
  } else {
12552
10004
  const cacheDir = testConfig.cache !== false ? (_a = testConfig.cache) == null ? void 0 : _a.dir : null;
10005
+ const currentInclude = testOptions.include || (viteOptions == null ? void 0 : viteOptions.include) || [];
10006
+ const exclude = [
10007
+ "vitest",
10008
+ // Ideally, we shouldn't optimize react in test mode, otherwise we need to optimize _every_ dependency that uses react.
10009
+ "react",
10010
+ ...testOptions.exclude || (viteOptions == null ? void 0 : viteOptions.exclude) || []
10011
+ ];
10012
+ const runtime = currentInclude.filter((n) => n.endsWith("jsx-dev-runtime"));
10013
+ exclude.push(...runtime);
10014
+ const include = (testOptions.include || (viteOptions == null ? void 0 : viteOptions.include) || []).filter((n) => !exclude.includes(n));
12553
10015
  newConfig.cacheDir = cacheDir ?? "node_modules/.vitest";
12554
10016
  newConfig.optimizeDeps = {
12555
10017
  ...viteOptions,
@@ -12557,8 +10019,8 @@ function resolveOptimizerConfig(_testOptions, viteOptions, testConfig) {
12557
10019
  noDiscovery: true,
12558
10020
  disabled: false,
12559
10021
  entries: [],
12560
- exclude: ["vitest", ...builtinModules, ...testOptions.exclude || (viteOptions == null ? void 0 : viteOptions.exclude) || []],
12561
- include: (testOptions.include || (viteOptions == null ? void 0 : viteOptions.include) || []).filter((n) => n !== "vitest")
10022
+ exclude,
10023
+ include
12562
10024
  };
12563
10025
  }
12564
10026
  return newConfig;
@@ -12656,7 +10118,7 @@ async function createBrowserServer(project, options) {
12656
10118
  });
12657
10119
  await server.listen();
12658
10120
  await server.watcher.close();
12659
- (await import('./chunk-api-setup.cc5282f7.js')).setup(project, server);
10121
+ (await import('./chunk-api-setup.3b016b1c.js')).setup(project, server);
12660
10122
  return server;
12661
10123
  }
12662
10124
 
@@ -12978,6 +10440,26 @@ function VitestResolver(ctx) {
12978
10440
  };
12979
10441
  }
12980
10442
 
10443
+ function VitestOptimizer() {
10444
+ return {
10445
+ name: "vitest:normalize-optimizer",
10446
+ config: {
10447
+ order: "post",
10448
+ handler(viteConfig) {
10449
+ var _a, _b, _c, _d, _e;
10450
+ const testConfig = viteConfig.test || {};
10451
+ const webOptimizer = resolveOptimizerConfig((_b = (_a = testConfig.deps) == null ? void 0 : _a.optimizer) == null ? void 0 : _b.web, viteConfig.optimizeDeps, testConfig);
10452
+ const ssrOptimizer = resolveOptimizerConfig((_d = (_c = testConfig.deps) == null ? void 0 : _c.optimizer) == null ? void 0 : _d.ssr, (_e = viteConfig.ssr) == null ? void 0 : _e.optimizeDeps, testConfig);
10453
+ viteConfig.cacheDir = webOptimizer.cacheDir || ssrOptimizer.cacheDir || viteConfig.cacheDir;
10454
+ viteConfig.optimizeDeps = webOptimizer.optimizeDeps;
10455
+ viteConfig.ssr = {
10456
+ optimizeDeps: ssrOptimizer.optimizeDeps
10457
+ };
10458
+ }
10459
+ }
10460
+ };
10461
+ }
10462
+
12981
10463
  function WorkspaceVitestPlugin(project, options) {
12982
10464
  return [
12983
10465
  {
@@ -12987,7 +10469,7 @@ function WorkspaceVitestPlugin(project, options) {
12987
10469
  this.meta.watchMode = false;
12988
10470
  },
12989
10471
  config(viteConfig) {
12990
- var _a, _b, _c, _d, _e, _f, _g, _h;
10472
+ var _a, _b, _c;
12991
10473
  const env = deleteDefineConfig(viteConfig);
12992
10474
  const testConfig = viteConfig.test || {};
12993
10475
  const root = testConfig.root || viteConfig.root || options.root;
@@ -13049,13 +10531,6 @@ function WorkspaceVitestPlugin(project, options) {
13049
10531
  };
13050
10532
  }
13051
10533
  }
13052
- const webOptimizer = resolveOptimizerConfig((_e = (_d = testConfig.deps) == null ? void 0 : _d.optimizer) == null ? void 0 : _e.web, viteConfig.optimizeDeps, testConfig);
13053
- const ssrOptimizer = resolveOptimizerConfig((_g = (_f = testConfig.deps) == null ? void 0 : _f.optimizer) == null ? void 0 : _g.ssr, (_h = viteConfig.ssr) == null ? void 0 : _h.optimizeDeps, testConfig);
13054
- config.cacheDir = webOptimizer.cacheDir || ssrOptimizer.cacheDir || config.cacheDir;
13055
- config.optimizeDeps = webOptimizer.optimizeDeps;
13056
- config.ssr = {
13057
- optimizeDeps: ssrOptimizer.optimizeDeps
13058
- };
13059
10534
  return config;
13060
10535
  },
13061
10536
  configResolved(viteConfig) {
@@ -13081,7 +10556,8 @@ function WorkspaceVitestPlugin(project, options) {
13081
10556
  CoverageTransform(project.ctx),
13082
10557
  GlobalSetupPlugin(project, project.ctx.logger),
13083
10558
  MocksPlugin(),
13084
- VitestResolver(project.ctx)
10559
+ VitestResolver(project.ctx),
10560
+ VitestOptimizer()
13085
10561
  ];
13086
10562
  }
13087
10563
 
@@ -13298,7 +10774,8 @@ class WorkspaceProject {
13298
10774
  return isBrowserEnabled(this.config);
13299
10775
  }
13300
10776
  getSerializableConfig() {
13301
- var _a, _b, _c, _d, _e, _f;
10777
+ var _a, _b, _c;
10778
+ const optimizer = (_a = this.config.deps) == null ? void 0 : _a.optimizer;
13302
10779
  return deepMerge(
13303
10780
  {
13304
10781
  ...this.config,
@@ -13308,10 +10785,10 @@ class WorkspaceProject {
13308
10785
  ...this.config.deps,
13309
10786
  optimizer: {
13310
10787
  web: {
13311
- enabled: ((_c = (_b = (_a = this.config.deps) == null ? void 0 : _a.optimizer) == null ? void 0 : _b.web) == null ? void 0 : _c.enabled) ?? true
10788
+ enabled: ((_b = optimizer == null ? void 0 : optimizer.web) == null ? void 0 : _b.enabled) ?? true
13312
10789
  },
13313
10790
  ssr: {
13314
- enabled: ((_f = (_e = (_d = this.config.deps) == null ? void 0 : _d.optimizer) == null ? void 0 : _e.ssr) == null ? void 0 : _f.enabled) ?? true
10791
+ enabled: ((_c = optimizer == null ? void 0 : optimizer.ssr) == null ? void 0 : _c.enabled) ?? true
13315
10792
  }
13316
10793
  }
13317
10794
  },
@@ -13329,7 +10806,8 @@ class WorkspaceProject {
13329
10806
  reporters: []
13330
10807
  },
13331
10808
  inspect: this.ctx.config.inspect,
13332
- inspectBrk: this.ctx.config.inspectBrk
10809
+ inspectBrk: this.ctx.config.inspectBrk,
10810
+ alias: []
13333
10811
  },
13334
10812
  this.ctx.configOverride || {}
13335
10813
  );
@@ -14002,7 +11480,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14002
11480
  this.meta.watchMode = false;
14003
11481
  },
14004
11482
  async config(viteConfig) {
14005
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
11483
+ var _a, _b, _c, _d;
14006
11484
  if (options.watch) {
14007
11485
  options = deepMerge({}, userConfig);
14008
11486
  }
@@ -14063,13 +11541,6 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14063
11541
  };
14064
11542
  }
14065
11543
  }
14066
- const webOptimizer = resolveOptimizerConfig((_f = (_e = testConfig.deps) == null ? void 0 : _e.optimizer) == null ? void 0 : _f.web, viteConfig.optimizeDeps, testConfig);
14067
- const ssrOptimizer = resolveOptimizerConfig((_h = (_g = testConfig.deps) == null ? void 0 : _g.optimizer) == null ? void 0 : _h.ssr, (_i = viteConfig.ssr) == null ? void 0 : _i.optimizeDeps, testConfig);
14068
- config.cacheDir = webOptimizer.cacheDir || ssrOptimizer.cacheDir || config.cacheDir;
14069
- config.optimizeDeps = webOptimizer.optimizeDeps;
14070
- config.ssr = {
14071
- optimizeDeps: ssrOptimizer.optimizeDeps
14072
- };
14073
11544
  return config;
14074
11545
  },
14075
11546
  async configResolved(viteConfig) {
@@ -14110,7 +11581,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14110
11581
  try {
14111
11582
  await ctx.setServer(options, server, userConfig);
14112
11583
  if (options.api && options.watch)
14113
- (await import('./chunk-api-setup.cc5282f7.js')).setup(ctx);
11584
+ (await import('./chunk-api-setup.3b016b1c.js')).setup(ctx);
14114
11585
  } catch (err) {
14115
11586
  await ctx.logger.printError(err, { fullStack: true });
14116
11587
  process.exit(1);
@@ -14125,7 +11596,8 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14125
11596
  CoverageTransform(ctx),
14126
11597
  options.ui ? await UIPlugin() : null,
14127
11598
  MocksPlugin(),
14128
- VitestResolver(ctx)
11599
+ VitestResolver(ctx),
11600
+ VitestOptimizer()
14129
11601
  ].filter(notNullish);
14130
11602
  }
14131
11603
 
@@ -20600,4 +18072,4 @@ async function startVitest(mode, cliFilters = [], options = {}, viteOverrides) {
20600
18072
  return ctx;
20601
18073
  }
20602
18074
 
20603
- export { BaseSequencer as B, VitestPlugin as V, createVitest as c, divider as d, onetimeExports as o, registerConsoleShortcuts as r, startVitest as s, version$1 as v };
18075
+ export { BaseSequencer as B, VitestPlugin as V, createVitest as c, onetimeExports as o, registerConsoleShortcuts as r, startVitest as s, version$1 as v };