vitest 4.1.12 → 5.1.0
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 +192 -10
- package/browser/context.d.ts +7 -1
- package/browser/context.js +5 -5
- package/config.d.ts +0 -2
- package/dist/browser.d.ts +52 -21
- package/dist/browser.js +12 -13
- package/dist/chunks/{acorn.B2iPLyUM.js → acorn.C1kjbUFw.js} +30 -30
- package/dist/chunks/{base.B6Opl8PE.js → base.Cof-UHJf.js} +81 -52
- package/dist/chunks/{browser.d.BcoexmFG.d.ts → browser.d.C7tWgUvw.d.ts} +17 -14
- package/dist/chunks/{cac.DzDtg8hz.js → cac.BYbt0aJp.js} +143 -87
- package/dist/chunks/{cli-api.B0Pz1_R7.js → cli-api.COfZo8lK.js} +7160 -7189
- package/dist/chunks/config.d.B3YV4t0O.d.ts +3873 -0
- package/dist/chunks/{console.3WNpx0tS.js → console.CQZ877Hi.js} +69 -63
- package/dist/chunks/{constants.CPYnjOGj.js → constants.DLYM6cZY.js} +2 -2
- package/dist/chunks/coverage.9iqXE2gN.js +26 -0
- package/dist/chunks/{coverage.CTzCuANN.js → coverage.jGCktcGP.js} +7 -2
- package/dist/chunks/{creator.DgVhQm5q.js → creator.DHWmytIK.js} +65 -28
- package/dist/chunks/{defaults.9aQKnqFk.js → defaults.B1FCaFfh.js} +16 -9
- package/dist/chunks/display.BlTmubjj.js +194 -0
- package/dist/chunks/doctor.B-oPbwps.js +465 -0
- package/dist/chunks/{env.D4Lgay0q.js → env.BKKtU2WC.js} +2 -1
- package/dist/chunks/{environment.d.CrsxCzP1.d.ts → environment.d.BFQtFKdZ.d.ts} +9 -1
- package/dist/chunks/globals.ZKtKSkEf.js +29 -0
- package/dist/chunks/index.Bi0NXYPf.js +1708 -0
- package/dist/chunks/{index.CMESou6r.js → index.BoyTG_B7.js} +82 -81
- package/dist/chunks/index.CZzC1gGg.js +8501 -0
- package/dist/chunks/index.D0heQG4v.js +1318 -0
- package/dist/chunks/index.Di8au7q4.js +15665 -0
- package/dist/chunks/{index.Chj8NDwU.js → index.DmDMHCg8.js} +6 -12
- package/dist/chunks/{index.DXx9Dtk7.js → index.w_oBZ9N8.js} +25 -12
- package/dist/chunks/{init-forks.H5ZuobOQ.js → init-forks.BaDXQSD8.js} +7 -10
- package/dist/chunks/{init-threads.6kl1khcL.js → init-threads.ZX_Vov0z.js} +1 -1
- package/dist/chunks/{init.k9zZ9sLh.js → init.CO4AB7HZ.js} +113 -38
- package/dist/chunks/module-dependencies._2Eei3FO.js +71 -0
- package/dist/chunks/{native.DPzPHdi5.js → native.upB-V0CK.js} +50 -37
- package/dist/chunks/{nativeModuleMocker.BkNfQMkH.js → nativeModuleMocker.Dh5azSB4.js} +48 -19
- package/dist/chunks/{index.BCY_7LL2.js → nativeModuleRunner.9xPIMzi7.js} +110 -42
- package/dist/chunks/node.B9mkVmLH.js +47 -0
- package/dist/chunks/offset.Dy-5Fdfn.js +24 -0
- package/dist/chunks/pathe.M-eThtNZ.zq3TM4NT.js +492 -0
- package/dist/chunks/{reporters.d.DtoKVV2s.d.ts → plugin.d.LRFSN46m.d.ts} +2573 -1453
- package/dist/chunks/plugins.DPQHVT0p.js +37 -0
- package/dist/chunks/rawSnapshot.DqSiqIEx.js +356 -0
- package/dist/chunks/resolver.BzpmeQeT.js +48 -0
- package/dist/chunks/rpc.Uhkwr2NM.js +93 -0
- package/dist/chunks/rpc.d.3FOhdFx8.d.ts +75 -0
- package/dist/chunks/run.CjdgFZiW.js +4231 -0
- package/dist/chunks/setup-common.CqAQCXzx.js +36 -0
- package/dist/chunks/source-map.DakdQc29.js +1788 -0
- package/dist/chunks/source-map.d.BkG8YK_3.d.ts +89 -0
- package/dist/chunks/spy.DDMXghXv.js +509 -0
- package/dist/chunks/task-utils.d.D-gFPNFi.d.ts +144 -0
- package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
- package/dist/chunks/{utils.BS4fH3nR.js → utils.BBk_icFG.js} +50 -52
- package/dist/chunks/{utils.BX5Fg8C4.js → utils.DYj33du9.js} +1 -17
- package/dist/chunks/vm.b4MbCAJQ.js +1329 -0
- package/dist/chunks/{worker.d.ZpHpO4yb.d.ts → worker.d.CyJRpyfZ.d.ts} +34 -19
- package/dist/cli.js +5 -6
- package/dist/config.cjs +9 -6
- package/dist/config.d.ts +27 -25
- package/dist/config.js +3 -3
- package/dist/index.d.ts +471 -38
- package/dist/index.js +18 -19
- package/dist/module-evaluator.d.ts +64 -5
- package/dist/module-evaluator.js +122 -62
- package/dist/node.d.ts +355 -87
- package/dist/node.js +49 -73
- package/dist/runtime.d.ts +43 -6
- package/dist/runtime.js +7 -9
- package/dist/spy.js +1 -1
- package/dist/task-utils.js +290 -0
- package/dist/{chunks/traces.DT5aQ62U.js → traces.js} +3 -2
- package/dist/worker.d.ts +8 -10
- package/dist/worker.js +33 -43
- package/dist/workers/forks.js +30 -40
- package/dist/workers/runVmTests.js +66 -43
- package/dist/workers/threads.js +30 -40
- package/dist/workers/vmForks.js +19 -20
- package/dist/workers/vmThreads.js +19 -20
- package/globals.d.ts +19 -19
- package/index.cjs +3 -3
- package/optional-runtime-types.d.ts +1 -1
- package/optional-types.d.ts +1 -1
- package/package.json +59 -74
- package/suppress-warnings.cjs +1 -1
- package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -6
- package/dist/chunks/benchmark.CX_oY03V.js +0 -40
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +0 -24
- package/dist/chunks/config.d.A1h_Y6Jt.d.ts +0 -232
- package/dist/chunks/coverage.DM_a_rWm.js +0 -1087
- package/dist/chunks/coverage.d.BZtK59WP.d.ts +0 -37
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -17
- package/dist/chunks/global.d.DVsSRdQ5.d.ts +0 -100
- package/dist/chunks/globals.Dj1TGiMC.js +0 -31
- 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/index.og1WyBLx.js +0 -6358
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +0 -36
- package/dist/chunks/node.COQbm6gK.js +0 -14
- package/dist/chunks/plugin.d.DwFIiJ7i.d.ts +0 -38
- package/dist/chunks/rpc.MzXet3jl.js +0 -144
- package/dist/chunks/rpc.d.B_8sPU0w.d.ts +0 -30
- package/dist/chunks/setup-common.DYx3LtFI.js +0 -60
- package/dist/chunks/startVitestModuleRunner.DB-7oCpn.js +0 -740
- package/dist/chunks/suite.d.udJtyAgw.d.ts +0 -10
- package/dist/chunks/test.DNmyFkvJ.js +0 -4430
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +0 -60
- package/dist/chunks/vm.CXMd5FHa.js +0 -785
- 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.1.0",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"imports": {
|
|
26
26
|
"#module-evaluator": {
|
|
27
|
+
"__vitest_source__": "./src/runtime/moduleRunner/moduleEvaluator.ts",
|
|
27
28
|
"types": "./dist/module-evaluator.d.ts",
|
|
28
29
|
"default": "./dist/module-evaluator.js"
|
|
29
30
|
},
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
},
|
|
32
33
|
"exports": {
|
|
33
34
|
".": {
|
|
35
|
+
"__vitest_source__": "./src/public/index.ts",
|
|
34
36
|
"import": {
|
|
35
37
|
"types": "./dist/index.d.ts",
|
|
36
38
|
"default": "./dist/index.js"
|
|
@@ -51,7 +53,6 @@
|
|
|
51
53
|
"./optional-runtime-types.js": {
|
|
52
54
|
"types": "./optional-runtime-types.d.ts"
|
|
53
55
|
},
|
|
54
|
-
"./src/*": "./src/*",
|
|
55
56
|
"./globals": {
|
|
56
57
|
"types": "./globals.d.ts"
|
|
57
58
|
},
|
|
@@ -65,47 +66,32 @@
|
|
|
65
66
|
"types": "./import-meta.d.ts"
|
|
66
67
|
},
|
|
67
68
|
"./node": {
|
|
69
|
+
"__vitest_source__": "./src/public/node.ts",
|
|
68
70
|
"types": "./dist/node.d.ts",
|
|
69
71
|
"default": "./dist/node.js"
|
|
70
72
|
},
|
|
71
73
|
"./internal/browser": {
|
|
74
|
+
"__vitest_source__": "./src/public/browser.ts",
|
|
72
75
|
"types": "./dist/browser.d.ts",
|
|
73
76
|
"default": "./dist/browser.js"
|
|
74
77
|
},
|
|
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"
|
|
78
|
+
"./internal/traces": {
|
|
79
|
+
"__vitest_source__": "./src/utils/traces.ts",
|
|
80
|
+
"default": "./dist/traces.js"
|
|
86
81
|
},
|
|
87
82
|
"./config": {
|
|
83
|
+
"__vitest_source__": "./src/public/config.ts",
|
|
88
84
|
"types": "./config.d.ts",
|
|
89
85
|
"require": "./dist/config.cjs",
|
|
90
86
|
"default": "./dist/config.js"
|
|
91
87
|
},
|
|
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
88
|
"./runtime": {
|
|
89
|
+
"__vitest_source__": "./src/public/runtime.ts",
|
|
105
90
|
"types": "./dist/runtime.d.ts",
|
|
106
91
|
"default": "./dist/runtime.js"
|
|
107
92
|
},
|
|
108
93
|
"./worker": {
|
|
94
|
+
"__vitest_source__": "./src/public/worker.ts",
|
|
109
95
|
"types": "./worker.d.ts",
|
|
110
96
|
"default": "./dist/worker.js"
|
|
111
97
|
}
|
|
@@ -126,21 +112,21 @@
|
|
|
126
112
|
"dist"
|
|
127
113
|
],
|
|
128
114
|
"engines": {
|
|
129
|
-
"node": "^
|
|
115
|
+
"node": "^22.12.0 || ^24.0.0 || >=26.0.0"
|
|
130
116
|
},
|
|
131
117
|
"peerDependencies": {
|
|
132
118
|
"@edge-runtime/vm": "*",
|
|
133
119
|
"@opentelemetry/api": "^1.9.0",
|
|
134
|
-
"@types/node": "^
|
|
135
|
-
"@vitest/browser-
|
|
120
|
+
"@types/node": "^22.0.0 || >=24.0.0",
|
|
121
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
122
|
+
"@vitest/browser-preview": "5.1.0",
|
|
123
|
+
"@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
|
|
124
|
+
"@vitest/coverage-istanbul": "5.1.0",
|
|
125
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
126
|
+
"@vitest/ui": "5.1.0",
|
|
136
127
|
"happy-dom": "*",
|
|
137
128
|
"jsdom": "*",
|
|
138
|
-
"vite": "^6.
|
|
139
|
-
"@vitest/browser-playwright": "4.1.12",
|
|
140
|
-
"@vitest/coverage-istanbul": "4.1.12",
|
|
141
|
-
"@vitest/browser-preview": "4.1.12",
|
|
142
|
-
"@vitest/coverage-v8": "4.1.12",
|
|
143
|
-
"@vitest/ui": "4.1.12"
|
|
129
|
+
"vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
|
|
144
130
|
},
|
|
145
131
|
"peerDependenciesMeta": {
|
|
146
132
|
"@edge-runtime/vm": {
|
|
@@ -181,56 +167,55 @@
|
|
|
181
167
|
}
|
|
182
168
|
},
|
|
183
169
|
"dependencies": {
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"why-is-node-running": "
|
|
197
|
-
"@vitest/expect": "4.1.12",
|
|
198
|
-
"@vitest/pretty-format": "4.1.12",
|
|
199
|
-
"@vitest/mocker": "4.1.12",
|
|
200
|
-
"@vitest/snapshot": "4.1.12",
|
|
201
|
-
"@vitest/utils": "4.1.12",
|
|
202
|
-
"@vitest/runner": "4.1.12",
|
|
203
|
-
"@vitest/spy": "4.1.12"
|
|
170
|
+
"@types/chai": "^5.2.2",
|
|
171
|
+
"@vitest/mocker": "5.1.0",
|
|
172
|
+
"chai": "^6.3.0",
|
|
173
|
+
"es-module-lexer": "^2.3.2",
|
|
174
|
+
"expect-type": "^1.4.0",
|
|
175
|
+
"magic-string": "^1.4.3",
|
|
176
|
+
"obug": "^3.0.0",
|
|
177
|
+
"picomatch": "^4.0.7",
|
|
178
|
+
"std-env": "^4.3.0",
|
|
179
|
+
"tinybench": "^6.2.2",
|
|
180
|
+
"tinyexec": "^1.3.1",
|
|
181
|
+
"tinyglobby": "^0.2.17",
|
|
182
|
+
"why-is-node-running": "3.2.1"
|
|
204
183
|
},
|
|
205
184
|
"devDependencies": {
|
|
206
|
-
"@antfu/install-pkg": "^
|
|
207
|
-
"@bomb.sh/tab": "^0.0.
|
|
185
|
+
"@antfu/install-pkg": "^2.1.0",
|
|
186
|
+
"@bomb.sh/tab": "^0.0.22",
|
|
208
187
|
"@edge-runtime/vm": "^5.0.0",
|
|
209
188
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
210
|
-
"@opentelemetry/api": "^1.9.
|
|
211
|
-
"@sinonjs/fake-timers": "15.
|
|
212
|
-
"@types/
|
|
213
|
-
"@types/
|
|
214
|
-
"@types/
|
|
215
|
-
"@types/jsdom": "^27.0.0",
|
|
216
|
-
"@types/node": "^24.12.0",
|
|
217
|
-
"@types/picomatch": "^4.0.2",
|
|
189
|
+
"@opentelemetry/api": "^1.9.1",
|
|
190
|
+
"@sinonjs/fake-timers": "15.4.0",
|
|
191
|
+
"@types/jsdom": "^30.0.0",
|
|
192
|
+
"@types/node": "^24.19.2",
|
|
193
|
+
"@types/picomatch": "^4.0.3",
|
|
218
194
|
"@types/prompts": "^2.4.9",
|
|
219
|
-
"@types/
|
|
195
|
+
"@types/ws": "^8.18.2",
|
|
196
|
+
"@vitest/expect": "5.1.0",
|
|
197
|
+
"@vitest/istanbul-lib-coverage": "^2.1.0",
|
|
198
|
+
"@vitest/istanbul-lib-report": "^2.1.0",
|
|
199
|
+
"@vitest/pretty-format": "5.1.0",
|
|
200
|
+
"@vitest/snapshot": "5.1.0",
|
|
201
|
+
"@vitest/spy": "5.1.0",
|
|
202
|
+
"@vitest/utils": "5.1.0",
|
|
220
203
|
"acorn": "8.11.3",
|
|
221
204
|
"acorn-walk": "^8.3.5",
|
|
222
|
-
"birpc": "^4.
|
|
205
|
+
"birpc": "^4.2.0",
|
|
223
206
|
"cac": "^6.7.14",
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
207
|
+
"flatted": "^3.4.4",
|
|
208
|
+
"happy-dom": "^21.0.3",
|
|
209
|
+
"jsdom": "^30.1.3",
|
|
210
|
+
"local-pkg": "^1.2.1",
|
|
211
|
+
"mime": "^4.1.1",
|
|
212
|
+
"pathe": "^2.0.3",
|
|
230
213
|
"prompts": "^2.4.2",
|
|
231
|
-
"strip-literal": "^
|
|
214
|
+
"strip-literal": "^4.0.0",
|
|
232
215
|
"tinyhighlight": "^0.3.2",
|
|
233
|
-
"
|
|
216
|
+
"tinyrainbow": "^3.2.0",
|
|
217
|
+
"vite": "^6.4.0 || ^7.0.0 || ^8.0.0",
|
|
218
|
+
"ws": "^8.22.0"
|
|
234
219
|
},
|
|
235
220
|
"scripts": {
|
|
236
221
|
"build": "premove dist && rollup -c",
|
package/suppress-warnings.cjs
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
-
function getDefaultExportFromCjs(x) {
|
|
3
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export { commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
@@ -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,232 +0,0 @@
|
|
|
1
|
-
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
2
|
-
import { SequenceHooks, SequenceSetupFiles, SerializableRetry, TestTagDefinition } from '@vitest/runner';
|
|
3
|
-
import { SnapshotUpdateState, SnapshotEnvironment } from '@vitest/snapshot';
|
|
4
|
-
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
5
|
-
import { L as LabelColor } from './traces.d.D2T_R8rx.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Names of clock methods that may be faked by install.
|
|
9
|
-
*/
|
|
10
|
-
type FakeMethod =
|
|
11
|
-
| "setTimeout"
|
|
12
|
-
| "clearTimeout"
|
|
13
|
-
| "setImmediate"
|
|
14
|
-
| "clearImmediate"
|
|
15
|
-
| "setInterval"
|
|
16
|
-
| "clearInterval"
|
|
17
|
-
| "Date"
|
|
18
|
-
| "nextTick"
|
|
19
|
-
| "hrtime"
|
|
20
|
-
| "requestAnimationFrame"
|
|
21
|
-
| "cancelAnimationFrame"
|
|
22
|
-
| "requestIdleCallback"
|
|
23
|
-
| "cancelIdleCallback"
|
|
24
|
-
| "performance"
|
|
25
|
-
| "queueMicrotask";
|
|
26
|
-
|
|
27
|
-
interface FakeTimerInstallOpts {
|
|
28
|
-
/**
|
|
29
|
-
* Installs fake timers with the specified unix epoch (default: 0)
|
|
30
|
-
*/
|
|
31
|
-
now?: number | Date | undefined;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* An array with names of global methods and APIs to fake. By default, `@sinonjs/fake-timers` does not replace `nextTick()` and `queueMicrotask()`.
|
|
35
|
-
* For instance, `FakeTimers.install({ toFake: ['setTimeout', 'nextTick'] })` will fake only `setTimeout()` and `nextTick()`
|
|
36
|
-
*/
|
|
37
|
-
toFake?: FakeMethod[] | undefined;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The maximum number of timers that will be run when calling runAll() (default: 1000)
|
|
41
|
-
*/
|
|
42
|
-
loopLimit?: number | undefined;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Tells @sinonjs/fake-timers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by
|
|
46
|
-
* 20ms for every 20ms change in the real system time) (default: false)
|
|
47
|
-
*/
|
|
48
|
-
shouldAdvanceTime?: boolean | undefined;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change
|
|
52
|
-
* in the real system time (default: 20)
|
|
53
|
-
*/
|
|
54
|
-
advanceTimeDelta?: number | undefined;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by
|
|
58
|
-
* default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. (default: false)
|
|
59
|
-
*/
|
|
60
|
-
shouldClearNativeTimers?: boolean | undefined;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Tells FakeTimers to not throw an error when faking a timer that does not exist in the global object. (default: false)
|
|
64
|
-
*/
|
|
65
|
-
ignoreMissingTimers?: boolean | undefined;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Config that tests have access to.
|
|
70
|
-
*/
|
|
71
|
-
interface SerializedConfig {
|
|
72
|
-
name: string | undefined;
|
|
73
|
-
color?: LabelColor;
|
|
74
|
-
globals: boolean;
|
|
75
|
-
base: string | undefined;
|
|
76
|
-
snapshotEnvironment?: string;
|
|
77
|
-
disableConsoleIntercept: boolean | undefined;
|
|
78
|
-
runner: string | undefined;
|
|
79
|
-
isolate: boolean;
|
|
80
|
-
maxWorkers: number;
|
|
81
|
-
mode: "test" | "benchmark";
|
|
82
|
-
bail: number | undefined;
|
|
83
|
-
environmentOptions?: Record<string, any>;
|
|
84
|
-
root: string;
|
|
85
|
-
setupFiles: string[];
|
|
86
|
-
passWithNoTests: boolean;
|
|
87
|
-
testNamePattern: RegExp | undefined;
|
|
88
|
-
allowOnly: boolean;
|
|
89
|
-
testTimeout: number;
|
|
90
|
-
hookTimeout: number;
|
|
91
|
-
clearMocks: boolean;
|
|
92
|
-
mockReset: boolean;
|
|
93
|
-
restoreMocks: boolean;
|
|
94
|
-
unstubGlobals: boolean;
|
|
95
|
-
unstubEnvs: boolean;
|
|
96
|
-
fakeTimers: FakeTimerInstallOpts;
|
|
97
|
-
maxConcurrency: number;
|
|
98
|
-
defines: Record<string, any>;
|
|
99
|
-
expect: {
|
|
100
|
-
requireAssertions?: boolean;
|
|
101
|
-
poll?: {
|
|
102
|
-
timeout?: number;
|
|
103
|
-
interval?: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
printConsoleTrace: boolean | undefined;
|
|
107
|
-
sequence: {
|
|
108
|
-
shuffle?: boolean;
|
|
109
|
-
concurrent?: boolean;
|
|
110
|
-
seed: number;
|
|
111
|
-
hooks: SequenceHooks;
|
|
112
|
-
setupFiles: SequenceSetupFiles;
|
|
113
|
-
};
|
|
114
|
-
deps: {
|
|
115
|
-
web: {
|
|
116
|
-
transformAssets?: boolean;
|
|
117
|
-
transformCss?: boolean;
|
|
118
|
-
transformGlobPattern?: RegExp | RegExp[];
|
|
119
|
-
};
|
|
120
|
-
optimizer: Record<string, {
|
|
121
|
-
enabled: boolean;
|
|
122
|
-
}>;
|
|
123
|
-
interopDefault: boolean | undefined;
|
|
124
|
-
moduleDirectories: string[] | undefined;
|
|
125
|
-
};
|
|
126
|
-
snapshotOptions: {
|
|
127
|
-
updateSnapshot: SnapshotUpdateState;
|
|
128
|
-
expand: boolean | undefined;
|
|
129
|
-
snapshotFormat: PrettyFormatOptions | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* only exists for tests, not available in the main process
|
|
132
|
-
*/
|
|
133
|
-
snapshotEnvironment: SnapshotEnvironment;
|
|
134
|
-
};
|
|
135
|
-
pool: string;
|
|
136
|
-
snapshotSerializers: string[];
|
|
137
|
-
chaiConfig: {
|
|
138
|
-
includeStack?: boolean;
|
|
139
|
-
showDiff?: boolean;
|
|
140
|
-
truncateThreshold?: number;
|
|
141
|
-
} | undefined;
|
|
142
|
-
api: {
|
|
143
|
-
allowExec: boolean | undefined;
|
|
144
|
-
allowWrite: boolean | undefined;
|
|
145
|
-
};
|
|
146
|
-
diff: string | SerializedDiffOptions | undefined;
|
|
147
|
-
retry: SerializableRetry;
|
|
148
|
-
includeTaskLocation: boolean | undefined;
|
|
149
|
-
inspect: boolean | string | undefined;
|
|
150
|
-
inspectBrk: boolean | string | undefined;
|
|
151
|
-
inspector: {
|
|
152
|
-
enabled?: boolean;
|
|
153
|
-
port?: number;
|
|
154
|
-
host?: string;
|
|
155
|
-
waitForDebugger?: boolean;
|
|
156
|
-
};
|
|
157
|
-
watch: boolean;
|
|
158
|
-
env: Record<string, any>;
|
|
159
|
-
browser: {
|
|
160
|
-
name: string;
|
|
161
|
-
headless: boolean;
|
|
162
|
-
isolate: boolean;
|
|
163
|
-
fileParallelism: boolean;
|
|
164
|
-
ui: boolean;
|
|
165
|
-
viewport: {
|
|
166
|
-
width: number;
|
|
167
|
-
height: number;
|
|
168
|
-
};
|
|
169
|
-
locators: {
|
|
170
|
-
testIdAttribute: string;
|
|
171
|
-
exact: boolean;
|
|
172
|
-
};
|
|
173
|
-
screenshotFailures: boolean;
|
|
174
|
-
providerOptions: {
|
|
175
|
-
actionTimeout?: number;
|
|
176
|
-
};
|
|
177
|
-
trace: BrowserTraceViewMode;
|
|
178
|
-
trackUnhandledErrors: boolean;
|
|
179
|
-
detailsPanelPosition: "right" | "bottom";
|
|
180
|
-
};
|
|
181
|
-
standalone: boolean;
|
|
182
|
-
logHeapUsage: boolean | undefined;
|
|
183
|
-
detectAsyncLeaks: boolean;
|
|
184
|
-
coverage: SerializedCoverageConfig;
|
|
185
|
-
benchmark: {
|
|
186
|
-
includeSamples: boolean;
|
|
187
|
-
} | undefined;
|
|
188
|
-
serializedDefines: string;
|
|
189
|
-
experimental: {
|
|
190
|
-
fsModuleCache: boolean;
|
|
191
|
-
importDurations: {
|
|
192
|
-
print: boolean | "on-warn";
|
|
193
|
-
limit: number;
|
|
194
|
-
failOnDanger: boolean;
|
|
195
|
-
thresholds: {
|
|
196
|
-
warn: number;
|
|
197
|
-
danger: number;
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
viteModuleRunner: boolean;
|
|
201
|
-
nodeLoader: boolean;
|
|
202
|
-
openTelemetry: {
|
|
203
|
-
enabled: boolean;
|
|
204
|
-
sdkPath?: string;
|
|
205
|
-
browserSdkPath?: string;
|
|
206
|
-
} | undefined;
|
|
207
|
-
};
|
|
208
|
-
tags: TestTagDefinition[];
|
|
209
|
-
tagsFilter: string[] | undefined;
|
|
210
|
-
strictTags: boolean;
|
|
211
|
-
slowTestThreshold: number | undefined;
|
|
212
|
-
isAgent: boolean;
|
|
213
|
-
}
|
|
214
|
-
interface SerializedCoverageConfig {
|
|
215
|
-
provider: "istanbul" | "v8" | "custom" | undefined;
|
|
216
|
-
reportsDirectory: string;
|
|
217
|
-
htmlDir: string | undefined;
|
|
218
|
-
enabled: boolean;
|
|
219
|
-
customProviderModule: string | undefined;
|
|
220
|
-
}
|
|
221
|
-
interface SerializedRootConfig extends SerializedConfig {
|
|
222
|
-
projects: SerializedConfig[];
|
|
223
|
-
}
|
|
224
|
-
type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookTimeout" | "clearMocks" | "mockReset" | "restoreMocks" | "fakeTimers" | "maxConcurrency" | "expect" | "printConsoleTrace"> & {
|
|
225
|
-
sequence?: {
|
|
226
|
-
hooks?: SequenceHooks;
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
type RuntimeOptions = Partial<RuntimeConfig>;
|
|
230
|
-
type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
|
|
231
|
-
|
|
232
|
-
export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, SerializedRootConfig as b, RuntimeConfig as c };
|