vitest 3.2.0-beta.2 → 3.2.0-beta.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 +3 -3
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.DwtwORaC.js → base.D4119yLM.js} +4 -3
- package/dist/chunks/{benchmark.BoF7jW0Q.js → benchmark.Cf_PACH1.js} +1 -1
- package/dist/chunks/{cac.I9MLYfT-.js → cac.DWaWHIIE.js} +18 -15
- package/dist/chunks/{cli-api.d6IK1pnk.js → cli-api.CnmEXkxs.js} +250 -49
- package/dist/chunks/{config.d.UqE-KR0o.d.ts → config.d.D2ROskhv.d.ts} +2 -0
- package/dist/chunks/{console.K1NMVOSc.js → console.Cwr-MFPV.js} +3 -2
- package/dist/chunks/{constants.BZZyIeIE.js → constants.DnKduX2e.js} +1 -0
- package/dist/chunks/{coverage.OGU09Jbh.js → coverage.C73DaDgS.js} +116 -12
- package/dist/chunks/{creator.DGAdZ4Hj.js → creator.C8WKy2eW.js} +10 -7
- package/dist/chunks/{date.CDOsz-HY.js → date.ByMsSlOr.js} +25 -0
- package/dist/chunks/{defaults.DSxsTG0h.js → defaults.DpVH7vbg.js} +1 -0
- package/dist/chunks/{environment.d.D8YDy2v5.d.ts → environment.d.cL3nLXbE.d.ts} +1 -0
- package/dist/chunks/{execute.JlGHLJZT.js → execute.B3q-2LPV.js} +25 -0
- package/dist/chunks/{global.d.BPa1eL3O.d.ts → global.d.BNLIi6yo.d.ts} +3 -1
- package/dist/chunks/{globals.CpxW8ccg.js → globals.CI21aWXF.js} +7 -6
- package/dist/chunks/{index.DFXFpH3w.js → index.2jgTs_Q5.js} +19 -1
- package/dist/chunks/{index.CV36oG_L.js → index.Bter3jj9.js} +83 -16
- package/dist/chunks/{index.DswW_LEs.js → index.CbT4iuwc.js} +7 -4
- package/dist/chunks/index.D3XRDfWc.js +213 -0
- package/dist/chunks/{index.CfXMNXHg.js → index.DNgLEKsQ.js} +4 -2
- package/dist/chunks/{index.CmC5OK9L.js → index.JOzufsrU.js} +2 -1
- package/dist/chunks/{inspector.DbDkSkFn.js → inspector.BFsh5KO0.js} +3 -0
- package/dist/chunks/{node.3xsWotC9.js → node.Be-ntJnD.js} +1 -1
- package/dist/chunks/{reporters.d.CLC9rhKy.d.ts → reporters.d.Bt4IGtsa.d.ts} +24 -6
- package/dist/chunks/{rpc.D9_013TY.js → rpc.BKExFSRG.js} +2 -1
- package/dist/chunks/{runBaseTests.Dn2vyej_.js → runBaseTests.B_M1TTsK.js} +19 -10
- package/dist/chunks/{setup-common.CYo3Y0dD.js → setup-common.CF-O-dZX.js} +2 -1
- package/dist/chunks/{typechecker.DnTrplSJ.js → typechecker.BgzF-6iO.js} +78 -21
- package/dist/chunks/{utils.CgTj3MsC.js → utils.BlI4TC7Y.js} +1 -0
- package/dist/chunks/{utils.BfxieIyZ.js → utils.DPCq3gzW.js} +3 -0
- package/dist/chunks/{vi.BFR5YIgu.js → vi.pkoYCV6A.js} +25 -2
- package/dist/chunks/{vite.d.CBZ3M_ru.d.ts → vite.d.B-Kx3KCF.d.ts} +3 -1
- package/dist/chunks/{vm.C1HHjtNS.js → vm.DPYem2so.js} +72 -4
- package/dist/chunks/{worker.d.CoCI7hzP.d.ts → worker.d.BKbBp2ga.d.ts} +2 -2
- package/dist/chunks/{worker.d.D5Xdi-Zr.d.ts → worker.d.Bl1O4kuf.d.ts} +1 -1
- package/dist/cli.js +4 -4
- package/dist/config.cjs +2 -0
- package/dist/config.d.ts +7 -6
- package/dist/config.js +2 -2
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +5 -5
- package/dist/environments.d.ts +6 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +9 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +24 -12
- package/dist/index.js +5 -5
- package/dist/node.d.ts +18 -10
- package/dist/node.js +14 -12
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +13 -5
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +9 -5
- package/dist/workers/forks.js +6 -4
- package/dist/workers/runVmTests.js +14 -9
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +4 -4
- package/dist/workers.js +10 -10
- package/package.json +18 -18
- package/dist/chunks/index.CK1YOQaa.js +0 -143
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.D2ROskhv.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.S9RMNXIe.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
4
|
import { VitestExecutor } from './execute.js';
|
|
@@ -12,8 +12,8 @@ import '@vitest/snapshot';
|
|
|
12
12
|
import '@vitest/snapshot/environment';
|
|
13
13
|
import 'vite-node/client';
|
|
14
14
|
import 'vite-node';
|
|
15
|
-
import './chunks/worker.d.
|
|
16
|
-
import './chunks/environment.d.
|
|
15
|
+
import './chunks/worker.d.BKbBp2ga.js';
|
|
16
|
+
import './chunks/environment.d.cL3nLXbE.js';
|
|
17
17
|
import 'vitest/optional-types.js';
|
|
18
18
|
import 'node:vm';
|
|
19
19
|
import '@vitest/mocker';
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
1
|
+
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.CF-O-dZX.js';
|
|
2
2
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
3
3
|
import * as spy from '@vitest/spy';
|
|
4
4
|
export { spy as SpyModule };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
3
|
-
import { p as provideWorkerState } from './utils.
|
|
2
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B3q-2LPV.js';
|
|
3
|
+
import { p as provideWorkerState } from './utils.BlI4TC7Y.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
6
6
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -14,6 +14,7 @@ async function startViteNode(options) {
|
|
|
14
14
|
}
|
|
15
15
|
async function runBaseTests(method, state) {
|
|
16
16
|
const { ctx } = state;
|
|
17
|
+
// state has new context, but we want to reuse existing ones
|
|
17
18
|
state.moduleCache = moduleCache;
|
|
18
19
|
state.moduleExecutionInfo = moduleExecutionInfo;
|
|
19
20
|
provideWorkerState(globalThis, state);
|
|
@@ -27,7 +28,7 @@ async function runBaseTests(method, state) {
|
|
|
27
28
|
const [executor, { run }] = await Promise.all([startViteNode({
|
|
28
29
|
state,
|
|
29
30
|
requestStubs: getDefaultRequestStubs()
|
|
30
|
-
}), import('./runBaseTests.
|
|
31
|
+
}), import('./runBaseTests.B_M1TTsK.js')]);
|
|
31
32
|
const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
|
|
32
33
|
filepath: f,
|
|
33
34
|
testLocations: undefined
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
3
|
import { noop } from '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './utils.
|
|
4
|
+
import { g as getWorkerState } from './utils.BlI4TC7Y.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = new WeakMap();
|
|
7
7
|
const benchOptsMap = new WeakMap();
|
|
@@ -2,8 +2,8 @@ import { toArray } from '@vitest/utils';
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
-
import { a as defaultPort, d as defaultBrowserPort } from './constants.
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
5
|
+
import { a as defaultPort, d as defaultBrowserPort } from './constants.DnKduX2e.js';
|
|
6
|
+
import { R as ReportersMap } from './index.Bter3jj9.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "3.2.0-beta.
|
|
622
|
+
var version = "3.2.0-beta.3";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -865,10 +865,7 @@ const cliOptionsConfig = {
|
|
|
865
865
|
return { enabled: browser === "yes" };
|
|
866
866
|
}
|
|
867
867
|
if (typeof browser === "string") {
|
|
868
|
-
return {
|
|
869
|
-
enabled: true,
|
|
870
|
-
name: browser
|
|
871
|
-
};
|
|
868
|
+
return { name: browser };
|
|
872
869
|
}
|
|
873
870
|
return browser;
|
|
874
871
|
},
|
|
@@ -1128,6 +1125,10 @@ const cliOptionsConfig = {
|
|
|
1128
1125
|
argument: "<path>",
|
|
1129
1126
|
normalize: true
|
|
1130
1127
|
},
|
|
1128
|
+
spawnTimeout: {
|
|
1129
|
+
description: "Minimum time in milliseconds it takes to spawn the typechecker",
|
|
1130
|
+
argument: "<time>"
|
|
1131
|
+
},
|
|
1131
1132
|
include: null,
|
|
1132
1133
|
exclude: null
|
|
1133
1134
|
}
|
|
@@ -1339,6 +1340,7 @@ function createCLI(options = {}) {
|
|
|
1339
1340
|
const helpIndex = process.argv.findIndex((arg) => arg === "--help");
|
|
1340
1341
|
const subcommands = process.argv.slice(helpIndex + 1);
|
|
1341
1342
|
const defaultOutput = options.body.split("\n").filter((line) => /^\s+--\S+\./.test(line) === false).join("\n");
|
|
1343
|
+
// Filter out options with dot-notation if --help is not called with a subcommand (default behavior)
|
|
1342
1344
|
if (subcommands.length === 0) {
|
|
1343
1345
|
options.body = defaultOutput;
|
|
1344
1346
|
return info;
|
|
@@ -1356,16 +1358,20 @@ function createCLI(options = {}) {
|
|
|
1356
1358
|
banner.body = `${banner.body}\n WARN: ${warning}`;
|
|
1357
1359
|
}
|
|
1358
1360
|
}
|
|
1361
|
+
// If other subcommand combinations are used, only show options for the subcommand
|
|
1359
1362
|
for (let i = 0; i < subcommands.length; i++) {
|
|
1360
1363
|
const subcommand = subcommands[i];
|
|
1364
|
+
// --help --expand-help can't be called with multiple subcommands and is handled above
|
|
1361
1365
|
if (subcommand === "--expand-help" || subcommand === "--expandHelp") {
|
|
1362
1366
|
addBannerWarning("--expand-help subcommand ignored because, when used with --help, it must be the only subcommand");
|
|
1363
1367
|
continue;
|
|
1364
1368
|
}
|
|
1369
|
+
// Mark the help section for the subcommands
|
|
1365
1370
|
if (subcommand.startsWith("--")) {
|
|
1366
1371
|
options.body = options.body.split("\n").map((line) => line.trim().startsWith(subcommand) ? `${subcommandMarker}${line}` : line).join("\n");
|
|
1367
1372
|
}
|
|
1368
1373
|
}
|
|
1374
|
+
// Filter based on the marked options to preserve the original sort order
|
|
1369
1375
|
options.body = options.body.split("\n").map((line) => line.startsWith(subcommandMarker) ? line.split(subcommandMarker)[1] : "").filter((line) => line.length !== 0).join("\n");
|
|
1370
1376
|
if (!options.body) {
|
|
1371
1377
|
addBannerWarning("no options were found for your subcommands so we printed the whole output");
|
|
@@ -1455,9 +1461,6 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1455
1461
|
if (cliFilters.some((filter) => filter.includes(":"))) {
|
|
1456
1462
|
argv.includeTaskLocation ??= true;
|
|
1457
1463
|
}
|
|
1458
|
-
if (typeof argv.browser === "object" && !("enabled" in argv.browser)) {
|
|
1459
|
-
argv.browser.enabled = true;
|
|
1460
|
-
}
|
|
1461
1464
|
if (typeof argv.typecheck?.only === "boolean") {
|
|
1462
1465
|
argv.typecheck.enabled ??= true;
|
|
1463
1466
|
}
|
|
@@ -1468,13 +1471,13 @@ async function start(mode, cliFilters, options) {
|
|
|
1468
1471
|
process.title = "node (vitest)";
|
|
1469
1472
|
} catch {}
|
|
1470
1473
|
try {
|
|
1471
|
-
const { startVitest } = await import('./cli-api.
|
|
1474
|
+
const { startVitest } = await import('./cli-api.CnmEXkxs.js').then(function (n) { return n.f; });
|
|
1472
1475
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1473
1476
|
if (!ctx.shouldKeepServer()) {
|
|
1474
1477
|
await ctx.exit();
|
|
1475
1478
|
}
|
|
1476
1479
|
} catch (e) {
|
|
1477
|
-
const { errorBanner } = await import('./index.
|
|
1480
|
+
const { errorBanner } = await import('./index.Bter3jj9.js').then(function (n) { return n.u; });
|
|
1478
1481
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
1479
1482
|
console.error(e);
|
|
1480
1483
|
console.error("\n\n");
|
|
@@ -1489,7 +1492,7 @@ async function init(project) {
|
|
|
1489
1492
|
console.error(new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
1490
1493
|
process.exit(1);
|
|
1491
1494
|
}
|
|
1492
|
-
const { create } = await import('./creator.
|
|
1495
|
+
const { create } = await import('./creator.C8WKy2eW.js');
|
|
1493
1496
|
await create();
|
|
1494
1497
|
}
|
|
1495
1498
|
async function collect(mode, cliFilters, options) {
|
|
@@ -1497,7 +1500,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1497
1500
|
process.title = "node (vitest)";
|
|
1498
1501
|
} catch {}
|
|
1499
1502
|
try {
|
|
1500
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1503
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CnmEXkxs.js').then(function (n) { return n.f; });
|
|
1501
1504
|
const ctx = await prepareVitest(mode, {
|
|
1502
1505
|
...normalizeCliOptions(cliFilters, options),
|
|
1503
1506
|
watch: false,
|
|
@@ -1519,7 +1522,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1519
1522
|
}
|
|
1520
1523
|
await ctx.close();
|
|
1521
1524
|
} catch (e) {
|
|
1522
|
-
const { errorBanner } = await import('./index.
|
|
1525
|
+
const { errorBanner } = await import('./index.Bter3jj9.js').then(function (n) { return n.u; });
|
|
1523
1526
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
1524
1527
|
console.error(e);
|
|
1525
1528
|
console.error("\n\n");
|