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