vitest 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.d.ts +3 -2
  3. package/dist/browser.js +2 -1
  4. package/dist/chunks/{api-setup.srzH0bDf.js → api-setup.Xh60JpeM.js} +27 -64
  5. package/dist/chunks/{integrations-globals.J_6tnlri.js → integrations-globals.FlQVNhQx.js} +6 -6
  6. package/dist/chunks/{runtime-runBaseTests.QReNMrJA.js → runtime-runBaseTests.0UwIvo_U.js} +9 -9
  7. package/dist/cli-wrapper.js +1 -1
  8. package/dist/cli.js +1314 -69
  9. package/dist/config.cjs +1 -1
  10. package/dist/config.d.ts +1 -1
  11. package/dist/coverage.d.ts +3 -3
  12. package/dist/environments.d.ts +1 -1
  13. package/dist/environments.js +1 -1
  14. package/dist/execute.d.ts +1 -1
  15. package/dist/execute.js +2 -2
  16. package/dist/index.d.ts +74 -78
  17. package/dist/index.js +7 -7
  18. package/dist/node.d.ts +3 -3
  19. package/dist/node.js +21 -21
  20. package/dist/{reporters-1evA5lom.d.ts → reporters-QGe8gs4b.d.ts} +146 -55
  21. package/dist/reporters.d.ts +1 -1
  22. package/dist/reporters.js +20 -6
  23. package/dist/runners.d.ts +6 -6
  24. package/dist/runners.js +10 -10
  25. package/dist/{suite-ghspeorC.d.ts → suite-xGC-mxBC.d.ts} +1 -1
  26. package/dist/suite.d.ts +2 -2
  27. package/dist/suite.js +2 -2
  28. package/dist/vendor/{base.Rmxiv35Y.js → base.RpormaJz.js} +2 -2
  29. package/dist/vendor/{base.QYERqzkH.js → base.knFzp7G3.js} +1 -1
  30. package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
  31. package/dist/vendor/{node.Zme77R4t.js → cli-api.RIYLcWhB.js} +1510 -3639
  32. package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
  33. package/dist/vendor/{execute.TxmaEFIQ.js → execute.aFSzc0Da.js} +23 -12
  34. package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
  35. package/dist/vendor/{index.RDKo8czB.js → index.CKbXK54q.js} +7 -3
  36. package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
  37. package/dist/vendor/index.QcWmThJv.js +4927 -0
  38. package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
  39. package/dist/vendor/{index.LgG0iblq.js → index.n-Ib4UWN.js} +4 -3
  40. package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
  41. package/dist/vendor/setup-common.NSpEdAQm.js +45 -0
  42. package/dist/vendor/{vi.PPwhENHF.js → vi.-Nr_x6dl.js} +2 -1
  43. package/dist/vendor/{vm.jVxKtN5R.js → vm.UmCkcXp-.js} +25 -8
  44. package/dist/worker.js +5 -10
  45. package/dist/workers/forks.js +3 -3
  46. package/dist/workers/runVmTests.js +13 -9
  47. package/dist/workers/threads.js +3 -3
  48. package/dist/workers/vmForks.js +4 -4
  49. package/dist/workers/vmThreads.js +4 -4
  50. package/dist/workers.d.ts +3 -3
  51. package/dist/workers.js +8 -8
  52. package/globals.d.ts +2 -0
  53. package/jsdom.d.ts +6 -0
  54. package/package.json +24 -21
  55. package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
  56. package/dist/vendor/setup-common.C2iBd0K0.js +0 -29
