vitest 0.14.1 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-api-setup.7945baf8.mjs → chunk-api-setup.ff687d0e.mjs} +44 -37
- package/dist/{chunk-constants.41584d81.mjs → chunk-constants.7b9cfc82.mjs} +1 -1
- package/dist/{chunk-defaults.a820faeb.mjs → chunk-defaults.dc6dc23d.mjs} +142 -3
- package/dist/{chunk-install-pkg.6f5930c3.mjs → chunk-install-pkg.3fa50769.mjs} +1 -1
- package/dist/{chunk-integrations-globals.f0c5e97f.mjs → chunk-integrations-globals.df0878f4.mjs} +7 -7
- package/dist/{chunk-runtime-chain.6a3c6576.mjs → chunk-runtime-chain.ce7f4b92.mjs} +117 -64
- package/dist/{chunk-runtime-mocker.7cf95199.mjs → chunk-runtime-mocker.2f3cbfe5.mjs} +3 -3
- package/dist/{chunk-runtime-rpc.44043bb4.mjs → chunk-runtime-rpc.5e78af38.mjs} +1 -1
- package/dist/{chunk-utils-global.624991bc.mjs → chunk-utils-global.79a8b1cc.mjs} +15 -8
- package/dist/{chunk-utils-source-map.4408ba82.mjs → chunk-utils-source-map.2556cba8.mjs} +29 -14
- package/dist/{chunk-vite-node-externalize.d492e389.mjs → chunk-vite-node-externalize.105bc106.mjs} +105 -165
- package/dist/{chunk-vite-node-utils.d6687931.mjs → chunk-vite-node-utils.c0a0e1b3.mjs} +4 -4
- package/dist/cli.mjs +11 -10
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +6 -6
- package/dist/index.d.ts +36 -4
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +32 -1
- package/dist/node.mjs +10 -9
- package/dist/{vendor-entry.93b045ee.mjs → vendor-entry.7ec02ea2.mjs} +41 -27
- package/dist/{vendor-index.a2a385d8.mjs → vendor-index.e5dc6622.mjs} +0 -0
- package/dist/worker.mjs +8 -7
- package/package.json +9 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
1
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.c0a0e1b3.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname,
|
|
3
|
+
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, m as resolve, l as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.79a8b1cc.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.7b9cfc82.mjs';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -290,20 +290,27 @@ function getOwnProperties(obj) {
|
|
|
290
290
|
collectOwnProperties(obj, ownProps);
|
|
291
291
|
return Array.from(ownProps);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
|
|
293
|
+
function deepClone(val) {
|
|
294
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
295
|
+
return clone(val, seen);
|
|
296
|
+
}
|
|
297
|
+
function clone(val, seen) {
|
|
298
|
+
let k, out;
|
|
299
|
+
if (seen.has(val))
|
|
300
|
+
return seen.get(val);
|
|
295
301
|
if (Array.isArray(val)) {
|
|
296
302
|
out = Array(k = val.length);
|
|
303
|
+
seen.set(val, out);
|
|
297
304
|
while (k--)
|
|
298
|
-
out[k] = (
|
|
305
|
+
out[k] = clone(val[k], seen);
|
|
299
306
|
return out;
|
|
300
307
|
}
|
|
301
308
|
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
302
309
|
out = Object.create(Object.getPrototypeOf(val));
|
|
310
|
+
seen.set(val, out);
|
|
303
311
|
const props = getOwnProperties(val);
|
|
304
|
-
for (const k2 of props)
|
|
305
|
-
out[k2] = (
|
|
306
|
-
}
|
|
312
|
+
for (const k2 of props)
|
|
313
|
+
out[k2] = clone(val[k2], seen);
|
|
307
314
|
return out;
|
|
308
315
|
}
|
|
309
316
|
return val;
|
|
@@ -459,7 +466,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
459
466
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
460
467
|
});
|
|
461
468
|
if (install) {
|
|
462
|
-
await (await import('./chunk-install-pkg.
|
|
469
|
+
await (await import('./chunk-install-pkg.3fa50769.mjs')).installPackage(dependency, { dev: true });
|
|
463
470
|
process.stderr.write(picocolors.exports.yellow(`
|
|
464
471
|
Package ${dependency} installed, re-run the command to start.
|
|
465
472
|
`));
|
|
@@ -503,4 +510,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
512
|
|
|
506
|
-
export { AggregateErrorPonyfill as A,
|
|
513
|
+
export { AggregateErrorPonyfill as A, safeClearInterval as B, toArray as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, deepClone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, safeSetTimeout as f, getCallLastIndex as g, safeClearTimeout as h, isObject as i, join as j, notNullish as k, basename as l, resolve as m, noop as n, isAbsolute as o, picocolors as p, relative as q, resetModules as r, slash as s, isNode as t, getTests as u, hasFailed as v, withSafeTimers as w, hasFailedSnapshot as x, getSuites as y, safeSetInterval as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as slash,
|
|
1
|
+
import { s as slash, k as notNullish, p as picocolors } from './chunk-utils-global.79a8b1cc.mjs';
|
|
2
2
|
|
|
3
3
|
var build = {};
|
|
4
4
|
|
|
@@ -5646,8 +5646,6 @@ function getOriginalPos(map, { line, column }) {
|
|
|
5646
5646
|
resolve(null);
|
|
5647
5647
|
});
|
|
5648
5648
|
}
|
|
5649
|
-
const stackFnCallRE = /at (.*) \((.+):(\d+):(\d+)\)$/;
|
|
5650
|
-
const stackBarePathRE = /at ?(.*) (.+):(\d+):(\d+)$/;
|
|
5651
5649
|
async function interpretSourcePos(stackFrames, ctx) {
|
|
5652
5650
|
var _a;
|
|
5653
5651
|
for (const frame of stackFrames) {
|
|
@@ -5669,25 +5667,42 @@ const stackIgnorePatterns = [
|
|
|
5669
5667
|
"/node_modules/tinypool/",
|
|
5670
5668
|
"/node_modules/tinyspy/"
|
|
5671
5669
|
];
|
|
5670
|
+
function extractLocation(urlLike) {
|
|
5671
|
+
if (!urlLike.includes(":"))
|
|
5672
|
+
return [urlLike];
|
|
5673
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
5674
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
5675
|
+
if (!parts)
|
|
5676
|
+
return [urlLike];
|
|
5677
|
+
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
|
5678
|
+
}
|
|
5672
5679
|
function parseStacktrace(e, full = false) {
|
|
5673
5680
|
if (e.stacks)
|
|
5674
5681
|
return e.stacks;
|
|
5675
5682
|
const stackStr = e.stack || e.stackStr || "";
|
|
5676
5683
|
const stackFrames = stackStr.split("\n").map((raw) => {
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5684
|
+
let line = raw.trim();
|
|
5685
|
+
if (line.includes("(eval "))
|
|
5686
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
5687
|
+
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
5688
|
+
const location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
5689
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
5690
|
+
const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
|
|
5691
|
+
let method = location && sanitizedLine || "";
|
|
5692
|
+
let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
|
|
5693
|
+
if (!file || !lineNumber || !columnNumber)
|
|
5680
5694
|
return null;
|
|
5681
|
-
|
|
5695
|
+
if (method.startsWith("async "))
|
|
5696
|
+
method = method.slice(6);
|
|
5682
5697
|
if (file.startsWith("file://"))
|
|
5683
5698
|
file = file.slice(7);
|
|
5684
|
-
if (!full && stackIgnorePatterns.some((p) => file.includes(p)))
|
|
5699
|
+
if (!full && stackIgnorePatterns.some((p) => file && file.includes(p)))
|
|
5685
5700
|
return null;
|
|
5686
5701
|
return {
|
|
5687
|
-
method
|
|
5688
|
-
file:
|
|
5689
|
-
line: parseInt(
|
|
5690
|
-
column: parseInt(
|
|
5702
|
+
method,
|
|
5703
|
+
file: slash(file),
|
|
5704
|
+
line: parseInt(lineNumber),
|
|
5705
|
+
column: parseInt(columnNumber)
|
|
5691
5706
|
};
|
|
5692
5707
|
}).filter(notNullish);
|
|
5693
5708
|
e.stacks = stackFrames;
|
|
@@ -7247,9 +7262,9 @@ function formatLine(line, outputTruncateLength) {
|
|
|
7247
7262
|
function unifiedDiff(actual, expected, options = {}) {
|
|
7248
7263
|
if (actual === expected)
|
|
7249
7264
|
return "";
|
|
7250
|
-
const { outputTruncateLength, showLegend = true } = options;
|
|
7265
|
+
const { outputTruncateLength, outputDiffLines, showLegend = true } = options;
|
|
7251
7266
|
const indent = " ";
|
|
7252
|
-
const diffLimit = 15;
|
|
7267
|
+
const diffLimit = outputDiffLines || 15;
|
|
7253
7268
|
const counts = {
|
|
7254
7269
|
"+": 0,
|
|
7255
7270
|
"-": 0
|
package/dist/{chunk-vite-node-externalize.d492e389.mjs → chunk-vite-node-externalize.105bc106.mjs}
RENAMED
|
@@ -1,166 +1,32 @@
|
|
|
1
|
-
import { j as join,
|
|
1
|
+
import { j as join, l as basename, d as dirname, m as resolve, s as slash$2, A as AggregateErrorPonyfill, p as picocolors, o as isAbsolute, q as relative, t as isNode, u as getTests, e as getFullName, v as hasFailed, x as hasFailedSnapshot, y as getSuites, z as safeSetInterval, B as safeClearInterval, f as safeSetTimeout, C as toArray$1, D as normalize, n as noop$1, h as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, k as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.79a8b1cc.mjs';
|
|
2
2
|
import { createServer, mergeConfig } from 'vite';
|
|
3
3
|
import path$a from 'path';
|
|
4
4
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
5
5
|
import process$1 from 'process';
|
|
6
6
|
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
7
|
-
import {
|
|
7
|
+
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.dc6dc23d.mjs';
|
|
8
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.7b9cfc82.mjs';
|
|
8
9
|
import readline from 'readline';
|
|
9
10
|
import require$$0, { cpus, hostname, constants as constants$5 } from 'os';
|
|
10
11
|
import require$$0$1 from 'util';
|
|
11
12
|
import require$$0$2 from 'stream';
|
|
12
13
|
import require$$2 from 'events';
|
|
13
14
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
14
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
15
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.c0a0e1b3.mjs';
|
|
15
16
|
import createDebug from 'debug';
|
|
16
|
-
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.a820faeb.mjs';
|
|
17
17
|
import { MessageChannel } from 'worker_threads';
|
|
18
|
+
import { createHash } from 'crypto';
|
|
18
19
|
import { Tinypool } from 'tinypool';
|
|
19
20
|
import { performance } from 'perf_hooks';
|
|
20
|
-
import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.
|
|
21
|
-
import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
21
|
+
import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.2556cba8.mjs';
|
|
22
|
+
import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.e5dc6622.mjs';
|
|
22
23
|
import { resolveModule } from 'local-pkg';
|
|
23
24
|
import { Buffer } from 'buffer';
|
|
24
25
|
import childProcess from 'child_process';
|
|
25
26
|
import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
26
27
|
import { p as prompts } from './vendor-index.98e769c1.mjs';
|
|
27
28
|
|
|
28
|
-
var version = "0.
|
|
29
|
-
|
|
30
|
-
/*
|
|
31
|
-
How it works:
|
|
32
|
-
`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
class Node {
|
|
36
|
-
value;
|
|
37
|
-
next;
|
|
38
|
-
|
|
39
|
-
constructor(value) {
|
|
40
|
-
this.value = value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class Queue {
|
|
45
|
-
#head;
|
|
46
|
-
#tail;
|
|
47
|
-
#size;
|
|
48
|
-
|
|
49
|
-
constructor() {
|
|
50
|
-
this.clear();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
enqueue(value) {
|
|
54
|
-
const node = new Node(value);
|
|
55
|
-
|
|
56
|
-
if (this.#head) {
|
|
57
|
-
this.#tail.next = node;
|
|
58
|
-
this.#tail = node;
|
|
59
|
-
} else {
|
|
60
|
-
this.#head = node;
|
|
61
|
-
this.#tail = node;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.#size++;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
dequeue() {
|
|
68
|
-
const current = this.#head;
|
|
69
|
-
if (!current) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
this.#head = this.#head.next;
|
|
74
|
-
this.#size--;
|
|
75
|
-
return current.value;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
clear() {
|
|
79
|
-
this.#head = undefined;
|
|
80
|
-
this.#tail = undefined;
|
|
81
|
-
this.#size = 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
get size() {
|
|
85
|
-
return this.#size;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
* [Symbol.iterator]() {
|
|
89
|
-
let current = this.#head;
|
|
90
|
-
|
|
91
|
-
while (current) {
|
|
92
|
-
yield current.value;
|
|
93
|
-
current = current.next;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function pLimit(concurrency) {
|
|
99
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
100
|
-
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const queue = new Queue();
|
|
104
|
-
let activeCount = 0;
|
|
105
|
-
|
|
106
|
-
const next = () => {
|
|
107
|
-
activeCount--;
|
|
108
|
-
|
|
109
|
-
if (queue.size > 0) {
|
|
110
|
-
queue.dequeue()();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const run = async (fn, resolve, args) => {
|
|
115
|
-
activeCount++;
|
|
116
|
-
|
|
117
|
-
const result = (async () => fn(...args))();
|
|
118
|
-
|
|
119
|
-
resolve(result);
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
await result;
|
|
123
|
-
} catch {}
|
|
124
|
-
|
|
125
|
-
next();
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const enqueue = (fn, resolve, args) => {
|
|
129
|
-
queue.enqueue(run.bind(undefined, fn, resolve, args));
|
|
130
|
-
|
|
131
|
-
(async () => {
|
|
132
|
-
// This function needs to wait until the next microtask before comparing
|
|
133
|
-
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
|
134
|
-
// when the run function is dequeued and called. The comparison in the if-statement
|
|
135
|
-
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
|
136
|
-
await Promise.resolve();
|
|
137
|
-
|
|
138
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
139
|
-
queue.dequeue()();
|
|
140
|
-
}
|
|
141
|
-
})();
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const generator = (fn, ...args) => new Promise(resolve => {
|
|
145
|
-
enqueue(fn, resolve, args);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
Object.defineProperties(generator, {
|
|
149
|
-
activeCount: {
|
|
150
|
-
get: () => activeCount,
|
|
151
|
-
},
|
|
152
|
-
pendingCount: {
|
|
153
|
-
get: () => queue.size,
|
|
154
|
-
},
|
|
155
|
-
clearQueue: {
|
|
156
|
-
value: () => {
|
|
157
|
-
queue.clear();
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
return generator;
|
|
163
|
-
}
|
|
29
|
+
var version = "0.15.1";
|
|
164
30
|
|
|
165
31
|
class EndError extends Error {
|
|
166
32
|
constructor(value) {
|
|
@@ -188,7 +54,7 @@ async function pLocate(
|
|
|
188
54
|
{
|
|
189
55
|
concurrency = Number.POSITIVE_INFINITY,
|
|
190
56
|
preserveOrder = true,
|
|
191
|
-
},
|
|
57
|
+
} = {},
|
|
192
58
|
) {
|
|
193
59
|
const limit = pLimit(concurrency);
|
|
194
60
|
|
|
@@ -255,7 +121,7 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
|
|
|
255
121
|
|
|
256
122
|
const findUpStop = Symbol('findUpStop');
|
|
257
123
|
|
|
258
|
-
async function findUpMultiple(name, options) {
|
|
124
|
+
async function findUpMultiple(name, options = {}) {
|
|
259
125
|
let directory = path$a.resolve(toPath(options.cwd) || '');
|
|
260
126
|
const {root} = path$a.parse(directory);
|
|
261
127
|
const stopAt = path$a.resolve(directory, options.stopAt || root);
|
|
@@ -299,7 +165,7 @@ async function findUpMultiple(name, options) {
|
|
|
299
165
|
return matches;
|
|
300
166
|
}
|
|
301
167
|
|
|
302
|
-
async function findUp(name, options) {
|
|
168
|
+
async function findUp(name, options = {}) {
|
|
303
169
|
const matches = await findUpMultiple(name, {...options, limit: 1});
|
|
304
170
|
return matches[0];
|
|
305
171
|
}
|
|
@@ -1189,7 +1055,7 @@ const invalidStep = (step, options) => {
|
|
|
1189
1055
|
return [];
|
|
1190
1056
|
};
|
|
1191
1057
|
|
|
1192
|
-
const fillNumbers = (start, end, step = 1, options) => {
|
|
1058
|
+
const fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1193
1059
|
let a = Number(start);
|
|
1194
1060
|
let b = Number(end);
|
|
1195
1061
|
|
|
@@ -1241,7 +1107,7 @@ const fillNumbers = (start, end, step = 1, options) => {
|
|
|
1241
1107
|
return range;
|
|
1242
1108
|
};
|
|
1243
1109
|
|
|
1244
|
-
const fillLetters = (start, end, step = 1, options) => {
|
|
1110
|
+
const fillLetters = (start, end, step = 1, options = {}) => {
|
|
1245
1111
|
if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
|
|
1246
1112
|
return invalidRange(start, end, options);
|
|
1247
1113
|
}
|
|
@@ -7151,11 +7017,13 @@ const workerPath = pathToFileURL(resolve(distDir, "./worker.mjs")).href;
|
|
|
7151
7017
|
function createPool(ctx) {
|
|
7152
7018
|
var _a;
|
|
7153
7019
|
const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
|
|
7020
|
+
const maxThreads = ctx.config.maxThreads ?? threadsCount;
|
|
7021
|
+
const minThreads = ctx.config.minThreads ?? threadsCount;
|
|
7154
7022
|
const options = {
|
|
7155
7023
|
filename: workerPath,
|
|
7156
7024
|
useAtomics: false,
|
|
7157
|
-
maxThreads
|
|
7158
|
-
minThreads
|
|
7025
|
+
maxThreads,
|
|
7026
|
+
minThreads
|
|
7159
7027
|
};
|
|
7160
7028
|
if (ctx.config.isolate) {
|
|
7161
7029
|
options.isolateWorkers = true;
|
|
@@ -7180,12 +7048,14 @@ function createPool(ctx) {
|
|
|
7180
7048
|
const config = ctx.getSerializableConfig();
|
|
7181
7049
|
async function runFiles(files, invalidates = []) {
|
|
7182
7050
|
const { workerPort, port } = createChannel(ctx);
|
|
7051
|
+
const workerId = ++id;
|
|
7183
7052
|
const data = {
|
|
7184
7053
|
port: workerPort,
|
|
7185
7054
|
config,
|
|
7186
7055
|
files,
|
|
7187
7056
|
invalidates,
|
|
7188
|
-
|
|
7057
|
+
workerId,
|
|
7058
|
+
poolId: !ctx.config.threads ? 1 : (workerId - 1) % maxThreads + 1
|
|
7189
7059
|
};
|
|
7190
7060
|
try {
|
|
7191
7061
|
await pool.run(data, { transferList: [workerPort], name });
|
|
@@ -7195,6 +7065,20 @@ function createPool(ctx) {
|
|
|
7195
7065
|
}
|
|
7196
7066
|
}
|
|
7197
7067
|
return async (files, invalidates) => {
|
|
7068
|
+
if (config.shard) {
|
|
7069
|
+
const { index, count } = config.shard;
|
|
7070
|
+
const shardSize = Math.ceil(files.length / count);
|
|
7071
|
+
const shardStart = shardSize * (index - 1);
|
|
7072
|
+
const shardEnd = shardSize * index;
|
|
7073
|
+
files = files.map((file) => {
|
|
7074
|
+
const fullPath = resolve(slash$2(config.root), slash$2(file));
|
|
7075
|
+
const specPath = fullPath.slice(config.root.length);
|
|
7076
|
+
return {
|
|
7077
|
+
file,
|
|
7078
|
+
hash: createHash("sha1").update(specPath).digest("hex")
|
|
7079
|
+
};
|
|
7080
|
+
}).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ file }) => file);
|
|
7081
|
+
}
|
|
7198
7082
|
if (!ctx.config.threads) {
|
|
7199
7083
|
await runFiles(files);
|
|
7200
7084
|
} else {
|
|
@@ -7274,7 +7158,7 @@ const F_DOWN = "\u2193";
|
|
|
7274
7158
|
const F_DOWN_RIGHT = "\u21B3";
|
|
7275
7159
|
const F_POINTER = "\u276F";
|
|
7276
7160
|
const F_DOT = "\xB7";
|
|
7277
|
-
const F_CHECK = "\
|
|
7161
|
+
const F_CHECK = "\u2713";
|
|
7278
7162
|
const F_CROSS = "\xD7";
|
|
7279
7163
|
const F_LONG_DASH = "\u23AF";
|
|
7280
7164
|
|
|
@@ -8963,7 +8847,7 @@ function resolveApiConfig(options) {
|
|
|
8963
8847
|
return api;
|
|
8964
8848
|
}
|
|
8965
8849
|
function resolveConfig(options, viteConfig) {
|
|
8966
|
-
var _a, _b;
|
|
8850
|
+
var _a, _b, _c;
|
|
8967
8851
|
if (options.dom) {
|
|
8968
8852
|
if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
|
|
8969
8853
|
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}"`));
|
|
@@ -8976,6 +8860,18 @@ function resolveConfig(options, viteConfig) {
|
|
|
8976
8860
|
if (viteConfig.base !== "/")
|
|
8977
8861
|
resolved.base = viteConfig.base;
|
|
8978
8862
|
resolved.coverage = resolveC8Options(options.coverage || {}, resolved.root);
|
|
8863
|
+
if (options.shard) {
|
|
8864
|
+
if (resolved.watch)
|
|
8865
|
+
throw new Error("You cannot use --shard option with enabled watch");
|
|
8866
|
+
const [indexString, countString] = options.shard.split("/");
|
|
8867
|
+
const index = Math.abs(parseInt(indexString, 10));
|
|
8868
|
+
const count = Math.abs(parseInt(countString, 10));
|
|
8869
|
+
if (isNaN(count) || count <= 0)
|
|
8870
|
+
throw new Error("--shard <count> must be a positive number");
|
|
8871
|
+
if (isNaN(index) || index <= 0 || index > count)
|
|
8872
|
+
throw new Error("--shard <index> must be a positive number less then <count>");
|
|
8873
|
+
resolved.shard = { index, count };
|
|
8874
|
+
}
|
|
8979
8875
|
resolved.deps = resolved.deps || {};
|
|
8980
8876
|
if (resolved.deps.inline !== true) {
|
|
8981
8877
|
const ssrOptions = viteConfig.ssr || {};
|
|
@@ -9012,6 +8908,9 @@ function resolveConfig(options, viteConfig) {
|
|
|
9012
8908
|
resolved.reporters.push("default");
|
|
9013
8909
|
if (resolved.changed)
|
|
9014
8910
|
resolved.passWithNoTests ?? (resolved.passWithNoTests = true);
|
|
8911
|
+
resolved.css ?? (resolved.css = {});
|
|
8912
|
+
if (typeof resolved.css === "object")
|
|
8913
|
+
(_c = resolved.css).include ?? (_c.include = [/\.module\./]);
|
|
9015
8914
|
return resolved;
|
|
9016
8915
|
}
|
|
9017
8916
|
|
|
@@ -9021,7 +8920,7 @@ function fileFromParsedStack(stack) {
|
|
|
9021
8920
|
return join(stack.file, "../", stack.sourcePos.source);
|
|
9022
8921
|
return stack.file;
|
|
9023
8922
|
}
|
|
9024
|
-
async function printError(error, ctx, options) {
|
|
8923
|
+
async function printError(error, ctx, options = {}) {
|
|
9025
8924
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
9026
8925
|
let e = error;
|
|
9027
8926
|
if (typeof error === "string") {
|
|
@@ -9039,8 +8938,11 @@ async function printError(error, ctx, options) {
|
|
|
9039
8938
|
printErrorMessage(e, ctx.console);
|
|
9040
8939
|
printStack(ctx, stacks, nearest, errorProperties, (s, pos) => {
|
|
9041
8940
|
if (showCodeFrame && s === nearest && nearest) {
|
|
9042
|
-
const
|
|
9043
|
-
|
|
8941
|
+
const file = fileFromParsedStack(nearest);
|
|
8942
|
+
if (existsSync(file)) {
|
|
8943
|
+
const sourceCode = readFileSync(file, "utf-8");
|
|
8944
|
+
ctx.log(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, pos)));
|
|
8945
|
+
}
|
|
9044
8946
|
}
|
|
9045
8947
|
});
|
|
9046
8948
|
if (e.cause) {
|
|
@@ -9048,8 +8950,12 @@ async function printError(error, ctx, options) {
|
|
|
9048
8950
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
9049
8951
|
}
|
|
9050
8952
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
9051
|
-
if (e.showDiff)
|
|
9052
|
-
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console,
|
|
8953
|
+
if (e.showDiff) {
|
|
8954
|
+
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console, {
|
|
8955
|
+
outputTruncateLength: ctx.config.outputTruncateLength,
|
|
8956
|
+
outputDiffLines: ctx.config.outputDiffLines
|
|
8957
|
+
});
|
|
8958
|
+
}
|
|
9053
8959
|
}
|
|
9054
8960
|
function printErrorType(type, ctx) {
|
|
9055
8961
|
ctx.error(`
|
|
@@ -9108,8 +9014,8 @@ As a temporary workaround you can try to inline the package by updating your con
|
|
|
9108
9014
|
}
|
|
9109
9015
|
`)));
|
|
9110
9016
|
}
|
|
9111
|
-
function displayDiff(actual, expected, console,
|
|
9112
|
-
console.error(picocolors.exports.gray(unifiedDiff(actual, expected,
|
|
9017
|
+
function displayDiff(actual, expected, console, options) {
|
|
9018
|
+
console.error(picocolors.exports.gray(unifiedDiff(actual, expected, options)) + "\n");
|
|
9113
9019
|
}
|
|
9114
9020
|
function printErrorMessage(error, console) {
|
|
9115
9021
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -9136,7 +9042,7 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
|
9136
9042
|
ctx.log(picocolors.exports.red(picocolors.exports.bold("Serialized Error:")), picocolors.exports.gray(propertiesString));
|
|
9137
9043
|
}
|
|
9138
9044
|
}
|
|
9139
|
-
function generateCodeFrame(source, indent, start = 0, end, range = 2) {
|
|
9045
|
+
function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
9140
9046
|
var _a;
|
|
9141
9047
|
start = posToNumber(source, start);
|
|
9142
9048
|
end = end || start;
|
|
@@ -9229,7 +9135,7 @@ function npmRunPath(options = {}) {
|
|
|
9229
9135
|
return [...result, path_].join(path$a.delimiter);
|
|
9230
9136
|
}
|
|
9231
9137
|
|
|
9232
|
-
function npmRunPathEnv({env = process$1.env, ...options}) {
|
|
9138
|
+
function npmRunPathEnv({env = process$1.env, ...options} = {}) {
|
|
9233
9139
|
env = {...env};
|
|
9234
9140
|
|
|
9235
9141
|
const path = pathKey({env});
|
|
@@ -10889,6 +10795,34 @@ function getIndexStatus(code, from) {
|
|
|
10889
10795
|
};
|
|
10890
10796
|
}
|
|
10891
10797
|
|
|
10798
|
+
const cssLangs = "\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)";
|
|
10799
|
+
const cssLangRE = new RegExp(cssLangs);
|
|
10800
|
+
const isCSS = (id) => {
|
|
10801
|
+
return cssLangRE.test(id);
|
|
10802
|
+
};
|
|
10803
|
+
function CSSEnablerPlugin(ctx) {
|
|
10804
|
+
const shouldProcessCSS = (id) => {
|
|
10805
|
+
const { css } = ctx.config;
|
|
10806
|
+
if (typeof css === "boolean")
|
|
10807
|
+
return css;
|
|
10808
|
+
if (toArray$1(css.exclude).some((re) => re.test(id)))
|
|
10809
|
+
return false;
|
|
10810
|
+
if (toArray$1(css.include).some((re) => re.test(id)))
|
|
10811
|
+
return true;
|
|
10812
|
+
return false;
|
|
10813
|
+
};
|
|
10814
|
+
return {
|
|
10815
|
+
name: "vitest:css-enabler",
|
|
10816
|
+
enforce: "pre",
|
|
10817
|
+
transform(code, id) {
|
|
10818
|
+
if (!isCSS(id))
|
|
10819
|
+
return;
|
|
10820
|
+
if (!shouldProcessCSS(id))
|
|
10821
|
+
return { code: "" };
|
|
10822
|
+
}
|
|
10823
|
+
};
|
|
10824
|
+
}
|
|
10825
|
+
|
|
10892
10826
|
var __defProp = Object.defineProperty;
|
|
10893
10827
|
var __defProps = Object.defineProperties;
|
|
10894
10828
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -10998,10 +10932,15 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10998
10932
|
async configureServer(server) {
|
|
10999
10933
|
if (haveStarted)
|
|
11000
10934
|
await ctx.report("onServerRestart");
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
10935
|
+
try {
|
|
10936
|
+
await ctx.setServer(options, server);
|
|
10937
|
+
haveStarted = true;
|
|
10938
|
+
if (options.api && options.watch)
|
|
10939
|
+
(await import('./chunk-api-setup.ff687d0e.mjs')).setup(ctx);
|
|
10940
|
+
} catch (err) {
|
|
10941
|
+
ctx.printError(err, true);
|
|
10942
|
+
process.exit(1);
|
|
10943
|
+
}
|
|
11005
10944
|
if (!options.watch)
|
|
11006
10945
|
await server.watcher.close();
|
|
11007
10946
|
}
|
|
@@ -11009,6 +10948,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
11009
10948
|
EnvReplacerPlugin(),
|
|
11010
10949
|
MocksPlugin(),
|
|
11011
10950
|
GlobalSetupPlugin(ctx),
|
|
10951
|
+
CSSEnablerPlugin(ctx),
|
|
11012
10952
|
options.ui ? await UIPlugin() : null
|
|
11013
10953
|
].filter(notNullish);
|
|
11014
10954
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import {
|
|
4
|
+
import { o as isAbsolute$2, m as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.79a8b1cc.mjs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
|
@@ -2776,7 +2776,7 @@ const compare$b = compare_1$1;
|
|
|
2776
2776
|
// - If no C has a prerelease and the LT.semver tuple, return false
|
|
2777
2777
|
// - Else return true
|
|
2778
2778
|
|
|
2779
|
-
const subset$1 = (sub, dom, options) => {
|
|
2779
|
+
const subset$1 = (sub, dom, options = {}) => {
|
|
2780
2780
|
if (sub === dom)
|
|
2781
2781
|
return true
|
|
2782
2782
|
|
|
@@ -7290,7 +7290,7 @@ const compare = compare_1;
|
|
|
7290
7290
|
// - If no C has a prerelease and the LT.semver tuple, return false
|
|
7291
7291
|
// - Else return true
|
|
7292
7292
|
|
|
7293
|
-
const subset = (sub, dom, options) => {
|
|
7293
|
+
const subset = (sub, dom, options = {}) => {
|
|
7294
7294
|
if (sub === dom)
|
|
7295
7295
|
return true
|
|
7296
7296
|
|
|
@@ -7948,7 +7948,7 @@ const defaultFindOptions = {
|
|
|
7948
7948
|
return null;
|
|
7949
7949
|
}
|
|
7950
7950
|
};
|
|
7951
|
-
async function findNearestFile(filename, _options) {
|
|
7951
|
+
async function findNearestFile(filename, _options = {}) {
|
|
7952
7952
|
const options = { ...defaultFindOptions, ..._options };
|
|
7953
7953
|
const basePath = resolve(options.startingFrom);
|
|
7954
7954
|
const leadingSlash = basePath[0] === "/";
|