vitest 3.0.0-beta.1 → 3.0.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/dist/browser.d.ts +12 -9
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.CkcgFVQd.js → base.CUgXReRN.js} +1 -1
- package/dist/chunks/{cac.CWCZimpS.js → cac.Xzv7eNWw.js} +18 -13
- package/dist/chunks/{cli-api.BKUOv0Nc.js → cli-api.CETCDGgZ.js} +915 -531
- package/dist/chunks/{coverage.BoMDb1ip.js → coverage.BWeNbfBa.js} +4 -4
- package/dist/chunks/{environment.CT0jpO-1.d.ts → environment.d8YfPkTm.d.ts} +1 -3
- package/dist/chunks/{globals.DJTzb7B3.js → globals.BFncSRNA.js} +2 -2
- package/dist/chunks/{index.DKe7vK-G.js → index.9ZEBV_TJ.js} +635 -606
- package/dist/chunks/{index.BqHViJW9.js → index.CkWmZCXU.js} +1 -1
- package/dist/chunks/{index.CkOJwybT.js → index.DoV7W5gc.js} +2 -2
- package/dist/chunks/{reporters.BZbwTvrM.d.ts → reporters.DTtxC3KQ.d.ts} +447 -374
- package/dist/chunks/{resolveConfig.3rGGWga5.js → resolveConfig.BA-_OKEx.js} +5529 -5532
- package/dist/chunks/{runBaseTests.C6huCAng.js → runBaseTests.D0dWpzZV.js} +11 -10
- package/dist/chunks/{setup-common.B5ClyS48.js → setup-common.Cp_bu5q3.js} +1 -1
- package/dist/chunks/types.BOjykUpq.d.ts +27 -0
- package/dist/chunks/{vi.CZKezqeD.js → vi.S4Fq8wSo.js} +2 -1
- package/dist/chunks/{vite.DIfmneq0.d.ts → vite.CXaetSK3.d.ts} +1 -1
- package/dist/chunks/{worker.umPNbBNk.d.ts → worker.ClntunZp.d.ts} +1 -1
- package/dist/chunks/{worker.CmzGeuVD.d.ts → worker.o1PBoDdo.d.ts} +3 -3
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +6 -8
- package/dist/coverage.d.ts +4 -6
- package/dist/coverage.js +1 -1
- package/dist/environments.d.ts +2 -2
- package/dist/execute.d.ts +2 -2
- package/dist/index.d.ts +11 -14
- package/dist/index.js +2 -2
- package/dist/node.d.ts +22 -17
- package/dist/node.js +65 -31
- package/dist/reporters.d.ts +4 -6
- package/dist/reporters.js +1 -1
- package/dist/runners.d.ts +2 -2
- package/dist/runners.js +1 -1
- package/dist/suite.d.ts +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +7 -7
- package/dist/workers/threads.js +1 -1
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +1 -1
- package/package.json +13 -13
package/dist/browser.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.
|
|
1
|
+
import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.DTtxC3KQ.js';
|
|
2
2
|
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.BTPBhmK5.js';
|
|
3
3
|
import * as spy$1 from '@vitest/spy';
|
|
4
4
|
import * as _vitest_utils_diff from '@vitest/utils/diff';
|
|
5
5
|
import { VitestExecutor } from './execute.js';
|
|
6
6
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
7
|
-
import './chunks/environment.
|
|
7
|
+
import './chunks/environment.d8YfPkTm.js';
|
|
8
|
+
import '@vitest/utils';
|
|
8
9
|
import 'node:stream';
|
|
9
10
|
import 'vite';
|
|
10
|
-
import '@vitest/utils';
|
|
11
|
-
import 'vite-node';
|
|
12
11
|
import '@vitest/utils/source-map';
|
|
13
12
|
import '@vitest/pretty-format';
|
|
14
13
|
import '@vitest/snapshot';
|
|
14
|
+
import 'vite-node';
|
|
15
15
|
import 'chai';
|
|
16
16
|
import './chunks/benchmark.CFFwLv-O.js';
|
|
17
17
|
import '@vitest/runner/utils';
|
|
18
18
|
import 'tinybench';
|
|
19
|
-
import 'vite-node/client';
|
|
20
|
-
import 'vite-node/server';
|
|
21
19
|
import '@vitest/snapshot/manager';
|
|
22
20
|
import 'node:fs';
|
|
23
21
|
import '@vitest/snapshot/environment';
|
|
24
|
-
import '
|
|
22
|
+
import 'vite-node/client';
|
|
23
|
+
import './chunks/worker.o1PBoDdo.js';
|
|
25
24
|
import 'node:vm';
|
|
26
25
|
import '@vitest/mocker';
|
|
27
26
|
import './chunks/mocker.cRtM890J.js';
|
|
@@ -52,9 +51,13 @@ interface Loader {
|
|
|
52
51
|
isBrowser?: boolean;
|
|
53
52
|
}
|
|
54
53
|
declare function getCoverageProvider(options: SerializedCoverageConfig | undefined, loader: Loader): Promise<CoverageProvider | null>;
|
|
55
|
-
declare function startCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader
|
|
54
|
+
declare function startCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader, runtimeOptions: {
|
|
55
|
+
isolate: boolean;
|
|
56
|
+
}): Promise<unknown>;
|
|
56
57
|
declare function takeCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader): Promise<unknown>;
|
|
57
|
-
declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader
|
|
58
|
+
declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader, runtimeOptions: {
|
|
59
|
+
isolate: boolean;
|
|
60
|
+
}): Promise<unknown>;
|
|
58
61
|
|
|
59
62
|
declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
|
|
60
63
|
declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<_vitest_utils_diff.SerializedDiffOptions | undefined>;
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.
|
|
1
|
+
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BWeNbfBa.js';
|
|
2
2
|
export { s as SpyModule } from './chunks/spy.Cf_4R5Oe.js';
|
|
3
|
-
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.
|
|
3
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.Cp_bu5q3.js';
|
|
4
4
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
5
5
|
import '@vitest/spy';
|
|
6
6
|
import '@vitest/snapshot';
|
|
@@ -26,7 +26,7 @@ async function runBaseTests(method, state) {
|
|
|
26
26
|
));
|
|
27
27
|
const [executor, { run }] = await Promise.all([
|
|
28
28
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
29
|
-
import('./runBaseTests.
|
|
29
|
+
import('./runBaseTests.D0dWpzZV.js')
|
|
30
30
|
]);
|
|
31
31
|
const fileSpecs = ctx.files.map(
|
|
32
32
|
(f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "3.0.0-beta.
|
|
621
|
+
var version = "3.0.0-beta.2";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -962,7 +962,7 @@ const cliOptionsConfig = {
|
|
|
962
962
|
}
|
|
963
963
|
},
|
|
964
964
|
pool: {
|
|
965
|
-
description: "Specify pool, if not running in the browser (default: `
|
|
965
|
+
description: "Specify pool, if not running in the browser (default: `forks`)",
|
|
966
966
|
argument: "<pool>",
|
|
967
967
|
subcommands: null
|
|
968
968
|
// don't support custom objects
|
|
@@ -1296,6 +1296,9 @@ const cliOptionsConfig = {
|
|
|
1296
1296
|
printConsoleTrace: {
|
|
1297
1297
|
description: "Always print console stack traces"
|
|
1298
1298
|
},
|
|
1299
|
+
includeTaskLocation: {
|
|
1300
|
+
description: "Collect test and suite locations in the `location` property"
|
|
1301
|
+
},
|
|
1299
1302
|
// CLI only options
|
|
1300
1303
|
run: {
|
|
1301
1304
|
description: "Disable watch mode"
|
|
@@ -1311,7 +1314,7 @@ const cliOptionsConfig = {
|
|
|
1311
1314
|
description: "Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)"
|
|
1312
1315
|
},
|
|
1313
1316
|
mergeReports: {
|
|
1314
|
-
description: "
|
|
1317
|
+
description: "Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests",
|
|
1315
1318
|
argument: "[path]",
|
|
1316
1319
|
transform(value) {
|
|
1317
1320
|
if (!value || typeof value === "boolean") {
|
|
@@ -1350,7 +1353,6 @@ const cliOptionsConfig = {
|
|
|
1350
1353
|
poolMatchGlobs: null,
|
|
1351
1354
|
deps: null,
|
|
1352
1355
|
name: null,
|
|
1353
|
-
includeTaskLocation: null,
|
|
1354
1356
|
snapshotEnvironment: null,
|
|
1355
1357
|
compare: null,
|
|
1356
1358
|
outputJson: null,
|
|
@@ -1538,11 +1540,14 @@ async function benchmark(cliFilters, options) {
|
|
|
1538
1540
|
console.warn(c.yellow("Benchmarking is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
|
|
1539
1541
|
await start("benchmark", cliFilters, options);
|
|
1540
1542
|
}
|
|
1541
|
-
function normalizeCliOptions(argv) {
|
|
1543
|
+
function normalizeCliOptions(cliFilters, argv) {
|
|
1542
1544
|
if (argv.exclude) {
|
|
1543
1545
|
argv.cliExclude = toArray(argv.exclude);
|
|
1544
1546
|
delete argv.exclude;
|
|
1545
1547
|
}
|
|
1548
|
+
if (cliFilters.some((filter) => filter.includes(":"))) {
|
|
1549
|
+
argv.includeTaskLocation ??= true;
|
|
1550
|
+
}
|
|
1546
1551
|
return argv;
|
|
1547
1552
|
}
|
|
1548
1553
|
async function start(mode, cliFilters, options) {
|
|
@@ -1551,10 +1556,10 @@ async function start(mode, cliFilters, options) {
|
|
|
1551
1556
|
} catch {
|
|
1552
1557
|
}
|
|
1553
1558
|
try {
|
|
1554
|
-
const { startVitest } = await import('./cli-api.
|
|
1555
|
-
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1556
|
-
if (!ctx
|
|
1557
|
-
await ctx
|
|
1559
|
+
const { startVitest } = await import('./cli-api.CETCDGgZ.js').then(function (n) { return n.f; });
|
|
1560
|
+
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1561
|
+
if (!ctx.shouldKeepServer()) {
|
|
1562
|
+
await ctx.exit();
|
|
1558
1563
|
}
|
|
1559
1564
|
} catch (e) {
|
|
1560
1565
|
const { divider } = await import('./utils.CMUTX-p8.js').then(function (n) { return n.u; });
|
|
@@ -1582,14 +1587,14 @@ async function collect(mode, cliFilters, options) {
|
|
|
1582
1587
|
} catch {
|
|
1583
1588
|
}
|
|
1584
1589
|
try {
|
|
1585
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1590
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CETCDGgZ.js').then(function (n) { return n.f; });
|
|
1586
1591
|
const ctx = await prepareVitest(mode, {
|
|
1587
|
-
...normalizeCliOptions(options),
|
|
1592
|
+
...normalizeCliOptions(cliFilters, options),
|
|
1588
1593
|
watch: false,
|
|
1589
1594
|
run: true
|
|
1590
1595
|
});
|
|
1591
1596
|
if (!options.filesOnly) {
|
|
1592
|
-
const { tests, errors } = await ctx.collect(cliFilters.map(normalize));
|
|
1597
|
+
const { testModules: tests, unhandledErrors: errors } = await ctx.collect(cliFilters.map(normalize));
|
|
1593
1598
|
if (errors.length) {
|
|
1594
1599
|
console.error("\nThere were unhandled errors during test collection");
|
|
1595
1600
|
errors.forEach((e) => console.error(e));
|
|
@@ -1599,7 +1604,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1599
1604
|
}
|
|
1600
1605
|
processCollected(ctx, tests, options);
|
|
1601
1606
|
} else {
|
|
1602
|
-
const files = await ctx.
|
|
1607
|
+
const files = await ctx.getRelevantTestSpecifications(cliFilters.map(normalize));
|
|
1603
1608
|
outputFileList(files, options);
|
|
1604
1609
|
}
|
|
1605
1610
|
await ctx.close();
|