@@ -1,2664 +0,0 @@
1
- import { performance } from 'node:perf_hooks';
2
- import c from 'picocolors';
3
- import { b as isNode, c as relativePath } from './index.rJjbcrrp.js';
4
- import { UNKNOWN_TEST_ID } from '../chunks/runtime-console.Iloo9fIt.js';
5
- import { isAbsolute, relative, dirname, basename, resolve } from 'pathe';
6
- import { b as slash, t as toArray } from './base.QYERqzkH.js';
7
- import { g as getFullName, h as hasFailedSnapshot } from './tasks.IknbGB2n.js';
8
- import { getSafeTimers, notNullish } from '@vitest/utils';
9
- import { isCI } from 'std-env';
10
- import { getTests, hasFailed, getSuites } from '@vitest/runner/utils';
11
- import { existsSync, promises } from 'node:fs';
12
- import { parseErrorStacktrace } from '@vitest/utils/source-map';
13
- import { hostname } from 'node:os';
14
- import { createRequire } from 'node:module';
15
-
16
- const F_RIGHT = "\u2192";
17
- const F_DOWN = "\u2193";
18
- const F_DOWN_RIGHT = "\u21B3";
19
- const F_POINTER = "\u276F";
20
- const F_DOT = "\xB7";
21
- const F_CHECK = "\u2713";
22
- const F_CROSS = "\xD7";
23
- const F_LONG_DASH = "\u23AF";
24
-
25
- function ansiRegex({onlyFirst = false} = {}) {
26
- const pattern = [
27
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
28
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
29
- ].join('|');
30
-
31
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
32
- }
33
-
34
- const regex = ansiRegex();
35
-
36
- function stripAnsi(string) {
37
- if (typeof string !== 'string') {
38
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
39
- }
40
-
41
- // Even though the regex is global, we don't need to reset the `.lastIndex`
42
- // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
43
- // and doing it manually has a performance penalty.
44
- return string.replace(regex, '');
45
- }
46
-
47
- const spinnerMap = /* @__PURE__ */ new WeakMap();
48
- const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
49
- const pointer = c.yellow(F_POINTER);
50
- const skipped = c.dim(c.gray(F_DOWN));
51
- function getCols(delta = 0) {
52
- var _a;
53
- let length = (_a = process.stdout) == null ? void 0 : _a.columns;
54
- if (!length || Number.isNaN(length))
55
- length = 30;
56
- return Math.max(length + delta, 0);
57
- }
58
- function divider(text, left, right) {
59
- const cols = getCols();
60
- if (text) {
61
- const textLength = stripAnsi(text).length;
62
- if (left == null && right != null) {
63
- left = cols - textLength - right;
64
- } else {
65
- left = left ?? Math.floor((cols - textLength) / 2);
66
- right = cols - textLength - left;
67
- }
68
- left = Math.max(0, left);
69
- right = Math.max(0, right);
70
- return `${F_LONG_DASH.repeat(left)}${text}${F_LONG_DASH.repeat(right)}`;
71
- }
72
- return F_LONG_DASH.repeat(cols);
73
- }
74
- function formatTestPath(root, path) {
75
- var _a;
76
- if (isAbsolute(path))
77
- path = relative(root, path);
78
- const dir = dirname(path);
79
- const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
80
- const base = basename(path, ext);
81
- return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
82
- }
83
- function renderSnapshotSummary(rootDir, snapshots) {
84
- const summary = [];
85
- if (snapshots.added)
86
- summary.push(c.bold(c.green(`${snapshots.added} written`)));
87
- if (snapshots.unmatched)
88
- summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
89
- if (snapshots.updated)
90
- summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
91
- if (snapshots.filesRemoved) {
92
- if (snapshots.didUpdate)
93
- summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
94
- else
95
- summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
96
- }
97
- if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
98
- const [head, ...tail] = snapshots.filesRemovedList;
99
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
100
- tail.forEach((key) => {
101
- summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
102
- });
103
- }
104
- if (snapshots.unchecked) {
105
- if (snapshots.didUpdate)
106
- summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
107
- else
108
- summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
109
- snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
110
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
111
- uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
112
- });
113
- }
114
- return summary;
115
- }
116
- function countTestErrors(tasks) {
117
- return tasks.reduce((c2, i) => {
118
- var _a, _b;
119
- return c2 + (((_b = (_a = i.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.length) || 0);
120
- }, 0);
121
- }
122
- function getStateString(tasks, name = "tests", showTotal = true) {
123
- if (tasks.length === 0)
124
- return c.dim(`no ${name}`);
125
- const passed = tasks.filter((i) => {
126
- var _a;
127
- return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
128
- });
129
- const failed = tasks.filter((i) => {
130
- var _a;
131
- return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
132
- });
133
- const skipped2 = tasks.filter((i) => i.mode === "skip");
134
- const todo = tasks.filter((i) => i.mode === "todo");
135
- return [
136
- failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
137
- passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
138
- skipped2.length ? c.yellow(`${skipped2.length} skipped`) : null,
139
- todo.length ? c.gray(`${todo.length} todo`) : null
140
- ].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
141
- }
142
- function getStateSymbol(task) {
143
- var _a;
144
- if (task.mode === "skip" || task.mode === "todo")
145
- return skipped;
146
- if (!task.result)
147
- return c.gray("\xB7");
148
- if (task.result.state === "run") {
149
- if (task.type === "suite")
150
- return pointer;
151
- let spinner = spinnerMap.get(task);
152
- if (!spinner) {
153
- spinner = elegantSpinner();
154
- spinnerMap.set(task, spinner);
155
- }
156
- return c.yellow(spinner());
157
- }
158
- if (task.result.state === "pass") {
159
- return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? c.green(F_DOT) : c.green(F_CHECK);
160
- }
161
- if (task.result.state === "fail") {
162
- return task.type === "suite" ? pointer : c.red(F_CROSS);
163
- }
164
- return " ";
165
- }
166
- function getHookStateSymbol(task, hookName) {
167
- var _a, _b;
168
- const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
169
- if (state && state === "run") {
170
- let spinnerMap2 = hookSpinnerMap.get(task);
171
- if (!spinnerMap2) {
172
- spinnerMap2 = /* @__PURE__ */ new Map();
173
- hookSpinnerMap.set(task, spinnerMap2);
174
- }
175
- let spinner = spinnerMap2.get(hookName);
176
- if (!spinner) {
177
- spinner = elegantSpinner();
178
- spinnerMap2.set(hookName, spinner);
179
- }
180
- return c.yellow(spinner());
181
- }
182
- }
183
- const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
184
- function elegantSpinner() {
185
- let index = 0;
186
- return () => {
187
- index = ++index % spinnerFrames.length;
188
- return spinnerFrames[index];
189
- };
190
- }
191
- function formatTimeString(date) {
192
- return date.toTimeString().split(" ")[0];
193
- }
194
- function formatProjectName(name, suffix = " ") {
195
- if (!name)
196
- return "";
197
- const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
198
- const colors = [
199
- c.blue,
200
- c.yellow,
201
- c.cyan,
202
- c.green,
203
- c.magenta
204
- ];
205
- return colors[index % colors.length](`|${name}|`) + suffix;
206
- }
207
-
208
- var _a;
209
- const BADGE_PADDING = " ";
210
- const HELP_HINT = `${c.dim("press ")}${c.bold("h")}${c.dim(" to show help")}`;
211
- const HELP_UPDATE_SNAP = c.dim("press ") + c.bold(c.yellow("u")) + c.dim(" to update snapshot");
212
- const HELP_QUITE = `${c.dim("press ")}${c.bold("q")}${c.dim(" to quit")}`;
213
- const WAIT_FOR_CHANGE_PASS = `
214
- ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")}`;
215
- const WAIT_FOR_CHANGE_FAIL = `
216
- ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(" Tests failed. Watching for file changes...")}`;
217
- const WAIT_FOR_CHANGE_CANCELLED = `
218
- ${c.bold(c.inverse(c.red(" CANCELLED ")))}${c.red(" Test run cancelled. Watching for file changes...")}`;
219
- const LAST_RUN_LOG_TIMEOUT = 1500;
220
- class BaseReporter {
221
- start = 0;
222
- end = 0;
223
- watchFilters;
224
- isTTY = isNode && ((_a = process.stdout) == null ? void 0 : _a.isTTY) && !isCI;
225
- ctx = void 0;
226
- _filesInWatchMode = /* @__PURE__ */ new Map();
227
- _lastRunTimeout = 0;
228
- _lastRunTimer;
229
- _lastRunCount = 0;
230
- _timeStart = /* @__PURE__ */ new Date();
231
- _offUnhandledRejection;
232
- constructor() {
233
- this.registerUnhandledRejection();
234
- }
235
- get mode() {
236
- return this.ctx.config.mode;
237
- }
238
- onInit(ctx) {
239
- this.ctx = ctx;
240
- ctx.onClose(() => {
241
- var _a2;
242
- (_a2 = this._offUnhandledRejection) == null ? void 0 : _a2.call(this);
243
- });
244
- ctx.logger.printBanner();
245
- this.start = performance.now();
246
- }
247
- relative(path) {
248
- return relativePath(this.ctx.config.root, path);
249
- }
250
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
251
- this.end = performance.now();
252
- await this.reportSummary(files, errors);
253
- if (errors.length) {
254
- if (!this.ctx.config.dangerouslyIgnoreUnhandledErrors)
255
- process.exitCode = 1;
256
- }
257
- }
258
- onTaskUpdate(packs) {
259
- var _a2, _b, _c, _d;
260
- if (this.isTTY)
261
- return;
262
- const logger = this.ctx.logger;
263
- for (const pack of packs) {
264
- const task = this.ctx.state.idMap.get(pack[0]);
265
- if (task && "filepath" in task && ((_a2 = task.result) == null ? void 0 : _a2.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
266
- const tests = getTests(task);
267
- const failed = tests.filter((t) => {
268
- var _a3;
269
- return ((_a3 = t.result) == null ? void 0 : _a3.state) === "fail";
270
- });
271
- const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
272
- let state = c.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
273
- if (failed.length)
274
- state += ` ${c.dim("|")} ${c.red(`${failed.length} failed`)}`;
275
- if (skipped.length)
276
- state += ` ${c.dim("|")} ${c.yellow(`${skipped.length} skipped`)}`;
277
- let suffix = c.dim(" (") + state + c.dim(")");
278
- if (task.result.duration) {
279
- const color = task.result.duration > this.ctx.config.slowTestThreshold ? c.yellow : c.gray;
280
- suffix += color(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
281
- }
282
- if (this.ctx.config.logHeapUsage && task.result.heap != null)
283
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
284
- let title = ` ${getStateSymbol(task)} `;
285
- if (task.projectName)
286
- title += formatProjectName(task.projectName);
287
- title += `${task.name} ${suffix}`;
288
- logger.log(title);
289
- for (const test of failed) {
290
- logger.log(c.red(` ${pointer} ${getFullName(test, c.dim(" > "))}`));
291
- (_d = (_c = test.result) == null ? void 0 : _c.errors) == null ? void 0 : _d.forEach((e) => {
292
- logger.log(c.red(` ${F_RIGHT} ${e == null ? void 0 : e.message}`));
293
- });
294
- }
295
- }
296
- }
297
- }
298
- async onWatcherStart(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
299
- this.resetLastRunLog();
300
- const failed = errors.length > 0 || hasFailed(files);
301
- const failedSnap = hasFailedSnapshot(files);
302
- const cancelled = this.ctx.isCancelling;
303
- if (failed)
304
- this.ctx.logger.log(WAIT_FOR_CHANGE_FAIL);
305
- else if (cancelled)
306
- this.ctx.logger.log(WAIT_FOR_CHANGE_CANCELLED);
307
- else
308
- this.ctx.logger.log(WAIT_FOR_CHANGE_PASS);
309
- const hints = [];
310
- hints.push(HELP_HINT);
311
- if (failedSnap)
312
- hints.unshift(HELP_UPDATE_SNAP);
313
- else
314
- hints.push(HELP_QUITE);
315
- this.ctx.logger.log(BADGE_PADDING + hints.join(c.dim(", ")));
316
- if (this._lastRunCount) {
317
- const LAST_RUN_TEXT = `rerun x${this._lastRunCount}`;
318
- const LAST_RUN_TEXTS = [
319
- c.blue(LAST_RUN_TEXT),
320
- c.gray(LAST_RUN_TEXT),
321
- c.dim(c.gray(LAST_RUN_TEXT))
322
- ];
323
- this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[0]);
324
- this._lastRunTimeout = 0;
325
- const { setInterval } = getSafeTimers();
326
- this._lastRunTimer = setInterval(
327
- () => {
328
- this._lastRunTimeout += 1;
329
- if (this._lastRunTimeout >= LAST_RUN_TEXTS.length)
330
- this.resetLastRunLog();
331
- else
332
- this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[this._lastRunTimeout]);
333
- },
334
- LAST_RUN_LOG_TIMEOUT / LAST_RUN_TEXTS.length
335
- );
336
- }
337
- }
338
- resetLastRunLog() {
339
- const { clearInterval } = getSafeTimers();
340
- clearInterval(this._lastRunTimer);
341
- this._lastRunTimer = void 0;
342
- this.ctx.logger.logUpdate.clear();
343
- }
344
- async onWatcherRerun(files, trigger) {
345
- this.resetLastRunLog();
346
- this.watchFilters = files;
347
- files.forEach((filepath) => {
348
- let reruns = this._filesInWatchMode.get(filepath) ?? 0;
349
- this._filesInWatchMode.set(filepath, ++reruns);
350
- });
351
- const BADGE = c.inverse(c.bold(c.blue(" RERUN ")));
352
- const TRIGGER = trigger ? c.dim(` ${this.relative(trigger)}`) : "";
353
- const FILENAME_PATTERN = this.ctx.filenamePattern ? `${BADGE_PADDING} ${c.dim("Filename pattern: ")}${c.blue(this.ctx.filenamePattern)}
354
- ` : "";
355
- const TESTNAME_PATTERN = this.ctx.configOverride.testNamePattern ? `${BADGE_PADDING} ${c.dim("Test name pattern: ")}${c.blue(String(this.ctx.configOverride.testNamePattern))}
356
- ` : "";
357
- const PROJECT_FILTER = this.ctx.configOverride.project ? `${BADGE_PADDING} ${c.dim("Project name: ")}${c.blue(toArray(this.ctx.configOverride.project).join(", "))}
358
- ` : "";
359
- if (files.length > 1 || !files.length) {
360
- this.ctx.logger.clearFullScreen(`
361
- ${BADGE}${TRIGGER}
362
- ${PROJECT_FILTER}${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
363
- this._lastRunCount = 0;
364
- } else if (files.length === 1) {
365
- const rerun = this._filesInWatchMode.get(files[0]) ?? 1;
366
- this._lastRunCount = rerun;
367
- this.ctx.logger.clearFullScreen(`
368
- ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
369
- ${PROJECT_FILTER}${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
370
- }
371
- this._timeStart = /* @__PURE__ */ new Date();
372
- this.start = performance.now();
373
- }
374
- onUserConsoleLog(log) {
375
- if (!this.shouldLog(log))
376
- return;
377
- const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
378
- const header = c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : log.taskId !== UNKNOWN_TEST_ID ? log.taskId : "unknown test"}`));
379
- process[log.type].write(`${header}
380
- ${log.content}
381
- `);
382
- }
383
- shouldLog(log) {
384
- var _a2, _b;
385
- if (this.ctx.config.silent)
386
- return false;
387
- const shouldLog = (_b = (_a2 = this.ctx.config).onConsoleLog) == null ? void 0 : _b.call(_a2, log.content, log.type);
388
- if (shouldLog === false)
389
- return shouldLog;
390
- return true;
391
- }
392
- onServerRestart(reason) {
393
- this.ctx.logger.log(c.bold(c.magenta(
394
- reason === "config" ? "\nRestarting due to config changes..." : "\nRestarting Vitest..."
395
- )));
396
- }
397
- async reportSummary(files, errors) {
398
- await this.printErrorsSummary(files, errors);
399
- if (this.mode === "benchmark")
400
- await this.reportBenchmarkSummary(files);
401
- else
402
- await this.reportTestSummary(files, errors);
403
- }
404
- async reportTestSummary(files, errors) {
405
- const tests = getTests(files);
406
- const logger = this.ctx.logger;
407
- const executionTime = this.end - this.start;
408
- const collectTime = files.reduce((acc, test) => acc + Math.max(0, test.collectDuration || 0), 0);
409
- const setupTime = files.reduce((acc, test) => acc + Math.max(0, test.setupDuration || 0), 0);
410
- const testsTime = files.reduce((acc, test) => {
411
- var _a2;
412
- return acc + Math.max(0, ((_a2 = test.result) == null ? void 0 : _a2.duration) || 0);
413
- }, 0);
414
- const transformTime = this.ctx.projects.flatMap((w) => Array.from(w.vitenode.fetchCache.values()).map((i) => i.duration || 0)).reduce((a, b) => a + b, 0);
415
- const environmentTime = files.reduce((acc, file) => acc + Math.max(0, file.environmentLoad || 0), 0);
416
- const prepareTime = files.reduce((acc, file) => acc + Math.max(0, file.prepareDuration || 0), 0);
417
- const threadTime = collectTime + testsTime + setupTime;
418
- const padTitle = (str) => c.dim(`${str.padStart(11)} `);
419
- const time = (time2) => {
420
- if (time2 > 1e3)
421
- return `${(time2 / 1e3).toFixed(2)}s`;
422
- return `${Math.round(time2)}ms`;
423
- };
424
- const snapshotOutput = renderSnapshotSummary(this.ctx.config.root, this.ctx.snapshot.summary);
425
- if (snapshotOutput.length) {
426
- logger.log(snapshotOutput.map(
427
- (t, i) => i === 0 ? `${padTitle("Snapshots")} ${t}` : `${padTitle("")} ${t}`
428
- ).join("\n"));
429
- if (snapshotOutput.length > 1)
430
- logger.log();
431
- }
432
- logger.log(padTitle("Test Files"), getStateString(files));
433
- logger.log(padTitle("Tests"), getStateString(tests));
434
- if (this.ctx.projects.some((c2) => c2.config.typecheck.enabled)) {
435
- const failed = tests.filter((t) => {
436
- var _a2, _b, _c;
437
- return ((_a2 = t.meta) == null ? void 0 : _a2.typecheck) && ((_c = (_b = t.result) == null ? void 0 : _b.errors) == null ? void 0 : _c.length);
438
- });
439
- logger.log(padTitle("Type Errors"), failed.length ? c.bold(c.red(`${failed.length} failed`)) : c.dim("no errors"));
440
- }
441
- if (errors.length)
442
- logger.log(padTitle("Errors"), c.bold(c.red(`${errors.length} error${errors.length > 1 ? "s" : ""}`)));
443
- logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
444
- if (this.watchFilters) {
445
- logger.log(padTitle("Duration"), time(threadTime));
446
- } else {
447
- let timers = `transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)}, environment ${time(environmentTime)}, prepare ${time(prepareTime)}`;
448
- const typecheck = this.ctx.projects.reduce((acc, c2) => {
449
- var _a2;
450
- return acc + (((_a2 = c2.typechecker) == null ? void 0 : _a2.getResult().time) || 0);
451
- }, 0);
452
- if (typecheck)
453
- timers += `, typecheck ${time(typecheck)}`;
454
- logger.log(padTitle("Duration"), time(executionTime) + c.dim(` (${timers})`));
455
- }
456
- logger.log();
457
- }
458
- async printErrorsSummary(files, errors) {
459
- const logger = this.ctx.logger;
460
- const suites = getSuites(files);
461
- const tests = getTests(files);
462
- const failedSuites = suites.filter((i) => {
463
- var _a2;
464
- return (_a2 = i.result) == null ? void 0 : _a2.errors;
465
- });
466
- const failedTests = tests.filter((i) => {
467
- var _a2;
468
- return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
469
- });
470
- const failedTotal = countTestErrors(failedSuites) + countTestErrors(failedTests);
471
- let current = 1;
472
- const errorDivider = () => logger.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
473
- `);
474
- if (failedSuites.length) {
475
- logger.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
476
- logger.error();
477
- await this.printTaskErrors(failedSuites, errorDivider);
478
- }
479
- if (failedTests.length) {
480
- logger.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
481
- logger.error();
482
- await this.printTaskErrors(failedTests, errorDivider);
483
- }
484
- if (errors.length) {
485
- await logger.printUnhandledErrors(errors);
486
- logger.error();
487
- }
488
- return tests;
489
- }
490
- async reportBenchmarkSummary(files) {
491
- const logger = this.ctx.logger;
492
- const benches = getTests(files);
493
- const topBenches = benches.filter((i) => {
494
- var _a2, _b;
495
- return ((_b = (_a2 = i.result) == null ? void 0 : _a2.benchmark) == null ? void 0 : _b.rank) === 1;
496
- });
497
- logger.log(`
498
- ${c.cyan(c.inverse(c.bold(" BENCH ")))} ${c.cyan("Summary")}
499
- `);
500
- for (const bench of topBenches) {
501
- const group = bench.suite;
502
- if (!group)
503
- continue;
504
- const groupName = getFullName(group, c.dim(" > "));
505
- logger.log(` ${bench.name}${c.dim(` - ${groupName}`)}`);
506
- const siblings = group.tasks.filter((i) => {
507
- var _a2;
508
- return ((_a2 = i.result) == null ? void 0 : _a2.benchmark) && i !== bench;
509
- }).sort((a, b) => a.result.benchmark.rank - b.result.benchmark.rank);
510
- for (const sibling of siblings) {
511
- const number = `${(sibling.result.benchmark.mean / bench.result.benchmark.mean).toFixed(2)}x`;
512
- logger.log(` ${c.green(number)} ${c.gray("faster than")} ${sibling.name}`);
513
- }
514
- logger.log("");
515
- }
516
- }
517
- async printTaskErrors(tasks, errorDivider) {
518
- var _a2, _b, _c;
519
- const errorsQueue = [];
520
- for (const task of tasks) {
521
- (_b = (_a2 = task.result) == null ? void 0 : _a2.errors) == null ? void 0 : _b.forEach((error) => {
522
- const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
523
- var _a3, _b2, _c2, _d;
524
- const hasStr = ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
525
- if (!hasStr)
526
- return false;
527
- const currentProjectName = (task == null ? void 0 : task.projectName) || ((_b2 = task.file) == null ? void 0 : _b2.projectName);
528
- const projectName = ((_c2 = i[1][0]) == null ? void 0 : _c2.projectName) || ((_d = i[1][0].file) == null ? void 0 : _d.projectName);
529
- return projectName === currentProjectName;
530
- });
531
- if (errorItem)
532
- errorItem[1].push(task);
533
- else
534
- errorsQueue.push([error, [task]]);
535
- });
536
- }
537
- for (const [error, tasks2] of errorsQueue) {
538
- for (const task of tasks2) {
539
- const filepath = (task == null ? void 0 : task.filepath) || "";
540
- const projectName = (task == null ? void 0 : task.projectName) || ((_c = task.file) == null ? void 0 : _c.projectName);
541
- let name = getFullName(task, c.dim(" > "));
542
- if (filepath)
543
- name = `${name} ${c.dim(`[ ${this.relative(filepath)} ]`)}`;
544
- this.ctx.logger.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${formatProjectName(projectName)}${name}`);
545
- }
546
- const project = this.ctx.getProjectByTaskId(tasks2[0].id);
547
- await this.ctx.logger.printError(error, { project });
548
- errorDivider();
549
- await Promise.resolve();
550
- }
551
- }
552
- registerUnhandledRejection() {
553
- const onUnhandledRejection = async (err) => {
554
- process.exitCode = 1;
555
- await this.ctx.logger.printError(err, { fullStack: true, type: "Unhandled Rejection" });
556
- this.ctx.logger.error("\n\n");
557
- process.exit(1);
558
- };
559
- process.on("unhandledRejection", onUnhandledRejection);
560
- this._offUnhandledRejection = () => {
561
- process.off("unhandledRejection", onUnhandledRejection);
562
- };
563
- }
564
- }
565
-
566
- class BasicReporter extends BaseReporter {
567
- isTTY = false;
568
- reportSummary(files, errors) {
569
- this.ctx.logger.log();
570
- return super.reportSummary(files, errors);
571
- }
572
- }
573
-
574
- /* eslint-disable yoda */
575
-
576
- function isFullwidthCodePoint(codePoint) {
577
- if (!Number.isInteger(codePoint)) {
578
- return false;
579
- }
580
-
581
- // Code points are derived from:
582
- // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
583
- return codePoint >= 0x1100 && (
584
- codePoint <= 0x115F || // Hangul Jamo
585
- codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
586
- codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
587
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
588
- (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
589
- // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
590
- (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
591
- // CJK Unified Ideographs .. Yi Radicals
592
- (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
593
- // Hangul Jamo Extended-A
594
- (0xA960 <= codePoint && codePoint <= 0xA97C) ||
595
- // Hangul Syllables
596
- (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
597
- // CJK Compatibility Ideographs
598
- (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
599
- // Vertical Forms
600
- (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
601
- // CJK Compatibility Forms .. Small Form Variants
602
- (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
603
- // Halfwidth and Fullwidth Forms
604
- (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
605
- (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
606
- // Kana Supplement
607
- (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
608
- // Enclosed Ideographic Supplement
609
- (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
610
- // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
611
- (0x20000 <= codePoint && codePoint <= 0x3FFFD)
612
- );
613
- }
614
-
615
- const ANSI_BACKGROUND_OFFSET = 10;
616
-
617
- const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
618
-
619
- const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
620
-
621
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
622
-
623
- const styles = {
624
- modifier: {
625
- reset: [0, 0],
626
- // 21 isn't widely supported and 22 does the same thing
627
- bold: [1, 22],
628
- dim: [2, 22],
629
- italic: [3, 23],
630
- underline: [4, 24],
631
- overline: [53, 55],
632
- inverse: [7, 27],
633
- hidden: [8, 28],
634
- strikethrough: [9, 29],
635
- },
636
- color: {
637
- black: [30, 39],
638
- red: [31, 39],
639
- green: [32, 39],
640
- yellow: [33, 39],
641
- blue: [34, 39],
642
- magenta: [35, 39],
643
- cyan: [36, 39],
644
- white: [37, 39],
645
-
646
- // Bright color
647
- blackBright: [90, 39],
648
- gray: [90, 39], // Alias of `blackBright`
649
- grey: [90, 39], // Alias of `blackBright`
650
- redBright: [91, 39],
651
- greenBright: [92, 39],
652
- yellowBright: [93, 39],
653
- blueBright: [94, 39],
654
- magentaBright: [95, 39],
655
- cyanBright: [96, 39],
656
- whiteBright: [97, 39],
657
- },
658
- bgColor: {
659
- bgBlack: [40, 49],
660
- bgRed: [41, 49],
661
- bgGreen: [42, 49],
662
- bgYellow: [43, 49],
663
- bgBlue: [44, 49],
664
- bgMagenta: [45, 49],
665
- bgCyan: [46, 49],
666
- bgWhite: [47, 49],
667
-
668
- // Bright color
669
- bgBlackBright: [100, 49],
670
- bgGray: [100, 49], // Alias of `bgBlackBright`
671
- bgGrey: [100, 49], // Alias of `bgBlackBright`
672
- bgRedBright: [101, 49],
673
- bgGreenBright: [102, 49],
674
- bgYellowBright: [103, 49],
675
- bgBlueBright: [104, 49],
676
- bgMagentaBright: [105, 49],
677
- bgCyanBright: [106, 49],
678
- bgWhiteBright: [107, 49],
679
- },
680
- };
681
-
682
- Object.keys(styles.modifier);
683
- const foregroundColorNames = Object.keys(styles.color);
684
- const backgroundColorNames = Object.keys(styles.bgColor);
685
- [...foregroundColorNames, ...backgroundColorNames];
686
-
687
- function assembleStyles() {
688
- const codes = new Map();
689
-
690
- for (const [groupName, group] of Object.entries(styles)) {
691
- for (const [styleName, style] of Object.entries(group)) {
692
- styles[styleName] = {
693
- open: `\u001B[${style[0]}m`,
694
- close: `\u001B[${style[1]}m`,
695
- };
696
-
697
- group[styleName] = styles[styleName];
698
-
699
- codes.set(style[0], style[1]);
700
- }
701
-
702
- Object.defineProperty(styles, groupName, {
703
- value: group,
704
- enumerable: false,
705
- });
706
- }
707
-
708
- Object.defineProperty(styles, 'codes', {
709
- value: codes,
710
- enumerable: false,
711
- });
712
-
713
- styles.color.close = '\u001B[39m';
714
- styles.bgColor.close = '\u001B[49m';
715
-
716
- styles.color.ansi = wrapAnsi16();
717
- styles.color.ansi256 = wrapAnsi256();
718
- styles.color.ansi16m = wrapAnsi16m();
719
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
720
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
721
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
722
-
723
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
724
- Object.defineProperties(styles, {
725
- rgbToAnsi256: {
726
- value: (red, green, blue) => {
727
- // We use the extended greyscale palette here, with the exception of
728
- // black and white. normal palette only has 4 greyscale shades.
729
- if (red === green && green === blue) {
730
- if (red < 8) {
731
- return 16;
732
- }
733
-
734
- if (red > 248) {
735
- return 231;
736
- }
737
-
738
- return Math.round(((red - 8) / 247) * 24) + 232;
739
- }
740
-
741
- return 16
742
- + (36 * Math.round(red / 255 * 5))
743
- + (6 * Math.round(green / 255 * 5))
744
- + Math.round(blue / 255 * 5);
745
- },
746
- enumerable: false,
747
- },
748
- hexToRgb: {
749
- value: hex => {
750
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
751
- if (!matches) {
752
- return [0, 0, 0];
753
- }
754
-
755
- let [colorString] = matches;
756
-
757
- if (colorString.length === 3) {
758
- colorString = [...colorString].map(character => character + character).join('');
759
- }
760
-
761
- const integer = Number.parseInt(colorString, 16);
762
-
763
- return [
764
- /* eslint-disable no-bitwise */
765
- (integer >> 16) & 0xFF,
766
- (integer >> 8) & 0xFF,
767
- integer & 0xFF,
768
- /* eslint-enable no-bitwise */
769
- ];
770
- },
771
- enumerable: false,
772
- },
773
- hexToAnsi256: {
774
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
775
- enumerable: false,
776
- },
777
- ansi256ToAnsi: {
778
- value: code => {
779
- if (code < 8) {
780
- return 30 + code;
781
- }
782
-
783
- if (code < 16) {
784
- return 90 + (code - 8);
785
- }
786
-
787
- let red;
788
- let green;
789
- let blue;
790
-
791
- if (code >= 232) {
792
- red = (((code - 232) * 10) + 8) / 255;
793
- green = red;
794
- blue = red;
795
- } else {
796
- code -= 16;
797
-
798
- const remainder = code % 36;
799
-
800
- red = Math.floor(code / 36) / 5;
801
- green = Math.floor(remainder / 6) / 5;
802
- blue = (remainder % 6) / 5;
803
- }
804
-
805
- const value = Math.max(red, green, blue) * 2;
806
-
807
- if (value === 0) {
808
- return 30;
809
- }
810
-
811
- // eslint-disable-next-line no-bitwise
812
- let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
813
-
814
- if (value === 2) {
815
- result += 60;
816
- }
817
-
818
- return result;
819
- },
820
- enumerable: false,
821
- },
822
- rgbToAnsi: {
823
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
824
- enumerable: false,
825
- },
826
- hexToAnsi: {
827
- value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
828
- enumerable: false,
829
- },
830
- });
831
-
832
- return styles;
833
- }
834
-
835
- const ansiStyles = assembleStyles();
836
-
837
- const astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
838
-
839
- const ESCAPES = [
840
- '\u001B',
841
- '\u009B'
842
- ];
843
-
844
- const wrapAnsi = code => `${ESCAPES[0]}[${code}m`;
845
-
846
- const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
847
- let output = [];
848
- ansiCodes = [...ansiCodes];
849
-
850
- for (let ansiCode of ansiCodes) {
851
- const ansiCodeOrigin = ansiCode;
852
- if (ansiCode.includes(';')) {
853
- ansiCode = ansiCode.split(';')[0][0] + '0';
854
- }
855
-
856
- const item = ansiStyles.codes.get(Number.parseInt(ansiCode, 10));
857
- if (item) {
858
- const indexEscape = ansiCodes.indexOf(item.toString());
859
- if (indexEscape === -1) {
860
- output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
861
- } else {
862
- ansiCodes.splice(indexEscape, 1);
863
- }
864
- } else if (isEscapes) {
865
- output.push(wrapAnsi(0));
866
- break;
867
- } else {
868
- output.push(wrapAnsi(ansiCodeOrigin));
869
- }
870
- }
871
-
872
- if (isEscapes) {
873
- output = output.filter((element, index) => output.indexOf(element) === index);
874
-
875
- if (endAnsiCode !== undefined) {
876
- const fistEscapeCode = wrapAnsi(ansiStyles.codes.get(Number.parseInt(endAnsiCode, 10)));
877
- // TODO: Remove the use of `.reduce` here.
878
- // eslint-disable-next-line unicorn/no-array-reduce
879
- output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
880
- }
881
- }
882
-
883
- return output.join('');
884
- };
885
-
886
- function sliceAnsi(string, begin, end) {
887
- const characters = [...string];
888
- const ansiCodes = [];
889
-
890
- let stringEnd = typeof end === 'number' ? end : characters.length;
891
- let isInsideEscape = false;
892
- let ansiCode;
893
- let visible = 0;
894
- let output = '';
895
-
896
- for (const [index, character] of characters.entries()) {
897
- let leftEscape = false;
898
-
899
- if (ESCAPES.includes(character)) {
900
- const code = /\d[^m]*/.exec(string.slice(index, index + 18));
901
- ansiCode = code && code.length > 0 ? code[0] : undefined;
902
-
903
- if (visible < stringEnd) {
904
- isInsideEscape = true;
905
-
906
- if (ansiCode !== undefined) {
907
- ansiCodes.push(ansiCode);
908
- }
909
- }
910
- } else if (isInsideEscape && character === 'm') {
911
- isInsideEscape = false;
912
- leftEscape = true;
913
- }
914
-
915
- if (!isInsideEscape && !leftEscape) {
916
- visible++;
917
- }
918
-
919
- if (!astralRegex.test(character) && isFullwidthCodePoint(character.codePointAt())) {
920
- visible++;
921
-
922
- if (typeof end !== 'number') {
923
- stringEnd++;
924
- }
925
- }
926
-
927
- if (visible > begin && visible <= stringEnd) {
928
- output += character;
929
- } else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
930
- output = checkAnsi(ansiCodes);
931
- } else if (visible >= stringEnd) {
932
- output += checkAnsi(ansiCodes, true, ansiCode);
933
- break;
934
- }
935
- }
936
-
937
- return output;
938
- }
939
-
940
- // Generated code.
941
-
942
- function isAmbiguous(x) {
943
- return x === 0xA1
944
- || x === 0xA4
945
- || x === 0xA7
946
- || x === 0xA8
947
- || x === 0xAA
948
- || x === 0xAD
949
- || x === 0xAE
950
- || x >= 0xB0 && x <= 0xB4
951
- || x >= 0xB6 && x <= 0xBA
952
- || x >= 0xBC && x <= 0xBF
953
- || x === 0xC6
954
- || x === 0xD0
955
- || x === 0xD7
956
- || x === 0xD8
957
- || x >= 0xDE && x <= 0xE1
958
- || x === 0xE6
959
- || x >= 0xE8 && x <= 0xEA
960
- || x === 0xEC
961
- || x === 0xED
962
- || x === 0xF0
963
- || x === 0xF2
964
- || x === 0xF3
965
- || x >= 0xF7 && x <= 0xFA
966
- || x === 0xFC
967
- || x === 0xFE
968
- || x === 0x101
969
- || x === 0x111
970
- || x === 0x113
971
- || x === 0x11B
972
- || x === 0x126
973
- || x === 0x127
974
- || x === 0x12B
975
- || x >= 0x131 && x <= 0x133
976
- || x === 0x138
977
- || x >= 0x13F && x <= 0x142
978
- || x === 0x144
979
- || x >= 0x148 && x <= 0x14B
980
- || x === 0x14D
981
- || x === 0x152
982
- || x === 0x153
983
- || x === 0x166
984
- || x === 0x167
985
- || x === 0x16B
986
- || x === 0x1CE
987
- || x === 0x1D0
988
- || x === 0x1D2
989
- || x === 0x1D4
990
- || x === 0x1D6
991
- || x === 0x1D8
992
- || x === 0x1DA
993
- || x === 0x1DC
994
- || x === 0x251
995
- || x === 0x261
996
- || x === 0x2C4
997
- || x === 0x2C7
998
- || x >= 0x2C9 && x <= 0x2CB
999
- || x === 0x2CD
1000
- || x === 0x2D0
1001
- || x >= 0x2D8 && x <= 0x2DB
1002
- || x === 0x2DD
1003
- || x === 0x2DF
1004
- || x >= 0x300 && x <= 0x36F
1005
- || x >= 0x391 && x <= 0x3A1
1006
- || x >= 0x3A3 && x <= 0x3A9
1007
- || x >= 0x3B1 && x <= 0x3C1
1008
- || x >= 0x3C3 && x <= 0x3C9
1009
- || x === 0x401
1010
- || x >= 0x410 && x <= 0x44F
1011
- || x === 0x451
1012
- || x === 0x2010
1013
- || x >= 0x2013 && x <= 0x2016
1014
- || x === 0x2018
1015
- || x === 0x2019
1016
- || x === 0x201C
1017
- || x === 0x201D
1018
- || x >= 0x2020 && x <= 0x2022
1019
- || x >= 0x2024 && x <= 0x2027
1020
- || x === 0x2030
1021
- || x === 0x2032
1022
- || x === 0x2033
1023
- || x === 0x2035
1024
- || x === 0x203B
1025
- || x === 0x203E
1026
- || x === 0x2074
1027
- || x === 0x207F
1028
- || x >= 0x2081 && x <= 0x2084
1029
- || x === 0x20AC
1030
- || x === 0x2103
1031
- || x === 0x2105
1032
- || x === 0x2109
1033
- || x === 0x2113
1034
- || x === 0x2116
1035
- || x === 0x2121
1036
- || x === 0x2122
1037
- || x === 0x2126
1038
- || x === 0x212B
1039
- || x === 0x2153
1040
- || x === 0x2154
1041
- || x >= 0x215B && x <= 0x215E
1042
- || x >= 0x2160 && x <= 0x216B
1043
- || x >= 0x2170 && x <= 0x2179
1044
- || x === 0x2189
1045
- || x >= 0x2190 && x <= 0x2199
1046
- || x === 0x21B8
1047
- || x === 0x21B9
1048
- || x === 0x21D2
1049
- || x === 0x21D4
1050
- || x === 0x21E7
1051
- || x === 0x2200
1052
- || x === 0x2202
1053
- || x === 0x2203
1054
- || x === 0x2207
1055
- || x === 0x2208
1056
- || x === 0x220B
1057
- || x === 0x220F
1058
- || x === 0x2211
1059
- || x === 0x2215
1060
- || x === 0x221A
1061
- || x >= 0x221D && x <= 0x2220
1062
- || x === 0x2223
1063
- || x === 0x2225
1064
- || x >= 0x2227 && x <= 0x222C
1065
- || x === 0x222E
1066
- || x >= 0x2234 && x <= 0x2237
1067
- || x === 0x223C
1068
- || x === 0x223D
1069
- || x === 0x2248
1070
- || x === 0x224C
1071
- || x === 0x2252
1072
- || x === 0x2260
1073
- || x === 0x2261
1074
- || x >= 0x2264 && x <= 0x2267
1075
- || x === 0x226A
1076
- || x === 0x226B
1077
- || x === 0x226E
1078
- || x === 0x226F
1079
- || x === 0x2282
1080
- || x === 0x2283
1081
- || x === 0x2286
1082
- || x === 0x2287
1083
- || x === 0x2295
1084
- || x === 0x2299
1085
- || x === 0x22A5
1086
- || x === 0x22BF
1087
- || x === 0x2312
1088
- || x >= 0x2460 && x <= 0x24E9
1089
- || x >= 0x24EB && x <= 0x254B
1090
- || x >= 0x2550 && x <= 0x2573
1091
- || x >= 0x2580 && x <= 0x258F
1092
- || x >= 0x2592 && x <= 0x2595
1093
- || x === 0x25A0
1094
- || x === 0x25A1
1095
- || x >= 0x25A3 && x <= 0x25A9
1096
- || x === 0x25B2
1097
- || x === 0x25B3
1098
- || x === 0x25B6
1099
- || x === 0x25B7
1100
- || x === 0x25BC
1101
- || x === 0x25BD
1102
- || x === 0x25C0
1103
- || x === 0x25C1
1104
- || x >= 0x25C6 && x <= 0x25C8
1105
- || x === 0x25CB
1106
- || x >= 0x25CE && x <= 0x25D1
1107
- || x >= 0x25E2 && x <= 0x25E5
1108
- || x === 0x25EF
1109
- || x === 0x2605
1110
- || x === 0x2606
1111
- || x === 0x2609
1112
- || x === 0x260E
1113
- || x === 0x260F
1114
- || x === 0x261C
1115
- || x === 0x261E
1116
- || x === 0x2640
1117
- || x === 0x2642
1118
- || x === 0x2660
1119
- || x === 0x2661
1120
- || x >= 0x2663 && x <= 0x2665
1121
- || x >= 0x2667 && x <= 0x266A
1122
- || x === 0x266C
1123
- || x === 0x266D
1124
- || x === 0x266F
1125
- || x === 0x269E
1126
- || x === 0x269F
1127
- || x === 0x26BF
1128
- || x >= 0x26C6 && x <= 0x26CD
1129
- || x >= 0x26CF && x <= 0x26D3
1130
- || x >= 0x26D5 && x <= 0x26E1
1131
- || x === 0x26E3
1132
- || x === 0x26E8
1133
- || x === 0x26E9
1134
- || x >= 0x26EB && x <= 0x26F1
1135
- || x === 0x26F4
1136
- || x >= 0x26F6 && x <= 0x26F9
1137
- || x === 0x26FB
1138
- || x === 0x26FC
1139
- || x === 0x26FE
1140
- || x === 0x26FF
1141
- || x === 0x273D
1142
- || x >= 0x2776 && x <= 0x277F
1143
- || x >= 0x2B56 && x <= 0x2B59
1144
- || x >= 0x3248 && x <= 0x324F
1145
- || x >= 0xE000 && x <= 0xF8FF
1146
- || x >= 0xFE00 && x <= 0xFE0F
1147
- || x === 0xFFFD
1148
- || x >= 0x1F100 && x <= 0x1F10A
1149
- || x >= 0x1F110 && x <= 0x1F12D
1150
- || x >= 0x1F130 && x <= 0x1F169
1151
- || x >= 0x1F170 && x <= 0x1F18D
1152
- || x === 0x1F18F
1153
- || x === 0x1F190
1154
- || x >= 0x1F19B && x <= 0x1F1AC
1155
- || x >= 0xE0100 && x <= 0xE01EF
1156
- || x >= 0xF0000 && x <= 0xFFFFD
1157
- || x >= 0x100000 && x <= 0x10FFFD;
1158
- }
1159
-
1160
- function isFullWidth(x) {
1161
- return x === 0x3000
1162
- || x >= 0xFF01 && x <= 0xFF60
1163
- || x >= 0xFFE0 && x <= 0xFFE6;
1164
- }
1165
-
1166
- function isWide(x) {
1167
- return x >= 0x1100 && x <= 0x115F
1168
- || x === 0x231A
1169
- || x === 0x231B
1170
- || x === 0x2329
1171
- || x === 0x232A
1172
- || x >= 0x23E9 && x <= 0x23EC
1173
- || x === 0x23F0
1174
- || x === 0x23F3
1175
- || x === 0x25FD
1176
- || x === 0x25FE
1177
- || x === 0x2614
1178
- || x === 0x2615
1179
- || x >= 0x2648 && x <= 0x2653
1180
- || x === 0x267F
1181
- || x === 0x2693
1182
- || x === 0x26A1
1183
- || x === 0x26AA
1184
- || x === 0x26AB
1185
- || x === 0x26BD
1186
- || x === 0x26BE
1187
- || x === 0x26C4
1188
- || x === 0x26C5
1189
- || x === 0x26CE
1190
- || x === 0x26D4
1191
- || x === 0x26EA
1192
- || x === 0x26F2
1193
- || x === 0x26F3
1194
- || x === 0x26F5
1195
- || x === 0x26FA
1196
- || x === 0x26FD
1197
- || x === 0x2705
1198
- || x === 0x270A
1199
- || x === 0x270B
1200
- || x === 0x2728
1201
- || x === 0x274C
1202
- || x === 0x274E
1203
- || x >= 0x2753 && x <= 0x2755
1204
- || x === 0x2757
1205
- || x >= 0x2795 && x <= 0x2797
1206
- || x === 0x27B0
1207
- || x === 0x27BF
1208
- || x === 0x2B1B
1209
- || x === 0x2B1C
1210
- || x === 0x2B50
1211
- || x === 0x2B55
1212
- || x >= 0x2E80 && x <= 0x2E99
1213
- || x >= 0x2E9B && x <= 0x2EF3
1214
- || x >= 0x2F00 && x <= 0x2FD5
1215
- || x >= 0x2FF0 && x <= 0x2FFF
1216
- || x >= 0x3001 && x <= 0x303E
1217
- || x >= 0x3041 && x <= 0x3096
1218
- || x >= 0x3099 && x <= 0x30FF
1219
- || x >= 0x3105 && x <= 0x312F
1220
- || x >= 0x3131 && x <= 0x318E
1221
- || x >= 0x3190 && x <= 0x31E3
1222
- || x >= 0x31EF && x <= 0x321E
1223
- || x >= 0x3220 && x <= 0x3247
1224
- || x >= 0x3250 && x <= 0x4DBF
1225
- || x >= 0x4E00 && x <= 0xA48C
1226
- || x >= 0xA490 && x <= 0xA4C6
1227
- || x >= 0xA960 && x <= 0xA97C
1228
- || x >= 0xAC00 && x <= 0xD7A3
1229
- || x >= 0xF900 && x <= 0xFAFF
1230
- || x >= 0xFE10 && x <= 0xFE19
1231
- || x >= 0xFE30 && x <= 0xFE52
1232
- || x >= 0xFE54 && x <= 0xFE66
1233
- || x >= 0xFE68 && x <= 0xFE6B
1234
- || x >= 0x16FE0 && x <= 0x16FE4
1235
- || x === 0x16FF0
1236
- || x === 0x16FF1
1237
- || x >= 0x17000 && x <= 0x187F7
1238
- || x >= 0x18800 && x <= 0x18CD5
1239
- || x >= 0x18D00 && x <= 0x18D08
1240
- || x >= 0x1AFF0 && x <= 0x1AFF3
1241
- || x >= 0x1AFF5 && x <= 0x1AFFB
1242
- || x === 0x1AFFD
1243
- || x === 0x1AFFE
1244
- || x >= 0x1B000 && x <= 0x1B122
1245
- || x === 0x1B132
1246
- || x >= 0x1B150 && x <= 0x1B152
1247
- || x === 0x1B155
1248
- || x >= 0x1B164 && x <= 0x1B167
1249
- || x >= 0x1B170 && x <= 0x1B2FB
1250
- || x === 0x1F004
1251
- || x === 0x1F0CF
1252
- || x === 0x1F18E
1253
- || x >= 0x1F191 && x <= 0x1F19A
1254
- || x >= 0x1F200 && x <= 0x1F202
1255
- || x >= 0x1F210 && x <= 0x1F23B
1256
- || x >= 0x1F240 && x <= 0x1F248
1257
- || x === 0x1F250
1258
- || x === 0x1F251
1259
- || x >= 0x1F260 && x <= 0x1F265
1260
- || x >= 0x1F300 && x <= 0x1F320
1261
- || x >= 0x1F32D && x <= 0x1F335
1262
- || x >= 0x1F337 && x <= 0x1F37C
1263
- || x >= 0x1F37E && x <= 0x1F393
1264
- || x >= 0x1F3A0 && x <= 0x1F3CA
1265
- || x >= 0x1F3CF && x <= 0x1F3D3
1266
- || x >= 0x1F3E0 && x <= 0x1F3F0
1267
- || x === 0x1F3F4
1268
- || x >= 0x1F3F8 && x <= 0x1F43E
1269
- || x === 0x1F440
1270
- || x >= 0x1F442 && x <= 0x1F4FC
1271
- || x >= 0x1F4FF && x <= 0x1F53D
1272
- || x >= 0x1F54B && x <= 0x1F54E
1273
- || x >= 0x1F550 && x <= 0x1F567
1274
- || x === 0x1F57A
1275
- || x === 0x1F595
1276
- || x === 0x1F596
1277
- || x === 0x1F5A4
1278
- || x >= 0x1F5FB && x <= 0x1F64F
1279
- || x >= 0x1F680 && x <= 0x1F6C5
1280
- || x === 0x1F6CC
1281
- || x >= 0x1F6D0 && x <= 0x1F6D2
1282
- || x >= 0x1F6D5 && x <= 0x1F6D7
1283
- || x >= 0x1F6DC && x <= 0x1F6DF
1284
- || x === 0x1F6EB
1285
- || x === 0x1F6EC
1286
- || x >= 0x1F6F4 && x <= 0x1F6FC
1287
- || x >= 0x1F7E0 && x <= 0x1F7EB
1288
- || x === 0x1F7F0
1289
- || x >= 0x1F90C && x <= 0x1F93A
1290
- || x >= 0x1F93C && x <= 0x1F945
1291
- || x >= 0x1F947 && x <= 0x1F9FF
1292
- || x >= 0x1FA70 && x <= 0x1FA7C
1293
- || x >= 0x1FA80 && x <= 0x1FA88
1294
- || x >= 0x1FA90 && x <= 0x1FABD
1295
- || x >= 0x1FABF && x <= 0x1FAC5
1296
- || x >= 0x1FACE && x <= 0x1FADB
1297
- || x >= 0x1FAE0 && x <= 0x1FAE8
1298
- || x >= 0x1FAF0 && x <= 0x1FAF8
1299
- || x >= 0x20000 && x <= 0x2FFFD
1300
- || x >= 0x30000 && x <= 0x3FFFD;
1301
- }
1302
-
1303
- function validate(codePoint) {
1304
- if (!Number.isSafeInteger(codePoint)) {
1305
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
1306
- }
1307
- }
1308
-
1309
- function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
1310
- validate(codePoint);
1311
-
1312
- if (
1313
- isFullWidth(codePoint)
1314
- || isWide(codePoint)
1315
- || (ambiguousAsWide && isAmbiguous(codePoint))
1316
- ) {
1317
- return 2;
1318
- }
1319
-
1320
- return 1;
1321
- }
1322
-
1323
- var emojiRegex = () => {
1324
- // https://mths.be/emoji
1325
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
1326
- };
1327
-
1328
- function stringWidth(string, options = {}) {
1329
- if (typeof string !== 'string' || string.length === 0) {
1330
- return 0;
1331
- }
1332
-
1333
- const {
1334
- ambiguousIsNarrow = true,
1335
- countAnsiEscapeCodes = false,
1336
- } = options;
1337
-
1338
- if (!countAnsiEscapeCodes) {
1339
- string = stripAnsi(string);
1340
- }
1341
-
1342
- if (string.length === 0) {
1343
- return 0;
1344
- }
1345
-
1346
- let width = 0;
1347
-
1348
- for (const {segment: character} of new Intl.Segmenter().segment(string)) {
1349
- const codePoint = character.codePointAt(0);
1350
-
1351
- // Ignore control characters
1352
- if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
1353
- continue;
1354
- }
1355
-
1356
- // Ignore combining characters
1357
- if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
1358
- continue;
1359
- }
1360
-
1361
- if (emojiRegex().test(character)) {
1362
- width += 2;
1363
- continue;
1364
- }
1365
-
1366
- width += eastAsianWidth(codePoint, {ambiguousAsWide: !ambiguousIsNarrow});
1367
- }
1368
-
1369
- return width;
1370
- }
1371
-
1372
- function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
1373
- if (string.charAt(wantedIndex) === ' ') {
1374
- return wantedIndex;
1375
- }
1376
-
1377
- const direction = shouldSearchRight ? 1 : -1;
1378
-
1379
- for (let index = 0; index <= 3; index++) {
1380
- const finalIndex = wantedIndex + (index * direction);
1381
- if (string.charAt(finalIndex) === ' ') {
1382
- return finalIndex;
1383
- }
1384
- }
1385
-
1386
- return wantedIndex;
1387
- }
1388
-
1389
- function cliTruncate(text, columns, options = {}) {
1390
- const {
1391
- position = 'end',
1392
- space = false,
1393
- preferTruncationOnSpace = false,
1394
- } = options;
1395
-
1396
- let {truncationCharacter = '…'} = options;
1397
-
1398
- if (typeof text !== 'string') {
1399
- throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
1400
- }
1401
-
1402
- if (typeof columns !== 'number') {
1403
- throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
1404
- }
1405
-
1406
- if (columns < 1) {
1407
- return '';
1408
- }
1409
-
1410
- if (columns === 1) {
1411
- return truncationCharacter;
1412
- }
1413
-
1414
- const length = stringWidth(text);
1415
-
1416
- if (length <= columns) {
1417
- return text;
1418
- }
1419
-
1420
- if (position === 'start') {
1421
- if (preferTruncationOnSpace) {
1422
- const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
1423
- return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
1424
- }
1425
-
1426
- if (space === true) {
1427
- truncationCharacter += ' ';
1428
- }
1429
-
1430
- return truncationCharacter + sliceAnsi(text, length - columns + stringWidth(truncationCharacter), length);
1431
- }
1432
-
1433
- if (position === 'middle') {
1434
- if (space === true) {
1435
- truncationCharacter = ` ${truncationCharacter} `;
1436
- }
1437
-
1438
- const half = Math.floor(columns / 2);
1439
-
1440
- if (preferTruncationOnSpace) {
1441
- const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
1442
- const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
1443
- return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
1444
- }
1445
-
1446
- return (
1447
- sliceAnsi(text, 0, half)
1448
- + truncationCharacter
1449
- + sliceAnsi(text, length - (columns - half) + stringWidth(truncationCharacter), length)
1450
- );
1451
- }
1452
-
1453
- if (position === 'end') {
1454
- if (preferTruncationOnSpace) {
1455
- const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
1456
- return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
1457
- }
1458
-
1459
- if (space === true) {
1460
- truncationCharacter = ` ${truncationCharacter}`;
1461
- }
1462
-
1463
- return sliceAnsi(text, 0, columns - stringWidth(truncationCharacter)) + truncationCharacter;
1464
- }
1465
-
1466
- throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
1467
- }
1468
-
1469
- const outputMap$1 = /* @__PURE__ */ new WeakMap();
1470
- function formatFilepath$1(path) {
1471
- const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
1472
- const basename = path.slice(lastSlash);
1473
- let firstDot = basename.indexOf(".");
1474
- if (firstDot < 0)
1475
- firstDot = basename.length;
1476
- firstDot += lastSlash;
1477
- return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
1478
- }
1479
- function formatNumber$1(number) {
1480
- const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
1481
- return res[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ",") + (res[1] ? `.${res[1]}` : "");
1482
- }
1483
- function renderHookState(task, hookName, level = 0) {
1484
- var _a, _b;
1485
- const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
1486
- if (state && state === "run")
1487
- return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${c.dim(`[ ${hookName} ]`)}`;
1488
- return "";
1489
- }
1490
- function renderBenchmarkItems$1(result) {
1491
- return [
1492
- result.name,
1493
- formatNumber$1(result.hz || 0),
1494
- formatNumber$1(result.p99 || 0),
1495
- `\xB1${result.rme.toFixed(2)}%`,
1496
- result.samples.length.toString()
1497
- ];
1498
- }
1499
- function renderBenchmark$1(task, tasks) {
1500
- var _a;
1501
- const result = (_a = task.result) == null ? void 0 : _a.benchmark;
1502
- if (!result)
1503
- return task.name;
1504
- const benches = tasks.map((i) => {
1505
- var _a2, _b;
1506
- return ((_a2 = i.meta) == null ? void 0 : _a2.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
1507
- }).filter(notNullish);
1508
- const allItems = benches.map(renderBenchmarkItems$1);
1509
- const items = renderBenchmarkItems$1(result);
1510
- const padded = items.map((i, idx) => {
1511
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
1512
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
1513
- });
1514
- return [
1515
- padded[0],
1516
- // name
1517
- c.dim(" "),
1518
- c.blue(padded[1]),
1519
- c.dim(" ops/sec "),
1520
- c.cyan(padded[3]),
1521
- c.dim(` (${padded[4]} samples)`),
1522
- result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
1523
- ].join("");
1524
- }
1525
- function renderTree$1(tasks, options, level = 0, maxRows) {
1526
- var _a, _b, _c, _d, _e, _f, _g, _h;
1527
- const output = [];
1528
- let currentRowCount = 0;
1529
- for (const task of [...tasks].reverse()) {
1530
- const taskOutput = [];
1531
- let suffix = "";
1532
- let prefix = ` ${getStateSymbol(task)} `;
1533
- if (level === 0 && task.type === "suite" && task.projectName)
1534
- prefix += formatProjectName(task.projectName);
1535
- if (task.type === "test" && ((_a = task.result) == null ? void 0 : _a.retryCount) && task.result.retryCount > 0)
1536
- suffix += c.yellow(` (retry x${task.result.retryCount})`);
1537
- if (task.type === "suite") {
1538
- const tests = getTests(task);
1539
- suffix += c.dim(` (${tests.length})`);
1540
- }
1541
- if (task.mode === "skip" || task.mode === "todo")
1542
- suffix += ` ${c.dim(c.gray("[skipped]"))}`;
1543
- if (task.type === "test" && ((_b = task.result) == null ? void 0 : _b.repeatCount) && task.result.repeatCount > 0)
1544
- suffix += c.yellow(` (repeat x${task.result.repeatCount})`);
1545
- if (((_c = task.result) == null ? void 0 : _c.duration) != null) {
1546
- if (task.result.duration > options.slowTestThreshold)
1547
- suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
1548
- }
1549
- if (options.showHeap && ((_d = task.result) == null ? void 0 : _d.heap) != null)
1550
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
1551
- let name = task.name;
1552
- if (level === 0)
1553
- name = formatFilepath$1(name);
1554
- const padding = " ".repeat(level);
1555
- const body = ((_e = task.meta) == null ? void 0 : _e.benchmark) ? renderBenchmark$1(task, tasks) : name;
1556
- taskOutput.push(padding + prefix + body + suffix);
1557
- if (((_f = task.result) == null ? void 0 : _f.state) !== "pass" && outputMap$1.get(task) != null) {
1558
- let data = outputMap$1.get(task);
1559
- if (typeof data === "string") {
1560
- data = stripAnsi(data.trim().split("\n").filter(Boolean).pop());
1561
- if (data === "")
1562
- data = void 0;
1563
- }
1564
- if (data != null) {
1565
- const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
1566
- taskOutput.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
1567
- }
1568
- }
1569
- taskOutput.push(renderHookState(task, "beforeAll", level + 1));
1570
- taskOutput.push(renderHookState(task, "beforeEach", level + 1));
1571
- if (task.type === "suite" && task.tasks.length > 0) {
1572
- if (((_g = task.result) == null ? void 0 : _g.state) === "fail" || ((_h = task.result) == null ? void 0 : _h.state) === "run" || options.renderSucceed) {
1573
- if (options.logger.ctx.config.hideSkippedTests) {
1574
- const filteredTasks = task.tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
1575
- taskOutput.push(renderTree$1(filteredTasks, options, level + 1, maxRows));
1576
- } else {
1577
- taskOutput.push(renderTree$1(task.tasks, options, level + 1, maxRows));
1578
- }
1579
- }
1580
- }
1581
- taskOutput.push(renderHookState(task, "afterAll", level + 1));
1582
- taskOutput.push(renderHookState(task, "afterEach", level + 1));
1583
- const rows = taskOutput.filter(Boolean);
1584
- output.push(rows.join("\n"));
1585
- currentRowCount += rows.length;
1586
- if (maxRows && currentRowCount >= maxRows)
1587
- break;
1588
- }
1589
- return output.reverse().join("\n");
1590
- }
1591
- function createListRenderer(_tasks, options) {
1592
- let tasks = _tasks;
1593
- let timer;
1594
- const log = options.logger.logUpdate;
1595
- function update() {
1596
- if (options.logger.ctx.config.hideSkippedTests) {
1597
- const filteredTasks = tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
1598
- log(renderTree$1(
1599
- filteredTasks,
1600
- options,
1601
- 0,
1602
- // log-update already limits the amount of printed rows to fit the current terminal
1603
- // but we can optimize performance by doing it ourselves
1604
- process.stdout.rows
1605
- ));
1606
- } else {
1607
- log(renderTree$1(
1608
- tasks,
1609
- options,
1610
- 0,
1611
- // log-update already limits the amount of printed rows to fit the current terminal
1612
- // but we can optimize performance by doing it ourselves
1613
- process.stdout.rows
1614
- ));
1615
- }
1616
- }
1617
- return {
1618
- start() {
1619
- if (timer)
1620
- return this;
1621
- timer = setInterval(update, 16);
1622
- return this;
1623
- },
1624
- update(_tasks2) {
1625
- tasks = _tasks2;
1626
- return this;
1627
- },
1628
- async stop() {
1629
- if (timer) {
1630
- clearInterval(timer);
1631
- timer = void 0;
1632
- }
1633
- log.clear();
1634
- if (options.logger.ctx.config.hideSkippedTests) {
1635
- const filteredTasks = tasks.filter((t) => t.mode !== "skip" && t.mode !== "todo");
1636
- options.logger.log(renderTree$1(filteredTasks, options));
1637
- } else {
1638
- options.logger.log(renderTree$1(tasks, options));
1639
- }
1640
- return this;
1641
- },
1642
- clear() {
1643
- log.clear();
1644
- }
1645
- };
1646
- }
1647
-
1648
- class DefaultReporter extends BaseReporter {
1649
- renderer;
1650
- rendererOptions = {};
1651
- renderSucceedDefault;
1652
- onPathsCollected(paths = []) {
1653
- if (this.isTTY) {
1654
- if (this.renderSucceedDefault === void 0)
1655
- this.renderSucceedDefault = !!this.rendererOptions.renderSucceed;
1656
- if (this.renderSucceedDefault !== true)
1657
- this.rendererOptions.renderSucceed = paths.length <= 1;
1658
- }
1659
- }
1660
- async onTestRemoved(trigger) {
1661
- await this.stopListRender();
1662
- this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
1663
- `) : ""), true);
1664
- const files = this.ctx.state.getFiles(this.watchFilters);
1665
- createListRenderer(files, this.rendererOptions).stop();
1666
- this.ctx.logger.log();
1667
- await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
1668
- super.onWatcherStart();
1669
- }
1670
- onCollected() {
1671
- if (this.isTTY) {
1672
- this.rendererOptions.logger = this.ctx.logger;
1673
- this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
1674
- this.rendererOptions.slowTestThreshold = this.ctx.config.slowTestThreshold;
1675
- this.rendererOptions.mode = this.mode;
1676
- const files = this.ctx.state.getFiles(this.watchFilters);
1677
- if (!this.renderer)
1678
- this.renderer = createListRenderer(files, this.rendererOptions).start();
1679
- else
1680
- this.renderer.update(files);
1681
- }
1682
- }
1683
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
1684
- await this.stopListRender();
1685
- this.ctx.logger.log();
1686
- await super.onFinished(files, errors);
1687
- }
1688
- async onWatcherStart(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
1689
- await this.stopListRender();
1690
- await super.onWatcherStart(files, errors);
1691
- }
1692
- async stopListRender() {
1693
- var _a;
1694
- await ((_a = this.renderer) == null ? void 0 : _a.stop());
1695
- this.renderer = void 0;
1696
- }
1697
- async onWatcherRerun(files, trigger) {
1698
- await this.stopListRender();
1699
- await super.onWatcherRerun(files, trigger);
1700
- }
1701
- onUserConsoleLog(log) {
1702
- var _a;
1703
- if (!this.shouldLog(log))
1704
- return;
1705
- (_a = this.renderer) == null ? void 0 : _a.clear();
1706
- super.onUserConsoleLog(log);
1707
- }
1708
- }
1709
-
1710
- const check = { char: "\xB7", color: c.green };
1711
- const cross = { char: "x", color: c.red };
1712
- const pending = { char: "*", color: c.yellow };
1713
- const skip = { char: "-", color: (char) => c.dim(c.gray(char)) };
1714
- function getIcon(task) {
1715
- var _a;
1716
- if (task.mode === "skip" || task.mode === "todo")
1717
- return skip;
1718
- switch ((_a = task.result) == null ? void 0 : _a.state) {
1719
- case "pass":
1720
- return check;
1721
- case "fail":
1722
- return cross;
1723
- default:
1724
- return pending;
1725
- }
1726
- }
1727
- function render(tasks, width) {
1728
- const all = getTests(tasks);
1729
- let currentIcon = pending;
1730
- let currentTasks = 0;
1731
- let previousLineWidth = 0;
1732
- let output = "";
1733
- const addOutput = () => {
1734
- const { char, color } = currentIcon;
1735
- const availableWidth = width - previousLineWidth;
1736
- if (availableWidth > currentTasks) {
1737
- output += color(char.repeat(currentTasks));
1738
- previousLineWidth += currentTasks;
1739
- } else {
1740
- let buf = `${char.repeat(availableWidth)}
1741
- `;
1742
- const remaining = currentTasks - availableWidth;
1743
- const fullRows = Math.floor(remaining / width);
1744
- buf += `${char.repeat(width)}
1745
- `.repeat(fullRows);
1746
- const partialRow = remaining % width;
1747
- if (partialRow > 0) {
1748
- buf += char.repeat(partialRow);
1749
- previousLineWidth = partialRow;
1750
- } else {
1751
- previousLineWidth = 0;
1752
- }
1753
- output += color(buf);
1754
- }
1755
- };
1756
- for (const task of all) {
1757
- const icon = getIcon(task);
1758
- if (icon === currentIcon) {
1759
- currentTasks++;
1760
- continue;
1761
- }
1762
- addOutput();
1763
- currentTasks = 1;
1764
- currentIcon = icon;
1765
- }
1766
- addOutput();
1767
- return output;
1768
- }
1769
- function createDotRenderer(_tasks, options) {
1770
- let tasks = _tasks;
1771
- let timer;
1772
- const { logUpdate: log, outputStream } = options.logger;
1773
- function update() {
1774
- log(render(tasks, outputStream.columns));
1775
- }
1776
- return {
1777
- start() {
1778
- if (timer)
1779
- return this;
1780
- timer = setInterval(update, 16);
1781
- return this;
1782
- },
1783
- update(_tasks2) {
1784
- tasks = _tasks2;
1785
- return this;
1786
- },
1787
- async stop() {
1788
- if (timer) {
1789
- clearInterval(timer);
1790
- timer = void 0;
1791
- }
1792
- log.clear();
1793
- options.logger.log(render(tasks, outputStream.columns));
1794
- return this;
1795
- },
1796
- clear() {
1797
- log.clear();
1798
- }
1799
- };
1800
- }
1801
-
1802
- class DotReporter extends BaseReporter {
1803
- renderer;
1804
- onCollected() {
1805
- if (this.isTTY) {
1806
- const files = this.ctx.state.getFiles(this.watchFilters);
1807
- if (!this.renderer)
1808
- this.renderer = createDotRenderer(files, { logger: this.ctx.logger }).start();
1809
- else
1810
- this.renderer.update(files);
1811
- }
1812
- }
1813
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
1814
- await this.stopListRender();
1815
- this.ctx.logger.log();
1816
- await super.onFinished(files, errors);
1817
- }
1818
- async onWatcherStart() {
1819
- await this.stopListRender();
1820
- super.onWatcherStart();
1821
- }
1822
- async stopListRender() {
1823
- var _a;
1824
- (_a = this.renderer) == null ? void 0 : _a.stop();
1825
- this.renderer = void 0;
1826
- await new Promise((resolve) => setTimeout(resolve, 10));
1827
- }
1828
- async onWatcherRerun(files, trigger) {
1829
- await this.stopListRender();
1830
- await super.onWatcherRerun(files, trigger);
1831
- }
1832
- onUserConsoleLog(log) {
1833
- var _a;
1834
- (_a = this.renderer) == null ? void 0 : _a.clear();
1835
- super.onUserConsoleLog(log);
1836
- }
1837
- }
1838
-
1839
- function getOutputFile(config, reporter) {
1840
- if (!(config == null ? void 0 : config.outputFile))
1841
- return;
1842
- if (typeof config.outputFile === "string")
1843
- return config.outputFile;
1844
- return config.outputFile[reporter];
1845
- }
1846
-
1847
- const StatusMap = {
1848
- fail: "failed",
1849
- only: "pending",
1850
- pass: "passed",
1851
- run: "pending",
1852
- skip: "skipped",
1853
- todo: "todo"
1854
- };
1855
- let JsonReporter$1 = class JsonReporter {
1856
- start = 0;
1857
- ctx;
1858
- onInit(ctx) {
1859
- this.ctx = ctx;
1860
- this.start = Date.now();
1861
- }
1862
- async logTasks(files) {
1863
- var _a, _b, _c;
1864
- const suites = getSuites(files);
1865
- const numTotalTestSuites = suites.length;
1866
- const tests = getTests(files);
1867
- const numTotalTests = tests.length;
1868
- const numFailedTestSuites = suites.filter((s) => {
1869
- var _a2;
1870
- return (_a2 = s.result) == null ? void 0 : _a2.errors;
1871
- }).length;
1872
- const numPassedTestSuites = numTotalTestSuites - numFailedTestSuites;
1873
- const numPendingTestSuites = suites.filter((s) => {
1874
- var _a2;
1875
- return ((_a2 = s.result) == null ? void 0 : _a2.state) === "run";
1876
- }).length;
1877
- const numFailedTests = tests.filter((t) => {
1878
- var _a2;
1879
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
1880
- }).length;
1881
- const numPassedTests = numTotalTests - numFailedTests;
1882
- const numPendingTests = tests.filter((t) => {
1883
- var _a2;
1884
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
1885
- }).length;
1886
- const numTodoTests = tests.filter((t) => t.mode === "todo").length;
1887
- const testResults = [];
1888
- const success = numFailedTestSuites === 0 && numFailedTests === 0;
1889
- for (const file of files) {
1890
- const tests2 = getTests([file]);
1891
- let startTime = tests2.reduce((prev, next) => {
1892
- var _a2;
1893
- return Math.min(prev, ((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? Number.POSITIVE_INFINITY);
1894
- }, Number.POSITIVE_INFINITY);
1895
- if (startTime === Number.POSITIVE_INFINITY)
1896
- startTime = this.start;
1897
- const endTime = tests2.reduce((prev, next) => {
1898
- var _a2, _b2;
1899
- return Math.max(prev, (((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? 0) + (((_b2 = next.result) == null ? void 0 : _b2.duration) ?? 0));
1900
- }, startTime);
1901
- const assertionResults = await Promise.all(tests2.map(async (t) => {
1902
- var _a2, _b2, _c2, _d;
1903
- const ancestorTitles = [];
1904
- let iter = t.suite;
1905
- while (iter) {
1906
- ancestorTitles.push(iter.name);
1907
- iter = iter.suite;
1908
- }
1909
- ancestorTitles.reverse();
1910
- return {
1911
- ancestorTitles,
1912
- fullName: ancestorTitles.length > 0 ? `${ancestorTitles.join(" ")} ${t.name}` : t.name,
1913
- status: StatusMap[((_a2 = t.result) == null ? void 0 : _a2.state) || t.mode] || "skipped",
1914
- title: t.name,
1915
- duration: (_b2 = t.result) == null ? void 0 : _b2.duration,
1916
- failureMessages: ((_d = (_c2 = t.result) == null ? void 0 : _c2.errors) == null ? void 0 : _d.map((e) => e.message)) || [],
1917
- location: await this.getFailureLocation(t)
1918
- };
1919
- }));
1920
- if (tests2.some((t) => {
1921
- var _a2;
1922
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
1923
- })) {
1924
- 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");
1925
- }
1926
- testResults.push({
1927
- assertionResults,
1928
- startTime,
1929
- endTime,
1930
- status: tests2.some((t) => {
1931
- var _a2;
1932
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
1933
- }) ? "failed" : "passed",
1934
- message: ((_c = (_b = (_a = file.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0]) == null ? void 0 : _c.message) ?? "",
1935
- name: file.filepath
1936
- });
1937
- }
1938
- const result = {
1939
- numTotalTestSuites,
1940
- numPassedTestSuites,
1941
- numFailedTestSuites,
1942
- numPendingTestSuites,
1943
- numTotalTests,
1944
- numPassedTests,
1945
- numFailedTests,
1946
- numPendingTests,
1947
- numTodoTests,
1948
- startTime: this.start,
1949
- success,
1950
- testResults
1951
- };
1952
- await this.writeReport(JSON.stringify(result));
1953
- }
1954
- async onFinished(files = this.ctx.state.getFiles()) {
1955
- await this.logTasks(files);
1956
- }
1957
- /**
1958
- * Writes the report to an output file if specified in the config,
1959
- * or logs it to the console otherwise.
1960
- * @param report
1961
- */
1962
- async writeReport(report) {
1963
- const outputFile = getOutputFile(this.ctx.config, "json");
1964
- if (outputFile) {
1965
- const reportFile = resolve(this.ctx.config.root, outputFile);
1966
- const outputDirectory = dirname(reportFile);
1967
- if (!existsSync(outputDirectory))
1968
- await promises.mkdir(outputDirectory, { recursive: true });
1969
- await promises.writeFile(reportFile, report, "utf-8");
1970
- this.ctx.logger.log(`JSON report written to ${reportFile}`);
1971
- } else {
1972
- this.ctx.logger.log(report);
1973
- }
1974
- }
1975
- async getFailureLocation(test) {
1976
- var _a, _b;
1977
- const error = (_b = (_a = test.result) == null ? void 0 : _a.errors) == null ? void 0 : _b[0];
1978
- if (!error)
1979
- return;
1980
- const project = this.ctx.getProjectByTaskId(test.id);
1981
- const stack = parseErrorStacktrace(error, {
1982
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file),
1983
- frameFilter: this.ctx.config.onStackTrace
1984
- });
1985
- const frame = stack[0];
1986
- if (!frame)
1987
- return;
1988
- return { line: frame.line, column: frame.column };
1989
- }
1990
- };
1991
-
1992
- class VerboseReporter extends DefaultReporter {
1993
- constructor() {
1994
- super();
1995
- this.rendererOptions.renderSucceed = true;
1996
- }
1997
- onTaskUpdate(packs) {
1998
- var _a, _b, _c, _d;
1999
- if (this.isTTY)
2000
- return;
2001
- for (const pack of packs) {
2002
- const task = this.ctx.state.idMap.get(pack[0]);
2003
- if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
2004
- let title = ` ${getStateSymbol(task)} `;
2005
- if ((_c = task.suite) == null ? void 0 : _c.projectName)
2006
- title += formatProjectName(task.suite.projectName);
2007
- title += getFullName(task, c.dim(" > "));
2008
- if (task.result.duration != null && task.result.duration > this.ctx.config.slowTestThreshold)
2009
- title += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
2010
- if (this.ctx.config.logHeapUsage && task.result.heap != null)
2011
- title += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
2012
- this.ctx.logger.log(title);
2013
- if (task.result.state === "fail") {
2014
- (_d = task.result.errors) == null ? void 0 : _d.forEach((error) => {
2015
- this.ctx.logger.log(c.red(` ${F_RIGHT} ${error == null ? void 0 : error.message}`));
2016
- });
2017
- }
2018
- }
2019
- }
2020
- }
2021
- }
2022
-
2023
- class IndentedLogger {
2024
- constructor(baseLog) {
2025
- this.baseLog = baseLog;
2026
- }
2027
- currentIndent = "";
2028
- indent() {
2029
- this.currentIndent += " ";
2030
- }
2031
- unindent() {
2032
- this.currentIndent = this.currentIndent.substring(0, this.currentIndent.length - 4);
2033
- }
2034
- log(text) {
2035
- return this.baseLog(this.currentIndent + text);
2036
- }
2037
- }
2038
-
2039
- function yamlString(str) {
2040
- return `"${str.replace(/"/g, '\\"')}"`;
2041
- }
2042
- function tapString(str) {
2043
- return str.replace(/\\/g, "\\\\").replace(/#/g, "\\#").replace(/\n/g, " ");
2044
- }
2045
- class TapReporter {
2046
- ctx;
2047
- logger;
2048
- onInit(ctx) {
2049
- this.ctx = ctx;
2050
- this.logger = new IndentedLogger(ctx.logger.log.bind(ctx.logger));
2051
- }
2052
- static getComment(task) {
2053
- var _a;
2054
- if (task.mode === "skip")
2055
- return " # SKIP";
2056
- else if (task.mode === "todo")
2057
- return " # TODO";
2058
- else if (((_a = task.result) == null ? void 0 : _a.duration) != null)
2059
- return ` # time=${task.result.duration.toFixed(2)}ms`;
2060
- else
2061
- return "";
2062
- }
2063
- logErrorDetails(error, stack) {
2064
- const errorName = error.name || error.nameStr || "Unknown Error";
2065
- this.logger.log(`name: ${yamlString(String(errorName))}`);
2066
- this.logger.log(`message: ${yamlString(String(error.message))}`);
2067
- if (stack) {
2068
- this.logger.log(`stack: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
2069
- }
2070
- }
2071
- logTasks(tasks) {
2072
- var _a, _b;
2073
- this.logger.log(`1..${tasks.length}`);
2074
- for (const [i, task] of tasks.entries()) {
2075
- const id = i + 1;
2076
- const ok = ((_a = task.result) == null ? void 0 : _a.state) === "pass" || task.mode === "skip" || task.mode === "todo" ? "ok" : "not ok";
2077
- const comment = TapReporter.getComment(task);
2078
- if (task.type === "suite" && task.tasks.length > 0) {
2079
- this.logger.log(`${ok} ${id} - ${tapString(task.name)}${comment} {`);
2080
- this.logger.indent();
2081
- this.logTasks(task.tasks);
2082
- this.logger.unindent();
2083
- this.logger.log("}");
2084
- } else {
2085
- this.logger.log(`${ok} ${id} - ${tapString(task.name)}${comment}`);
2086
- const project = this.ctx.getProjectByTaskId(task.id);
2087
- if (((_b = task.result) == null ? void 0 : _b.state) === "fail" && task.result.errors) {
2088
- this.logger.indent();
2089
- task.result.errors.forEach((error) => {
2090
- const stacks = parseErrorStacktrace(error, {
2091
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file),
2092
- frameFilter: this.ctx.config.onStackTrace
2093
- });
2094
- const stack = stacks[0];
2095
- this.logger.log("---");
2096
- this.logger.log("error:");
2097
- this.logger.indent();
2098
- this.logErrorDetails(error);
2099
- this.logger.unindent();
2100
- if (stack)
2101
- this.logger.log(`at: ${yamlString(`${stack.file}:${stack.line}:${stack.column}`)}`);
2102
- if (error.showDiff) {
2103
- this.logger.log(`actual: ${yamlString(error.actual)}`);
2104
- this.logger.log(`expected: ${yamlString(error.expected)}`);
2105
- }
2106
- });
2107
- this.logger.log("...");
2108
- this.logger.unindent();
2109
- }
2110
- }
2111
- }
2112
- }
2113
- async onFinished(files = this.ctx.state.getFiles()) {
2114
- this.logger.log("TAP version 13");
2115
- this.logTasks(files);
2116
- }
2117
- }
2118
-
2119
- function flattenTasks$1(task, baseName = "") {
2120
- const base = baseName ? `${baseName} > ` : "";
2121
- if (task.type === "suite") {
2122
- return task.tasks.flatMap((child) => flattenTasks$1(child, `${base}${task.name}`));
2123
- } else {
2124
- return [{
2125
- ...task,
2126
- name: `${base}${task.name}`
2127
- }];
2128
- }
2129
- }
2130
- function removeInvalidXMLCharacters(value, removeDiscouragedChars) {
2131
- let regex = /((?:[\0-\x08\x0B\f\x0E-\x1F\uFFFD\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g;
2132
- value = String(value || "").replace(regex, "");
2133
- if (removeDiscouragedChars) {
2134
- regex = new RegExp(
2135
- "([\\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]))",
2136
- "g"
2137
- );
2138
- value = value.replace(regex, "");
2139
- }
2140
- return value;
2141
- }
2142
- function escapeXML(value) {
2143
- return removeInvalidXMLCharacters(
2144
- String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;"),
2145
- true
2146
- );
2147
- }
2148
- function executionTime(durationMS) {
2149
- return (durationMS / 1e3).toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 10 });
2150
- }
2151
- function getDuration(task) {
2152
- var _a;
2153
- const duration = ((_a = task.result) == null ? void 0 : _a.duration) ?? 0;
2154
- return executionTime(duration);
2155
- }
2156
- class JUnitReporter {
2157
- ctx;
2158
- reportFile;
2159
- baseLog;
2160
- logger;
2161
- _timeStart = /* @__PURE__ */ new Date();
2162
- fileFd;
2163
- async onInit(ctx) {
2164
- this.ctx = ctx;
2165
- const outputFile = getOutputFile(this.ctx.config, "junit");
2166
- if (outputFile) {
2167
- this.reportFile = resolve(this.ctx.config.root, outputFile);
2168
- const outputDirectory = dirname(this.reportFile);
2169
- if (!existsSync(outputDirectory))
2170
- await promises.mkdir(outputDirectory, { recursive: true });
2171
- const fileFd = await promises.open(this.reportFile, "w+");
2172
- this.fileFd = fileFd;
2173
- this.baseLog = async (text) => {
2174
- if (!this.fileFd)
2175
- this.fileFd = await promises.open(this.reportFile, "w+");
2176
- await promises.writeFile(this.fileFd, `${text}
2177
- `);
2178
- };
2179
- } else {
2180
- this.baseLog = async (text) => this.ctx.logger.log(text);
2181
- }
2182
- this._timeStart = /* @__PURE__ */ new Date();
2183
- this.logger = new IndentedLogger(this.baseLog);
2184
- }
2185
- async writeElement(name, attrs, children) {
2186
- const pairs = [];
2187
- for (const key in attrs) {
2188
- const attr = attrs[key];
2189
- if (attr === void 0)
2190
- continue;
2191
- pairs.push(`${key}="${escapeXML(attr)}"`);
2192
- }
2193
- await this.logger.log(`<${name}${pairs.length ? ` ${pairs.join(" ")}` : ""}>`);
2194
- this.logger.indent();
2195
- await children.call(this);
2196
- this.logger.unindent();
2197
- await this.logger.log(`</${name}>`);
2198
- }
2199
- async writeErrorDetails(task, error) {
2200
- const errorName = error.name ?? error.nameStr ?? "Unknown Error";
2201
- const errorDetails = `${errorName}: ${error.message}`;
2202
- await this.baseLog(escapeXML(errorDetails));
2203
- const project = this.ctx.getProjectByTaskId(task.id);
2204
- const stack = parseErrorStacktrace(error, {
2205
- getSourceMap: (file) => project.getBrowserSourceMapModuleById(file),
2206
- frameFilter: this.ctx.config.onStackTrace
2207
- });
2208
- for (const frame of stack) {
2209
- const path = relative(this.ctx.config.root, frame.file);
2210
- await this.baseLog(escapeXML(` ${F_POINTER} ${[frame.method, `${path}:${frame.line}:${frame.column}`].filter(Boolean).join(" ")}`));
2211
- if (frame.file in this.ctx.state.filesMap)
2212
- break;
2213
- }
2214
- }
2215
- async writeLogs(task, type) {
2216
- if (task.logs == null || task.logs.length === 0)
2217
- return;
2218
- const logType = type === "err" ? "stderr" : "stdout";
2219
- const logs = task.logs.filter((log) => log.type === logType);
2220
- if (logs.length === 0)
2221
- return;
2222
- await this.writeElement(`system-${type}`, {}, async () => {
2223
- for (const log of logs)
2224
- await this.baseLog(escapeXML(log.content));
2225
- });
2226
- }
2227
- async writeTasks(tasks, filename) {
2228
- for (const task of tasks) {
2229
- await this.writeElement("testcase", {
2230
- classname: process.env.VITEST_JUNIT_CLASSNAME ?? filename,
2231
- name: task.name,
2232
- time: getDuration(task)
2233
- }, async () => {
2234
- var _a;
2235
- await this.writeLogs(task, "out");
2236
- await this.writeLogs(task, "err");
2237
- if (task.mode === "skip" || task.mode === "todo")
2238
- await this.logger.log("<skipped/>");
2239
- if (((_a = task.result) == null ? void 0 : _a.state) === "fail") {
2240
- const errors = task.result.errors || [];
2241
- for (const error of errors) {
2242
- await this.writeElement("failure", {
2243
- message: error == null ? void 0 : error.message,
2244
- type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
2245
- }, async () => {
2246
- if (!error)
2247
- return;
2248
- await this.writeErrorDetails(task, error);
2249
- });
2250
- }
2251
- }
2252
- });
2253
- }
2254
- }
2255
- async onFinished(files = this.ctx.state.getFiles()) {
2256
- var _a;
2257
- await this.logger.log('<?xml version="1.0" encoding="UTF-8" ?>');
2258
- const transformed = files.map((file) => {
2259
- var _a2, _b;
2260
- const tasks = file.tasks.flatMap((task) => flattenTasks$1(task));
2261
- const stats2 = tasks.reduce((stats3, task) => {
2262
- var _a3, _b2;
2263
- return {
2264
- passed: stats3.passed + Number(((_a3 = task.result) == null ? void 0 : _a3.state) === "pass"),
2265
- failures: stats3.failures + Number(((_b2 = task.result) == null ? void 0 : _b2.state) === "fail"),
2266
- skipped: stats3.skipped + Number(task.mode === "skip" || task.mode === "todo")
2267
- };
2268
- }, {
2269
- passed: 0,
2270
- failures: 0,
2271
- skipped: 0
2272
- });
2273
- const suites = getSuites(file);
2274
- for (const suite of suites) {
2275
- if ((_a2 = suite.result) == null ? void 0 : _a2.errors) {
2276
- tasks.push(suite);
2277
- stats2.failures += 1;
2278
- }
2279
- }
2280
- if (tasks.length === 0 && ((_b = file.result) == null ? void 0 : _b.state) === "fail") {
2281
- stats2.failures = 1;
2282
- tasks.push({
2283
- id: file.id,
2284
- type: "test",
2285
- name: file.name,
2286
- mode: "run",
2287
- result: file.result,
2288
- meta: {},
2289
- // NOTE: not used in JUnitReporter
2290
- context: null,
2291
- suite: null
2292
- });
2293
- }
2294
- return {
2295
- ...file,
2296
- tasks,
2297
- stats: stats2
2298
- };
2299
- });
2300
- const stats = transformed.reduce((stats2, file) => {
2301
- stats2.tests += file.tasks.length;
2302
- stats2.failures += file.stats.failures;
2303
- return stats2;
2304
- }, {
2305
- name: process.env.VITEST_JUNIT_SUITE_NAME || "vitest tests",
2306
- tests: 0,
2307
- failures: 0,
2308
- errors: 0,
2309
- // we cannot detect those
2310
- time: executionTime((/* @__PURE__ */ new Date()).getTime() - this._timeStart.getTime())
2311
- });
2312
- await this.writeElement("testsuites", stats, async () => {
2313
- for (const file of transformed) {
2314
- await this.writeElement("testsuite", {
2315
- name: file.name,
2316
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2317
- hostname: hostname(),
2318
- tests: file.tasks.length,
2319
- failures: file.stats.failures,
2320
- errors: 0,
2321
- // An errored test is one that had an unanticipated problem. We cannot detect those.
2322
- skipped: file.stats.skipped,
2323
- time: getDuration(file)
2324
- }, async () => {
2325
- await this.writeTasks(file.tasks, file.name);
2326
- });
2327
- }
2328
- });
2329
- if (this.reportFile)
2330
- this.ctx.logger.log(`JUNIT report written to ${this.reportFile}`);
2331
- await ((_a = this.fileFd) == null ? void 0 : _a.close());
2332
- this.fileFd = void 0;
2333
- }
2334
- }
2335
-
2336
- function flattenTasks(task, baseName = "") {
2337
- const base = baseName ? `${baseName} > ` : "";
2338
- if (task.type === "suite" && task.tasks.length > 0) {
2339
- return task.tasks.flatMap((child) => flattenTasks(child, `${base}${task.name}`));
2340
- } else {
2341
- return [{
2342
- ...task,
2343
- name: `${base}${task.name}`
2344
- }];
2345
- }
2346
- }
2347
- class TapFlatReporter extends TapReporter {
2348
- onInit(ctx) {
2349
- super.onInit(ctx);
2350
- }
2351
- async onFinished(files = this.ctx.state.getFiles()) {
2352
- this.ctx.logger.log("TAP version 13");
2353
- const flatTasks = files.flatMap((task) => flattenTasks(task));
2354
- this.logTasks(flatTasks);
2355
- }
2356
- }
2357
-
2358
- class HangingProcessReporter {
2359
- whyRunning;
2360
- onInit() {
2361
- const _require = createRequire(import.meta.url);
2362
- this.whyRunning = _require("why-is-node-running");
2363
- }
2364
- onProcessTimeout() {
2365
- var _a;
2366
- (_a = this.whyRunning) == null ? void 0 : _a.call(this);
2367
- }
2368
- }
2369
-
2370
- class JsonReporter {
2371
- start = 0;
2372
- ctx;
2373
- onInit(ctx) {
2374
- this.ctx = ctx;
2375
- }
2376
- async logTasks(files) {
2377
- var _a;
2378
- const suites = getSuites(files);
2379
- const numTotalTestSuites = suites.length;
2380
- const tests = getTests(files);
2381
- const numTotalTests = tests.length;
2382
- const testResults = {};
2383
- const outputFile = getOutputFile(this.ctx.config.benchmark, "json");
2384
- for (const file of files) {
2385
- const tests2 = getTests([file]);
2386
- for (const test of tests2) {
2387
- const res = (_a = test.result) == null ? void 0 : _a.benchmark;
2388
- if (!res || test.mode === "skip")
2389
- continue;
2390
- if (!outputFile)
2391
- res.samples = "ignore on terminal";
2392
- testResults[test.suite.name] = (testResults[test.suite.name] || []).concat(res);
2393
- }
2394
- if (tests2.some((t) => {
2395
- var _a2;
2396
- return ((_a2 = t.result) == null ? void 0 : _a2.state) === "run";
2397
- })) {
2398
- 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");
2399
- }
2400
- }
2401
- const result = {
2402
- numTotalTestSuites,
2403
- numTotalTests,
2404
- testResults
2405
- };
2406
- await this.writeReport(JSON.stringify(result, null, 2));
2407
- }
2408
- async onFinished(files = this.ctx.state.getFiles()) {
2409
- await this.logTasks(files);
2410
- }
2411
- /**
2412
- * Writes the report to an output file if specified in the config,
2413
- * or logs it to the console otherwise.
2414
- * @param report
2415
- */
2416
- async writeReport(report) {
2417
- const outputFile = getOutputFile(this.ctx.config.benchmark, "json");
2418
- if (outputFile) {
2419
- const reportFile = resolve(this.ctx.config.root, outputFile);
2420
- const outputDirectory = dirname(reportFile);
2421
- if (!existsSync(outputDirectory))
2422
- await promises.mkdir(outputDirectory, { recursive: true });
2423
- await promises.writeFile(reportFile, report, "utf-8");
2424
- this.ctx.logger.log(`json report written to ${reportFile}`);
2425
- } else {
2426
- this.ctx.logger.log(report);
2427
- }
2428
- }
2429
- }
2430
-
2431
- const outputMap = /* @__PURE__ */ new WeakMap();
2432
- function formatFilepath(path) {
2433
- const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
2434
- const basename = path.slice(lastSlash);
2435
- let firstDot = basename.indexOf(".");
2436
- if (firstDot < 0)
2437
- firstDot = basename.length;
2438
- firstDot += lastSlash;
2439
- return c.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + c.dim(path.slice(firstDot));
2440
- }
2441
- function formatNumber(number) {
2442
- const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
2443
- return res[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ",") + (res[1] ? `.${res[1]}` : "");
2444
- }
2445
- const tableHead = ["name", "hz", "min", "max", "mean", "p75", "p99", "p995", "p999", "rme", "samples"];
2446
- function renderTableHead(tasks) {
2447
- const benches = tasks.map((i) => {
2448
- var _a, _b;
2449
- return ((_a = i.meta) == null ? void 0 : _a.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
2450
- }).filter(notNullish);
2451
- const allItems = benches.map(renderBenchmarkItems).concat([tableHead]);
2452
- return `${" ".repeat(3)}${tableHead.map((i, idx) => {
2453
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
2454
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
2455
- }).map(c.bold).join(" ")}`;
2456
- }
2457
- function renderBenchmarkItems(result) {
2458
- return [
2459
- result.name,
2460
- formatNumber(result.hz || 0),
2461
- formatNumber(result.min || 0),
2462
- formatNumber(result.max || 0),
2463
- formatNumber(result.mean || 0),
2464
- formatNumber(result.p75 || 0),
2465
- formatNumber(result.p99 || 0),
2466
- formatNumber(result.p995 || 0),
2467
- formatNumber(result.p999 || 0),
2468
- `\xB1${(result.rme || 0).toFixed(2)}%`,
2469
- result.samples.length.toString()
2470
- ];
2471
- }
2472
- function renderBenchmark(task, tasks) {
2473
- var _a;
2474
- const result = (_a = task.result) == null ? void 0 : _a.benchmark;
2475
- if (!result)
2476
- return task.name;
2477
- const benches = tasks.map((i) => {
2478
- var _a2, _b;
2479
- return ((_a2 = i.meta) == null ? void 0 : _a2.benchmark) ? (_b = i.result) == null ? void 0 : _b.benchmark : void 0;
2480
- }).filter(notNullish);
2481
- const allItems = benches.map(renderBenchmarkItems).concat([tableHead]);
2482
- const items = renderBenchmarkItems(result);
2483
- const padded = items.map((i, idx) => {
2484
- const width = Math.max(...allItems.map((i2) => i2[idx].length));
2485
- return idx ? i.padStart(width, " ") : i.padEnd(width, " ");
2486
- });
2487
- return [
2488
- padded[0],
2489
- // name
2490
- c.blue(padded[1]),
2491
- // hz
2492
- c.cyan(padded[2]),
2493
- // min
2494
- c.cyan(padded[3]),
2495
- // max
2496
- c.cyan(padded[4]),
2497
- // mean
2498
- c.cyan(padded[5]),
2499
- // p75
2500
- c.cyan(padded[6]),
2501
- // p99
2502
- c.cyan(padded[7]),
2503
- // p995
2504
- c.cyan(padded[8]),
2505
- // p999
2506
- c.dim(padded[9]),
2507
- // rem
2508
- c.dim(padded[10]),
2509
- // sample
2510
- result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
2511
- ].join(" ");
2512
- }
2513
- function renderTree(tasks, options, level = 0) {
2514
- var _a, _b, _c, _d, _e, _f;
2515
- const output = [];
2516
- let idx = 0;
2517
- for (const task of tasks) {
2518
- const padding = " ".repeat(level ? 1 : 0);
2519
- let prefix = "";
2520
- if (idx === 0 && ((_a = task.meta) == null ? void 0 : _a.benchmark))
2521
- prefix += `${renderTableHead(tasks)}
2522
- ${padding}`;
2523
- prefix += ` ${getStateSymbol(task)} `;
2524
- let suffix = "";
2525
- if (task.type === "suite")
2526
- suffix += c.dim(` (${getTests(task).length})`);
2527
- if (task.mode === "skip" || task.mode === "todo")
2528
- suffix += ` ${c.dim(c.gray("[skipped]"))}`;
2529
- if (((_b = task.result) == null ? void 0 : _b.duration) != null) {
2530
- if (task.result.duration > options.slowTestThreshold)
2531
- suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
2532
- }
2533
- if (options.showHeap && ((_c = task.result) == null ? void 0 : _c.heap) != null)
2534
- suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
2535
- let name = task.name;
2536
- if (level === 0)
2537
- name = formatFilepath(name);
2538
- const body = ((_d = task.meta) == null ? void 0 : _d.benchmark) ? renderBenchmark(task, tasks) : name;
2539
- output.push(padding + prefix + body + suffix);
2540
- if (((_e = task.result) == null ? void 0 : _e.state) !== "pass" && outputMap.get(task) != null) {
2541
- let data = outputMap.get(task);
2542
- if (typeof data === "string") {
2543
- data = stripAnsi(data.trim().split("\n").filter(Boolean).pop());
2544
- if (data === "")
2545
- data = void 0;
2546
- }
2547
- if (data != null) {
2548
- const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
2549
- output.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
2550
- }
2551
- }
2552
- if (task.type === "suite" && task.tasks.length > 0) {
2553
- if ((_f = task.result) == null ? void 0 : _f.state)
2554
- output.push(renderTree(task.tasks, options, level + 1));
2555
- }
2556
- idx++;
2557
- }
2558
- return output.filter(Boolean).join("\n");
2559
- }
2560
- function createTableRenderer(_tasks, options) {
2561
- let tasks = _tasks;
2562
- let timer;
2563
- const log = options.logger.logUpdate;
2564
- function update() {
2565
- log(renderTree(tasks, options));
2566
- }
2567
- return {
2568
- start() {
2569
- if (timer)
2570
- return this;
2571
- timer = setInterval(update, 200);
2572
- return this;
2573
- },
2574
- update(_tasks2) {
2575
- tasks = _tasks2;
2576
- update();
2577
- return this;
2578
- },
2579
- async stop() {
2580
- if (timer) {
2581
- clearInterval(timer);
2582
- timer = void 0;
2583
- }
2584
- log.clear();
2585
- options.logger.log(renderTree(tasks, options));
2586
- return this;
2587
- },
2588
- clear() {
2589
- log.clear();
2590
- }
2591
- };
2592
- }
2593
-
2594
- class TableReporter extends BaseReporter {
2595
- renderer;
2596
- rendererOptions = {};
2597
- async onTestRemoved(trigger) {
2598
- await this.stopListRender();
2599
- this.ctx.logger.clearScreen(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
2600
- `) : ""), true);
2601
- const files = this.ctx.state.getFiles(this.watchFilters);
2602
- createTableRenderer(files, this.rendererOptions).stop();
2603
- this.ctx.logger.log();
2604
- await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
2605
- super.onWatcherStart();
2606
- }
2607
- onCollected() {
2608
- if (this.isTTY) {
2609
- this.rendererOptions.logger = this.ctx.logger;
2610
- this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
2611
- this.rendererOptions.slowTestThreshold = this.ctx.config.slowTestThreshold;
2612
- const files = this.ctx.state.getFiles(this.watchFilters);
2613
- if (!this.renderer)
2614
- this.renderer = createTableRenderer(files, this.rendererOptions).start();
2615
- else
2616
- this.renderer.update(files);
2617
- }
2618
- }
2619
- async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
2620
- await this.stopListRender();
2621
- this.ctx.logger.log();
2622
- await super.onFinished(files, errors);
2623
- }
2624
- async onWatcherStart() {
2625
- await this.stopListRender();
2626
- await super.onWatcherStart();
2627
- }
2628
- async stopListRender() {
2629
- var _a;
2630
- await ((_a = this.renderer) == null ? void 0 : _a.stop());
2631
- this.renderer = void 0;
2632
- }
2633
- async onWatcherRerun(files, trigger) {
2634
- await this.stopListRender();
2635
- await super.onWatcherRerun(files, trigger);
2636
- }
2637
- onUserConsoleLog(log) {
2638
- var _a;
2639
- if (!this.shouldLog(log))
2640
- return;
2641
- (_a = this.renderer) == null ? void 0 : _a.clear();
2642
- super.onUserConsoleLog(log);
2643
- }
2644
- }
2645
-
2646
- const BenchmarkReportsMap = {
2647
- default: TableReporter,
2648
- verbose: VerboseReporter,
2649
- json: JsonReporter
2650
- };
2651
-
2652
- const ReportersMap = {
2653
- "default": DefaultReporter,
2654
- "basic": BasicReporter,
2655
- "verbose": VerboseReporter,
2656
- "dot": DotReporter,
2657
- "json": JsonReporter$1,
2658
- "tap": TapReporter,
2659
- "tap-flat": TapFlatReporter,
2660
- "junit": JUnitReporter,
2661
- "hanging-process": HangingProcessReporter
2662
- };
2663
-
2664
- export { BenchmarkReportsMap as B, DefaultReporter as D, F_POINTER as F, HangingProcessReporter as H, JsonReporter$1 as J, ReportersMap as R, TapReporter as T, VerboseReporter as V, ansiStyles as a, sliceAnsi as b, cliTruncate as c, divider as d, BasicReporter as e, DotReporter as f, JUnitReporter as g, TapFlatReporter as h, stripAnsi as s };