vitest 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +7 -0
- package/dist/{chunk-api-setup.49283db8.js → chunk-api-setup.d70fc960.js} +5 -5
- package/dist/{chunk-constants.c8f1d38c.js → chunk-constants.d540b1d1.js} +1 -1
- package/dist/{chunk-defaults.43e746f3.js → chunk-defaults.04d5d90b.js} +1 -1
- package/dist/{chunk-install-pkg.cbf3a38b.js → chunk-install-pkg.73b84ae1.js} +113 -115
- package/dist/chunk-integrations-globals.d2c09cd2.js +29 -0
- package/dist/chunk-integrations-spy.f036df6f.js +102 -0
- package/dist/{chunk-runtime-chain.701cffd8.js → chunk-runtime-chain.f863f182.js} +931 -897
- package/dist/{chunk-runtime-mocker.e802beae.js → chunk-runtime-mocker.111ac858.js} +3 -3
- package/dist/{chunk-runtime-rpc.c47f2233.js → chunk-runtime-rpc.8f648236.js} +1 -1
- package/dist/{chunk-utils-global.a3293dce.js → chunk-utils-global.37a7c822.js} +8 -10
- package/dist/{chunk-utils-timers.b26e7c5c.js → chunk-utils-timers.12bc05d1.js} +1404 -1057
- package/dist/{chunk-vite-node-externalize.1c19fc5e.js → chunk-vite-node-externalize.5c678054.js} +544 -517
- package/dist/{chunk-vite-node-utils.b4debb0b.js → chunk-vite-node-utils.33447cc0.js} +71 -71
- package/dist/cli.js +12 -12
- package/dist/entry.js +15 -919
- package/dist/index.d.ts +90 -25
- package/dist/index.js +8 -8
- package/dist/node.d.ts +24 -7
- package/dist/node.js +11 -11
- package/dist/spy.js +2 -102
- package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
- package/dist/vendor-entry.369fd6c9.js +949 -0
- package/dist/vendor-index.405e58ef.js +6291 -0
- package/dist/{vendor-index.bd255bc8.js → vendor-index.40be925a.js} +173 -158
- package/dist/worker.js +6 -6
- package/package.json +4 -4
- package/dist/chunk-integrations-globals.b4a20711.js +0 -23
- package/dist/vendor-_commonjsHelpers.34b404ce.js +0 -7
- package/dist/vendor-index.13468339.js +0 -5707
package/dist/{chunk-vite-node-externalize.1c19fc5e.js → chunk-vite-node-externalize.5c678054.js}
RENAMED
|
@@ -2,28 +2,28 @@ import { Buffer } from 'buffer';
|
|
|
2
2
|
import path$a from 'path';
|
|
3
3
|
import childProcess from 'child_process';
|
|
4
4
|
import process$1 from 'process';
|
|
5
|
-
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.40be925a.js';
|
|
6
6
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
7
|
-
import require$$0, { constants as constants$5,
|
|
8
|
-
import { j as join,
|
|
7
|
+
import require$$0, { constants as constants$5, cpus, hostname } from 'os';
|
|
8
|
+
import { j as join, f as basename, h as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, g as getCallLastIndex, e as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.37a7c822.js';
|
|
9
9
|
import { createServer, mergeConfig } from 'vite';
|
|
10
10
|
import fs$8, { promises, existsSync } from 'fs';
|
|
11
|
-
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.
|
|
11
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.d540b1d1.js';
|
|
12
12
|
import readline from 'readline';
|
|
13
13
|
import require$$0$1 from 'util';
|
|
14
14
|
import require$$0$2 from 'stream';
|
|
15
15
|
import require$$2 from 'events';
|
|
16
|
-
import {
|
|
17
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
18
|
-
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.
|
|
19
|
-
import { performance } from 'perf_hooks';
|
|
20
|
-
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, s as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, d as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, c as clearTimeout$1 } from './chunk-utils-timers.b26e7c5c.js';
|
|
16
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
17
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.33447cc0.js';
|
|
18
|
+
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.04d5d90b.js';
|
|
21
19
|
import { MessageChannel } from 'worker_threads';
|
|
22
20
|
import { Tinypool } from 'tinypool';
|
|
21
|
+
import { performance } from 'perf_hooks';
|
|
22
|
+
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.12bc05d1.js';
|
|
23
23
|
import MagicString from './chunk-magic-string.d5e0e473.js';
|
|
24
|
-
import { p as prompts } from './vendor-index.
|
|
24
|
+
import { p as prompts } from './vendor-index.405e58ef.js';
|
|
25
25
|
|
|
26
|
-
var version = "0.
|
|
26
|
+
var version = "0.10.0";
|
|
27
27
|
|
|
28
28
|
function stripFinalNewline(input) {
|
|
29
29
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -784,7 +784,7 @@ const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
|
|
|
784
784
|
return timedPromise;
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
-
const removeExitHandler = signalExit(() => {
|
|
787
|
+
const removeExitHandler = signalExit.exports(() => {
|
|
788
788
|
spawned.kill();
|
|
789
789
|
});
|
|
790
790
|
|
|
@@ -854,10 +854,10 @@ const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
|
|
|
854
854
|
}
|
|
855
855
|
|
|
856
856
|
if (encoding) {
|
|
857
|
-
return getStream(stream, {encoding, maxBuffer});
|
|
857
|
+
return getStream.exports(stream, {encoding, maxBuffer});
|
|
858
858
|
}
|
|
859
859
|
|
|
860
|
-
return getStream.buffer(stream, {maxBuffer});
|
|
860
|
+
return getStream.exports.buffer(stream, {maxBuffer});
|
|
861
861
|
};
|
|
862
862
|
|
|
863
863
|
// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
|
|
@@ -951,7 +951,7 @@ const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) =>
|
|
|
951
951
|
};
|
|
952
952
|
|
|
953
953
|
const handleArguments = (file, args, options = {}) => {
|
|
954
|
-
const parsed = crossSpawn._parse(file, args, options);
|
|
954
|
+
const parsed = crossSpawn.exports._parse(file, args, options);
|
|
955
955
|
file = parsed.command;
|
|
956
956
|
args = parsed.args;
|
|
957
957
|
options = parsed.options;
|
|
@@ -1675,117 +1675,117 @@ var utils$j = {};
|
|
|
1675
1675
|
|
|
1676
1676
|
(function (exports) {
|
|
1677
1677
|
|
|
1678
|
-
exports.isInteger = num => {
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
};
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
* Find a node of the given type
|
|
1690
|
-
*/
|
|
1691
|
-
|
|
1692
|
-
exports.find = (node, type) => node.nodes.find(node => node.type === type);
|
|
1693
|
-
|
|
1694
|
-
/**
|
|
1695
|
-
* Find a node of the given type
|
|
1696
|
-
*/
|
|
1697
|
-
|
|
1698
|
-
exports.exceedsLimit = (min, max, step = 1, limit) => {
|
|
1699
|
-
if (limit === false) return false;
|
|
1700
|
-
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1701
|
-
return ((Number(max) - Number(min)) / Number(step)) >= limit;
|
|
1702
|
-
};
|
|
1703
|
-
|
|
1704
|
-
/**
|
|
1705
|
-
* Escape the given node with '\\' before node.value
|
|
1706
|
-
*/
|
|
1678
|
+
exports.isInteger = num => {
|
|
1679
|
+
if (typeof num === 'number') {
|
|
1680
|
+
return Number.isInteger(num);
|
|
1681
|
+
}
|
|
1682
|
+
if (typeof num === 'string' && num.trim() !== '') {
|
|
1683
|
+
return Number.isInteger(Number(num));
|
|
1684
|
+
}
|
|
1685
|
+
return false;
|
|
1686
|
+
};
|
|
1707
1687
|
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1688
|
+
/**
|
|
1689
|
+
* Find a node of the given type
|
|
1690
|
+
*/
|
|
1711
1691
|
|
|
1712
|
-
|
|
1713
|
-
if (node.escaped !== true) {
|
|
1714
|
-
node.value = '\\' + node.value;
|
|
1715
|
-
node.escaped = true;
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1692
|
+
exports.find = (node, type) => node.nodes.find(node => node.type === type);
|
|
1719
1693
|
|
|
1720
|
-
/**
|
|
1721
|
-
|
|
1722
|
-
|
|
1694
|
+
/**
|
|
1695
|
+
* Find a node of the given type
|
|
1696
|
+
*/
|
|
1723
1697
|
|
|
1724
|
-
exports.
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
}
|
|
1730
|
-
return false;
|
|
1731
|
-
};
|
|
1698
|
+
exports.exceedsLimit = (min, max, step = 1, limit) => {
|
|
1699
|
+
if (limit === false) return false;
|
|
1700
|
+
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1701
|
+
return ((Number(max) - Number(min)) / Number(step)) >= limit;
|
|
1702
|
+
};
|
|
1732
1703
|
|
|
1733
|
-
/**
|
|
1734
|
-
|
|
1735
|
-
|
|
1704
|
+
/**
|
|
1705
|
+
* Escape the given node with '\\' before node.value
|
|
1706
|
+
*/
|
|
1736
1707
|
|
|
1737
|
-
exports.
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
if ((block.commas >> 0 + block.ranges >> 0) === 0) {
|
|
1741
|
-
block.invalid = true;
|
|
1742
|
-
return true;
|
|
1743
|
-
}
|
|
1744
|
-
if (block.open !== true || block.close !== true) {
|
|
1745
|
-
block.invalid = true;
|
|
1746
|
-
return true;
|
|
1747
|
-
}
|
|
1748
|
-
return false;
|
|
1749
|
-
};
|
|
1708
|
+
exports.escapeNode = (block, n = 0, type) => {
|
|
1709
|
+
let node = block.nodes[n];
|
|
1710
|
+
if (!node) return;
|
|
1750
1711
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1712
|
+
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
|
|
1713
|
+
if (node.escaped !== true) {
|
|
1714
|
+
node.value = '\\' + node.value;
|
|
1715
|
+
node.escaped = true;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1754
1719
|
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1720
|
+
/**
|
|
1721
|
+
* Returns true if the given brace node should be enclosed in literal braces
|
|
1722
|
+
*/
|
|
1723
|
+
|
|
1724
|
+
exports.encloseBrace = node => {
|
|
1725
|
+
if (node.type !== 'brace') return false;
|
|
1726
|
+
if ((node.commas >> 0 + node.ranges >> 0) === 0) {
|
|
1727
|
+
node.invalid = true;
|
|
1728
|
+
return true;
|
|
1729
|
+
}
|
|
1730
|
+
return false;
|
|
1731
|
+
};
|
|
1761
1732
|
|
|
1762
|
-
/**
|
|
1763
|
-
|
|
1764
|
-
|
|
1733
|
+
/**
|
|
1734
|
+
* Returns true if a brace node is invalid.
|
|
1735
|
+
*/
|
|
1736
|
+
|
|
1737
|
+
exports.isInvalidBrace = block => {
|
|
1738
|
+
if (block.type !== 'brace') return false;
|
|
1739
|
+
if (block.invalid === true || block.dollar) return true;
|
|
1740
|
+
if ((block.commas >> 0 + block.ranges >> 0) === 0) {
|
|
1741
|
+
block.invalid = true;
|
|
1742
|
+
return true;
|
|
1743
|
+
}
|
|
1744
|
+
if (block.open !== true || block.close !== true) {
|
|
1745
|
+
block.invalid = true;
|
|
1746
|
+
return true;
|
|
1747
|
+
}
|
|
1748
|
+
return false;
|
|
1749
|
+
};
|
|
1765
1750
|
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
return acc;
|
|
1770
|
-
}, []);
|
|
1751
|
+
/**
|
|
1752
|
+
* Returns true if a node is an open or close node
|
|
1753
|
+
*/
|
|
1771
1754
|
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1755
|
+
exports.isOpenOrClose = node => {
|
|
1756
|
+
if (node.type === 'open' || node.type === 'close') {
|
|
1757
|
+
return true;
|
|
1758
|
+
}
|
|
1759
|
+
return node.open === true || node.close === true;
|
|
1760
|
+
};
|
|
1775
1761
|
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1762
|
+
/**
|
|
1763
|
+
* Reduce an array of text nodes.
|
|
1764
|
+
*/
|
|
1765
|
+
|
|
1766
|
+
exports.reduce = nodes => nodes.reduce((acc, node) => {
|
|
1767
|
+
if (node.type === 'text') acc.push(node.value);
|
|
1768
|
+
if (node.type === 'range') node.type = 'text';
|
|
1769
|
+
return acc;
|
|
1770
|
+
}, []);
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Flatten an array
|
|
1774
|
+
*/
|
|
1775
|
+
|
|
1776
|
+
exports.flatten = (...args) => {
|
|
1777
|
+
const result = [];
|
|
1778
|
+
const flat = arr => {
|
|
1779
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1780
|
+
let ele = arr[i];
|
|
1781
|
+
Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
|
|
1782
|
+
}
|
|
1783
|
+
return result;
|
|
1784
|
+
};
|
|
1785
|
+
flat(args);
|
|
1786
|
+
return result;
|
|
1787
|
+
};
|
|
1788
|
+
} (utils$j));
|
|
1789
1789
|
|
|
1790
1790
|
const utils$i = utils$j;
|
|
1791
1791
|
|
|
@@ -3091,6 +3091,8 @@ braces$1.create = (input, options = {}) => {
|
|
|
3091
3091
|
|
|
3092
3092
|
var braces_1 = braces$1;
|
|
3093
3093
|
|
|
3094
|
+
var picomatch$2 = {exports: {}};
|
|
3095
|
+
|
|
3094
3096
|
var utils$f = {};
|
|
3095
3097
|
|
|
3096
3098
|
const path$7 = path$a;
|
|
@@ -3273,69 +3275,69 @@ var constants$3 = {
|
|
|
3273
3275
|
|
|
3274
3276
|
(function (exports) {
|
|
3275
3277
|
|
|
3276
|
-
const path = path$a;
|
|
3277
|
-
const win32 = process.platform === 'win32';
|
|
3278
|
-
const {
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
} = constants$3;
|
|
3284
|
-
|
|
3285
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
3286
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
3287
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
3288
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
3289
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
3290
|
-
|
|
3291
|
-
exports.removeBackslashes = str => {
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
};
|
|
3278
|
+
const path = path$a;
|
|
3279
|
+
const win32 = process.platform === 'win32';
|
|
3280
|
+
const {
|
|
3281
|
+
REGEX_BACKSLASH,
|
|
3282
|
+
REGEX_REMOVE_BACKSLASH,
|
|
3283
|
+
REGEX_SPECIAL_CHARS,
|
|
3284
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
3285
|
+
} = constants$3;
|
|
3286
|
+
|
|
3287
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
3288
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
3289
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
3290
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
3291
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
3292
|
+
|
|
3293
|
+
exports.removeBackslashes = str => {
|
|
3294
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
3295
|
+
return match === '\\' ? '' : match;
|
|
3296
|
+
});
|
|
3297
|
+
};
|
|
3296
3298
|
|
|
3297
|
-
exports.supportsLookbehinds = () => {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
};
|
|
3299
|
+
exports.supportsLookbehinds = () => {
|
|
3300
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
3301
|
+
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
3302
|
+
return true;
|
|
3303
|
+
}
|
|
3304
|
+
return false;
|
|
3305
|
+
};
|
|
3304
3306
|
|
|
3305
|
-
exports.isWindows = options => {
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
};
|
|
3307
|
+
exports.isWindows = options => {
|
|
3308
|
+
if (options && typeof options.windows === 'boolean') {
|
|
3309
|
+
return options.windows;
|
|
3310
|
+
}
|
|
3311
|
+
return win32 === true || path.sep === '\\';
|
|
3312
|
+
};
|
|
3311
3313
|
|
|
3312
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
};
|
|
3314
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
3315
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
3316
|
+
if (idx === -1) return input;
|
|
3317
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
3318
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
3319
|
+
};
|
|
3318
3320
|
|
|
3319
|
-
exports.removePrefix = (input, state = {}) => {
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
};
|
|
3321
|
+
exports.removePrefix = (input, state = {}) => {
|
|
3322
|
+
let output = input;
|
|
3323
|
+
if (output.startsWith('./')) {
|
|
3324
|
+
output = output.slice(2);
|
|
3325
|
+
state.prefix = './';
|
|
3326
|
+
}
|
|
3327
|
+
return output;
|
|
3328
|
+
};
|
|
3327
3329
|
|
|
3328
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
3329
|
-
|
|
3330
|
-
|
|
3330
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
3331
|
+
const prepend = options.contains ? '' : '^';
|
|
3332
|
+
const append = options.contains ? '' : '$';
|
|
3331
3333
|
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
};
|
|
3338
|
-
}(utils$f));
|
|
3334
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
3335
|
+
if (state.negated === true) {
|
|
3336
|
+
output = `(?:^(?!${output}).*$)`;
|
|
3337
|
+
}
|
|
3338
|
+
return output;
|
|
3339
|
+
};
|
|
3340
|
+
} (utils$f));
|
|
3339
3341
|
|
|
3340
3342
|
const utils$e = utils$f;
|
|
3341
3343
|
const {
|
|
@@ -4846,9 +4848,9 @@ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
|
4846
4848
|
* @api public
|
|
4847
4849
|
*/
|
|
4848
4850
|
|
|
4849
|
-
const picomatch$
|
|
4851
|
+
const picomatch$1 = (glob, options, returnState = false) => {
|
|
4850
4852
|
if (Array.isArray(glob)) {
|
|
4851
|
-
const fns = glob.map(input => picomatch$
|
|
4853
|
+
const fns = glob.map(input => picomatch$1(input, options, returnState));
|
|
4852
4854
|
const arrayMatcher = str => {
|
|
4853
4855
|
for (const isMatch of fns) {
|
|
4854
4856
|
const state = isMatch(str);
|
|
@@ -4868,8 +4870,8 @@ const picomatch$2 = (glob, options, returnState = false) => {
|
|
|
4868
4870
|
const opts = options || {};
|
|
4869
4871
|
const posix = utils$c.isWindows(options);
|
|
4870
4872
|
const regex = isState
|
|
4871
|
-
? picomatch$
|
|
4872
|
-
: picomatch$
|
|
4873
|
+
? picomatch$1.compileRe(glob, options)
|
|
4874
|
+
: picomatch$1.makeRe(glob, options, false, true);
|
|
4873
4875
|
|
|
4874
4876
|
const state = regex.state;
|
|
4875
4877
|
delete regex.state;
|
|
@@ -4877,11 +4879,11 @@ const picomatch$2 = (glob, options, returnState = false) => {
|
|
|
4877
4879
|
let isIgnored = () => false;
|
|
4878
4880
|
if (opts.ignore) {
|
|
4879
4881
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4880
|
-
isIgnored = picomatch$
|
|
4882
|
+
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
|
4881
4883
|
}
|
|
4882
4884
|
|
|
4883
4885
|
const matcher = (input, returnObject = false) => {
|
|
4884
|
-
const { isMatch, match, output } = picomatch$
|
|
4886
|
+
const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
|
|
4885
4887
|
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4886
4888
|
|
|
4887
4889
|
if (typeof opts.onResult === 'function') {
|
|
@@ -4931,7 +4933,7 @@ const picomatch$2 = (glob, options, returnState = false) => {
|
|
|
4931
4933
|
* @api public
|
|
4932
4934
|
*/
|
|
4933
4935
|
|
|
4934
|
-
picomatch$
|
|
4936
|
+
picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
4935
4937
|
if (typeof input !== 'string') {
|
|
4936
4938
|
throw new TypeError('Expected input to be a string');
|
|
4937
4939
|
}
|
|
@@ -4952,7 +4954,7 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4952
4954
|
|
|
4953
4955
|
if (match === false || opts.capture === true) {
|
|
4954
4956
|
if (opts.matchBase === true || opts.basename === true) {
|
|
4955
|
-
match = picomatch$
|
|
4957
|
+
match = picomatch$1.matchBase(input, regex, options, posix);
|
|
4956
4958
|
} else {
|
|
4957
4959
|
match = regex.exec(output);
|
|
4958
4960
|
}
|
|
@@ -4975,8 +4977,8 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4975
4977
|
* @api public
|
|
4976
4978
|
*/
|
|
4977
4979
|
|
|
4978
|
-
picomatch$
|
|
4979
|
-
const regex = glob instanceof RegExp ? glob : picomatch$
|
|
4980
|
+
picomatch$1.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
|
|
4981
|
+
const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
|
|
4980
4982
|
return regex.test(path$6.basename(input));
|
|
4981
4983
|
};
|
|
4982
4984
|
|
|
@@ -4997,7 +4999,7 @@ picomatch$2.matchBase = (input, glob, options, posix = utils$c.isWindows(options
|
|
|
4997
4999
|
* @api public
|
|
4998
5000
|
*/
|
|
4999
5001
|
|
|
5000
|
-
picomatch$
|
|
5002
|
+
picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
|
|
5001
5003
|
|
|
5002
5004
|
/**
|
|
5003
5005
|
* Parse a glob pattern to create the source string for a regular
|
|
@@ -5013,8 +5015,8 @@ picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)
|
|
|
5013
5015
|
* @api public
|
|
5014
5016
|
*/
|
|
5015
5017
|
|
|
5016
|
-
picomatch$
|
|
5017
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch$
|
|
5018
|
+
picomatch$1.parse = (pattern, options) => {
|
|
5019
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
|
|
5018
5020
|
return parse(pattern, { ...options, fastpaths: false });
|
|
5019
5021
|
};
|
|
5020
5022
|
|
|
@@ -5045,7 +5047,7 @@ picomatch$2.parse = (pattern, options) => {
|
|
|
5045
5047
|
* @api public
|
|
5046
5048
|
*/
|
|
5047
5049
|
|
|
5048
|
-
picomatch$
|
|
5050
|
+
picomatch$1.scan = (input, options) => scan(input, options);
|
|
5049
5051
|
|
|
5050
5052
|
/**
|
|
5051
5053
|
* Compile a regular expression from the `state` object returned by the
|
|
@@ -5059,7 +5061,7 @@ picomatch$2.scan = (input, options) => scan(input, options);
|
|
|
5059
5061
|
* @api public
|
|
5060
5062
|
*/
|
|
5061
5063
|
|
|
5062
|
-
picomatch$
|
|
5064
|
+
picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
5063
5065
|
if (returnOutput === true) {
|
|
5064
5066
|
return state.output;
|
|
5065
5067
|
}
|
|
@@ -5073,7 +5075,7 @@ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
5073
5075
|
source = `^(?!${source}).*$`;
|
|
5074
5076
|
}
|
|
5075
5077
|
|
|
5076
|
-
const regex = picomatch$
|
|
5078
|
+
const regex = picomatch$1.toRegex(source, options);
|
|
5077
5079
|
if (returnState === true) {
|
|
5078
5080
|
regex.state = state;
|
|
5079
5081
|
}
|
|
@@ -5100,7 +5102,7 @@ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
5100
5102
|
* @api public
|
|
5101
5103
|
*/
|
|
5102
5104
|
|
|
5103
|
-
picomatch$
|
|
5105
|
+
picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
5104
5106
|
if (!input || typeof input !== 'string') {
|
|
5105
5107
|
throw new TypeError('Expected a non-empty string');
|
|
5106
5108
|
}
|
|
@@ -5115,7 +5117,7 @@ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
5115
5117
|
parsed = parse(input, options);
|
|
5116
5118
|
}
|
|
5117
5119
|
|
|
5118
|
-
return picomatch$
|
|
5120
|
+
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
5119
5121
|
};
|
|
5120
5122
|
|
|
5121
5123
|
/**
|
|
@@ -5135,7 +5137,7 @@ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
5135
5137
|
* @api public
|
|
5136
5138
|
*/
|
|
5137
5139
|
|
|
5138
|
-
picomatch$
|
|
5140
|
+
picomatch$1.toRegex = (source, options) => {
|
|
5139
5141
|
try {
|
|
5140
5142
|
const opts = options || {};
|
|
5141
5143
|
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
@@ -5150,19 +5152,22 @@ picomatch$2.toRegex = (source, options) => {
|
|
|
5150
5152
|
* @return {Object}
|
|
5151
5153
|
*/
|
|
5152
5154
|
|
|
5153
|
-
picomatch$
|
|
5155
|
+
picomatch$1.constants = constants$1;
|
|
5154
5156
|
|
|
5155
5157
|
/**
|
|
5156
5158
|
* Expose "picomatch"
|
|
5157
5159
|
*/
|
|
5158
5160
|
|
|
5159
|
-
var picomatch_1 = picomatch$
|
|
5161
|
+
var picomatch_1 = picomatch$1;
|
|
5160
5162
|
|
|
5161
|
-
|
|
5163
|
+
(function (module) {
|
|
5164
|
+
|
|
5165
|
+
module.exports = picomatch_1;
|
|
5166
|
+
} (picomatch$2));
|
|
5162
5167
|
|
|
5163
5168
|
const util = require$$0$1;
|
|
5164
5169
|
const braces = braces_1;
|
|
5165
|
-
const picomatch = picomatch$
|
|
5170
|
+
const picomatch = picomatch$2.exports;
|
|
5166
5171
|
const utils$b = utils$f;
|
|
5167
5172
|
const isEmptyString = val => val === '' || val === './';
|
|
5168
5173
|
|
|
@@ -6165,23 +6170,23 @@ var settings$3 = {};
|
|
|
6165
6170
|
var fs$5 = {};
|
|
6166
6171
|
|
|
6167
6172
|
(function (exports) {
|
|
6168
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6169
|
-
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
6170
|
-
const fs = fs$8;
|
|
6171
|
-
exports.FILE_SYSTEM_ADAPTER = {
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
};
|
|
6177
|
-
function createFileSystemAdapter(fsMethods) {
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
}
|
|
6183
|
-
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
6184
|
-
}(fs$5));
|
|
6173
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6174
|
+
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
6175
|
+
const fs = fs$8;
|
|
6176
|
+
exports.FILE_SYSTEM_ADAPTER = {
|
|
6177
|
+
lstat: fs.lstat,
|
|
6178
|
+
stat: fs.stat,
|
|
6179
|
+
lstatSync: fs.lstatSync,
|
|
6180
|
+
statSync: fs.statSync
|
|
6181
|
+
};
|
|
6182
|
+
function createFileSystemAdapter(fsMethods) {
|
|
6183
|
+
if (fsMethods === undefined) {
|
|
6184
|
+
return exports.FILE_SYSTEM_ADAPTER;
|
|
6185
|
+
}
|
|
6186
|
+
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
6187
|
+
}
|
|
6188
|
+
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
6189
|
+
} (fs$5));
|
|
6185
6190
|
|
|
6186
6191
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
6187
6192
|
const fs$4 = fs$5;
|
|
@@ -6526,25 +6531,25 @@ var settings$2 = {};
|
|
|
6526
6531
|
var fs$1 = {};
|
|
6527
6532
|
|
|
6528
6533
|
(function (exports) {
|
|
6529
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6530
|
-
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
6531
|
-
const fs = fs$8;
|
|
6532
|
-
exports.FILE_SYSTEM_ADAPTER = {
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
};
|
|
6540
|
-
function createFileSystemAdapter(fsMethods) {
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
}
|
|
6546
|
-
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
6547
|
-
}(fs$1));
|
|
6534
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6535
|
+
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
6536
|
+
const fs = fs$8;
|
|
6537
|
+
exports.FILE_SYSTEM_ADAPTER = {
|
|
6538
|
+
lstat: fs.lstat,
|
|
6539
|
+
stat: fs.stat,
|
|
6540
|
+
lstatSync: fs.lstatSync,
|
|
6541
|
+
statSync: fs.statSync,
|
|
6542
|
+
readdir: fs.readdir,
|
|
6543
|
+
readdirSync: fs.readdirSync
|
|
6544
|
+
};
|
|
6545
|
+
function createFileSystemAdapter(fsMethods) {
|
|
6546
|
+
if (fsMethods === undefined) {
|
|
6547
|
+
return exports.FILE_SYSTEM_ADAPTER;
|
|
6548
|
+
}
|
|
6549
|
+
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
6550
|
+
}
|
|
6551
|
+
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
6552
|
+
} (fs$1));
|
|
6548
6553
|
|
|
6549
6554
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
6550
6555
|
const path$3 = path$a;
|
|
@@ -7797,63 +7802,63 @@ sync$1.default = ProviderSync;
|
|
|
7797
7802
|
var settings = {};
|
|
7798
7803
|
|
|
7799
7804
|
(function (exports) {
|
|
7800
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7801
|
-
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
7802
|
-
const fs = fs$8;
|
|
7803
|
-
const os = require$$0;
|
|
7804
|
-
/**
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
|
7809
|
-
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
};
|
|
7817
|
-
class Settings {
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
}
|
|
7855
|
-
exports.default = Settings;
|
|
7856
|
-
}(settings));
|
|
7805
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7806
|
+
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
7807
|
+
const fs = fs$8;
|
|
7808
|
+
const os = require$$0;
|
|
7809
|
+
/**
|
|
7810
|
+
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
7811
|
+
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
7812
|
+
*/
|
|
7813
|
+
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
|
7814
|
+
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
7815
|
+
lstat: fs.lstat,
|
|
7816
|
+
lstatSync: fs.lstatSync,
|
|
7817
|
+
stat: fs.stat,
|
|
7818
|
+
statSync: fs.statSync,
|
|
7819
|
+
readdir: fs.readdir,
|
|
7820
|
+
readdirSync: fs.readdirSync
|
|
7821
|
+
};
|
|
7822
|
+
class Settings {
|
|
7823
|
+
constructor(_options = {}) {
|
|
7824
|
+
this._options = _options;
|
|
7825
|
+
this.absolute = this._getValue(this._options.absolute, false);
|
|
7826
|
+
this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
|
7827
|
+
this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
|
7828
|
+
this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
|
7829
|
+
this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
|
7830
|
+
this.cwd = this._getValue(this._options.cwd, process.cwd());
|
|
7831
|
+
this.deep = this._getValue(this._options.deep, Infinity);
|
|
7832
|
+
this.dot = this._getValue(this._options.dot, false);
|
|
7833
|
+
this.extglob = this._getValue(this._options.extglob, true);
|
|
7834
|
+
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
|
7835
|
+
this.fs = this._getFileSystemMethods(this._options.fs);
|
|
7836
|
+
this.globstar = this._getValue(this._options.globstar, true);
|
|
7837
|
+
this.ignore = this._getValue(this._options.ignore, []);
|
|
7838
|
+
this.markDirectories = this._getValue(this._options.markDirectories, false);
|
|
7839
|
+
this.objectMode = this._getValue(this._options.objectMode, false);
|
|
7840
|
+
this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
|
7841
|
+
this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
|
7842
|
+
this.stats = this._getValue(this._options.stats, false);
|
|
7843
|
+
this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
|
7844
|
+
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
|
7845
|
+
this.unique = this._getValue(this._options.unique, true);
|
|
7846
|
+
if (this.onlyDirectories) {
|
|
7847
|
+
this.onlyFiles = false;
|
|
7848
|
+
}
|
|
7849
|
+
if (this.stats) {
|
|
7850
|
+
this.objectMode = true;
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
_getValue(option, value) {
|
|
7854
|
+
return option === undefined ? value : option;
|
|
7855
|
+
}
|
|
7856
|
+
_getFileSystemMethods(methods = {}) {
|
|
7857
|
+
return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
|
7858
|
+
}
|
|
7859
|
+
}
|
|
7860
|
+
exports.default = Settings;
|
|
7861
|
+
} (settings));
|
|
7857
7862
|
|
|
7858
7863
|
const taskManager = tasks;
|
|
7859
7864
|
const patternManager = patterns;
|
|
@@ -8170,6 +8175,130 @@ function addSnapshotResult(summary, result) {
|
|
|
8170
8175
|
summary.total += result.added + result.matched + result.unmatched + result.updated;
|
|
8171
8176
|
}
|
|
8172
8177
|
|
|
8178
|
+
function createPool(ctx) {
|
|
8179
|
+
if (ctx.config.threads)
|
|
8180
|
+
return createWorkerPool(ctx);
|
|
8181
|
+
else
|
|
8182
|
+
return createFakePool(ctx);
|
|
8183
|
+
}
|
|
8184
|
+
const workerPath = pathToFileURL(resolve(distDir, "./worker.js")).href;
|
|
8185
|
+
function createFakePool(ctx) {
|
|
8186
|
+
const runWithFiles = (name) => {
|
|
8187
|
+
return async (files, invalidates) => {
|
|
8188
|
+
const worker = await import(workerPath);
|
|
8189
|
+
const { workerPort, port } = createChannel(ctx);
|
|
8190
|
+
const data = {
|
|
8191
|
+
port: workerPort,
|
|
8192
|
+
config: ctx.getConfig(),
|
|
8193
|
+
files,
|
|
8194
|
+
invalidates,
|
|
8195
|
+
id: 1
|
|
8196
|
+
};
|
|
8197
|
+
await worker[name](data, { transferList: [workerPort] });
|
|
8198
|
+
port.close();
|
|
8199
|
+
workerPort.close();
|
|
8200
|
+
};
|
|
8201
|
+
};
|
|
8202
|
+
return {
|
|
8203
|
+
runTests: runWithFiles("run"),
|
|
8204
|
+
collectTests: runWithFiles("collect"),
|
|
8205
|
+
close: async () => {
|
|
8206
|
+
}
|
|
8207
|
+
};
|
|
8208
|
+
}
|
|
8209
|
+
function createWorkerPool(ctx) {
|
|
8210
|
+
const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
|
|
8211
|
+
const options = {
|
|
8212
|
+
filename: workerPath,
|
|
8213
|
+
useAtomics: typeof process.versions.webcontainer !== "string",
|
|
8214
|
+
maxThreads: ctx.config.maxThreads ?? threadsCount,
|
|
8215
|
+
minThreads: ctx.config.minThreads ?? threadsCount
|
|
8216
|
+
};
|
|
8217
|
+
if (ctx.config.isolate) {
|
|
8218
|
+
options.isolateWorkers = true;
|
|
8219
|
+
options.concurrentTasksPerWorker = 1;
|
|
8220
|
+
}
|
|
8221
|
+
const pool = new Tinypool(options);
|
|
8222
|
+
const runWithFiles = (name) => {
|
|
8223
|
+
return async (files, invalidates) => {
|
|
8224
|
+
let id = 0;
|
|
8225
|
+
await Promise.all(files.map(async (file) => {
|
|
8226
|
+
const { workerPort, port } = createChannel(ctx);
|
|
8227
|
+
const data = {
|
|
8228
|
+
port: workerPort,
|
|
8229
|
+
config: ctx.getConfig(),
|
|
8230
|
+
files: [file],
|
|
8231
|
+
invalidates,
|
|
8232
|
+
id: ++id
|
|
8233
|
+
};
|
|
8234
|
+
await pool.run(data, { transferList: [workerPort], name });
|
|
8235
|
+
port.close();
|
|
8236
|
+
workerPort.close();
|
|
8237
|
+
}));
|
|
8238
|
+
};
|
|
8239
|
+
};
|
|
8240
|
+
return {
|
|
8241
|
+
runTests: runWithFiles("run"),
|
|
8242
|
+
collectTests: runWithFiles("collect"),
|
|
8243
|
+
close: async () => {
|
|
8244
|
+
}
|
|
8245
|
+
};
|
|
8246
|
+
}
|
|
8247
|
+
function createChannel(ctx) {
|
|
8248
|
+
const channel = new MessageChannel();
|
|
8249
|
+
const port = channel.port2;
|
|
8250
|
+
const workerPort = channel.port1;
|
|
8251
|
+
createBirpc({
|
|
8252
|
+
onWorkerExit(code) {
|
|
8253
|
+
process.exit(code || 1);
|
|
8254
|
+
},
|
|
8255
|
+
snapshotSaved(snapshot) {
|
|
8256
|
+
ctx.snapshot.add(snapshot);
|
|
8257
|
+
},
|
|
8258
|
+
resolveSnapshotPath(testPath) {
|
|
8259
|
+
return ctx.snapshot.resolvePath(testPath);
|
|
8260
|
+
},
|
|
8261
|
+
async getSourceMap(id, force) {
|
|
8262
|
+
if (force) {
|
|
8263
|
+
const mod = ctx.server.moduleGraph.getModuleById(id);
|
|
8264
|
+
if (mod)
|
|
8265
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
8266
|
+
}
|
|
8267
|
+
const r = await ctx.vitenode.transformRequest(id);
|
|
8268
|
+
return r == null ? void 0 : r.map;
|
|
8269
|
+
},
|
|
8270
|
+
fetch(id) {
|
|
8271
|
+
return ctx.vitenode.fetchModule(id);
|
|
8272
|
+
},
|
|
8273
|
+
resolveId(id, importer) {
|
|
8274
|
+
return ctx.vitenode.resolveId(id, importer);
|
|
8275
|
+
},
|
|
8276
|
+
onCollected(files) {
|
|
8277
|
+
ctx.state.collectFiles(files);
|
|
8278
|
+
ctx.report("onCollected", files);
|
|
8279
|
+
},
|
|
8280
|
+
onTaskUpdate(packs) {
|
|
8281
|
+
ctx.state.updateTasks(packs);
|
|
8282
|
+
ctx.report("onTaskUpdate", packs);
|
|
8283
|
+
},
|
|
8284
|
+
onUserConsoleLog(log) {
|
|
8285
|
+
ctx.state.updateUserLog(log);
|
|
8286
|
+
ctx.report("onUserConsoleLog", log);
|
|
8287
|
+
},
|
|
8288
|
+
onFinished(files) {
|
|
8289
|
+
ctx.report("onFinished", files);
|
|
8290
|
+
}
|
|
8291
|
+
}, {
|
|
8292
|
+
post(v) {
|
|
8293
|
+
port.postMessage(v);
|
|
8294
|
+
},
|
|
8295
|
+
on(fn) {
|
|
8296
|
+
port.on("message", fn);
|
|
8297
|
+
}
|
|
8298
|
+
});
|
|
8299
|
+
return { workerPort, port };
|
|
8300
|
+
}
|
|
8301
|
+
|
|
8173
8302
|
const F_RIGHT = "\u2192";
|
|
8174
8303
|
const F_DOWN = "\u2193";
|
|
8175
8304
|
const F_DOWN_RIGHT = "\u21B3";
|
|
@@ -8181,8 +8310,8 @@ const F_LONG_DASH = "\u23AF";
|
|
|
8181
8310
|
|
|
8182
8311
|
const spinnerMap = /* @__PURE__ */ new WeakMap();
|
|
8183
8312
|
const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
|
|
8184
|
-
const pointer =
|
|
8185
|
-
const skipped =
|
|
8313
|
+
const pointer = picocolors.exports.yellow(F_POINTER);
|
|
8314
|
+
const skipped = picocolors.exports.dim(picocolors.exports.gray(F_DOWN));
|
|
8186
8315
|
function getCols(delta = 0) {
|
|
8187
8316
|
let length = process.stdout.columns;
|
|
8188
8317
|
if (!length || isNaN(length))
|
|
@@ -8212,44 +8341,44 @@ function formatTestPath(root, path) {
|
|
|
8212
8341
|
const dir = dirname(path);
|
|
8213
8342
|
const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
|
|
8214
8343
|
const base = basename(path, ext);
|
|
8215
|
-
return slash$2(
|
|
8344
|
+
return slash$2(picocolors.exports.dim(`${dir}/`) + picocolors.exports.bold(base)) + picocolors.exports.dim(ext);
|
|
8216
8345
|
}
|
|
8217
8346
|
function renderSnapshotSummary(rootDir, snapshots) {
|
|
8218
8347
|
const summary = [];
|
|
8219
8348
|
if (snapshots.added)
|
|
8220
|
-
summary.push(
|
|
8349
|
+
summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.added} written`)));
|
|
8221
8350
|
if (snapshots.unmatched)
|
|
8222
|
-
summary.push(
|
|
8351
|
+
summary.push(picocolors.exports.bold(picocolors.exports.red(`${snapshots.unmatched} failed`)));
|
|
8223
8352
|
if (snapshots.updated)
|
|
8224
|
-
summary.push(
|
|
8353
|
+
summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.updated} updated `)));
|
|
8225
8354
|
if (snapshots.filesRemoved) {
|
|
8226
8355
|
if (snapshots.didUpdate)
|
|
8227
|
-
summary.push(
|
|
8356
|
+
summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.filesRemoved} files removed `)));
|
|
8228
8357
|
else
|
|
8229
|
-
summary.push(
|
|
8358
|
+
summary.push(picocolors.exports.bold(picocolors.exports.yellow(`${snapshots.filesRemoved} files obsolete `)));
|
|
8230
8359
|
}
|
|
8231
8360
|
if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
|
|
8232
8361
|
const [head, ...tail] = snapshots.filesRemovedList;
|
|
8233
|
-
summary.push(`${
|
|
8362
|
+
summary.push(`${picocolors.exports.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
|
|
8234
8363
|
tail.forEach((key) => {
|
|
8235
|
-
summary.push(` ${
|
|
8364
|
+
summary.push(` ${picocolors.exports.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
|
|
8236
8365
|
});
|
|
8237
8366
|
}
|
|
8238
8367
|
if (snapshots.unchecked) {
|
|
8239
8368
|
if (snapshots.didUpdate)
|
|
8240
|
-
summary.push(
|
|
8369
|
+
summary.push(picocolors.exports.bold(picocolors.exports.green(`${snapshots.unchecked} removed`)));
|
|
8241
8370
|
else
|
|
8242
|
-
summary.push(
|
|
8371
|
+
summary.push(picocolors.exports.bold(picocolors.exports.yellow(`${snapshots.unchecked} obsolete`)));
|
|
8243
8372
|
snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
|
|
8244
|
-
summary.push(`${
|
|
8245
|
-
uncheckedFile.keys.forEach((key) => summary.push(` ${
|
|
8373
|
+
summary.push(`${picocolors.exports.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
|
|
8374
|
+
uncheckedFile.keys.forEach((key) => summary.push(` ${picocolors.exports.gray(F_DOT)} ${key}`));
|
|
8246
8375
|
});
|
|
8247
8376
|
}
|
|
8248
8377
|
return summary;
|
|
8249
8378
|
}
|
|
8250
8379
|
function getStateString(tasks, name = "tests") {
|
|
8251
8380
|
if (tasks.length === 0)
|
|
8252
|
-
return
|
|
8381
|
+
return picocolors.exports.dim(`no ${name}`);
|
|
8253
8382
|
const passed = tasks.filter((i) => {
|
|
8254
8383
|
var _a;
|
|
8255
8384
|
return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
|
|
@@ -8261,17 +8390,17 @@ function getStateString(tasks, name = "tests") {
|
|
|
8261
8390
|
const skipped2 = tasks.filter((i) => i.mode === "skip");
|
|
8262
8391
|
const todo = tasks.filter((i) => i.mode === "todo");
|
|
8263
8392
|
return [
|
|
8264
|
-
failed.length ?
|
|
8265
|
-
passed.length ?
|
|
8266
|
-
skipped2.length ?
|
|
8267
|
-
todo.length ?
|
|
8268
|
-
].filter(Boolean).join(
|
|
8393
|
+
failed.length ? picocolors.exports.bold(picocolors.exports.red(`${failed.length} failed`)) : null,
|
|
8394
|
+
passed.length ? picocolors.exports.bold(picocolors.exports.green(`${passed.length} passed`)) : null,
|
|
8395
|
+
skipped2.length ? picocolors.exports.yellow(`${skipped2.length} skipped`) : null,
|
|
8396
|
+
todo.length ? picocolors.exports.gray(`${todo.length} todo`) : null
|
|
8397
|
+
].filter(Boolean).join(picocolors.exports.dim(" | ")) + picocolors.exports.gray(` (${tasks.length})`);
|
|
8269
8398
|
}
|
|
8270
8399
|
function getStateSymbol(task) {
|
|
8271
8400
|
if (task.mode === "skip" || task.mode === "todo")
|
|
8272
8401
|
return skipped;
|
|
8273
8402
|
if (!task.result)
|
|
8274
|
-
return
|
|
8403
|
+
return picocolors.exports.gray("\xB7");
|
|
8275
8404
|
if (task.result.state === "run") {
|
|
8276
8405
|
if (task.type === "suite")
|
|
8277
8406
|
return pointer;
|
|
@@ -8280,12 +8409,12 @@ function getStateSymbol(task) {
|
|
|
8280
8409
|
spinner = elegantSpinner();
|
|
8281
8410
|
spinnerMap.set(task, spinner);
|
|
8282
8411
|
}
|
|
8283
|
-
return
|
|
8412
|
+
return picocolors.exports.yellow(spinner());
|
|
8284
8413
|
}
|
|
8285
8414
|
if (task.result.state === "pass")
|
|
8286
|
-
return
|
|
8415
|
+
return picocolors.exports.green(F_CHECK);
|
|
8287
8416
|
if (task.result.state === "fail") {
|
|
8288
|
-
return task.type === "suite" ? pointer :
|
|
8417
|
+
return task.type === "suite" ? pointer : picocolors.exports.red(F_CROSS);
|
|
8289
8418
|
}
|
|
8290
8419
|
return " ";
|
|
8291
8420
|
}
|
|
@@ -8303,7 +8432,7 @@ function getHookStateSymbol(task, hookName) {
|
|
|
8303
8432
|
spinner = elegantSpinner();
|
|
8304
8433
|
spinnerMap2.set(hookName, spinner);
|
|
8305
8434
|
}
|
|
8306
|
-
return
|
|
8435
|
+
return picocolors.exports.yellow(spinner());
|
|
8307
8436
|
}
|
|
8308
8437
|
}
|
|
8309
8438
|
const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -8316,13 +8445,13 @@ function elegantSpinner() {
|
|
|
8316
8445
|
}
|
|
8317
8446
|
|
|
8318
8447
|
const BADGE_PADDING = " ";
|
|
8319
|
-
const HELP_HINT = `${
|
|
8320
|
-
const HELP_UPDATE_SNAP =
|
|
8321
|
-
const HELP_QUITE = `${
|
|
8448
|
+
const HELP_HINT = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("h")}${picocolors.exports.dim(" to show help")}`;
|
|
8449
|
+
const HELP_UPDATE_SNAP = picocolors.exports.dim("press ") + picocolors.exports.bold(picocolors.exports.yellow("u")) + picocolors.exports.dim(" to update snapshot");
|
|
8450
|
+
const HELP_QUITE = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("q")}${picocolors.exports.dim(" to quit")}`;
|
|
8322
8451
|
const WAIT_FOR_CHANGE_PASS = `
|
|
8323
|
-
${
|
|
8452
|
+
${picocolors.exports.bold(picocolors.exports.inverse(picocolors.exports.green(" PASS ")))}${picocolors.exports.green(" Waiting for file changes...")}`;
|
|
8324
8453
|
const WAIT_FOR_CHANGE_FAIL = `
|
|
8325
|
-
${
|
|
8454
|
+
${picocolors.exports.bold(picocolors.exports.inverse(picocolors.exports.red(" FAIL ")))}${picocolors.exports.red(" Tests failed. Watching for file changes...")}`;
|
|
8326
8455
|
class BaseReporter {
|
|
8327
8456
|
constructor() {
|
|
8328
8457
|
this.start = 0;
|
|
@@ -8335,13 +8464,13 @@ class BaseReporter {
|
|
|
8335
8464
|
var _a, _b;
|
|
8336
8465
|
this.ctx = ctx;
|
|
8337
8466
|
this.ctx.log();
|
|
8338
|
-
const versionTest = this.ctx.config.watch ?
|
|
8339
|
-
const mode = this.ctx.config.watch ?
|
|
8340
|
-
this.ctx.log(`${
|
|
8467
|
+
const versionTest = this.ctx.config.watch ? picocolors.exports.blue(`v${version}`) : picocolors.exports.cyan(`v${version}`);
|
|
8468
|
+
const mode = this.ctx.config.watch ? picocolors.exports.blue(" DEV ") : picocolors.exports.cyan(" RUN ");
|
|
8469
|
+
this.ctx.log(`${picocolors.exports.inverse(picocolors.exports.bold(mode))} ${versionTest} ${picocolors.exports.gray(this.ctx.config.root)}`);
|
|
8341
8470
|
if (this.ctx.config.ui)
|
|
8342
|
-
this.ctx.log(
|
|
8471
|
+
this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((_a = this.ctx.config.api) == null ? void 0 : _a.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}`)));
|
|
8343
8472
|
else if (this.ctx.config.api)
|
|
8344
|
-
this.ctx.log(
|
|
8473
|
+
this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` API started at http://${((_b = this.ctx.config.api) == null ? void 0 : _b.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.config.api.port}`)}`)));
|
|
8345
8474
|
this.ctx.log();
|
|
8346
8475
|
this.start = performance.now();
|
|
8347
8476
|
}
|
|
@@ -8365,18 +8494,18 @@ class BaseReporter {
|
|
|
8365
8494
|
return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
|
|
8366
8495
|
});
|
|
8367
8496
|
const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
|
|
8368
|
-
let state =
|
|
8497
|
+
let state = picocolors.exports.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
|
|
8369
8498
|
if (failed.length)
|
|
8370
|
-
state += ` ${
|
|
8499
|
+
state += ` ${picocolors.exports.dim("|")} ${picocolors.exports.red(`${failed.length} failed`)}`;
|
|
8371
8500
|
if (skipped.length)
|
|
8372
|
-
state += ` ${
|
|
8373
|
-
let suffix =
|
|
8501
|
+
state += ` ${picocolors.exports.dim("|")} ${picocolors.exports.yellow(`${skipped.length} skipped`)}`;
|
|
8502
|
+
let suffix = picocolors.exports.dim(" (") + state + picocolors.exports.dim(")");
|
|
8374
8503
|
if (task.result.duration)
|
|
8375
|
-
suffix +=
|
|
8504
|
+
suffix += picocolors.exports.yellow(` ${Math.round(task.result.duration)}${picocolors.exports.dim("ms")}`);
|
|
8376
8505
|
this.ctx.log(` ${getStateSymbol(task)} ${task.name} ${suffix}`);
|
|
8377
8506
|
for (const test of failed) {
|
|
8378
|
-
this.ctx.log(
|
|
8379
|
-
this.ctx.log(
|
|
8507
|
+
this.ctx.log(picocolors.exports.red(` ${pointer} ${getFullName(test)}`));
|
|
8508
|
+
this.ctx.log(picocolors.exports.red(` ${F_RIGHT} ${(_c = test.result.error) == null ? void 0 : _c.message}`));
|
|
8380
8509
|
}
|
|
8381
8510
|
}
|
|
8382
8511
|
}
|
|
@@ -8394,13 +8523,13 @@ class BaseReporter {
|
|
|
8394
8523
|
hints.unshift(HELP_UPDATE_SNAP);
|
|
8395
8524
|
else
|
|
8396
8525
|
hints.push(HELP_QUITE);
|
|
8397
|
-
this.ctx.log(BADGE_PADDING + hints.join(
|
|
8526
|
+
this.ctx.log(BADGE_PADDING + hints.join(picocolors.exports.dim(", ")));
|
|
8398
8527
|
}
|
|
8399
8528
|
async onWatcherRerun(files, trigger) {
|
|
8400
8529
|
this.watchFilters = files;
|
|
8401
8530
|
this.ctx.clearScreen();
|
|
8402
8531
|
this.ctx.log(`
|
|
8403
|
-
${
|
|
8532
|
+
${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" RERUN ")))}${trigger ? picocolors.exports.dim(` ${this.relative(trigger)}
|
|
8404
8533
|
`) : ""}`);
|
|
8405
8534
|
this.start = performance.now();
|
|
8406
8535
|
}
|
|
@@ -8408,12 +8537,12 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8408
8537
|
if (this.ctx.config.silent)
|
|
8409
8538
|
return;
|
|
8410
8539
|
const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
|
|
8411
|
-
this.ctx.log(
|
|
8540
|
+
this.ctx.log(picocolors.exports.gray(log.type + picocolors.exports.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
|
|
8412
8541
|
process[log.type].write(`${log.content}
|
|
8413
8542
|
`);
|
|
8414
8543
|
}
|
|
8415
8544
|
onServerRestart() {
|
|
8416
|
-
this.ctx.log(
|
|
8545
|
+
this.ctx.log(picocolors.exports.cyan("Restarted due to config changes..."));
|
|
8417
8546
|
}
|
|
8418
8547
|
async reportSummary(files) {
|
|
8419
8548
|
const suites = getSuites(files);
|
|
@@ -8428,15 +8557,15 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8428
8557
|
});
|
|
8429
8558
|
const failedTotal = failedSuites.length + failedTests.length;
|
|
8430
8559
|
let current = 1;
|
|
8431
|
-
const errorDivider = () => this.ctx.error(`${
|
|
8560
|
+
const errorDivider = () => this.ctx.error(`${picocolors.exports.red(picocolors.exports.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
|
|
8432
8561
|
`);
|
|
8433
8562
|
if (failedSuites.length) {
|
|
8434
|
-
this.ctx.error(
|
|
8563
|
+
this.ctx.error(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` Failed Suites ${failedSuites.length} `)))));
|
|
8435
8564
|
this.ctx.error();
|
|
8436
8565
|
await this.printTaskErrors(failedSuites, errorDivider);
|
|
8437
8566
|
}
|
|
8438
8567
|
if (failedTests.length) {
|
|
8439
|
-
this.ctx.error(
|
|
8568
|
+
this.ctx.error(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` Failed Tests ${failedTests.length} `)))));
|
|
8440
8569
|
this.ctx.error();
|
|
8441
8570
|
await this.printTaskErrors(failedTests, errorDivider);
|
|
8442
8571
|
}
|
|
@@ -8445,7 +8574,7 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8445
8574
|
var _a;
|
|
8446
8575
|
return acc + Math.max(0, ((_a = test.result) == null ? void 0 : _a.duration) || 0) + Math.max(0, test.collectDuration || 0);
|
|
8447
8576
|
}, 0);
|
|
8448
|
-
const padTitle = (str) =>
|
|
8577
|
+
const padTitle = (str) => picocolors.exports.dim(`${str.padStart(10)} `);
|
|
8449
8578
|
const time = (time2) => {
|
|
8450
8579
|
if (time2 > 1e3)
|
|
8451
8580
|
return `${(time2 / 1e3).toFixed(2)}s`;
|
|
@@ -8462,7 +8591,7 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8462
8591
|
if (this.watchFilters)
|
|
8463
8592
|
this.ctx.log(padTitle("Time"), time(threadTime));
|
|
8464
8593
|
else
|
|
8465
|
-
this.ctx.log(padTitle("Time"), time(executionTime) +
|
|
8594
|
+
this.ctx.log(padTitle("Time"), time(executionTime) + picocolors.exports.gray(` (in thread ${time(threadTime)}, ${(executionTime / threadTime * 100).toFixed(2)}%)`));
|
|
8466
8595
|
this.ctx.log();
|
|
8467
8596
|
}
|
|
8468
8597
|
async printTaskErrors(tasks, errorDivider) {
|
|
@@ -8484,8 +8613,8 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8484
8613
|
const filepath = (task == null ? void 0 : task.filepath) || "";
|
|
8485
8614
|
let name = getFullName(task);
|
|
8486
8615
|
if (filepath)
|
|
8487
|
-
name = `${name} ${
|
|
8488
|
-
this.ctx.error(`${
|
|
8616
|
+
name = `${name} ${picocolors.exports.dim(`[ ${this.relative(filepath)} ]`)}`;
|
|
8617
|
+
this.ctx.error(`${picocolors.exports.red(picocolors.exports.bold(picocolors.exports.inverse(" FAIL ")))} ${name}`);
|
|
8489
8618
|
}
|
|
8490
8619
|
await this.ctx.printError(error);
|
|
8491
8620
|
errorDivider();
|
|
@@ -8495,7 +8624,7 @@ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigg
|
|
|
8495
8624
|
process.on("unhandledRejection", async (err) => {
|
|
8496
8625
|
process.exitCode = 1;
|
|
8497
8626
|
this.ctx.error(`
|
|
8498
|
-
${
|
|
8627
|
+
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Rejection "))))}`);
|
|
8499
8628
|
await this.ctx.printError(err);
|
|
8500
8629
|
this.ctx.error("\n\n");
|
|
8501
8630
|
process.exit(1);
|
|
@@ -8658,8 +8787,8 @@ ansiEscapes.iTerm = {
|
|
|
8658
8787
|
}
|
|
8659
8788
|
};
|
|
8660
8789
|
|
|
8661
|
-
const restoreCursor = onetime$1(() => {
|
|
8662
|
-
signalExit(() => {
|
|
8790
|
+
const restoreCursor = onetime$1.exports(() => {
|
|
8791
|
+
signalExit.exports(() => {
|
|
8663
8792
|
process$1.stderr.write('\u001B[?25h');
|
|
8664
8793
|
}, {alwaysLast: true});
|
|
8665
8794
|
});
|
|
@@ -8998,13 +9127,13 @@ function formatFilepath(path) {
|
|
|
8998
9127
|
if (firstDot < 0)
|
|
8999
9128
|
firstDot = basename.length;
|
|
9000
9129
|
firstDot += lastSlash;
|
|
9001
|
-
return
|
|
9130
|
+
return picocolors.exports.dim(path.slice(0, lastSlash)) + path.slice(lastSlash, firstDot) + picocolors.exports.dim(path.slice(firstDot));
|
|
9002
9131
|
}
|
|
9003
9132
|
function renderHookState(task, hookName, level = 0) {
|
|
9004
9133
|
var _a, _b;
|
|
9005
9134
|
const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
|
|
9006
9135
|
if (state && state === "run")
|
|
9007
|
-
return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${
|
|
9136
|
+
return `${" ".repeat(level)} ${getHookStateSymbol(task, hookName)} ${picocolors.exports.dim(`[ ${hookName} ]`)}`;
|
|
9008
9137
|
return "";
|
|
9009
9138
|
}
|
|
9010
9139
|
function renderTree(tasks, options, level = 0) {
|
|
@@ -9014,12 +9143,12 @@ function renderTree(tasks, options, level = 0) {
|
|
|
9014
9143
|
let suffix = "";
|
|
9015
9144
|
const prefix = ` ${getStateSymbol(task)} `;
|
|
9016
9145
|
if (task.type === "suite")
|
|
9017
|
-
suffix +=
|
|
9146
|
+
suffix += picocolors.exports.dim(` (${getTests(task).length})`);
|
|
9018
9147
|
if (task.mode === "skip" || task.mode === "todo")
|
|
9019
|
-
suffix += ` ${
|
|
9148
|
+
suffix += ` ${picocolors.exports.dim(picocolors.exports.gray("[skipped]"))}`;
|
|
9020
9149
|
if (((_a = task.result) == null ? void 0 : _a.duration) != null) {
|
|
9021
9150
|
if (task.result.duration > DURATION_LONG)
|
|
9022
|
-
suffix +=
|
|
9151
|
+
suffix += picocolors.exports.yellow(` ${Math.round(task.result.duration)}${picocolors.exports.dim("ms")}`);
|
|
9023
9152
|
}
|
|
9024
9153
|
let name = task.name;
|
|
9025
9154
|
if (level === 0)
|
|
@@ -9034,7 +9163,7 @@ function renderTree(tasks, options, level = 0) {
|
|
|
9034
9163
|
}
|
|
9035
9164
|
if (data != null) {
|
|
9036
9165
|
const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
|
|
9037
|
-
output.push(` ${
|
|
9166
|
+
output.push(` ${picocolors.exports.gray(cliTruncate(out, getCols(-3)))}`);
|
|
9038
9167
|
}
|
|
9039
9168
|
}
|
|
9040
9169
|
output = output.concat(renderHookState(task, "beforeAll", level + 1));
|
|
@@ -9091,7 +9220,7 @@ class DefaultReporter extends BaseReporter {
|
|
|
9091
9220
|
async onTestRemoved(trigger) {
|
|
9092
9221
|
await this.stopListRender();
|
|
9093
9222
|
this.ctx.clearScreen();
|
|
9094
|
-
this.ctx.log(
|
|
9223
|
+
this.ctx.log(picocolors.exports.yellow("Test removed...") + (trigger ? picocolors.exports.dim(` [ ${this.relative(trigger)} ]
|
|
9095
9224
|
`) : ""));
|
|
9096
9225
|
const files = this.ctx.state.getFiles(this.watchFilters);
|
|
9097
9226
|
createListRenderer(files, this.rendererOptions).stop();
|
|
@@ -9134,10 +9263,10 @@ class DefaultReporter extends BaseReporter {
|
|
|
9134
9263
|
}
|
|
9135
9264
|
}
|
|
9136
9265
|
|
|
9137
|
-
const check =
|
|
9138
|
-
const cross =
|
|
9139
|
-
const pending =
|
|
9140
|
-
const skip =
|
|
9266
|
+
const check = picocolors.exports.green("\xB7");
|
|
9267
|
+
const cross = picocolors.exports.red("x");
|
|
9268
|
+
const pending = picocolors.exports.yellow("*");
|
|
9269
|
+
const skip = picocolors.exports.dim(picocolors.exports.gray("-"));
|
|
9141
9270
|
function render(tasks) {
|
|
9142
9271
|
const all = getTests(tasks);
|
|
9143
9272
|
return all.map((i) => {
|
|
@@ -9372,7 +9501,7 @@ class VerboseReporter extends DefaultReporter {
|
|
|
9372
9501
|
if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
|
|
9373
9502
|
this.ctx.log(` ${getStateSymbol(task)} ${getFullName(task)}`);
|
|
9374
9503
|
if (task.result.state === "fail")
|
|
9375
|
-
this.ctx.log(
|
|
9504
|
+
this.ctx.log(picocolors.exports.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
|
|
9376
9505
|
}
|
|
9377
9506
|
}
|
|
9378
9507
|
}
|
|
@@ -9684,128 +9813,31 @@ const ReportersMap = {
|
|
|
9684
9813
|
"junit": JUnitReporter
|
|
9685
9814
|
};
|
|
9686
9815
|
|
|
9687
|
-
function
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
}
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
port.close();
|
|
9708
|
-
workerPort.close();
|
|
9709
|
-
};
|
|
9710
|
-
};
|
|
9711
|
-
return {
|
|
9712
|
-
runTests: runWithFiles("run"),
|
|
9713
|
-
collectTests: runWithFiles("collect"),
|
|
9714
|
-
close: async () => {
|
|
9715
|
-
}
|
|
9716
|
-
};
|
|
9717
|
-
}
|
|
9718
|
-
function createWorkerPool(ctx) {
|
|
9719
|
-
const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
|
|
9720
|
-
const options = {
|
|
9721
|
-
filename: workerPath,
|
|
9722
|
-
useAtomics: typeof process.versions.webcontainer !== "string",
|
|
9723
|
-
maxThreads: ctx.config.maxThreads ?? threadsCount,
|
|
9724
|
-
minThreads: ctx.config.minThreads ?? threadsCount
|
|
9725
|
-
};
|
|
9726
|
-
if (ctx.config.isolate) {
|
|
9727
|
-
options.isolateWorkers = true;
|
|
9728
|
-
options.concurrentTasksPerWorker = 1;
|
|
9729
|
-
}
|
|
9730
|
-
const pool = new Tinypool(options);
|
|
9731
|
-
const runWithFiles = (name) => {
|
|
9732
|
-
return async (files, invalidates) => {
|
|
9733
|
-
let id = 0;
|
|
9734
|
-
await Promise.all(files.map(async (file) => {
|
|
9735
|
-
const { workerPort, port } = createChannel(ctx);
|
|
9736
|
-
const data = {
|
|
9737
|
-
port: workerPort,
|
|
9738
|
-
config: ctx.getConfig(),
|
|
9739
|
-
files: [file],
|
|
9740
|
-
invalidates,
|
|
9741
|
-
id: ++id
|
|
9742
|
-
};
|
|
9743
|
-
await pool.run(data, { transferList: [workerPort], name });
|
|
9744
|
-
port.close();
|
|
9745
|
-
workerPort.close();
|
|
9746
|
-
}));
|
|
9747
|
-
};
|
|
9748
|
-
};
|
|
9749
|
-
return {
|
|
9750
|
-
runTests: runWithFiles("run"),
|
|
9751
|
-
collectTests: runWithFiles("collect"),
|
|
9752
|
-
close: async () => {
|
|
9753
|
-
}
|
|
9754
|
-
};
|
|
9755
|
-
}
|
|
9756
|
-
function createChannel(ctx) {
|
|
9757
|
-
const channel = new MessageChannel();
|
|
9758
|
-
const port = channel.port2;
|
|
9759
|
-
const workerPort = channel.port1;
|
|
9760
|
-
createBirpc({
|
|
9761
|
-
onWorkerExit(code) {
|
|
9762
|
-
process.exit(code || 1);
|
|
9763
|
-
},
|
|
9764
|
-
snapshotSaved(snapshot) {
|
|
9765
|
-
ctx.snapshot.add(snapshot);
|
|
9766
|
-
},
|
|
9767
|
-
resolveSnapshotPath(testPath) {
|
|
9768
|
-
return ctx.snapshot.resolvePath(testPath);
|
|
9769
|
-
},
|
|
9770
|
-
async getSourceMap(id, force) {
|
|
9771
|
-
if (force) {
|
|
9772
|
-
const mod = ctx.server.moduleGraph.getModuleById(id);
|
|
9773
|
-
if (mod)
|
|
9774
|
-
ctx.server.moduleGraph.invalidateModule(mod);
|
|
9816
|
+
async function loadCustomReporterModule(path, fetchModule) {
|
|
9817
|
+
let customReporterModule;
|
|
9818
|
+
try {
|
|
9819
|
+
customReporterModule = await fetchModule(path);
|
|
9820
|
+
} catch (customReporterModuleError) {
|
|
9821
|
+
throw new Error(`Failed to load custom Reporter from ${path}`, { cause: customReporterModuleError });
|
|
9822
|
+
}
|
|
9823
|
+
if (customReporterModule.default === null || customReporterModule.default === void 0)
|
|
9824
|
+
throw new Error(`Custom reporter loaded from ${path} was not the default export`);
|
|
9825
|
+
return customReporterModule.default;
|
|
9826
|
+
}
|
|
9827
|
+
function createReporters(reporterReferences, fetchModule) {
|
|
9828
|
+
const promisedReporters = reporterReferences.map(async (referenceOrInstance) => {
|
|
9829
|
+
if (typeof referenceOrInstance === "string") {
|
|
9830
|
+
if (referenceOrInstance in ReportersMap) {
|
|
9831
|
+
const BuiltinReporter = ReportersMap[referenceOrInstance];
|
|
9832
|
+
return new BuiltinReporter();
|
|
9833
|
+
} else {
|
|
9834
|
+
const CustomReporter = await loadCustomReporterModule(referenceOrInstance, fetchModule);
|
|
9835
|
+
return new CustomReporter();
|
|
9775
9836
|
}
|
|
9776
|
-
const r = await ctx.vitenode.transformRequest(id);
|
|
9777
|
-
return r == null ? void 0 : r.map;
|
|
9778
|
-
},
|
|
9779
|
-
fetch(id) {
|
|
9780
|
-
return ctx.vitenode.fetchModule(id);
|
|
9781
|
-
},
|
|
9782
|
-
resolveId(id, importer) {
|
|
9783
|
-
return ctx.vitenode.resolveId(id, importer);
|
|
9784
|
-
},
|
|
9785
|
-
onCollected(files) {
|
|
9786
|
-
ctx.state.collectFiles(files);
|
|
9787
|
-
ctx.report("onCollected", files);
|
|
9788
|
-
},
|
|
9789
|
-
onTaskUpdate(packs) {
|
|
9790
|
-
ctx.state.updateTasks(packs);
|
|
9791
|
-
ctx.report("onTaskUpdate", packs);
|
|
9792
|
-
},
|
|
9793
|
-
onUserConsoleLog(log) {
|
|
9794
|
-
ctx.state.updateUserLog(log);
|
|
9795
|
-
ctx.report("onUserConsoleLog", log);
|
|
9796
|
-
},
|
|
9797
|
-
onFinished(files) {
|
|
9798
|
-
ctx.report("onFinished", files);
|
|
9799
|
-
}
|
|
9800
|
-
}, {
|
|
9801
|
-
post(v) {
|
|
9802
|
-
port.postMessage(v);
|
|
9803
|
-
},
|
|
9804
|
-
on(fn) {
|
|
9805
|
-
port.on("message", fn);
|
|
9806
9837
|
}
|
|
9838
|
+
return referenceOrInstance;
|
|
9807
9839
|
});
|
|
9808
|
-
return
|
|
9840
|
+
return Promise.all(promisedReporters);
|
|
9809
9841
|
}
|
|
9810
9842
|
|
|
9811
9843
|
class StateManager {
|
|
@@ -9917,7 +9949,7 @@ function resolveConfig(options, viteConfig) {
|
|
|
9917
9949
|
var _a, _b;
|
|
9918
9950
|
if (options.dom) {
|
|
9919
9951
|
if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
|
|
9920
|
-
console.warn(
|
|
9952
|
+
console.warn(picocolors.exports.yellow(`${picocolors.exports.inverse(picocolors.exports.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
|
|
9921
9953
|
}
|
|
9922
9954
|
options.environment = "happy-dom";
|
|
9923
9955
|
}
|
|
@@ -9980,7 +10012,7 @@ async function printError(error, ctx) {
|
|
|
9980
10012
|
await printStack(ctx, stacks, nearest, async (s, pos) => {
|
|
9981
10013
|
if (s === nearest && nearest) {
|
|
9982
10014
|
const sourceCode = await promises.readFile(fileFromParsedStack(nearest), "utf-8");
|
|
9983
|
-
ctx.log(
|
|
10015
|
+
ctx.log(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, pos)));
|
|
9984
10016
|
}
|
|
9985
10017
|
});
|
|
9986
10018
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
@@ -10000,15 +10032,15 @@ function handleImportOutsideModuleError(stack, ctx) {
|
|
|
10000
10032
|
name = name.split("/").slice(0, 2).join("/");
|
|
10001
10033
|
else
|
|
10002
10034
|
name = name.split("/")[0];
|
|
10003
|
-
ctx.console.error(
|
|
10035
|
+
ctx.console.error(picocolors.exports.yellow(`Module ${path} seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package ${picocolors.exports.bold(`"${name}"`)} asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
|
|
10004
10036
|
|
|
10005
10037
|
As a temporary workaround you can try to inline the package by updating your config:
|
|
10006
10038
|
|
|
10007
|
-
` +
|
|
10039
|
+
` + picocolors.exports.gray(picocolors.exports.dim("// vitest.config.js")) + "\n" + picocolors.exports.green(`export default {
|
|
10008
10040
|
test: {
|
|
10009
10041
|
deps: {
|
|
10010
10042
|
inline: [
|
|
10011
|
-
${
|
|
10043
|
+
${picocolors.exports.yellow(picocolors.exports.bold(`"${name}"`))}
|
|
10012
10044
|
]
|
|
10013
10045
|
}
|
|
10014
10046
|
}
|
|
@@ -10016,21 +10048,21 @@ As a temporary workaround you can try to inline the package by updating your con
|
|
|
10016
10048
|
`)));
|
|
10017
10049
|
}
|
|
10018
10050
|
function displayDiff(actual, expected, console, outputTruncateLength) {
|
|
10019
|
-
console.error(
|
|
10051
|
+
console.error(picocolors.exports.gray(unifiedDiff(actual, expected, { outputTruncateLength })) + "\n");
|
|
10020
10052
|
}
|
|
10021
10053
|
function printErrorMessage(error, console) {
|
|
10022
10054
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
10023
|
-
console.error(
|
|
10055
|
+
console.error(picocolors.exports.red(`${picocolors.exports.bold(errorName)}: ${error.message}`));
|
|
10024
10056
|
}
|
|
10025
10057
|
async function printStack(ctx, stack, highlight, onStack) {
|
|
10026
10058
|
if (!stack.length)
|
|
10027
10059
|
return;
|
|
10028
10060
|
for (const frame of stack) {
|
|
10029
10061
|
const pos = frame.sourcePos || frame;
|
|
10030
|
-
const color = frame === highlight ?
|
|
10062
|
+
const color = frame === highlight ? picocolors.exports.yellow : picocolors.exports.gray;
|
|
10031
10063
|
const file = fileFromParsedStack(frame);
|
|
10032
10064
|
const path = relative(ctx.config.root, file);
|
|
10033
|
-
ctx.log(color(` ${
|
|
10065
|
+
ctx.log(color(` ${picocolors.exports.dim(F_POINTER)} ${[frame.method, picocolors.exports.dim(`${path}:${pos.line}:${pos.column}`)].filter(Boolean).join(" ")}`));
|
|
10034
10066
|
await (onStack == null ? void 0 : onStack(frame, pos));
|
|
10035
10067
|
if (frame.file in ctx.state.filesMap)
|
|
10036
10068
|
break;
|
|
@@ -10045,7 +10077,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
10045
10077
|
let res = [];
|
|
10046
10078
|
const columns = process.stdout.columns || 80;
|
|
10047
10079
|
function lineNo(no = "") {
|
|
10048
|
-
return
|
|
10080
|
+
return picocolors.exports.gray(`${String(no).padStart(3, " ")}| `);
|
|
10049
10081
|
}
|
|
10050
10082
|
for (let i = 0; i < lines.length; i++) {
|
|
10051
10083
|
count += lines[i].length + 1;
|
|
@@ -10060,11 +10092,11 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
10060
10092
|
if (j === i) {
|
|
10061
10093
|
const pad = start - (count - lineLength);
|
|
10062
10094
|
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
|
10063
|
-
res.push(lineNo() + " ".repeat(pad) +
|
|
10095
|
+
res.push(lineNo() + " ".repeat(pad) + picocolors.exports.red("^".repeat(length)));
|
|
10064
10096
|
} else if (j > i) {
|
|
10065
10097
|
if (end > count) {
|
|
10066
10098
|
const length = Math.max(1, Math.min(end - count, lineLength));
|
|
10067
|
-
res.push(lineNo() +
|
|
10099
|
+
res.push(lineNo() + picocolors.exports.red("^".repeat(length)));
|
|
10068
10100
|
}
|
|
10069
10101
|
count += lineLength + 1;
|
|
10070
10102
|
}
|
|
@@ -10168,6 +10200,7 @@ class Vitest {
|
|
|
10168
10200
|
this.changedTests = /* @__PURE__ */ new Set();
|
|
10169
10201
|
this.isFirstRun = true;
|
|
10170
10202
|
this.restartsCount = 0;
|
|
10203
|
+
this.runner = void 0;
|
|
10171
10204
|
this._onRestartListeners = [];
|
|
10172
10205
|
this.unregisterWatcher = noop$1;
|
|
10173
10206
|
this.console = globalThis.console;
|
|
@@ -10184,18 +10217,21 @@ class Vitest {
|
|
|
10184
10217
|
this.config = resolved;
|
|
10185
10218
|
this.state = new StateManager();
|
|
10186
10219
|
this.snapshot = new SnapshotManager(__spreadValues$1({}, resolved.snapshotOptions));
|
|
10187
|
-
this.reporters = resolved.reporters.map((i) => {
|
|
10188
|
-
if (typeof i === "string") {
|
|
10189
|
-
const Reporter = ReportersMap[i];
|
|
10190
|
-
if (!Reporter)
|
|
10191
|
-
throw new Error(`Unknown reporter: ${i}`);
|
|
10192
|
-
return new Reporter();
|
|
10193
|
-
}
|
|
10194
|
-
return i;
|
|
10195
|
-
});
|
|
10196
10220
|
if (this.config.watch)
|
|
10197
10221
|
this.registerWatcher();
|
|
10198
10222
|
this.vitenode = new ViteNodeServer(server, this.config);
|
|
10223
|
+
const node = this.vitenode;
|
|
10224
|
+
this.runner = new ViteNodeRunner({
|
|
10225
|
+
root: server.config.root,
|
|
10226
|
+
base: server.config.base,
|
|
10227
|
+
fetchModule(id) {
|
|
10228
|
+
return node.fetchModule(id);
|
|
10229
|
+
},
|
|
10230
|
+
resolveId(id, importer) {
|
|
10231
|
+
return node.resolveId(id, importer);
|
|
10232
|
+
}
|
|
10233
|
+
});
|
|
10234
|
+
this.reporters = await createReporters(resolved.reporters, this.runner.executeFile.bind(this.runner));
|
|
10199
10235
|
this.runningPromise = void 0;
|
|
10200
10236
|
this._onRestartListeners.forEach((fn) => fn());
|
|
10201
10237
|
if (resolved.coverage.enabled)
|
|
@@ -10219,17 +10255,17 @@ class Vitest {
|
|
|
10219
10255
|
const files = await this.filterTestsBySource(await this.globTestFiles(filters));
|
|
10220
10256
|
if (!files.length) {
|
|
10221
10257
|
const exitCode = this.config.passWithNoTests ? 0 : 1;
|
|
10222
|
-
const comma =
|
|
10258
|
+
const comma = picocolors.exports.dim(", ");
|
|
10223
10259
|
if (filters == null ? void 0 : filters.length)
|
|
10224
|
-
this.console.error(
|
|
10260
|
+
this.console.error(picocolors.exports.dim("filter: ") + picocolors.exports.yellow(filters.join(comma)));
|
|
10225
10261
|
if (this.config.include)
|
|
10226
|
-
this.console.error(
|
|
10262
|
+
this.console.error(picocolors.exports.dim("include: ") + picocolors.exports.yellow(this.config.include.join(comma)));
|
|
10227
10263
|
if (this.config.watchIgnore)
|
|
10228
|
-
this.console.error(
|
|
10264
|
+
this.console.error(picocolors.exports.dim("ignore: ") + picocolors.exports.yellow(this.config.watchIgnore.join(comma)));
|
|
10229
10265
|
if (this.config.passWithNoTests)
|
|
10230
10266
|
this.log("No test files found, exiting with code 0\n");
|
|
10231
10267
|
else
|
|
10232
|
-
this.error(
|
|
10268
|
+
this.error(picocolors.exports.red("\nNo test files found, exiting with code 1"));
|
|
10233
10269
|
process.exit(exitCode);
|
|
10234
10270
|
}
|
|
10235
10271
|
await this.runFiles(files);
|
|
@@ -10264,7 +10300,7 @@ class Vitest {
|
|
|
10264
10300
|
changedSince: this.config.changed
|
|
10265
10301
|
});
|
|
10266
10302
|
if (!related2) {
|
|
10267
|
-
this.error(
|
|
10303
|
+
this.error(picocolors.exports.red("Could not find Git root. Have you initialized git with `git init`?\n"));
|
|
10268
10304
|
process.exit(1);
|
|
10269
10305
|
}
|
|
10270
10306
|
this.config.related = Array.from(new Set(related2));
|
|
@@ -10529,18 +10565,8 @@ const EnvReplacerPlugin = () => {
|
|
|
10529
10565
|
|
|
10530
10566
|
async function loadGlobalSetupFiles(ctx) {
|
|
10531
10567
|
var _a;
|
|
10532
|
-
const node = ctx.vitenode;
|
|
10533
10568
|
const server = ctx.server;
|
|
10534
|
-
const runner =
|
|
10535
|
-
root: server.config.root,
|
|
10536
|
-
base: server.config.base,
|
|
10537
|
-
fetchModule(id) {
|
|
10538
|
-
return node.fetchModule(id);
|
|
10539
|
-
},
|
|
10540
|
-
resolveId(id, importer) {
|
|
10541
|
-
return node.resolveId(id, importer);
|
|
10542
|
-
}
|
|
10543
|
-
});
|
|
10569
|
+
const runner = ctx.runner;
|
|
10544
10570
|
const globalSetupFiles = toArray((_a = server.config.test) == null ? void 0 : _a.globalSetup);
|
|
10545
10571
|
return Promise.all(globalSetupFiles.map((file) => loadGlobalSetupFile(file, runner)));
|
|
10546
10572
|
}
|
|
@@ -10586,7 +10612,7 @@ const GlobalSetupPlugin = (ctx) => {
|
|
|
10586
10612
|
}
|
|
10587
10613
|
} catch (e) {
|
|
10588
10614
|
ctx.error(`
|
|
10589
|
-
${
|
|
10615
|
+
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Error during global setup "))))}`);
|
|
10590
10616
|
await ctx.printError(e);
|
|
10591
10617
|
process.exit(1);
|
|
10592
10618
|
}
|
|
@@ -10821,7 +10847,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10821
10847
|
await ctx.setServer(options, server);
|
|
10822
10848
|
haveStarted = true;
|
|
10823
10849
|
if (options.api && options.watch)
|
|
10824
|
-
(await import('./chunk-api-setup.
|
|
10850
|
+
(await import('./chunk-api-setup.d70fc960.js')).setup(ctx);
|
|
10825
10851
|
if (!options.watch)
|
|
10826
10852
|
await server.watcher.close();
|
|
10827
10853
|
}
|
|
@@ -10861,8 +10887,8 @@ const keys = [
|
|
|
10861
10887
|
];
|
|
10862
10888
|
function printShortcutsHelp() {
|
|
10863
10889
|
process.stdout.write(`
|
|
10864
|
-
${
|
|
10865
|
-
${keys.map((i) =>
|
|
10890
|
+
${picocolors.exports.bold(" Watch Usage")}
|
|
10891
|
+
${keys.map((i) => picocolors.exports.dim(" press ") + picocolors.exports.reset(picocolors.exports.bold(i[0])) + picocolors.exports.dim(` to ${i[1]}`)).join("\n")}
|
|
10866
10892
|
`);
|
|
10867
10893
|
}
|
|
10868
10894
|
function registerConsoleShortcuts(ctx) {
|
|
@@ -10963,9 +10989,10 @@ async function startVitest(cliFilters, options, viteOverrides) {
|
|
|
10963
10989
|
} catch (e) {
|
|
10964
10990
|
process.exitCode = 1;
|
|
10965
10991
|
ctx.error(`
|
|
10966
|
-
${
|
|
10992
|
+
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Error "))))}`);
|
|
10967
10993
|
await ctx.printError(e);
|
|
10968
10994
|
ctx.error("\n\n");
|
|
10995
|
+
return false;
|
|
10969
10996
|
}
|
|
10970
10997
|
if (!ctx.config.watch) {
|
|
10971
10998
|
await ctx.exit();
|