vitest 4.1.5 → 5.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/LICENSE.md +7 -0
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +4 -4
- package/dist/chunks/{base.RR7zL1h0.js → base.Opc_YHkk.js} +10 -11
- package/dist/chunks/browser.d.BUhkKcDl.d.ts +899 -0
- package/dist/chunks/{cac.DJJmV0dT.js → cac.8N4bOkkB.js} +23 -11
- package/dist/chunks/{cli-api.Cjt90eJu.js → cli-api.B0RFke2g.js} +5799 -353
- package/dist/chunks/{config.d.A1h_Y6Jt.d.ts → config.d.D91DHYaD.d.ts} +11 -3
- package/dist/chunks/{console.3WNpx0tS.js → console.B3IRP8fX.js} +3 -1
- package/dist/chunks/{constants.CPYnjOGj.js → constants.-juJ8b_4.js} +1 -1
- package/dist/chunks/{coverage.d.BZtK59WP.d.ts → coverage.d.g2xbl2sP.d.ts} +4 -0
- package/dist/chunks/{creator.DgVhQm5q.js → creator.BqL2U_x4.js} +1 -1
- package/dist/chunks/{defaults.9aQKnqFk.js → defaults.szbHWQun.js} +4 -2
- package/dist/chunks/environment.d-DOJxxZV9.d.DOJxxZV9.d.ts +17 -0
- package/dist/chunks/general.d.DFAHgpC2.d.ts +247 -0
- package/dist/chunks/{global.d.DVsSRdQ5.d.ts → global.d.DhbKSQoV.d.ts} +4 -5
- package/dist/chunks/{globals.Dj1TGiMC.js → globals.EHmmu0nC.js} +15 -14
- package/dist/chunks/{index.DXx9Dtk7.js → index.CViWo__T.js} +5 -5
- package/dist/chunks/{startVitestModuleRunner.bRl2_oI_.js → index.CbgUM9E5.js} +731 -5
- package/dist/chunks/{test.DNmyFkvJ.js → index.D_7-4CaB.js} +2659 -14
- package/dist/chunks/{init-forks.UV3ZQGQH.js → init-forks.DMge3WTt.js} +1 -1
- package/dist/chunks/{init-threads.D3eCsY76.js → init-threads.eIoyCTon.js} +1 -1
- package/dist/chunks/{init.D98-gwRW.js → init.BVd7SaCA.js} +3 -5
- package/dist/chunks/{nativeModuleMocker.BRN2oBJd.js → nativeModuleMocker.DKpFw0pk.js} +3 -2
- package/dist/chunks/{index.BCY_7LL2.js → nativeModuleRunner.BOeMnHl4.js} +43 -12
- package/dist/chunks/node.CwFbQqI1.js +47 -0
- package/dist/chunks/{reporters.d.CEnv6XRv.d.ts → plugin.d.cIKZEZ16.d.ts} +306 -19
- package/dist/chunks/plugins.DrsmdUE2.js +37 -0
- package/dist/chunks/{rpc.MzXet3jl.js → rpc.DFRWVnRh.js} +16 -1
- package/dist/chunks/{rpc.d.B_8sPU0w.d.ts → rpc.d.7JZuxZ8u.d.ts} +19 -3
- package/dist/chunks/{setup-common.DYx3LtFI.js → setup-common.Hpq30zVk.js} +7 -3
- package/dist/chunks/{utils.BS4fH3nR.js → utils.DKODp04v.js} +3 -4
- package/dist/chunks/{vm.DVLYObm9.js → vm.2okbRRME.js} +6 -6
- package/dist/chunks/{worker.d.ZpHpO4yb.d.ts → worker.d.Bu1kXGw4.d.ts} +3 -3
- package/dist/cli.js +2 -2
- package/dist/config.cjs +4 -2
- package/dist/config.d.ts +21 -18
- package/dist/config.js +2 -2
- package/dist/index.d.ts +84 -22
- package/dist/index.js +15 -13
- package/dist/module-evaluator.d.ts +5 -3
- package/dist/module-evaluator.js +1 -1
- package/dist/node.d.ts +114 -19
- package/dist/node.js +21 -26
- package/dist/runtime.d.ts +40 -4
- package/dist/runtime.js +5 -6
- package/dist/{chunks/traces.DT5aQ62U.js → traces.js} +1 -1
- package/dist/worker.d.ts +5 -5
- package/dist/worker.js +21 -23
- package/dist/workers/forks.js +21 -23
- package/dist/workers/runVmTests.js +17 -16
- package/dist/workers/threads.js +21 -23
- package/dist/workers/vmForks.js +7 -9
- package/dist/workers/vmThreads.js +7 -9
- package/package.json +21 -38
- package/dist/chunks/benchmark.CX_oY03V.js +0 -40
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +0 -24
- package/dist/chunks/browser.d.BcoexmFG.d.ts +0 -62
- package/dist/chunks/coverage.DM_a_rWm.js +0 -1087
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -17
- package/dist/chunks/index.DC7d2Pf8.js +0 -729
- package/dist/chunks/index.DdgEv5B1.js +0 -42
- package/dist/chunks/index.UpGiHP7g.js +0 -4255
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +0 -36
- package/dist/chunks/node.COQbm6gK.js +0 -14
- package/dist/chunks/plugin.d.BM2TCi12.d.ts +0 -38
- package/dist/chunks/suite.d.udJtyAgw.d.ts +0 -10
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +0 -60
- package/dist/coverage.d.ts +0 -123
- package/dist/coverage.js +0 -27
- package/dist/environments.d.ts +0 -22
- package/dist/environments.js +0 -5
- package/dist/reporters.d.ts +0 -27
- package/dist/reporters.js +0 -26
- package/dist/runners.d.ts +0 -70
- package/dist/runners.js +0 -19
- package/dist/snapshot.d.ts +0 -9
- package/dist/snapshot.js +0 -6
- package/dist/suite.d.ts +0 -5
- package/dist/suite.js +0 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-beta.2",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,38 +69,19 @@
|
|
|
69
69
|
"default": "./dist/node.js"
|
|
70
70
|
},
|
|
71
71
|
"./internal/browser": {
|
|
72
|
+
"__vitest_source__": "./src/public/browser.ts",
|
|
72
73
|
"types": "./dist/browser.d.ts",
|
|
73
74
|
"default": "./dist/browser.js"
|
|
74
75
|
},
|
|
75
|
-
"./
|
|
76
|
-
"
|
|
77
|
-
"default": "./dist/
|
|
78
|
-
},
|
|
79
|
-
"./suite": {
|
|
80
|
-
"types": "./dist/suite.d.ts",
|
|
81
|
-
"default": "./dist/suite.js"
|
|
82
|
-
},
|
|
83
|
-
"./environments": {
|
|
84
|
-
"types": "./dist/environments.d.ts",
|
|
85
|
-
"default": "./dist/environments.js"
|
|
76
|
+
"./internal/traces": {
|
|
77
|
+
"__vitest_source__": "./src/utils/traces.ts",
|
|
78
|
+
"default": "./dist/traces.js"
|
|
86
79
|
},
|
|
87
80
|
"./config": {
|
|
88
81
|
"types": "./config.d.ts",
|
|
89
82
|
"require": "./dist/config.cjs",
|
|
90
83
|
"default": "./dist/config.js"
|
|
91
84
|
},
|
|
92
|
-
"./coverage": {
|
|
93
|
-
"types": "./coverage.d.ts",
|
|
94
|
-
"default": "./dist/coverage.js"
|
|
95
|
-
},
|
|
96
|
-
"./reporters": {
|
|
97
|
-
"types": "./dist/reporters.d.ts",
|
|
98
|
-
"default": "./dist/reporters.js"
|
|
99
|
-
},
|
|
100
|
-
"./snapshot": {
|
|
101
|
-
"types": "./dist/snapshot.d.ts",
|
|
102
|
-
"default": "./dist/snapshot.js"
|
|
103
|
-
},
|
|
104
85
|
"./runtime": {
|
|
105
86
|
"types": "./dist/runtime.d.ts",
|
|
106
87
|
"default": "./dist/runtime.js"
|
|
@@ -135,12 +116,12 @@
|
|
|
135
116
|
"happy-dom": "*",
|
|
136
117
|
"jsdom": "*",
|
|
137
118
|
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
138
|
-
"@vitest/browser-
|
|
139
|
-
"@vitest/browser-
|
|
140
|
-
"@vitest/
|
|
141
|
-
"@vitest/
|
|
142
|
-
"@vitest/coverage-v8": "
|
|
143
|
-
"@vitest/
|
|
119
|
+
"@vitest/browser-playwright": "5.0.0-beta.2",
|
|
120
|
+
"@vitest/browser-preview": "5.0.0-beta.2",
|
|
121
|
+
"@vitest/coverage-istanbul": "5.0.0-beta.2",
|
|
122
|
+
"@vitest/ui": "5.0.0-beta.2",
|
|
123
|
+
"@vitest/coverage-v8": "5.0.0-beta.2",
|
|
124
|
+
"@vitest/browser-webdriverio": "5.0.0-beta.2"
|
|
144
125
|
},
|
|
145
126
|
"peerDependenciesMeta": {
|
|
146
127
|
"@edge-runtime/vm": {
|
|
@@ -181,6 +162,8 @@
|
|
|
181
162
|
}
|
|
182
163
|
},
|
|
183
164
|
"dependencies": {
|
|
165
|
+
"@types/chai": "^5.2.2",
|
|
166
|
+
"chai": "^6.2.2",
|
|
184
167
|
"es-module-lexer": "^2.0.0",
|
|
185
168
|
"expect-type": "^1.3.0",
|
|
186
169
|
"magic-string": "^0.30.21",
|
|
@@ -194,13 +177,11 @@
|
|
|
194
177
|
"tinyrainbow": "^3.1.0",
|
|
195
178
|
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
196
179
|
"why-is-node-running": "^2.3.0",
|
|
197
|
-
"@vitest/
|
|
198
|
-
"@vitest/
|
|
199
|
-
"@vitest/
|
|
200
|
-
"@vitest/
|
|
201
|
-
"@vitest/
|
|
202
|
-
"@vitest/runner": "4.1.5",
|
|
203
|
-
"@vitest/utils": "4.1.5"
|
|
180
|
+
"@vitest/mocker": "5.0.0-beta.2",
|
|
181
|
+
"@vitest/pretty-format": "5.0.0-beta.2",
|
|
182
|
+
"@vitest/spy": "5.0.0-beta.2",
|
|
183
|
+
"@vitest/utils": "5.0.0-beta.2",
|
|
184
|
+
"@vitest/runner": "5.0.0-beta.2"
|
|
204
185
|
},
|
|
205
186
|
"devDependencies": {
|
|
206
187
|
"@antfu/install-pkg": "^1.1.0",
|
|
@@ -230,7 +211,9 @@
|
|
|
230
211
|
"prompts": "^2.4.2",
|
|
231
212
|
"strip-literal": "^3.1.0",
|
|
232
213
|
"tinyhighlight": "^0.3.2",
|
|
233
|
-
"ws": "^8.19.0"
|
|
214
|
+
"ws": "^8.19.0",
|
|
215
|
+
"@vitest/expect": "5.0.0-beta.2",
|
|
216
|
+
"@vitest/snapshot": "5.0.0-beta.2"
|
|
234
217
|
},
|
|
235
218
|
"scripts": {
|
|
236
219
|
"build": "premove dist && rollup -c",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getCurrentSuite } from '@vitest/runner';
|
|
2
|
-
import { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
import { noop } from '@vitest/utils/helpers';
|
|
4
|
-
import { g as getWorkerState } from './utils.BX5Fg8C4.js';
|
|
5
|
-
|
|
6
|
-
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
|
-
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
function getBenchOptions(key) {
|
|
9
|
-
return benchOptsMap.get(key);
|
|
10
|
-
}
|
|
11
|
-
function getBenchFn(key) {
|
|
12
|
-
return benchFns.get(key);
|
|
13
|
-
}
|
|
14
|
-
const bench = createBenchmark(function(name, fn = noop, options = {}) {
|
|
15
|
-
if (getWorkerState().config.mode !== "benchmark") throw new Error("`bench()` is only available in benchmark mode.");
|
|
16
|
-
const task = getCurrentSuite().task(formatName(name), {
|
|
17
|
-
...this,
|
|
18
|
-
meta: { benchmark: true }
|
|
19
|
-
});
|
|
20
|
-
benchFns.set(task, fn);
|
|
21
|
-
benchOptsMap.set(task, options);
|
|
22
|
-
// vitest runner sets mode to `todo` if handler is not passed down
|
|
23
|
-
// but we store handler separately
|
|
24
|
-
if (!this.todo && task.mode === "todo") task.mode = "run";
|
|
25
|
-
});
|
|
26
|
-
function createBenchmark(fn) {
|
|
27
|
-
const benchmark = createChainable([
|
|
28
|
-
"skip",
|
|
29
|
-
"only",
|
|
30
|
-
"todo"
|
|
31
|
-
], fn);
|
|
32
|
-
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
|
|
33
|
-
benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
|
|
34
|
-
return benchmark;
|
|
35
|
-
}
|
|
36
|
-
function formatName(name) {
|
|
37
|
-
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { getBenchOptions as a, bench as b, getBenchFn as g };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Test } from '@vitest/runner';
|
|
2
|
-
import { ChainableFunction } from '@vitest/runner/utils';
|
|
3
|
-
import { TaskResult, Bench, Options } from 'tinybench';
|
|
4
|
-
|
|
5
|
-
interface Benchmark extends Test {
|
|
6
|
-
meta: {
|
|
7
|
-
benchmark: true;
|
|
8
|
-
result?: TaskResult;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
interface BenchmarkResult extends TaskResult {
|
|
12
|
-
name: string;
|
|
13
|
-
rank: number;
|
|
14
|
-
sampleCount: number;
|
|
15
|
-
median: number;
|
|
16
|
-
}
|
|
17
|
-
type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
18
|
-
type ChainableBenchmarkAPI = ChainableFunction<"skip" | "only" | "todo", (name: string | Function, fn?: BenchFunction, options?: Options) => void>;
|
|
19
|
-
type BenchmarkAPI = ChainableBenchmarkAPI & {
|
|
20
|
-
skipIf: (condition: any) => ChainableBenchmarkAPI;
|
|
21
|
-
runIf: (condition: any) => ChainableBenchmarkAPI;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type { BenchmarkResult as B, BenchFunction as a, Benchmark as b, BenchmarkAPI as c };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { FileSpecification } from '@vitest/runner';
|
|
2
|
-
import { O as OTELCarrier } from './traces.d.D2T_R8rx.js';
|
|
3
|
-
import { T as TestExecutionMethod } from './worker.d.ZpHpO4yb.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
|
-
}
|
|
61
|
-
|
|
62
|
-
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 };
|