vitest 3.2.0-beta.1 → 3.2.0-beta.2
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 +0 -232
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +3 -4
- package/dist/chunks/{base.SfTiRNZf.js → base.DwtwORaC.js} +2 -2
- package/dist/chunks/{cac.TfX2-DVH.js → cac.I9MLYfT-.js} +10 -8
- package/dist/chunks/{cli-api.2970Nj9J.js → cli-api.d6IK1pnk.js} +48 -16
- package/dist/chunks/{coverage.z0LVMxgb.js → coverage.OGU09Jbh.js} +126 -4215
- package/dist/chunks/{creator.CuL7xDWI.js → creator.DGAdZ4Hj.js} +18 -39
- package/dist/chunks/{execute.BpmIjFTD.js → execute.JlGHLJZT.js} +3 -5
- package/dist/chunks/{global.d.BCOHQEpR.d.ts → global.d.BPa1eL3O.d.ts} +10 -10
- package/dist/chunks/{globals.Cg4NtV4P.js → globals.CpxW8ccg.js} +1 -2
- package/dist/chunks/{index.Bw6JxgX8.js → index.CK1YOQaa.js} +7 -7
- package/dist/chunks/{index.CUacZlWG.js → index.CV36oG_L.js} +881 -948
- package/dist/chunks/{index.BPc7M5ni.js → index.CfXMNXHg.js} +1 -13
- package/dist/chunks/index.CmC5OK9L.js +275 -0
- package/dist/chunks/{index.DbWBPwtH.js → index.DswW_LEs.js} +1 -1
- package/dist/chunks/{index.DBIGubLC.js → index.X0nbfr6-.js} +7 -7
- package/dist/chunks/{reporters.d.DGm4k1Wx.d.ts → reporters.d.CLC9rhKy.d.ts} +17 -0
- package/dist/chunks/{runBaseTests.CguliJB5.js → runBaseTests.Dn2vyej_.js} +3 -4
- package/dist/chunks/{setup-common.BP6KrF_Z.js → setup-common.CYo3Y0dD.js} +1 -3
- package/dist/chunks/typechecker.DnTrplSJ.js +897 -0
- package/dist/chunks/{vite.d.DjP_ALCZ.d.ts → vite.d.CBZ3M_ru.d.ts} +1 -1
- package/dist/chunks/{vm.CuLHT1BG.js → vm.C1HHjtNS.js} +1 -1
- package/dist/cli.js +20 -1
- package/dist/config.d.ts +3 -3
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +4 -7
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +5 -27
- package/dist/index.js +1 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +16 -18
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +14 -14
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +3 -4
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +2 -2
- package/dist/workers/vmThreads.js +2 -2
- package/dist/workers.js +3 -3
- package/package.json +15 -19
- package/dist/chunks/run-once.Dimr7O9f.js +0 -47
- package/dist/chunks/typechecker.DYQbn8uK.js +0 -956
- package/dist/chunks/utils.8gfOgtry.js +0 -207
- package/dist/utils.d.ts +0 -3
- package/dist/utils.js +0 -2
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.BFR5YIgu.js';
|
|
2
|
-
import { i as isFirstRun, a as runOnce } from './run-once.Dimr7O9f.js';
|
|
3
2
|
import { b as bench } from './benchmark.BoF7jW0Q.js';
|
|
4
3
|
import { expectTypeOf } from 'expect-type';
|
|
5
4
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
5
|
import * as chai from 'chai';
|
|
7
6
|
import { assert, should } from 'chai';
|
|
8
7
|
|
|
9
|
-
function getRunningMode() {
|
|
10
|
-
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
11
|
-
}
|
|
12
|
-
function isWatchMode() {
|
|
13
|
-
return getRunningMode() === "watch";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
8
|
const assertType = function assertType() {};
|
|
17
9
|
|
|
18
10
|
var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
@@ -29,14 +21,10 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
|
29
21
|
describe: describe,
|
|
30
22
|
expect: globalExpect,
|
|
31
23
|
expectTypeOf: expectTypeOf,
|
|
32
|
-
getRunningMode: getRunningMode,
|
|
33
24
|
inject: inject,
|
|
34
|
-
isFirstRun: isFirstRun,
|
|
35
|
-
isWatchMode: isWatchMode,
|
|
36
25
|
it: it,
|
|
37
26
|
onTestFailed: onTestFailed,
|
|
38
27
|
onTestFinished: onTestFinished,
|
|
39
|
-
runOnce: runOnce,
|
|
40
28
|
should: should,
|
|
41
29
|
suite: suite,
|
|
42
30
|
test: test,
|
|
@@ -44,4 +32,4 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
|
|
|
44
32
|
vitest: vitest
|
|
45
33
|
});
|
|
46
34
|
|
|
47
|
-
export { VitestIndex as V, assertType as a
|
|
35
|
+
export { VitestIndex as V, assertType as a };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
|
|
3
|
+
import * as pathe from 'pathe';
|
|
4
|
+
import c from 'tinyrainbow';
|
|
5
|
+
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.CV36oG_L.js';
|
|
6
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
7
|
+
import { notNullish } from '@vitest/utils';
|
|
8
|
+
|
|
9
|
+
function createBenchmarkJsonReport(files) {
|
|
10
|
+
const report = { files: [] };
|
|
11
|
+
for (const file of files) {
|
|
12
|
+
const groups = [];
|
|
13
|
+
for (const task of getTasks(file)) {
|
|
14
|
+
if (task?.type === "suite") {
|
|
15
|
+
const benchmarks = [];
|
|
16
|
+
for (const t of task.tasks) {
|
|
17
|
+
const benchmark = t.meta.benchmark && t.result?.benchmark;
|
|
18
|
+
if (benchmark) {
|
|
19
|
+
benchmarks.push({
|
|
20
|
+
id: t.id,
|
|
21
|
+
...benchmark,
|
|
22
|
+
samples: []
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (benchmarks.length) {
|
|
27
|
+
groups.push({
|
|
28
|
+
fullName: getFullName(task, " > "),
|
|
29
|
+
benchmarks
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
report.files.push({
|
|
35
|
+
filepath: file.filepath,
|
|
36
|
+
groups
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return report;
|
|
40
|
+
}
|
|
41
|
+
function flattenFormattedBenchmarkReport(report) {
|
|
42
|
+
const flat = {};
|
|
43
|
+
for (const file of report.files) {
|
|
44
|
+
for (const group of file.groups) {
|
|
45
|
+
for (const t of group.benchmarks) {
|
|
46
|
+
flat[t.id] = t;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return flat;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const outputMap = new WeakMap();
|
|
54
|
+
function formatNumber(number) {
|
|
55
|
+
const res = String(number.toFixed(number < 100 ? 4 : 2)).split(".");
|
|
56
|
+
return res[0].replace(/(?=(?:\d{3})+$)\B/g, ",") + (res[1] ? `.${res[1]}` : "");
|
|
57
|
+
}
|
|
58
|
+
const tableHead = [
|
|
59
|
+
"name",
|
|
60
|
+
"hz",
|
|
61
|
+
"min",
|
|
62
|
+
"max",
|
|
63
|
+
"mean",
|
|
64
|
+
"p75",
|
|
65
|
+
"p99",
|
|
66
|
+
"p995",
|
|
67
|
+
"p999",
|
|
68
|
+
"rme",
|
|
69
|
+
"samples"
|
|
70
|
+
];
|
|
71
|
+
function renderBenchmarkItems(result) {
|
|
72
|
+
return [
|
|
73
|
+
result.name,
|
|
74
|
+
formatNumber(result.hz || 0),
|
|
75
|
+
formatNumber(result.min || 0),
|
|
76
|
+
formatNumber(result.max || 0),
|
|
77
|
+
formatNumber(result.mean || 0),
|
|
78
|
+
formatNumber(result.p75 || 0),
|
|
79
|
+
formatNumber(result.p99 || 0),
|
|
80
|
+
formatNumber(result.p995 || 0),
|
|
81
|
+
formatNumber(result.p999 || 0),
|
|
82
|
+
`±${(result.rme || 0).toFixed(2)}%`,
|
|
83
|
+
(result.sampleCount || 0).toString()
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function computeColumnWidths(results) {
|
|
87
|
+
const rows = [tableHead, ...results.map((v) => renderBenchmarkItems(v))];
|
|
88
|
+
return Array.from(tableHead, (_, i) => Math.max(...rows.map((row) => stripVTControlCharacters(row[i]).length)));
|
|
89
|
+
}
|
|
90
|
+
function padRow(row, widths) {
|
|
91
|
+
return row.map((v, i) => i ? v.padStart(widths[i], " ") : v.padEnd(widths[i], " "));
|
|
92
|
+
}
|
|
93
|
+
function renderTableHead(widths) {
|
|
94
|
+
return " ".repeat(3) + padRow(tableHead, widths).map(c.bold).join(" ");
|
|
95
|
+
}
|
|
96
|
+
function renderBenchmark(result, widths) {
|
|
97
|
+
const padded = padRow(renderBenchmarkItems(result), widths);
|
|
98
|
+
return [
|
|
99
|
+
padded[0],
|
|
100
|
+
c.blue(padded[1]),
|
|
101
|
+
c.cyan(padded[2]),
|
|
102
|
+
c.cyan(padded[3]),
|
|
103
|
+
c.cyan(padded[4]),
|
|
104
|
+
c.cyan(padded[5]),
|
|
105
|
+
c.cyan(padded[6]),
|
|
106
|
+
c.cyan(padded[7]),
|
|
107
|
+
c.cyan(padded[8]),
|
|
108
|
+
c.dim(padded[9]),
|
|
109
|
+
c.dim(padded[10])
|
|
110
|
+
].join(" ");
|
|
111
|
+
}
|
|
112
|
+
function renderTable(options) {
|
|
113
|
+
const output = [];
|
|
114
|
+
const benchMap = {};
|
|
115
|
+
for (const task of options.tasks) {
|
|
116
|
+
if (task.meta.benchmark && task.result?.benchmark) {
|
|
117
|
+
benchMap[task.id] = {
|
|
118
|
+
current: task.result.benchmark,
|
|
119
|
+
baseline: options.compare?.[task.id]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const benchCount = Object.entries(benchMap).length;
|
|
124
|
+
const columnWidths = computeColumnWidths(Object.values(benchMap).flatMap((v) => [v.current, v.baseline]).filter(notNullish));
|
|
125
|
+
let idx = 0;
|
|
126
|
+
const padding = " ".repeat(1 );
|
|
127
|
+
for (const task of options.tasks) {
|
|
128
|
+
const duration = task.result?.duration;
|
|
129
|
+
const bench = benchMap[task.id];
|
|
130
|
+
let prefix = "";
|
|
131
|
+
if (idx === 0 && task.meta?.benchmark) {
|
|
132
|
+
prefix += `${renderTableHead(columnWidths)}\n${padding}`;
|
|
133
|
+
}
|
|
134
|
+
prefix += ` ${getStateSymbol(task)} `;
|
|
135
|
+
let suffix = "";
|
|
136
|
+
if (task.type === "suite") {
|
|
137
|
+
suffix += c.dim(` (${getTests(task).length})`);
|
|
138
|
+
}
|
|
139
|
+
if (task.mode === "skip" || task.mode === "todo") {
|
|
140
|
+
suffix += c.dim(c.gray(" [skipped]"));
|
|
141
|
+
}
|
|
142
|
+
if (duration != null) {
|
|
143
|
+
const color = duration > options.slowTestThreshold ? c.yellow : c.green;
|
|
144
|
+
suffix += color(` ${Math.round(duration)}${c.dim("ms")}`);
|
|
145
|
+
}
|
|
146
|
+
if (options.showHeap && task.result?.heap != null) {
|
|
147
|
+
suffix += c.magenta(` ${Math.floor(task.result.heap / 1024 / 1024)} MB heap used`);
|
|
148
|
+
}
|
|
149
|
+
if (bench) {
|
|
150
|
+
let body = renderBenchmark(bench.current, columnWidths);
|
|
151
|
+
if (options.compare && bench.baseline) {
|
|
152
|
+
if (bench.current.hz) {
|
|
153
|
+
const diff = bench.current.hz / bench.baseline.hz;
|
|
154
|
+
const diffFixed = diff.toFixed(2);
|
|
155
|
+
if (diffFixed === "1.0.0") {
|
|
156
|
+
body += c.gray(` [${diffFixed}x]`);
|
|
157
|
+
}
|
|
158
|
+
if (diff > 1) {
|
|
159
|
+
body += c.blue(` [${diffFixed}x] ⇑`);
|
|
160
|
+
} else {
|
|
161
|
+
body += c.red(` [${diffFixed}x] ⇓`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
output.push(padding + prefix + body + suffix);
|
|
165
|
+
const bodyBaseline = renderBenchmark(bench.baseline, columnWidths);
|
|
166
|
+
output.push(`${padding} ${bodyBaseline} ${c.dim("(baseline)")}`);
|
|
167
|
+
} else {
|
|
168
|
+
if (bench.current.rank === 1 && benchCount > 1) {
|
|
169
|
+
body += c.bold(c.green(" fastest"));
|
|
170
|
+
}
|
|
171
|
+
if (bench.current.rank === benchCount && benchCount > 2) {
|
|
172
|
+
body += c.bold(c.gray(" slowest"));
|
|
173
|
+
}
|
|
174
|
+
output.push(padding + prefix + body + suffix);
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
output.push(padding + prefix + task.name + suffix);
|
|
178
|
+
}
|
|
179
|
+
if (task.result?.state !== "pass" && outputMap.get(task) != null) {
|
|
180
|
+
let data = outputMap.get(task);
|
|
181
|
+
if (typeof data === "string") {
|
|
182
|
+
data = stripVTControlCharacters(data.trim().split("\n").filter(Boolean).pop());
|
|
183
|
+
if (data === "") {
|
|
184
|
+
data = undefined;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (data != null) {
|
|
188
|
+
const out = ` ${" ".repeat(options.level)}${F_RIGHT} ${data}`;
|
|
189
|
+
output.push(c.gray(truncateString(out, options.columns)));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
idx++;
|
|
193
|
+
}
|
|
194
|
+
return output.filter(Boolean).join("\n");
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
class BenchmarkReporter extends DefaultReporter {
|
|
198
|
+
compare;
|
|
199
|
+
async onInit(ctx) {
|
|
200
|
+
super.onInit(ctx);
|
|
201
|
+
if (this.ctx.config.benchmark?.compare) {
|
|
202
|
+
const compareFile = pathe.resolve(this.ctx.config.root, this.ctx.config.benchmark?.compare);
|
|
203
|
+
try {
|
|
204
|
+
this.compare = flattenFormattedBenchmarkReport(JSON.parse(await fs.promises.readFile(compareFile, "utf-8")));
|
|
205
|
+
} catch (e) {
|
|
206
|
+
this.error(`Failed to read '${compareFile}'`, e);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
onTaskUpdate(packs) {
|
|
211
|
+
for (const pack of packs) {
|
|
212
|
+
const task = this.ctx.state.idMap.get(pack[0]);
|
|
213
|
+
if (task?.type === "suite" && task.result?.state !== "run") {
|
|
214
|
+
task.tasks.filter((task) => task.result?.benchmark).sort((benchA, benchB) => benchA.result.benchmark.mean - benchB.result.benchmark.mean).forEach((bench, idx) => {
|
|
215
|
+
bench.result.benchmark.rank = Number(idx) + 1;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
onTestSuiteResult(testSuite) {
|
|
221
|
+
super.onTestSuiteResult(testSuite);
|
|
222
|
+
this.printSuiteTable(testSuite);
|
|
223
|
+
}
|
|
224
|
+
printTestModule(testModule) {
|
|
225
|
+
this.printSuiteTable(testModule);
|
|
226
|
+
}
|
|
227
|
+
printSuiteTable(testTask) {
|
|
228
|
+
const state = testTask.state();
|
|
229
|
+
if (state === "pending" || state === "queued") {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const benches = testTask.task.tasks.filter((t) => t.meta.benchmark);
|
|
233
|
+
const duration = testTask.task.result?.duration || 0;
|
|
234
|
+
if (benches.length > 0 && benches.every((t) => t.result?.state !== "run" && t.result?.state !== "queued")) {
|
|
235
|
+
let title = `\n ${getStateSymbol(testTask.task)} ${formatProjectName(testTask.project)}${getFullName(testTask.task, c.dim(" > "))}`;
|
|
236
|
+
if (duration != null && duration > this.ctx.config.slowTestThreshold) {
|
|
237
|
+
title += c.yellow(` ${Math.round(duration)}${c.dim("ms")}`);
|
|
238
|
+
}
|
|
239
|
+
this.log(title);
|
|
240
|
+
this.log(renderTable({
|
|
241
|
+
tasks: benches,
|
|
242
|
+
level: 1,
|
|
243
|
+
columns: this.ctx.logger.getColumns(),
|
|
244
|
+
compare: this.compare,
|
|
245
|
+
showHeap: this.ctx.config.logHeapUsage,
|
|
246
|
+
slowTestThreshold: this.ctx.config.slowTestThreshold
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
|
|
251
|
+
super.onFinished(files, errors);
|
|
252
|
+
let outputFile = this.ctx.config.benchmark?.outputJson;
|
|
253
|
+
if (outputFile) {
|
|
254
|
+
outputFile = pathe.resolve(this.ctx.config.root, outputFile);
|
|
255
|
+
const outputDirectory = pathe.dirname(outputFile);
|
|
256
|
+
if (!fs.existsSync(outputDirectory)) {
|
|
257
|
+
await fs.promises.mkdir(outputDirectory, { recursive: true });
|
|
258
|
+
}
|
|
259
|
+
const output = createBenchmarkJsonReport(files);
|
|
260
|
+
await fs.promises.writeFile(outputFile, JSON.stringify(output, null, 2));
|
|
261
|
+
this.log(`Benchmark report written to ${outputFile}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
class VerboseBenchmarkReporter extends BenchmarkReporter {
|
|
267
|
+
verbose = true;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const BenchmarkReportsMap = {
|
|
271
|
+
default: BenchmarkReporter,
|
|
272
|
+
verbose: VerboseBenchmarkReporter
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export { BenchmarkReporter as B, VerboseBenchmarkReporter as V, BenchmarkReportsMap as a };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.
|
|
3
|
+
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.CYo3Y0dD.js';
|
|
4
4
|
import { distDir } from '../path.js';
|
|
5
5
|
import { r as rpc } from './rpc.D9_013TY.js';
|
|
6
6
|
import { g as getWorkerState } from './utils.CgTj3MsC.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import process$1 from 'node:process';
|
|
4
4
|
import { promises } from 'node:fs';
|
|
@@ -237,7 +237,7 @@ async function locatePath(
|
|
|
237
237
|
|
|
238
238
|
return pLocate(paths, async path_ => {
|
|
239
239
|
try {
|
|
240
|
-
const stat = await statFunction(
|
|
240
|
+
const stat = await statFunction(path.resolve(cwd, path_));
|
|
241
241
|
return matchType(type, stat);
|
|
242
242
|
} catch {
|
|
243
243
|
return false;
|
|
@@ -250,9 +250,9 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
|
|
|
250
250
|
const findUpStop = Symbol('findUpStop');
|
|
251
251
|
|
|
252
252
|
async function findUpMultiple(name, options = {}) {
|
|
253
|
-
let directory =
|
|
254
|
-
const {root} =
|
|
255
|
-
const stopAt =
|
|
253
|
+
let directory = path.resolve(toPath(options.cwd) || '');
|
|
254
|
+
const {root} = path.parse(directory);
|
|
255
|
+
const stopAt = path.resolve(directory, options.stopAt || root);
|
|
256
256
|
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
257
257
|
const paths = [name].flat();
|
|
258
258
|
|
|
@@ -280,14 +280,14 @@ async function findUpMultiple(name, options = {}) {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
if (foundPath) {
|
|
283
|
-
matches.push(
|
|
283
|
+
matches.push(path.resolve(directory, foundPath));
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
if (directory === stopAt || matches.length >= limit) {
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
directory =
|
|
290
|
+
directory = path.dirname(directory);
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
return matches;
|
|
@@ -1444,6 +1444,15 @@ interface SequenceOptions {
|
|
|
1444
1444
|
*/
|
|
1445
1445
|
sequencer?: TestSequencerConstructor;
|
|
1446
1446
|
/**
|
|
1447
|
+
* Controls the order in which this project runs its tests when using multiple [projects](/guide/projects).
|
|
1448
|
+
*
|
|
1449
|
+
* - Projects with the same group order number will run together, and groups are run from lowest to highest.
|
|
1450
|
+
* - If you don’t set this option, all projects run in parallel.
|
|
1451
|
+
* - If several projects use the same group order, they will run at the same time.
|
|
1452
|
+
* @default 0
|
|
1453
|
+
*/
|
|
1454
|
+
groupOrder?: number;
|
|
1455
|
+
/**
|
|
1447
1456
|
* Should files and tests run in random order.
|
|
1448
1457
|
* @default false
|
|
1449
1458
|
*/
|
|
@@ -2277,6 +2286,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
2277
2286
|
shuffle?: boolean
|
|
2278
2287
|
concurrent?: boolean
|
|
2279
2288
|
seed: number
|
|
2289
|
+
groupOrder: number
|
|
2280
2290
|
};
|
|
2281
2291
|
typecheck: Omit<TypecheckConfig, "enabled"> & {
|
|
2282
2292
|
enabled: boolean
|
|
@@ -2598,6 +2608,12 @@ declare class TestProject {
|
|
|
2598
2608
|
private _provided;
|
|
2599
2609
|
constructor(path: string | number, vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
2600
2610
|
/**
|
|
2611
|
+
* The unique hash of this project. This value is consistent between the reruns.
|
|
2612
|
+
*
|
|
2613
|
+
* It is based on the root of the project (not consistent between OS) and its name.
|
|
2614
|
+
*/
|
|
2615
|
+
get hash(): string;
|
|
2616
|
+
/**
|
|
2601
2617
|
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
2602
2618
|
*/
|
|
2603
2619
|
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
@@ -2698,6 +2714,7 @@ declare class TestProject {
|
|
|
2698
2714
|
getName(): string;
|
|
2699
2715
|
/** @deprecated internal */
|
|
2700
2716
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
2717
|
+
private _setHash;
|
|
2701
2718
|
private _serializeOverriddenConfig;
|
|
2702
2719
|
private clearTmpDir;
|
|
2703
2720
|
/** @deprecated */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
4
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.DswW_LEs.js';
|
|
4
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.CYo3Y0dD.js';
|
|
5
5
|
import { a as globalExpect, v as vi } from './vi.BFR5YIgu.js';
|
|
6
6
|
import { c as closeInspector } from './inspector.DbDkSkFn.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
@@ -11,7 +11,7 @@ import util from 'node:util';
|
|
|
11
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
12
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
13
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
14
|
-
import { V as VitestIndex } from './index.
|
|
14
|
+
import { V as VitestIndex } from './index.CfXMNXHg.js';
|
|
15
15
|
import { g as getWorkerState, r as resetModules } from './utils.CgTj3MsC.js';
|
|
16
16
|
import 'chai';
|
|
17
17
|
import 'node:path';
|
|
@@ -21,7 +21,6 @@ import './rpc.D9_013TY.js';
|
|
|
21
21
|
import './index.CJ0plNrh.js';
|
|
22
22
|
import './coverage.0iPg4Wrz.js';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
|
-
import './run-once.Dimr7O9f.js';
|
|
25
24
|
import '@vitest/expect';
|
|
26
25
|
import '@vitest/runner/utils';
|
|
27
26
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { r as resolveCoverageProviderModule } from './coverage.0iPg4Wrz.js';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
3
|
import { setSafeTimers } from '@vitest/utils';
|
|
4
|
-
import { r as resetRunOnceCounter } from './run-once.Dimr7O9f.js';
|
|
5
4
|
|
|
6
5
|
async function startCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
7
6
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
@@ -27,7 +26,6 @@ async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
|
27
26
|
|
|
28
27
|
let globalSetup = false;
|
|
29
28
|
async function setupCommonEnv(config) {
|
|
30
|
-
resetRunOnceCounter();
|
|
31
29
|
setupDefines(config.defines);
|
|
32
30
|
setupEnv(config.env);
|
|
33
31
|
if (globalSetup) {
|
|
@@ -36,7 +34,7 @@ async function setupCommonEnv(config) {
|
|
|
36
34
|
globalSetup = true;
|
|
37
35
|
setSafeTimers();
|
|
38
36
|
if (config.globals) {
|
|
39
|
-
(await import('./globals.
|
|
37
|
+
(await import('./globals.CpxW8ccg.js')).registerApiGlobally();
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
function setupDefines(defines) {
|