vitest 0.29.1 → 0.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/child.js +13 -6
- package/dist/{chunk-install-pkg.cbeede46.js → chunk-install-pkg.1dfb2c00.js} +2 -1
- package/dist/{chunk-integrations-globals.b56fcb06.js → chunk-integrations-globals.85aeb216.js} +3 -3
- package/dist/{chunk-integrations-utils.233d6a3b.js → chunk-integrations-utils.5243a0d7.js} +1 -1
- package/dist/{chunk-node-pkg.4e9b4238.js → chunk-node-pkg.7627b6fc.js} +104 -45
- package/dist/chunk-runtime-inspector.b1427a10.js +20 -0
- package/dist/{chunk-runtime-mocker.a048e92d.js → chunk-runtime-mocker.07568540.js} +2 -1
- package/dist/{chunk-runtime-rpc.971b3848.js → chunk-runtime-rpc.1232904e.js} +1 -1
- package/dist/{chunk-runtime-setup.992bb661.js → chunk-runtime-setup.ccad6a47.js} +1 -1
- package/dist/{chunk-utils-import.ec15dcad.js → chunk-utils-import.8bd22905.js} +1 -1
- package/dist/cli-wrapper.js +0 -2
- package/dist/cli.js +2 -1
- package/dist/config.d.ts +2 -2
- package/dist/coverage.d.ts +2 -2
- package/dist/entry.js +14 -11
- package/dist/environments.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/node.d.ts +3 -3
- package/dist/node.js +4 -4
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/{types-7cd96283.d.ts → types-5872e574.d.ts} +24 -4
- package/dist/worker.js +13 -6
- package/package.json +6 -6
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-5872e574.js';
|
|
3
3
|
export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
export { s as setupCommonEnv } from './chunk-runtime-setup.
|
|
2
|
+
export { s as setupCommonEnv } from './chunk-runtime-setup.ccad6a47.js';
|
|
3
3
|
export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import './chunk-integrations-run-once.9012f759.js';
|
package/dist/child.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
3
3
|
import { parseRegexp } from '@vitest/utils';
|
|
4
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.
|
|
5
|
-
import { a as rpcDone } from './chunk-runtime-rpc.
|
|
4
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.07568540.js';
|
|
5
|
+
import { a as rpcDone } from './chunk-runtime-rpc.1232904e.js';
|
|
6
|
+
import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
|
|
6
7
|
import 'node:url';
|
|
7
8
|
import 'vite-node/client';
|
|
8
9
|
import 'vite-node/utils';
|
|
@@ -22,6 +23,7 @@ import 'std-env';
|
|
|
22
23
|
import './chunk-constants.797d3ebf.js';
|
|
23
24
|
import './chunk-utils-base.81f83dbd.js';
|
|
24
25
|
import '@vitest/spy';
|
|
26
|
+
import 'node:inspector';
|
|
25
27
|
|
|
26
28
|
function init(ctx) {
|
|
27
29
|
const { config } = ctx;
|
|
@@ -69,10 +71,15 @@ function unwrapConfig(config) {
|
|
|
69
71
|
return config;
|
|
70
72
|
}
|
|
71
73
|
async function run(ctx) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const inspectorCleanup = setupInspect(ctx.config);
|
|
75
|
+
try {
|
|
76
|
+
init(ctx);
|
|
77
|
+
const { run: run2, executor } = await startViteNode(ctx);
|
|
78
|
+
await run2(ctx.files, ctx.config, ctx.environment, executor);
|
|
79
|
+
await rpcDone();
|
|
80
|
+
} finally {
|
|
81
|
+
inspectorCleanup();
|
|
82
|
+
}
|
|
76
83
|
}
|
|
77
84
|
const procesExit = process.exit;
|
|
78
85
|
process.on("message", async (message) => {
|
|
@@ -3,7 +3,7 @@ import k from 'path';
|
|
|
3
3
|
import require$$0$1 from 'util';
|
|
4
4
|
import require$$0$3 from 'child_process';
|
|
5
5
|
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.2cbcdd1e.js';
|
|
6
|
-
import { o as onetime$1 } from './chunk-node-pkg.
|
|
6
|
+
import { o as onetime$1 } from './chunk-node-pkg.7627b6fc.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import 'node:buffer';
|
|
9
9
|
import 'node:path';
|
|
@@ -47,6 +47,7 @@ import './chunk-utils-tasks.b41c8284.js';
|
|
|
47
47
|
import 'crypto';
|
|
48
48
|
import 'vite-node/utils';
|
|
49
49
|
import '@vitest/utils/diff';
|
|
50
|
+
import 'node:module';
|
|
50
51
|
import 'node:crypto';
|
|
51
52
|
import './chunk-magic-string.3a794426.js';
|
|
52
53
|
import 'strip-literal';
|
package/dist/{chunk-integrations-globals.b56fcb06.js → chunk-integrations-globals.85aeb216.js}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { g as globalApis } from './chunk-constants.797d3ebf.js';
|
|
2
|
-
import { i as index } from './chunk-integrations-utils.
|
|
2
|
+
import { i as index } from './chunk-integrations-utils.5243a0d7.js';
|
|
3
3
|
import 'node:url';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import './chunk-utils-env.860d90c2.js';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
import '@vitest/runner';
|
|
8
|
-
import './chunk-utils-import.
|
|
8
|
+
import './chunk-utils-import.8bd22905.js';
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils';
|
|
11
11
|
import './chunk-utils-global.727b6d25.js';
|
|
12
12
|
import 'chai';
|
|
13
13
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
14
14
|
import '@vitest/expect';
|
|
15
|
-
import './chunk-runtime-rpc.
|
|
15
|
+
import './chunk-runtime-rpc.1232904e.js';
|
|
16
16
|
import './chunk-snapshot-env.a347d647.js';
|
|
17
17
|
import './chunk-utils-base.81f83dbd.js';
|
|
18
18
|
import './chunk-utils-tasks.b41c8284.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
|
|
2
|
-
import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.
|
|
2
|
+
import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.8bd22905.js';
|
|
3
3
|
import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.9012f759.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
import { assert, should } from 'chai';
|
|
@@ -37,10 +37,11 @@ import { cpus, hostname } from 'node:os';
|
|
|
37
37
|
import Tinypool from 'tinypool';
|
|
38
38
|
import { performance } from 'perf_hooks';
|
|
39
39
|
import { g as getFullName, h as hasFailedSnapshot, a as parseErrorStacktrace, p as positionToOffset, l as lineSplitRE } from './chunk-utils-tasks.b41c8284.js';
|
|
40
|
-
import { getSafeTimers, shuffle, stringify as stringify$5 } from '@vitest/utils';
|
|
40
|
+
import { getSafeTimers, shuffle, stringify as stringify$5, toArray as toArray$1 } from '@vitest/utils';
|
|
41
41
|
import { createHash } from 'crypto';
|
|
42
42
|
import { slash as slash$2, cleanUrl } from 'vite-node/utils';
|
|
43
43
|
import { unifiedDiff } from '@vitest/utils/diff';
|
|
44
|
+
import { builtinModules } from 'node:module';
|
|
44
45
|
import { createHash as createHash$1 } from 'node:crypto';
|
|
45
46
|
import MagicString from './chunk-magic-string.3a794426.js';
|
|
46
47
|
import { stripLiteral } from 'strip-literal';
|
|
@@ -61,7 +62,7 @@ function _mergeNamespaces(n, m) {
|
|
|
61
62
|
return Object.freeze(n);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
var version$1 = "0.29.
|
|
65
|
+
var version$1 = "0.29.3";
|
|
65
66
|
|
|
66
67
|
async function ensurePackageInstalled(dependency, root) {
|
|
67
68
|
if (isPackageExists(dependency, { paths: [root] }))
|
|
@@ -79,7 +80,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
79
80
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
80
81
|
});
|
|
81
82
|
if (install) {
|
|
82
|
-
await (await import('./chunk-install-pkg.
|
|
83
|
+
await (await import('./chunk-install-pkg.1dfb2c00.js')).installPackage(dependency, { dev: true });
|
|
83
84
|
process.stderr.write(c.yellow(`
|
|
84
85
|
Package ${dependency} installed, re-run the command to start.
|
|
85
86
|
`));
|
|
@@ -7790,8 +7791,7 @@ function createPool(ctx) {
|
|
|
7790
7791
|
"--require",
|
|
7791
7792
|
suppressLoaderWarningsPath,
|
|
7792
7793
|
"--experimental-loader",
|
|
7793
|
-
loaderPath
|
|
7794
|
-
...execArgv
|
|
7794
|
+
loaderPath
|
|
7795
7795
|
] : [
|
|
7796
7796
|
...execArgv,
|
|
7797
7797
|
...conditions
|
|
@@ -9220,10 +9220,12 @@ function renderBenchmark$1(task, tasks) {
|
|
|
9220
9220
|
result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
|
|
9221
9221
|
].join("");
|
|
9222
9222
|
}
|
|
9223
|
-
function renderTree$1(tasks, options, level = 0) {
|
|
9223
|
+
function renderTree$1(tasks, options, level = 0, maxRows) {
|
|
9224
9224
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9225
|
-
|
|
9226
|
-
|
|
9225
|
+
const output = [];
|
|
9226
|
+
let currentRowCount = 0;
|
|
9227
|
+
for (const task of [...tasks].reverse()) {
|
|
9228
|
+
const taskOutput = [];
|
|
9227
9229
|
let suffix = "";
|
|
9228
9230
|
let prefix = ` ${getStateSymbol(task)} `;
|
|
9229
9231
|
if (level === 0 && task.type === "suite" && task.projectName)
|
|
@@ -9247,7 +9249,7 @@ function renderTree$1(tasks, options, level = 0) {
|
|
|
9247
9249
|
name = formatFilepath$1(name);
|
|
9248
9250
|
const padding = " ".repeat(level);
|
|
9249
9251
|
const body = ((_e = task.meta) == null ? void 0 : _e.benchmark) ? renderBenchmark$1(task, tasks) : name;
|
|
9250
|
-
|
|
9252
|
+
taskOutput.push(padding + prefix + body + suffix);
|
|
9251
9253
|
if (((_f = task.result) == null ? void 0 : _f.state) !== "pass" && outputMap$1.get(task) != null) {
|
|
9252
9254
|
let data = outputMap$1.get(task);
|
|
9253
9255
|
if (typeof data === "string") {
|
|
@@ -9257,37 +9259,46 @@ function renderTree$1(tasks, options, level = 0) {
|
|
|
9257
9259
|
}
|
|
9258
9260
|
if (data != null) {
|
|
9259
9261
|
const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
|
|
9260
|
-
|
|
9262
|
+
taskOutput.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
|
|
9261
9263
|
}
|
|
9262
9264
|
}
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
+
taskOutput.push(renderHookState(task, "beforeAll", level + 1));
|
|
9266
|
+
taskOutput.push(renderHookState(task, "beforeEach", level + 1));
|
|
9265
9267
|
if (task.type === "suite" && task.tasks.length > 0) {
|
|
9266
9268
|
if (((_g = task.result) == null ? void 0 : _g.state) === "fail" || ((_h = task.result) == null ? void 0 : _h.state) === "run" || options.renderSucceed)
|
|
9267
|
-
|
|
9268
|
-
}
|
|
9269
|
-
|
|
9270
|
-
|
|
9269
|
+
taskOutput.push(renderTree$1(task.tasks, options, level + 1, maxRows));
|
|
9270
|
+
}
|
|
9271
|
+
taskOutput.push(renderHookState(task, "afterAll", level + 1));
|
|
9272
|
+
taskOutput.push(renderHookState(task, "afterEach", level + 1));
|
|
9273
|
+
const rows = taskOutput.filter(Boolean);
|
|
9274
|
+
output.push(rows.join("\n"));
|
|
9275
|
+
currentRowCount += rows.length;
|
|
9276
|
+
if (maxRows && currentRowCount >= maxRows)
|
|
9277
|
+
break;
|
|
9271
9278
|
}
|
|
9272
|
-
return output.
|
|
9279
|
+
return output.reverse().join("\n");
|
|
9273
9280
|
}
|
|
9274
9281
|
const createListRenderer = (_tasks, options) => {
|
|
9275
9282
|
let tasks = _tasks;
|
|
9276
9283
|
let timer;
|
|
9277
9284
|
const log = options.logger.logUpdate;
|
|
9278
9285
|
function update() {
|
|
9279
|
-
log(renderTree$1(
|
|
9286
|
+
log(renderTree$1(
|
|
9287
|
+
tasks,
|
|
9288
|
+
options,
|
|
9289
|
+
0,
|
|
9290
|
+
process.stdout.rows
|
|
9291
|
+
));
|
|
9280
9292
|
}
|
|
9281
9293
|
return {
|
|
9282
9294
|
start() {
|
|
9283
9295
|
if (timer)
|
|
9284
9296
|
return this;
|
|
9285
|
-
timer = setInterval(update,
|
|
9297
|
+
timer = setInterval(update, 16);
|
|
9286
9298
|
return this;
|
|
9287
9299
|
},
|
|
9288
9300
|
update(_tasks2) {
|
|
9289
9301
|
tasks = _tasks2;
|
|
9290
|
-
update();
|
|
9291
9302
|
return this;
|
|
9292
9303
|
},
|
|
9293
9304
|
async stop() {
|
|
@@ -9359,25 +9370,45 @@ class DefaultReporter extends BaseReporter {
|
|
|
9359
9370
|
}
|
|
9360
9371
|
}
|
|
9361
9372
|
|
|
9362
|
-
const check =
|
|
9363
|
-
const cross = c.red
|
|
9364
|
-
const pending = c.yellow
|
|
9365
|
-
const skip = c.dim(c.gray(
|
|
9373
|
+
const check = { char: "\xB7", color: c.green };
|
|
9374
|
+
const cross = { char: "x", color: c.red };
|
|
9375
|
+
const pending = { char: "*", color: c.yellow };
|
|
9376
|
+
const skip = { char: "-", color: (char) => c.dim(c.gray(char)) };
|
|
9377
|
+
function getIcon(task) {
|
|
9378
|
+
var _a;
|
|
9379
|
+
if (task.mode === "skip" || task.mode === "todo")
|
|
9380
|
+
return skip;
|
|
9381
|
+
switch ((_a = task.result) == null ? void 0 : _a.state) {
|
|
9382
|
+
case "pass":
|
|
9383
|
+
return check;
|
|
9384
|
+
case "fail":
|
|
9385
|
+
return cross;
|
|
9386
|
+
default:
|
|
9387
|
+
return pending;
|
|
9388
|
+
}
|
|
9389
|
+
}
|
|
9366
9390
|
function render(tasks) {
|
|
9367
9391
|
const all = getTests(tasks);
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9392
|
+
const output = [];
|
|
9393
|
+
let currentIcon = pending;
|
|
9394
|
+
let currentTasks = 0;
|
|
9395
|
+
const addOutput = () => output.push(currentIcon.color(currentIcon.char.repeat(currentTasks)));
|
|
9396
|
+
for (const task of all) {
|
|
9397
|
+
const icon = getIcon(task);
|
|
9398
|
+
const isLast = all.indexOf(task) === all.length - 1;
|
|
9399
|
+
if (icon === currentIcon) {
|
|
9400
|
+
currentTasks++;
|
|
9401
|
+
if (isLast)
|
|
9402
|
+
addOutput();
|
|
9403
|
+
continue;
|
|
9404
|
+
}
|
|
9405
|
+
addOutput();
|
|
9406
|
+
currentTasks = 1;
|
|
9407
|
+
currentIcon = icon;
|
|
9408
|
+
if (isLast)
|
|
9409
|
+
addOutput();
|
|
9410
|
+
}
|
|
9411
|
+
return output.join("");
|
|
9381
9412
|
}
|
|
9382
9413
|
const createDotRenderer = (_tasks, options) => {
|
|
9383
9414
|
let tasks = _tasks;
|
|
@@ -9390,12 +9421,11 @@ const createDotRenderer = (_tasks, options) => {
|
|
|
9390
9421
|
start() {
|
|
9391
9422
|
if (timer)
|
|
9392
9423
|
return this;
|
|
9393
|
-
timer = setInterval(update,
|
|
9424
|
+
timer = setInterval(update, 16);
|
|
9394
9425
|
return this;
|
|
9395
9426
|
},
|
|
9396
9427
|
update(_tasks2) {
|
|
9397
9428
|
tasks = _tasks2;
|
|
9398
|
-
update();
|
|
9399
9429
|
return this;
|
|
9400
9430
|
},
|
|
9401
9431
|
async stop() {
|
|
@@ -10054,7 +10084,7 @@ function renderBenchmark(task, tasks) {
|
|
|
10054
10084
|
}
|
|
10055
10085
|
function renderTree(tasks, options, level = 0) {
|
|
10056
10086
|
var _a, _b, _c, _d, _e, _f;
|
|
10057
|
-
|
|
10087
|
+
const output = [];
|
|
10058
10088
|
let idx = 0;
|
|
10059
10089
|
for (const task of tasks) {
|
|
10060
10090
|
const padding = " ".repeat(level ? 1 : 0);
|
|
@@ -10093,7 +10123,7 @@ ${padding}`;
|
|
|
10093
10123
|
}
|
|
10094
10124
|
if (task.type === "suite" && task.tasks.length > 0) {
|
|
10095
10125
|
if ((_f = task.result) == null ? void 0 : _f.state)
|
|
10096
|
-
output
|
|
10126
|
+
output.push(renderTree(task.tasks, options, level + 1));
|
|
10097
10127
|
}
|
|
10098
10128
|
idx++;
|
|
10099
10129
|
}
|
|
@@ -10644,6 +10674,12 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
10644
10674
|
throw new Error("--shard <index> must be a positive number less then <count>");
|
|
10645
10675
|
resolved.shard = { index, count };
|
|
10646
10676
|
}
|
|
10677
|
+
if (resolved.inspect || resolved.inspectBrk) {
|
|
10678
|
+
if (resolved.threads !== false && resolved.singleThread !== true) {
|
|
10679
|
+
const inspectOption = `--inspect${resolved.inspectBrk ? "-brk" : ""}`;
|
|
10680
|
+
throw new Error(`You cannot use ${inspectOption} without "threads: false" or "singleThread: true"`);
|
|
10681
|
+
}
|
|
10682
|
+
}
|
|
10647
10683
|
resolved.deps = resolved.deps || {};
|
|
10648
10684
|
if (resolved.deps.inline !== true) {
|
|
10649
10685
|
const ssrOptions = viteConfig.ssr;
|
|
@@ -11285,7 +11321,7 @@ createLogUpdate(process$1.stdout);
|
|
|
11285
11321
|
|
|
11286
11322
|
createLogUpdate(process$1.stderr);
|
|
11287
11323
|
|
|
11288
|
-
var version = "0.29.
|
|
11324
|
+
var version = "0.29.3";
|
|
11289
11325
|
|
|
11290
11326
|
async function printError(error, ctx, options = {}) {
|
|
11291
11327
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
@@ -11303,6 +11339,8 @@ async function printError(error, ctx, options = {}) {
|
|
|
11303
11339
|
stack: error2.stack
|
|
11304
11340
|
};
|
|
11305
11341
|
}
|
|
11342
|
+
if (!ctx.config)
|
|
11343
|
+
return printErrorMessage(e, ctx.logger);
|
|
11306
11344
|
const stacks = parseErrorStacktrace(e, fullStack);
|
|
11307
11345
|
const nearest = error instanceof TypeCheckError ? error.stacks[0] : stacks.find(
|
|
11308
11346
|
(stack) => ctx.server.moduleGraph.getModuleById(stack.file) && existsSync$1(stack.file)
|
|
@@ -11323,6 +11361,7 @@ async function printError(error, ctx, options = {}) {
|
|
|
11323
11361
|
}
|
|
11324
11362
|
const testPath = e.VITEST_TEST_PATH;
|
|
11325
11363
|
const testName = e.VITEST_TEST_NAME;
|
|
11364
|
+
const afterEnvTeardown = e.VITEST_AFTER_ENV_TEARDOWN;
|
|
11326
11365
|
if (testPath)
|
|
11327
11366
|
ctx.logger.error(c.red(`This error originated in "${c.bold(testPath)}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`));
|
|
11328
11367
|
if (testName) {
|
|
@@ -11330,6 +11369,9 @@ async function printError(error, ctx, options = {}) {
|
|
|
11330
11369
|
- The error was thrown, while Vitest was running this test.
|
|
11331
11370
|
- This was the last recorded test before the error was thrown, if error originated after test finished its execution.`));
|
|
11332
11371
|
}
|
|
11372
|
+
if (afterEnvTeardown) {
|
|
11373
|
+
ctx.logger.error(c.red("This error was caught after test environment was torn down. Make sure to cancel any running tasks before test finishes:\n- cancel timeouts using clearTimeout and clearInterval\n- wait for promises to resolve using the await keyword"));
|
|
11374
|
+
}
|
|
11333
11375
|
if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
|
|
11334
11376
|
e.cause.name = `Caused by: ${e.cause.name}`;
|
|
11335
11377
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
@@ -11362,6 +11404,7 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
|
|
|
11362
11404
|
"expected",
|
|
11363
11405
|
"VITEST_TEST_NAME",
|
|
11364
11406
|
"VITEST_TEST_PATH",
|
|
11407
|
+
"VITEST_AFTER_ENV_TEARDOWN",
|
|
11365
11408
|
...Object.getOwnPropertyNames(Error.prototype),
|
|
11366
11409
|
...Object.getOwnPropertyNames(Object.prototype)
|
|
11367
11410
|
]);
|
|
@@ -11674,10 +11717,17 @@ class Vitest {
|
|
|
11674
11717
|
return this.coverageProvider;
|
|
11675
11718
|
}
|
|
11676
11719
|
getSerializableConfig() {
|
|
11720
|
+
var _a, _b;
|
|
11677
11721
|
return deepMerge(
|
|
11678
11722
|
{
|
|
11679
11723
|
...this.config,
|
|
11680
11724
|
reporters: [],
|
|
11725
|
+
deps: {
|
|
11726
|
+
...this.config.deps,
|
|
11727
|
+
experimentalOptimizer: {
|
|
11728
|
+
enabled: ((_b = (_a = this.config.deps) == null ? void 0 : _a.experimentalOptimizer) == null ? void 0 : _b.enabled) ?? false
|
|
11729
|
+
}
|
|
11730
|
+
},
|
|
11681
11731
|
snapshotOptions: {
|
|
11682
11732
|
...this.config.snapshotOptions,
|
|
11683
11733
|
resolveSnapshotPath: void 0
|
|
@@ -12503,14 +12553,23 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
12503
12553
|
entries: []
|
|
12504
12554
|
};
|
|
12505
12555
|
} else {
|
|
12506
|
-
const
|
|
12556
|
+
const root = config.root || process.cwd();
|
|
12557
|
+
const [...entries] = await ctx.globAllTestFiles(preOptions, preOptions.dir || root);
|
|
12558
|
+
if (preOptions == null ? void 0 : preOptions.setupFiles) {
|
|
12559
|
+
const setupFiles = toArray$1(preOptions.setupFiles).map(
|
|
12560
|
+
(file) => normalize(
|
|
12561
|
+
resolveModule(file, { paths: [root] }) ?? resolve(root, file)
|
|
12562
|
+
)
|
|
12563
|
+
);
|
|
12564
|
+
entries.push(...setupFiles);
|
|
12565
|
+
}
|
|
12507
12566
|
optimizeConfig.cacheDir = ((_f = preOptions.cache) == null ? void 0 : _f.dir) ?? "node_modules/.vitest";
|
|
12508
12567
|
optimizeConfig.optimizeDeps = {
|
|
12509
12568
|
...viteConfig.optimizeDeps,
|
|
12510
12569
|
...optimizer,
|
|
12511
12570
|
disabled: false,
|
|
12512
12571
|
entries: [...optimizer.entries || ((_g = viteConfig.optimizeDeps) == null ? void 0 : _g.entries) || [], ...entries],
|
|
12513
|
-
exclude: ["vitest", ...optimizer.exclude || ((_h = viteConfig.optimizeDeps) == null ? void 0 : _h.exclude) || []],
|
|
12572
|
+
exclude: ["vitest", ...builtinModules, ...optimizer.exclude || ((_h = viteConfig.optimizeDeps) == null ? void 0 : _h.exclude) || []],
|
|
12514
12573
|
include: (optimizer.include || ((_i = viteConfig.optimizeDeps) == null ? void 0 : _i.include) || []).filter((n) => n !== "vitest")
|
|
12515
12574
|
};
|
|
12516
12575
|
const { error: logError } = console;
|
|
@@ -12558,7 +12617,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
12558
12617
|
if (options.api && options.watch)
|
|
12559
12618
|
(await import('./chunk-api-setup.d9eccaeb.js')).setup(ctx);
|
|
12560
12619
|
} catch (err) {
|
|
12561
|
-
ctx.logger.printError(err, true);
|
|
12620
|
+
await ctx.logger.printError(err, true);
|
|
12562
12621
|
process.exit(1);
|
|
12563
12622
|
}
|
|
12564
12623
|
if (!options.watch)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import inspector from 'node:inspector';
|
|
2
|
+
|
|
3
|
+
function setupInspect(config) {
|
|
4
|
+
const isEnabled = config.inspect || config.inspectBrk;
|
|
5
|
+
if (isEnabled) {
|
|
6
|
+
const isOpen = inspector.url() !== void 0;
|
|
7
|
+
if (!isOpen) {
|
|
8
|
+
inspector.open();
|
|
9
|
+
if (config.inspectBrk)
|
|
10
|
+
inspector.waitForDebugger();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const keepOpen = config.watch && !config.isolate && config.singleThread;
|
|
14
|
+
return function cleanup() {
|
|
15
|
+
if (isEnabled && !keepOpen)
|
|
16
|
+
inspector.close();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { setupInspect as s };
|
|
@@ -10,7 +10,7 @@ import { existsSync, readdirSync } from 'node:fs';
|
|
|
10
10
|
import { getColors, getType } from '@vitest/utils';
|
|
11
11
|
import { e as getAllMockableProperties } from './chunk-utils-base.81f83dbd.js';
|
|
12
12
|
import { spyOn } from '@vitest/spy';
|
|
13
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
13
|
+
import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
|
|
14
14
|
|
|
15
15
|
class RefTracker {
|
|
16
16
|
constructor() {
|
|
@@ -321,6 +321,7 @@ async function startViteNode(ctx) {
|
|
|
321
321
|
error.VITEST_TEST_NAME = (_a = worker.current) == null ? void 0 : _a.name;
|
|
322
322
|
error.VITEST_TEST_PATH = relative(config.root, worker.filepath);
|
|
323
323
|
}
|
|
324
|
+
error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
|
|
324
325
|
rpc().onUnhandledError(error, type);
|
|
325
326
|
}
|
|
326
327
|
process.on("uncaughtException", (e) => catchError(e, "Uncaught Exception"));
|
|
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
|
|
|
10
10
|
globalSetup = true;
|
|
11
11
|
setSafeTimers();
|
|
12
12
|
if (config.globals)
|
|
13
|
-
(await import('./chunk-integrations-globals.
|
|
13
|
+
(await import('./chunk-integrations-globals.85aeb216.js')).registerApiGlobally();
|
|
14
14
|
}
|
|
15
15
|
function setupDefines(defines) {
|
|
16
16
|
for (const key in defines)
|
|
@@ -6,7 +6,7 @@ import * as chai$1 from 'chai';
|
|
|
6
6
|
import { expect } from 'chai';
|
|
7
7
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
8
8
|
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
|
|
9
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
9
|
+
import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
|
|
10
10
|
import { join, dirname } from 'pathe';
|
|
11
11
|
import { g as getSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
|
|
12
12
|
import { i as isObject } from './chunk-utils-base.81f83dbd.js';
|
package/dist/cli-wrapper.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.
|
|
4
|
+
import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.7627b6fc.js';
|
|
5
5
|
import './chunk-constants.797d3ebf.js';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import './chunk-utils-env.860d90c2.js';
|
|
@@ -48,6 +48,7 @@ import './chunk-utils-tasks.b41c8284.js';
|
|
|
48
48
|
import 'crypto';
|
|
49
49
|
import 'vite-node/utils';
|
|
50
50
|
import '@vitest/utils/diff';
|
|
51
|
+
import 'node:module';
|
|
51
52
|
import 'node:crypto';
|
|
52
53
|
import './chunk-magic-string.3a794426.js';
|
|
53
54
|
import 'strip-literal';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv } from 'vite';
|
|
3
|
-
import {
|
|
3
|
+
import { a2 as ResolvedCoverageOptions, U as UserConfig$1, a5 as CoverageC8Options, a6 as CustomProviderOptions, a4 as CoverageIstanbulOptions, ag as HtmlOptions, ah as FileOptions, ai as CloverOptions, aj as CoberturaOptions, ak as HtmlSpaOptions, al as LcovOptions, am as LcovOnlyOptions, an as TeamcityOptions, ao as TextOptions, ap as ProjectOptions, F as FakeTimerInstallOpts } from './types-5872e574.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
|
-
import '@vitest/runner/types';
|
|
6
5
|
import '@vitest/runner';
|
|
6
|
+
import '@vitest/runner/types';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a3 as BaseCoverageOptions, a2 as ResolvedCoverageOptions } from './types-5872e574.js';
|
|
2
2
|
import '@vitest/expect';
|
|
3
3
|
import 'vite';
|
|
4
|
-
import '@vitest/runner/types';
|
|
5
4
|
import '@vitest/runner';
|
|
5
|
+
import '@vitest/runner/types';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
7
|
import '@vitest/utils';
|
|
8
8
|
import 'tinybench';
|
package/dist/entry.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { startTests } from '@vitest/runner';
|
|
2
2
|
import { resolve } from 'pathe';
|
|
3
3
|
import { g as getWorkerState, r as resetModules } from './chunk-utils-global.727b6d25.js';
|
|
4
|
-
import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.
|
|
4
|
+
import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.8bd22905.js';
|
|
5
5
|
import { d as distDir } from './chunk-constants.797d3ebf.js';
|
|
6
6
|
import { s as startCoverageInsideWorker, t as takeCoverageInsideWorker, a as stopCoverageInsideWorker } from './chunk-integrations-coverage.e0a6acd2.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
|
-
import
|
|
8
|
+
import { isatty } from 'node:tty';
|
|
9
9
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
10
|
-
import {
|
|
10
|
+
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
11
11
|
import { e as environments } from './chunk-env-node.affdd278.js';
|
|
12
|
-
import { i as index } from './chunk-integrations-utils.
|
|
12
|
+
import { i as index } from './chunk-integrations-utils.5243a0d7.js';
|
|
13
13
|
import { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
|
|
14
14
|
import { promises, existsSync } from 'node:fs';
|
|
15
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
16
|
-
import { s as setupCommonEnv } from './chunk-runtime-setup.
|
|
15
|
+
import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
|
|
16
|
+
import { s as setupCommonEnv } from './chunk-runtime-setup.ccad6a47.js';
|
|
17
17
|
import './chunk-utils-env.860d90c2.js';
|
|
18
18
|
import 'std-env';
|
|
19
19
|
import '@vitest/runner/utils';
|
|
@@ -61,11 +61,11 @@ async function setupGlobalEnv(config) {
|
|
|
61
61
|
return;
|
|
62
62
|
globalSetup = true;
|
|
63
63
|
setupSnapshotEnvironment(new NodeSnapshotEnvironment());
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
setupColors(createColors(isatty(1)));
|
|
65
|
+
const _require = createRequire(import.meta.url);
|
|
66
|
+
_require.extensions[".css"] = () => ({});
|
|
67
|
+
_require.extensions[".scss"] = () => ({});
|
|
68
|
+
_require.extensions[".sass"] = () => ({});
|
|
69
69
|
const state = getWorkerState();
|
|
70
70
|
installSourcemapsSupport({
|
|
71
71
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
@@ -194,6 +194,8 @@ async function withEnv(name, options, executor, fn) {
|
|
|
194
194
|
try {
|
|
195
195
|
await fn();
|
|
196
196
|
} finally {
|
|
197
|
+
const { setTimeout } = getSafeTimers();
|
|
198
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
197
199
|
await env.teardown(globalThis);
|
|
198
200
|
}
|
|
199
201
|
}
|
|
@@ -260,6 +262,7 @@ async function run(files, config, environment, executor) {
|
|
|
260
262
|
}
|
|
261
263
|
await stopCoverageInsideWorker(config.coverage, executor);
|
|
262
264
|
});
|
|
265
|
+
workerState.environmentTeardownRun = true;
|
|
263
266
|
}
|
|
264
267
|
|
|
265
268
|
export { run };
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as Environment } from './types-5872e574.js';
|
|
2
2
|
import '@vitest/expect';
|
|
3
3
|
import 'vite';
|
|
4
|
-
import '@vitest/runner/types';
|
|
5
4
|
import '@vitest/runner';
|
|
5
|
+
import '@vitest/runner/types';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
7
|
import '@vitest/utils';
|
|
8
8
|
import 'tinybench';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Test } from '@vitest/runner';
|
|
2
|
-
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
-
import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-
|
|
4
|
-
export {
|
|
2
|
+
export { SequenceHooks, SequenceSetupFiles, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
+
import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-5872e574.js';
|
|
4
|
+
export { w as AfterSuiteRunMeta, A as ApiConfig, D as ArgumentsType, z as Arrayable, y as Awaitable, a3 as BaseCoverageOptions, aa as BenchFunction, a8 as Benchmark, B as BenchmarkAPI, a9 as BenchmarkResult, a7 as BenchmarkUserOptions, h as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, L as Constructable, g as Context, n as ContextRPC, m as ContextTestEnvironment, a5 as CoverageC8Options, a4 as CoverageIstanbulOptions, a1 as CoverageOptions, Z as CoverageProvider, $ as CoverageProviderModule, a0 as CoverageReporter, a6 as CustomProviderOptions, H as DeepMerge, Q as Environment, E as EnvironmentOptions, P as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, G as MergeInsertions, O as ModuleCache, b as ModuleGraphData, K as MutableArray, N as Nullable, Y as OnServerRestartHandler, d as RawErrsMap, _ as ReportContext, c as Reporter, v as ResolveIdFunction, a as ResolvedConfig, a2 as ResolvedCoverageOptions, f as RootAndTarget, R as RuntimeConfig, l as RuntimeRPC, p as SnapshotData, s as SnapshotMatchOptions, S as SnapshotResult, r as SnapshotStateOptions, u as SnapshotSummary, q as SnapshotUpdateState, T as TscErrorInfo, k as TypecheckConfig, t as UncheckedSnapshot, U as UserConfig, X as UserConsoleLog, o as Vitest, V as VitestEnvironment, j as VitestRunMode, W as WorkerContext, x as WorkerGlobalState } from './types-5872e574.js';
|
|
5
5
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
|
|
6
6
|
export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
|
|
7
7
|
export { S as SnapshotEnvironment } from './env-afee91f0.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.
|
|
2
|
+
export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.8bd22905.js';
|
|
3
3
|
export { i as isFirstRun, r as runOnce } from './chunk-integrations-run-once.9012f759.js';
|
|
4
|
-
import { d as dist } from './chunk-integrations-utils.
|
|
5
|
-
export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.
|
|
4
|
+
import { d as dist } from './chunk-integrations-utils.5243a0d7.js';
|
|
5
|
+
export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.5243a0d7.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
|
8
8
|
export { assert, should } from 'chai';
|
|
@@ -14,7 +14,7 @@ import './chunk-utils-env.860d90c2.js';
|
|
|
14
14
|
import 'std-env';
|
|
15
15
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
16
16
|
import '@vitest/expect';
|
|
17
|
-
import './chunk-runtime-rpc.
|
|
17
|
+
import './chunk-runtime-rpc.1232904e.js';
|
|
18
18
|
import './chunk-snapshot-env.a347d647.js';
|
|
19
19
|
import './chunk-utils-base.81f83dbd.js';
|
|
20
20
|
import './chunk-utils-tasks.b41c8284.js';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { j as VitestRunMode, U as UserConfig, o as Vitest, ab as MockFactory, ac as MockMap, ad as TestSequencer } from './types-5872e574.js';
|
|
2
|
+
export { ad as TestSequencer, af as TestSequencerConstructor, o as Vitest, ae as startVitest } from './types-5872e574.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
5
5
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
6
6
|
import '@vitest/expect';
|
|
7
|
-
import '@vitest/runner/types';
|
|
8
7
|
import '@vitest/runner';
|
|
8
|
+
import '@vitest/runner/types';
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils';
|
|
11
11
|
import 'tinybench';
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.
|
|
2
|
-
export { V as VitestExecutor } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.7627b6fc.js';
|
|
2
|
+
export { V as VitestExecutor } from './chunk-runtime-mocker.07568540.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import './chunk-constants.797d3ebf.js';
|
|
5
5
|
import 'node:url';
|
|
@@ -48,13 +48,13 @@ import './chunk-utils-tasks.b41c8284.js';
|
|
|
48
48
|
import 'crypto';
|
|
49
49
|
import 'vite-node/utils';
|
|
50
50
|
import '@vitest/utils/diff';
|
|
51
|
+
import 'node:module';
|
|
51
52
|
import 'node:crypto';
|
|
52
53
|
import './chunk-magic-string.3a794426.js';
|
|
53
54
|
import 'strip-literal';
|
|
54
55
|
import 'readline';
|
|
55
56
|
import './vendor-index.bdee400f.js';
|
|
56
|
-
import 'node:module';
|
|
57
57
|
import 'node:assert';
|
|
58
58
|
import 'node:util';
|
|
59
59
|
import '@vitest/spy';
|
|
60
|
-
import './chunk-runtime-rpc.
|
|
60
|
+
import './chunk-runtime-rpc.1232904e.js';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-5872e574.js';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner/types';
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.
|
|
2
|
+
import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.8bd22905.js';
|
|
3
3
|
import { g as getWorkerState } from './chunk-utils-global.727b6d25.js';
|
|
4
4
|
import { g as getFullName } from './chunk-utils-tasks.b41c8284.js';
|
|
5
5
|
import { updateTask } from '@vitest/runner';
|
|
@@ -7,7 +7,7 @@ import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import 'chai';
|
|
9
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
|
-
import './chunk-runtime-rpc.
|
|
10
|
+
import './chunk-runtime-rpc.1232904e.js';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import './chunk-snapshot-env.a347d647.js';
|
|
13
13
|
import './chunk-utils-base.81f83dbd.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MatchersObject, MatcherState } from '@vitest/expect';
|
|
2
2
|
import { UserConfig as UserConfig$1, ViteDevServer, CommonServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
|
|
3
|
-
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
4
3
|
import * as _vitest_runner from '@vitest/runner';
|
|
5
|
-
import { Task as Task$1, Test as Test$2, TaskCustom } from '@vitest/runner';
|
|
4
|
+
import { Task as Task$1, Test as Test$2, TaskCustom, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
|
|
5
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
6
6
|
import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
|
|
7
7
|
import { Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
8
8
|
import { Task as Task$2, TaskResult, Bench, Options } from 'tinybench';
|
|
@@ -1075,6 +1075,7 @@ interface WorkerGlobalState {
|
|
|
1075
1075
|
rpc: BirpcReturn<RuntimeRPC>;
|
|
1076
1076
|
current?: Test$2;
|
|
1077
1077
|
filepath?: string;
|
|
1078
|
+
environmentTeardownRun?: boolean;
|
|
1078
1079
|
moduleCache: ModuleCacheMap;
|
|
1079
1080
|
mockMap: MockMap;
|
|
1080
1081
|
}
|
|
@@ -1406,7 +1407,6 @@ type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
|
1406
1407
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
1407
1408
|
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
1408
1409
|
type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
|
|
1409
|
-
type SequenceHooks = 'stack' | 'list' | 'parallel';
|
|
1410
1410
|
type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
|
|
1411
1411
|
|
|
1412
1412
|
interface EnvironmentOptions {
|
|
@@ -1825,6 +1825,13 @@ interface InlineConfig {
|
|
|
1825
1825
|
* @default false
|
|
1826
1826
|
*/
|
|
1827
1827
|
shuffle?: boolean;
|
|
1828
|
+
/**
|
|
1829
|
+
* Defines how setup files should be ordered
|
|
1830
|
+
* - 'parallel' will run all setup files in parallel
|
|
1831
|
+
* - 'list' will run all setup files in the order they are defined in the config file
|
|
1832
|
+
* @default 'parallel'
|
|
1833
|
+
*/
|
|
1834
|
+
setupFiles?: SequenceSetupFiles;
|
|
1828
1835
|
/**
|
|
1829
1836
|
* Seed for the random number generator.
|
|
1830
1837
|
* @default Date.now()
|
|
@@ -1863,6 +1870,18 @@ interface InlineConfig {
|
|
|
1863
1870
|
* Path to a custom test runner.
|
|
1864
1871
|
*/
|
|
1865
1872
|
runner?: string;
|
|
1873
|
+
/**
|
|
1874
|
+
* Debug tests by opening `node:inspector` in worker / child process.
|
|
1875
|
+
* Provides similar experience as `--inspect` Node CLI argument.
|
|
1876
|
+
* Requires `singleThread: true` OR `threads: false`.
|
|
1877
|
+
*/
|
|
1878
|
+
inspect?: boolean;
|
|
1879
|
+
/**
|
|
1880
|
+
* Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
|
|
1881
|
+
* Provides similar experience as `--inspect-brk` Node CLI argument.
|
|
1882
|
+
* Requires `singleThread: true` OR `threads: false`.
|
|
1883
|
+
*/
|
|
1884
|
+
inspectBrk?: boolean;
|
|
1866
1885
|
}
|
|
1867
1886
|
interface TypecheckConfig {
|
|
1868
1887
|
/**
|
|
@@ -1952,6 +1971,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1952
1971
|
sequence: {
|
|
1953
1972
|
sequencer: TestSequencerConstructor;
|
|
1954
1973
|
hooks: SequenceHooks;
|
|
1974
|
+
setupFiles: SequenceSetupFiles;
|
|
1955
1975
|
shuffle?: boolean;
|
|
1956
1976
|
seed: number;
|
|
1957
1977
|
};
|
|
@@ -2166,4 +2186,4 @@ type Context = RootAndTarget & {
|
|
|
2166
2186
|
lastActivePath?: string;
|
|
2167
2187
|
};
|
|
2168
2188
|
|
|
2169
|
-
export {
|
|
2189
|
+
export { CoverageProviderModule as $, ApiConfig as A, BenchmarkAPI as B, CollectLineNumbers as C, ArgumentsType$1 as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, MergeInsertions as G, DeepMerge as H, InlineConfig as I, JSDOMOptions as J, MutableArray as K, Constructable as L, MockFactoryWithHelper as M, Nullable as N, ModuleCache as O, EnvironmentReturn as P, Environment as Q, RuntimeConfig as R, SnapshotResult as S, TscErrorInfo as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, UserConsoleLog as X, OnServerRestartHandler as Y, CoverageProvider as Z, ReportContext as _, ResolvedConfig as a, CoverageReporter as a0, CoverageOptions as a1, ResolvedCoverageOptions as a2, BaseCoverageOptions as a3, CoverageIstanbulOptions as a4, CoverageC8Options as a5, CustomProviderOptions as a6, BenchmarkUserOptions as a7, Benchmark as a8, BenchmarkResult as a9, BenchFunction as aa, MockFactory as ab, MockMap as ac, TestSequencer as ad, startVitest as ae, TestSequencerConstructor as af, HtmlOptions as ag, FileOptions as ah, CloverOptions as ai, CoberturaOptions as aj, HtmlSpaOptions as ak, LcovOptions as al, LcovOnlyOptions as am, TeamcityOptions as an, TextOptions as ao, ProjectOptions as ap, ModuleGraphData as b, Reporter as c, RawErrsMap as d, CollectLines as e, RootAndTarget as f, Context as g, BuiltinEnvironment as h, CSSModuleScopeStrategy as i, VitestRunMode as j, TypecheckConfig as k, RuntimeRPC as l, ContextTestEnvironment as m, ContextRPC as n, Vitest as o, SnapshotData as p, SnapshotUpdateState as q, SnapshotStateOptions as r, SnapshotMatchOptions as s, UncheckedSnapshot as t, SnapshotSummary as u, ResolveIdFunction as v, AfterSuiteRunMeta as w, WorkerGlobalState as x, Awaitable as y, Arrayable as z };
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
2
2
|
import { workerId } from 'tinypool';
|
|
3
3
|
import { g as getWorkerState } from './chunk-utils-global.727b6d25.js';
|
|
4
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.
|
|
5
|
-
import {
|
|
4
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.07568540.js';
|
|
5
|
+
import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
|
|
6
|
+
import { a as rpcDone } from './chunk-runtime-rpc.1232904e.js';
|
|
6
7
|
import 'pathe';
|
|
7
8
|
import './chunk-utils-env.860d90c2.js';
|
|
8
9
|
import 'std-env';
|
|
@@ -23,6 +24,7 @@ import 'node:util';
|
|
|
23
24
|
import './chunk-constants.797d3ebf.js';
|
|
24
25
|
import './chunk-utils-base.81f83dbd.js';
|
|
25
26
|
import '@vitest/spy';
|
|
27
|
+
import 'node:inspector';
|
|
26
28
|
|
|
27
29
|
function init(ctx) {
|
|
28
30
|
if (typeof __vitest_worker__ !== "undefined" && ctx.config.threads && ctx.config.isolate)
|
|
@@ -58,10 +60,15 @@ function init(ctx) {
|
|
|
58
60
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
|
59
61
|
}
|
|
60
62
|
async function run(ctx) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const inspectorCleanup = setupInspect(ctx.config);
|
|
64
|
+
try {
|
|
65
|
+
init(ctx);
|
|
66
|
+
const { run: run2, executor } = await startViteNode(ctx);
|
|
67
|
+
await run2(ctx.files, ctx.config, ctx.environment, executor);
|
|
68
|
+
await rpcDone();
|
|
69
|
+
} finally {
|
|
70
|
+
inspectorCleanup();
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
export { run };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.3",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -132,11 +132,11 @@
|
|
|
132
132
|
"tinyspy": "^1.0.2",
|
|
133
133
|
"vite": "^3.0.0 || ^4.0.0",
|
|
134
134
|
"why-is-node-running": "^2.2.2",
|
|
135
|
-
"@vitest/expect": "0.29.
|
|
136
|
-
"@vitest/runner": "0.29.
|
|
137
|
-
"vite-node": "0.29.
|
|
138
|
-
"@vitest/
|
|
139
|
-
"@vitest/
|
|
135
|
+
"@vitest/expect": "0.29.3",
|
|
136
|
+
"@vitest/runner": "0.29.3",
|
|
137
|
+
"vite-node": "0.29.3",
|
|
138
|
+
"@vitest/spy": "0.29.3",
|
|
139
|
+
"@vitest/utils": "0.29.3"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
142
|
"@antfu/install-pkg": "^0.1.1",
|