vitest 1.5.3 → 1.6.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/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/environments-node.vcoXCoKs.js +19 -0
- package/dist/chunks/{integrations-globals.Hr6znn-f.js → integrations-globals.kw4co3rx.js} +3 -3
- package/dist/chunks/{runtime-runBaseTests.l6qXp5eU.js → runtime-runBaseTests.oAvMKtQC.js} +8 -9
- package/dist/cli.js +2 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +6 -4
- package/dist/execute.js +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +7 -7
- package/dist/{reporters-BXNXFKfg.d.ts → reporters-w_64AS5f.d.ts} +103 -25
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +5 -5
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +8 -0
- package/dist/{suite-KPWE530F.d.ts → suite-dWqIFb_-.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.Xt0Omgh7.js → base.5NT-gWu5.js} +9 -1
- package/dist/vendor/{base.oIzAvGLe.js → base.Ybri3C14.js} +2 -2
- package/dist/vendor/{cac.RDd_SGOd.js → cac.cdAtVkJZ.js} +38 -15
- package/dist/vendor/{cli-api.AmIc1Dmz.js → cli-api.OdDWuB7Y.js} +159 -42
- package/dist/vendor/{execute.2_yoIC01.js → execute.fL3szUAI.js} +8 -3
- package/dist/vendor/{index.X7lgIMc_.js → index.-xs08BYx.js} +177 -122
- package/dist/vendor/{index.Fm6OikHU.js → index.DpVgvm2P.js} +17 -18
- package/dist/vendor/{index.QVcwRDVW.js → index.dI9lHwVn.js} +1 -1
- package/dist/vendor/{setup-common.5nUd4r76.js → setup-common.8nJLd4ay.js} +1 -1
- package/dist/vendor/{utils.VYmeMh-u.js → utils.dEtNIEgr.js} +1 -1
- package/dist/vendor/{vi.Y_w82WR8.js → vi.YFlodzP_.js} +1 -1
- package/dist/vendor/{vm.i4FO5N37.js → vm.QEE48c0T.js} +131 -41
- package/dist/worker.js +8 -2
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +10 -8
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +5 -5
- package/package.json +13 -9
- package/snapshot.d.ts +1 -0
package/dist/reporters.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.
|
|
1
|
+
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.-xs08BYx.js';
|
|
2
2
|
import 'node:fs';
|
|
3
|
+
import 'picocolors';
|
|
3
4
|
import 'pathe';
|
|
5
|
+
import './vendor/tasks.IknbGB2n.js';
|
|
4
6
|
import '@vitest/runner/utils';
|
|
5
7
|
import '@vitest/utils';
|
|
6
8
|
import './vendor/env.AtSIuHFg.js';
|
|
7
9
|
import 'std-env';
|
|
8
|
-
import '
|
|
9
|
-
import './vendor/
|
|
10
|
-
import './vendor/utils.VYmeMh-u.js';
|
|
11
|
-
import './vendor/base.Xt0Omgh7.js';
|
|
10
|
+
import './vendor/utils.dEtNIEgr.js';
|
|
11
|
+
import './vendor/base.5NT-gWu5.js';
|
|
12
12
|
import 'node:perf_hooks';
|
|
13
13
|
import './vendor/index.SMVOaj7F.js';
|
|
14
14
|
import './vendor/global.CkGT_TMy.js';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-w_64AS5f.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.YFlodzP_.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
5
5
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
@@ -14,7 +14,7 @@ import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
15
|
import '@vitest/utils/error';
|
|
16
16
|
import '@vitest/utils/source-map';
|
|
17
|
-
import './vendor/base.
|
|
17
|
+
import './vendor/base.5NT-gWu5.js';
|
|
18
18
|
import './vendor/date.Ns1pGd_X.js';
|
|
19
19
|
import '@vitest/spy';
|
|
20
20
|
import 'std-env';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
2
|
+
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
3
|
+
|
|
4
|
+
declare class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
|
|
5
|
+
getHeader(): string;
|
|
6
|
+
resolvePath(filepath: string): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment };
|
package/dist/snapshot.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/environments-node.vcoXCoKs.js';
|
|
2
|
+
import '@vitest/snapshot/environment';
|
|
3
|
+
import 'pathe';
|
|
4
|
+
import '@vitest/runner/utils';
|
|
5
|
+
import '@vitest/utils';
|
|
6
|
+
import './vendor/global.CkGT_TMy.js';
|
|
7
|
+
import './vendor/env.AtSIuHFg.js';
|
|
8
|
+
import 'std-env';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-w_64AS5f.js';
|
|
4
4
|
import { Options } from 'tinybench';
|
|
5
5
|
|
|
6
6
|
declare function getBenchOptions(key: Custom): Options;
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './suite-
|
|
4
|
-
import './reporters-
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './suite-dWqIFb_-.js';
|
|
4
|
+
import './reporters-w_64AS5f.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -107,5 +107,13 @@ function escapeRegExp(s) {
|
|
|
107
107
|
function wildcardPatternToRegExp(pattern) {
|
|
108
108
|
return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
|
|
109
109
|
}
|
|
110
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
111
|
+
function nanoid(size = 21) {
|
|
112
|
+
let id = "";
|
|
113
|
+
let i = size;
|
|
114
|
+
while (i--)
|
|
115
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
116
|
+
return id;
|
|
117
|
+
}
|
|
110
118
|
|
|
111
|
-
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d,
|
|
119
|
+
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, nanoid as e, stdout as f, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t, wildcardPatternToRegExp as w };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
2
|
import { p as provideWorkerState } from './global.CkGT_TMy.js';
|
|
3
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
3
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.fL3szUAI.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
6
6
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
|
|
|
25
25
|
ctx.files.forEach((i) => state.moduleCache.delete(i));
|
|
26
26
|
const [executor, { run }] = await Promise.all([
|
|
27
27
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
28
|
-
import('../chunks/runtime-runBaseTests.
|
|
28
|
+
import('../chunks/runtime-runBaseTests.oAvMKtQC.js')
|
|
29
29
|
]);
|
|
30
30
|
await run(
|
|
31
31
|
ctx.files,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { t as toArray } from './base.
|
|
4
|
+
import { t as toArray } from './base.5NT-gWu5.js';
|
|
5
5
|
import { d as defaultPort, a as defaultBrowserPort } from './constants.5J7I254_.js';
|
|
6
6
|
|
|
7
7
|
function toArr(any) {
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "1.
|
|
621
|
+
var version = "1.6.1";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -793,13 +793,13 @@ const cliOptionsConfig = {
|
|
|
793
793
|
array: true
|
|
794
794
|
},
|
|
795
795
|
reportOnFailure: {
|
|
796
|
-
description: "Generate coverage report even when tests fail (default: false)"
|
|
796
|
+
description: "Generate coverage report even when tests fail (default: `false`)"
|
|
797
797
|
},
|
|
798
798
|
allowExternal: {
|
|
799
|
-
description: "Collect coverage of files outside the project root (default: false)"
|
|
799
|
+
description: "Collect coverage of files outside the project root (default: `false`)"
|
|
800
800
|
},
|
|
801
801
|
skipFull: {
|
|
802
|
-
description: "Do not show files with 100% statement, branch, and function coverage (default: false)"
|
|
802
|
+
description: "Do not show files with 100% statement, branch, and function coverage (default: `false`)"
|
|
803
803
|
},
|
|
804
804
|
thresholds: {
|
|
805
805
|
description: null,
|
|
@@ -944,7 +944,9 @@ const cliOptionsConfig = {
|
|
|
944
944
|
},
|
|
945
945
|
fileParallelism: {
|
|
946
946
|
description: "Should all test files run in parallel. Use `--browser.file-parallelism=false` to disable (default: same as `--file-parallelism`)"
|
|
947
|
-
}
|
|
947
|
+
},
|
|
948
|
+
indexScripts: null,
|
|
949
|
+
testerScripts: null
|
|
948
950
|
}
|
|
949
951
|
},
|
|
950
952
|
pool: {
|
|
@@ -1199,6 +1201,9 @@ const cliOptionsConfig = {
|
|
|
1199
1201
|
clearScreen: {
|
|
1200
1202
|
description: "Clear terminal screen when re-running tests during watch mode (default: `true`)"
|
|
1201
1203
|
},
|
|
1204
|
+
standalone: {
|
|
1205
|
+
description: "Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)"
|
|
1206
|
+
},
|
|
1202
1207
|
// disable CLI options
|
|
1203
1208
|
cliExclude: null,
|
|
1204
1209
|
server: null,
|
|
@@ -1230,7 +1235,20 @@ const cliOptionsConfig = {
|
|
|
1230
1235
|
poolMatchGlobs: null,
|
|
1231
1236
|
deps: null,
|
|
1232
1237
|
name: null,
|
|
1233
|
-
includeTaskLocation: null
|
|
1238
|
+
includeTaskLocation: null,
|
|
1239
|
+
snapshotEnvironment: null,
|
|
1240
|
+
compare: null,
|
|
1241
|
+
outputJson: null
|
|
1242
|
+
};
|
|
1243
|
+
const benchCliOptionsConfig = {
|
|
1244
|
+
compare: {
|
|
1245
|
+
description: "benchmark output file to compare against",
|
|
1246
|
+
argument: "<filename>"
|
|
1247
|
+
},
|
|
1248
|
+
outputJson: {
|
|
1249
|
+
description: "benchmark output file",
|
|
1250
|
+
argument: "<filename>"
|
|
1251
|
+
}
|
|
1234
1252
|
};
|
|
1235
1253
|
|
|
1236
1254
|
function addCommand(cli, name, option) {
|
|
@@ -1270,14 +1288,16 @@ function addCommand(cli, name, option) {
|
|
|
1270
1288
|
}
|
|
1271
1289
|
}
|
|
1272
1290
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const
|
|
1275
|
-
cli.version(version);
|
|
1276
|
-
for (const optionName in cliOptionsConfig) {
|
|
1277
|
-
const option = cliOptionsConfig[optionName];
|
|
1291
|
+
function addCliOptions(cli, options) {
|
|
1292
|
+
for (const [optionName, option] of Object.entries(options)) {
|
|
1278
1293
|
if (option)
|
|
1279
1294
|
addCommand(cli, optionName, option);
|
|
1280
1295
|
}
|
|
1296
|
+
}
|
|
1297
|
+
function createCLI(options = {}) {
|
|
1298
|
+
const cli = cac("vitest");
|
|
1299
|
+
cli.version(version);
|
|
1300
|
+
addCliOptions(cli, cliOptionsConfig);
|
|
1281
1301
|
cli.help((info) => {
|
|
1282
1302
|
const helpSection = info.find((current) => {
|
|
1283
1303
|
var _a;
|
|
@@ -1328,7 +1348,10 @@ function createCLI(options = {}) {
|
|
|
1328
1348
|
cli.command("related [...filters]", void 0, options).action(runRelated);
|
|
1329
1349
|
cli.command("watch [...filters]", void 0, options).action(watch);
|
|
1330
1350
|
cli.command("dev [...filters]", void 0, options).action(watch);
|
|
1331
|
-
|
|
1351
|
+
addCliOptions(
|
|
1352
|
+
cli.command("bench [...filters]", void 0, options).action(benchmark),
|
|
1353
|
+
benchCliOptionsConfig
|
|
1354
|
+
);
|
|
1332
1355
|
cli.command("typecheck [...filters]").action(() => {
|
|
1333
1356
|
throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`);
|
|
1334
1357
|
});
|
|
@@ -1388,13 +1411,13 @@ async function start(mode, cliFilters, options) {
|
|
|
1388
1411
|
} catch {
|
|
1389
1412
|
}
|
|
1390
1413
|
try {
|
|
1391
|
-
const { startVitest } = await import('./cli-api.
|
|
1414
|
+
const { startVitest } = await import('./cli-api.OdDWuB7Y.js').then(function (n) { return n.d; });
|
|
1392
1415
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1393
1416
|
if (!(ctx == null ? void 0 : ctx.shouldKeepServer()))
|
|
1394
1417
|
await (ctx == null ? void 0 : ctx.exit());
|
|
1395
1418
|
return ctx;
|
|
1396
1419
|
} catch (e) {
|
|
1397
|
-
const { divider } = await import('./utils.
|
|
1420
|
+
const { divider } = await import('./utils.dEtNIEgr.js').then(function (n) { return n.u; });
|
|
1398
1421
|
console.error(`
|
|
1399
1422
|
${c.red(divider(c.bold(c.inverse(" Unhandled Error "))))}`);
|
|
1400
1423
|
console.error(e);
|