vitest 5.0.0-beta.4 → 5.0.0-beta.6
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 -17
- package/dist/browser.d.ts +8 -6
- package/dist/browser.js +5 -3
- package/dist/chunks/artifact.BNnEI1sJ.js +2770 -0
- package/dist/chunks/{base.BEGVMQrS.js → base.BKfXyFN7.js} +12 -12
- package/dist/chunks/browser.d.DoM6vBOs.d.ts +64 -0
- package/dist/chunks/{cac.CyXAEMkE.js → cac.DKrA6qEB.js} +15 -7
- package/dist/chunks/{cli-api.DJMXq34b.js → cli-api.cZcvaUFI.js} +491 -852
- package/dist/chunks/config.d.CKWK3nld.d.ts +2920 -0
- package/dist/chunks/{console.B3IRP8fX.js → console.DjVIMaXT.js} +4 -4
- package/dist/chunks/{coverage.d.g2xbl2sP.d.ts → coverage.d.CCNrKR65.d.ts} +2 -0
- package/dist/chunks/{creator.D66cVXYh.js → creator.C4nK7Krt.js} +19 -4
- package/dist/chunks/{defaults.CUUnbOrq.js → defaults.B_pFOTYy.js} +1 -1
- package/dist/chunks/{globals.BuY-yD0m.js → globals.CzUA1xn8.js} +12 -12
- package/dist/chunks/{index.CcluKS59.js → index.B4UTDegh.js} +6 -6
- package/dist/chunks/{nativeModuleRunner.BOeMnHl4.js → index.CesbTg1C.js} +3 -34
- package/dist/chunks/{index.CE58PZNH.js → index.D6NDM5O1.js} +515 -121
- package/dist/chunks/{index.nQFVd50u.js → index.DNRmy2jU.js} +32 -10
- package/dist/chunks/{index.og1WyBLx.js → index.Djaij2xr.js} +660 -58
- package/dist/chunks/{init-forks.Ce3vGWgL.js → init-forks.BG4bCDny.js} +1 -1
- package/dist/chunks/{init-threads.8e1OLv5v.js → init-threads.DLtIP5Qq.js} +1 -1
- package/dist/chunks/{init.6qx-LaHs.js → init.DTAQFCjl.js} +10 -6
- package/dist/chunks/{nativeModuleMocker.DDZfQXLs.js → nativeModuleMocker.BKtCThoO.js} +2 -3
- package/dist/chunks/nativeModuleRunner.WlMdOB52.js +36 -0
- package/dist/chunks/{node.CwFbQqI1.js → node.C9I1sbE9.js} +1 -2
- package/dist/chunks/{plugin.d.B7MTG_Fe.d.ts → plugin.d.Bpge8Jye.d.ts} +94 -37
- package/dist/chunks/{rpc.DFRWVnRh.js → rpc.DZEh5xnQ.js} +1 -1
- package/dist/chunks/{rpc.d.OQ_EZi1Z.d.ts → rpc.d.C6-dGZ2f.d.ts} +1 -2
- package/dist/chunks/{setup-common.DdEF_hkE.js → setup-common.ZNdeu5wa.js} +2 -2
- package/dist/chunks/{global.d.BtKPuz2X.d.ts → task-utils.d.mMDXJF_I.d.ts} +30 -89
- package/dist/chunks/{utils.BX5Fg8C4.js → utils.DYj33du9.js} +1 -17
- package/dist/chunks/{vm.Bu7mmcZq.js → vm.CeHWcIrU.js} +4 -4
- package/dist/chunks/{worker.d.yR22cs6X.d.ts → worker.d.JES7ffPK.d.ts} +3 -3
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +12 -13
- package/dist/config.js +1 -1
- package/dist/index.d.ts +416 -21
- package/dist/index.js +9 -9
- package/dist/module-evaluator.d.ts +7 -4
- package/dist/module-evaluator.js +7 -0
- package/dist/node.d.ts +31 -18
- package/dist/node.js +22 -16
- package/dist/runtime.d.ts +9 -3
- package/dist/runtime.js +4 -5
- package/dist/task-utils.js +296 -0
- package/dist/worker.d.ts +7 -6
- package/dist/worker.js +15 -14
- package/dist/workers/forks.js +16 -15
- package/dist/workers/runVmTests.js +10 -10
- package/dist/workers/threads.js +16 -15
- package/dist/workers/vmForks.js +8 -8
- package/dist/workers/vmThreads.js +8 -8
- package/package.json +18 -19
- package/dist/chunks/browser.d.BGxB4Xum.d.ts +0 -878
- package/dist/chunks/config.d.DXq1aBpy.d.ts +0 -244
- package/dist/chunks/environment.d-DOJxxZV9.d.DOJxxZV9.d.ts +0 -17
- package/dist/chunks/general.d.DFAHgpC2.d.ts +0 -247
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { runInThisContext } from 'node:vm';
|
|
2
2
|
import * as spyModule from '@vitest/spy';
|
|
3
|
-
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.
|
|
4
|
-
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.
|
|
5
|
-
import { N as NativeModuleRunner } from './nativeModuleRunner.
|
|
3
|
+
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.B4UTDegh.js';
|
|
4
|
+
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DTAQFCjl.js';
|
|
5
|
+
import { N as NativeModuleRunner } from './nativeModuleRunner.WlMdOB52.js';
|
|
6
6
|
import { Traces } from '../traces.js';
|
|
7
|
-
import { V as VitestEvaluatedModules } from './rpc.
|
|
8
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.
|
|
7
|
+
import { V as VitestEvaluatedModules } from './rpc.DZEh5xnQ.js';
|
|
8
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DNRmy2jU.js';
|
|
9
9
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { i as index, g as globalExpect, v as vi } from './index.CE58PZNH.js';
|
|
10
|
+
import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.ZNdeu5wa.js';
|
|
11
|
+
import { i as index, g as globalExpect, v as vi } from './index.D6NDM5O1.js';
|
|
13
12
|
import { c as closeInspector } from './inspector.CvyFGlXm.js';
|
|
13
|
+
import { s as startTests, p as publicCollect } from './artifact.BNnEI1sJ.js';
|
|
14
14
|
import { createRequire } from 'node:module';
|
|
15
15
|
import timers from 'node:timers';
|
|
16
16
|
import timersPromises from 'node:timers/promises';
|
|
17
17
|
import util from 'node:util';
|
|
18
18
|
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
19
|
-
import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.
|
|
19
|
+
import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
|
|
20
20
|
|
|
21
21
|
// this should only be used in Node
|
|
22
22
|
let globalSetup = false;
|
|
@@ -57,7 +57,7 @@ function resolveAsset(mod, url) {
|
|
|
57
57
|
mod.exports = url;
|
|
58
58
|
}
|
|
59
59
|
async function setupConsoleLogSpy() {
|
|
60
|
-
const { createCustomConsole } = await import('./console.
|
|
60
|
+
const { createCustomConsole } = await import('./console.DjVIMaXT.js');
|
|
61
61
|
globalThis.console = createCustomConsole();
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -89,7 +89,7 @@ async function run(method, files, config, moduleRunner, environment, traces) {
|
|
|
89
89
|
await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
|
|
90
90
|
const leaks = await collectAsyncLeaks?.();
|
|
91
91
|
if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
|
|
92
|
-
} else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () =>
|
|
92
|
+
} else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
|
|
93
93
|
// reset after tests, because user might call `vi.setConfig` in setupFile
|
|
94
94
|
vi.resetConfig();
|
|
95
95
|
// mocks should not affect different files
|
|
@@ -114,7 +114,7 @@ async function startModuleRunner(options) {
|
|
|
114
114
|
let mocker;
|
|
115
115
|
if (options.state.config.experimental.nodeLoader !== false) {
|
|
116
116
|
// this additionally imports acorn/magic-string
|
|
117
|
-
const { NativeModuleMocker } = await import('./nativeModuleMocker.
|
|
117
|
+
const { NativeModuleMocker } = await import('./nativeModuleMocker.BKtCThoO.js');
|
|
118
118
|
mocker = new NativeModuleMocker({
|
|
119
119
|
async resolveId(id, importer) {
|
|
120
120
|
// TODO: use import.meta.resolve instead
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { aH as FileSpecification } from './config.d.CKWK3nld.js';
|
|
2
|
+
import { O as OTELCarrier } from './rpc.d.C6-dGZ2f.js';
|
|
3
|
+
import { T as TestExecutionMethod } from './worker.d.JES7ffPK.js';
|
|
4
|
+
|
|
5
|
+
type SerializedTestSpecification = [project: {
|
|
6
|
+
name: string | undefined;
|
|
7
|
+
root: string;
|
|
8
|
+
}, file: string, options: {
|
|
9
|
+
pool: string;
|
|
10
|
+
testLines?: number[] | undefined;
|
|
11
|
+
testIds?: string[] | undefined;
|
|
12
|
+
testNamePattern?: RegExp | undefined;
|
|
13
|
+
testTagsFilter?: string[] | undefined;
|
|
14
|
+
}];
|
|
15
|
+
|
|
16
|
+
interface ModuleDefinitionLocation {
|
|
17
|
+
line: number;
|
|
18
|
+
column: number;
|
|
19
|
+
}
|
|
20
|
+
interface SourceModuleLocations {
|
|
21
|
+
modules: ModuleDefinitionDiagnostic[];
|
|
22
|
+
untracked: ModuleDefinitionDiagnostic[];
|
|
23
|
+
}
|
|
24
|
+
interface ModuleDefinitionDiagnostic {
|
|
25
|
+
start: ModuleDefinitionLocation;
|
|
26
|
+
end: ModuleDefinitionLocation;
|
|
27
|
+
startIndex: number;
|
|
28
|
+
endIndex: number;
|
|
29
|
+
rawUrl: string;
|
|
30
|
+
resolvedUrl: string;
|
|
31
|
+
resolvedId: string;
|
|
32
|
+
}
|
|
33
|
+
interface ModuleDefinitionDurationsDiagnostic extends ModuleDefinitionDiagnostic {
|
|
34
|
+
selfTime: number;
|
|
35
|
+
totalTime: number;
|
|
36
|
+
transformTime?: number;
|
|
37
|
+
external?: boolean;
|
|
38
|
+
importer?: string;
|
|
39
|
+
}
|
|
40
|
+
interface UntrackedModuleDefinitionDiagnostic {
|
|
41
|
+
url: string;
|
|
42
|
+
resolvedId: string;
|
|
43
|
+
resolvedUrl: string;
|
|
44
|
+
selfTime: number;
|
|
45
|
+
totalTime: number;
|
|
46
|
+
transformTime?: number;
|
|
47
|
+
external?: boolean;
|
|
48
|
+
importer?: string;
|
|
49
|
+
}
|
|
50
|
+
interface SourceModuleDiagnostic {
|
|
51
|
+
modules: ModuleDefinitionDurationsDiagnostic[];
|
|
52
|
+
untrackedModules: UntrackedModuleDefinitionDiagnostic[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface BrowserTesterOptions {
|
|
56
|
+
method: TestExecutionMethod;
|
|
57
|
+
files: FileSpecification[];
|
|
58
|
+
providedContext: string;
|
|
59
|
+
otelCarrier?: OTELCarrier;
|
|
60
|
+
concurrencyId: number;
|
|
61
|
+
workerId: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type { BrowserTesterOptions as B, ModuleDefinitionDurationsDiagnostic as M, SerializedTestSpecification as S, UntrackedModuleDefinitionDiagnostic as U, ModuleDefinitionDiagnostic as a, ModuleDefinitionLocation as b, SourceModuleDiagnostic as c, SourceModuleLocations as d };
|
|
@@ -621,7 +621,7 @@ class CAC extends EventEmitter {
|
|
|
621
621
|
|
|
622
622
|
const cac = (name = "") => new CAC(name);
|
|
623
623
|
|
|
624
|
-
var version = "5.0.0-beta.
|
|
624
|
+
var version = "5.0.0-beta.6";
|
|
625
625
|
|
|
626
626
|
const apiConfig = (port) => ({
|
|
627
627
|
port: {
|
|
@@ -751,7 +751,11 @@ const cliOptionsConfig = {
|
|
|
751
751
|
description: null,
|
|
752
752
|
argument: "",
|
|
753
753
|
subcommands: {
|
|
754
|
-
perFile: {
|
|
754
|
+
perFile: {
|
|
755
|
+
description: "Check thresholds per file. See `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches` and `--coverage.thresholds.statements` for the actual thresholds (default: `false`). Object form is available in config files only.",
|
|
756
|
+
subcommands: null,
|
|
757
|
+
argument: "<boolean>"
|
|
758
|
+
},
|
|
755
759
|
autoUpdate: {
|
|
756
760
|
description: "Update threshold values: \"lines\", \"functions\", \"branches\" and \"statements\" to configuration file when current coverage is above the configured thresholds (default: `false`)",
|
|
757
761
|
argument: "<boolean|function>",
|
|
@@ -1039,6 +1043,10 @@ const cliOptionsConfig = {
|
|
|
1039
1043
|
}
|
|
1040
1044
|
}
|
|
1041
1045
|
},
|
|
1046
|
+
repeats: {
|
|
1047
|
+
description: "Repeat every test a specific number of times regardless of the result (default: `0`)",
|
|
1048
|
+
argument: "<number>"
|
|
1049
|
+
},
|
|
1042
1050
|
diff: {
|
|
1043
1051
|
description: "DiffOptions object or a path to a module which exports DiffOptions object",
|
|
1044
1052
|
argument: "<path>",
|
|
@@ -2341,7 +2349,7 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
2341
2349
|
}
|
|
2342
2350
|
async function start(cliFilters, options) {
|
|
2343
2351
|
try {
|
|
2344
|
-
const { startVitest } = await import('./cli-api.
|
|
2352
|
+
const { startVitest } = await import('./cli-api.cZcvaUFI.js').then(function (n) { return n.y; });
|
|
2345
2353
|
const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2346
2354
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
2347
2355
|
} catch (e) {
|
|
@@ -2349,7 +2357,7 @@ async function start(cliFilters, options) {
|
|
|
2349
2357
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
2350
2358
|
console.error(e);
|
|
2351
2359
|
console.error("\n\n");
|
|
2352
|
-
|
|
2360
|
+
process.exitCode ??= 1;
|
|
2353
2361
|
process.exit();
|
|
2354
2362
|
}
|
|
2355
2363
|
}
|
|
@@ -2358,12 +2366,12 @@ async function init(project) {
|
|
|
2358
2366
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
2359
2367
|
process.exit(1);
|
|
2360
2368
|
}
|
|
2361
|
-
const { create } = await import('./creator.
|
|
2369
|
+
const { create } = await import('./creator.C4nK7Krt.js');
|
|
2362
2370
|
await create();
|
|
2363
2371
|
}
|
|
2364
2372
|
async function collect(cliFilters, options) {
|
|
2365
2373
|
try {
|
|
2366
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
2374
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.cZcvaUFI.js').then(function (n) { return n.y; });
|
|
2367
2375
|
const ctx = await prepareVitest({
|
|
2368
2376
|
...normalizeCliOptions(cliFilters, options),
|
|
2369
2377
|
watch: false,
|
|
@@ -2389,7 +2397,7 @@ async function collect(cliFilters, options) {
|
|
|
2389
2397
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
2390
2398
|
console.error(e);
|
|
2391
2399
|
console.error("\n\n");
|
|
2392
|
-
|
|
2400
|
+
process.exitCode ??= 1;
|
|
2393
2401
|
process.exit();
|
|
2394
2402
|
}
|
|
2395
2403
|
}
|