vitest 1.6.0 → 2.0.0-beta.1
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 +172 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +4 -4
- package/dist/chunks/{environments-node.vcoXCoKs.js → environments-node.39w4gmlF.js} +2 -2
- package/dist/chunks/{install-pkg.LE8oaA1t.js → install-pkg.DNUmWFkO.js} +2 -2
- package/dist/chunks/integrations-globals.B5Jl0grA.js +31 -0
- package/dist/chunks/{runtime-console.EO5ha7qv.js → runtime-console.CUES-L8X.js} +9 -9
- package/dist/chunks/{runtime-runBaseTests.oAvMKtQC.js → runtime-runBaseTests._dXkRAZc.js} +18 -18
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -2
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +2 -2
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +769 -21
- package/dist/index.js +12 -12
- package/dist/node.d.ts +2 -2
- package/dist/node.js +20 -21
- package/dist/{reporters-yx5ZTtEV.d.ts → reporters-MGvT5U9f.d.ts} +28 -31
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +10 -11
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +17 -18
- package/dist/snapshot.js +3 -3
- package/dist/{suite-IbNSsUWN.d.ts → suite-8WAe-urM.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +4 -4
- package/dist/vendor/{base.Ybri3C14.js → base.VFkIJ66g.js} +3 -3
- package/dist/vendor/{base.5NT-gWu5.js → base._gnK9Slw.js} +1 -2
- package/dist/vendor/{benchmark.yGkUTKnC.js → benchmark.BNLebNi5.js} +1 -1
- package/dist/vendor/{cac.EdDItJD-.js → cac.DzKZaJu2.js} +5 -6
- package/dist/vendor/{cli-api.E07AF1Yq.js → cli-api.DTeni0Qq.js} +3060 -361
- package/dist/vendor/{execute.fL3szUAI.js → execute.CLLNVNnK.js} +1 -1
- package/dist/vendor/{index.DpVgvm2P.js → index.BfoZyXD1.js} +5 -5
- package/dist/vendor/{index.8bPxjt7g.js → index.BpSiYbpB.js} +5 -1
- package/dist/vendor/{index.Q04MCqDO.js → index.CRxYS9H3.js} +414 -113
- package/dist/vendor/{index.dI9lHwVn.js → index.CmILuxzC.js} +8 -6
- package/dist/vendor/{index.xL8XjTLv.js → index.DP-km6lF.js} +1 -1
- package/dist/vendor/{index.SMVOaj7F.js → index._7XLd8Kd.js} +2 -2
- package/dist/vendor/{rpc.joBhAkyK.js → rpc.DRDE9Pu1.js} +2 -2
- package/dist/vendor/{run-once.Olz_Zkd8.js → run-once.DLomgGUH.js} +1 -1
- package/dist/vendor/{setup-common.8nJLd4ay.js → setup-common.XeoZAW8t.js} +2 -2
- package/dist/vendor/{tasks.IknbGB2n.js → tasks.WC7M-K-v.js} +4 -1
- package/dist/vendor/{utils.dEtNIEgr.js → utils.D5gGkwyH.js} +1 -1
- package/dist/vendor/{vi.YFlodzP_.js → vi.ClD3hi7L.js} +23 -10
- package/dist/vendor/{vm.QEE48c0T.js → vm.Bi3bljci.js} +47 -59
- package/dist/worker.js +6 -6
- package/dist/workers/forks.js +5 -5
- package/dist/workers/runVmTests.js +17 -17
- package/dist/workers/threads.js +5 -5
- package/dist/workers/vmForks.js +8 -8
- package/dist/workers/vmThreads.js +8 -8
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +13 -13
- package/package.json +29 -29
- package/vitest.mjs +1 -1
- package/dist/chunks/integrations-globals.kw4co3rx.js +0 -31
- package/dist/cli-wrapper.js +0 -119
- /package/dist/chunks/{node-git.Hw101KjS.js → node-git.CCI8evVZ.js} +0 -0
- /package/dist/vendor/{_commonjsHelpers.jjO7Zipk.js → _commonjsHelpers.BFTU3MAI.js} +0 -0
- /package/dist/vendor/{constants.5J7I254_.js → constants.5SOfHUj0.js} +0 -0
- /package/dist/vendor/{coverage.E7sG1b3r.js → coverage.ChSqD-qS.js} +0 -0
- /package/dist/vendor/{date.Ns1pGd_X.js → date.BKM1wewY.js} +0 -0
- /package/dist/vendor/{env.AtSIuHFg.js → env.bmJgw1qP.js} +0 -0
- /package/dist/vendor/{global.CkGT_TMy.js → global.7bFbnyXl.js} +0 -0
- /package/dist/vendor/{index.GVFv9dZ0.js → index.DeR1hhfY.js} +0 -0
- /package/dist/vendor/{inspector.IgLX3ur5.js → inspector.hPQncR7V.js} +0 -0
- /package/dist/vendor/{utils.0uYuCbzo.js → utils.CUjzkRH7.js} +0 -0
package/dist/workers.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.
|
|
2
|
-
export { p as provideWorkerState } from './vendor/global.
|
|
1
|
+
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.CUjzkRH7.js';
|
|
2
|
+
export { p as provideWorkerState } from './vendor/global.7bFbnyXl.js';
|
|
3
3
|
export { run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './vendor/vm.
|
|
5
|
-
export { r as runBaseTests } from './vendor/base.
|
|
4
|
+
export { r as runVmTests } from './vendor/vm.Bi3bljci.js';
|
|
5
|
+
export { r as runBaseTests } from './vendor/base.VFkIJ66g.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
9
9
|
import 'vite-node/client';
|
|
10
10
|
import 'node:fs';
|
|
11
11
|
import 'pathe';
|
|
12
|
-
import './vendor/index.
|
|
12
|
+
import './vendor/index.DeR1hhfY.js';
|
|
13
13
|
import 'node:console';
|
|
14
|
-
import './vendor/base.
|
|
15
|
-
import './vendor/inspector.
|
|
14
|
+
import './vendor/base._gnK9Slw.js';
|
|
15
|
+
import './vendor/inspector.hPQncR7V.js';
|
|
16
16
|
import 'node:module';
|
|
17
|
-
import './vendor/rpc.
|
|
18
|
-
import './vendor/index.
|
|
17
|
+
import './vendor/rpc.DRDE9Pu1.js';
|
|
18
|
+
import './vendor/index.BpSiYbpB.js';
|
|
19
19
|
import 'node:vm';
|
|
20
|
-
import './chunks/runtime-console.
|
|
20
|
+
import './chunks/runtime-console.CUES-L8X.js';
|
|
21
21
|
import 'node:stream';
|
|
22
22
|
import 'node:path';
|
|
23
|
-
import './vendor/date.
|
|
23
|
+
import './vendor/date.BKM1wewY.js';
|
|
24
24
|
import '@vitest/runner/utils';
|
|
25
|
-
import './vendor/env.
|
|
25
|
+
import './vendor/env.bmJgw1qP.js';
|
|
26
26
|
import 'std-env';
|
|
27
|
-
import './vendor/execute.
|
|
27
|
+
import './vendor/execute.CLLNVNnK.js';
|
|
28
28
|
import 'vite-node/utils';
|
|
29
29
|
import '@vitest/utils/error';
|
|
30
30
|
import './path.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-beta.1",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
120
120
|
"happy-dom": "*",
|
|
121
121
|
"jsdom": "*",
|
|
122
|
-
"@vitest/
|
|
123
|
-
"@vitest/
|
|
122
|
+
"@vitest/ui": "2.0.0-beta.1",
|
|
123
|
+
"@vitest/browser": "2.0.0-beta.1"
|
|
124
124
|
},
|
|
125
125
|
"peerDependenciesMeta": {
|
|
126
126
|
"@edge-runtime/vm": {
|
|
@@ -143,58 +143,58 @@
|
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
"dependencies": {
|
|
146
|
-
"
|
|
147
|
-
"chai": "^4.3.10",
|
|
146
|
+
"chai": "^5.1.1",
|
|
148
147
|
"debug": "^4.3.4",
|
|
149
148
|
"execa": "^8.0.1",
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"pathe": "^1.1.1",
|
|
149
|
+
"magic-string": "^0.30.10",
|
|
150
|
+
"pathe": "^1.1.2",
|
|
153
151
|
"picocolors": "^1.0.0",
|
|
154
|
-
"std-env": "^3.
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"tinypool": "^0.8.3",
|
|
152
|
+
"std-env": "^3.7.0",
|
|
153
|
+
"tinybench": "^2.8.0",
|
|
154
|
+
"tinypool": "^0.8.4",
|
|
158
155
|
"vite": "^5.0.0",
|
|
159
156
|
"why-is-node-running": "^2.2.2",
|
|
160
|
-
"@vitest/
|
|
161
|
-
"@vitest/
|
|
162
|
-
"@vitest/snapshot": "
|
|
163
|
-
"@vitest/
|
|
164
|
-
"
|
|
165
|
-
"
|
|
157
|
+
"@vitest/runner": "2.0.0-beta.1",
|
|
158
|
+
"@vitest/expect": "2.0.0-beta.1",
|
|
159
|
+
"@vitest/snapshot": "2.0.0-beta.1",
|
|
160
|
+
"@vitest/utils": "2.0.0-beta.1",
|
|
161
|
+
"@vitest/spy": "2.0.0-beta.1",
|
|
162
|
+
"vite-node": "2.0.0-beta.1"
|
|
166
163
|
},
|
|
167
164
|
"devDependencies": {
|
|
168
|
-
"@ampproject/remapping": "^2.
|
|
169
|
-
"@antfu/install-pkg": "
|
|
170
|
-
"@edge-runtime/vm": "^3.
|
|
165
|
+
"@ampproject/remapping": "^2.3.0",
|
|
166
|
+
"@antfu/install-pkg": "0.3.1",
|
|
167
|
+
"@edge-runtime/vm": "^3.2.0",
|
|
171
168
|
"@sinonjs/fake-timers": "11.1.0",
|
|
172
169
|
"@types/estree": "^1.0.5",
|
|
173
170
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
174
171
|
"@types/istanbul-reports": "^3.0.4",
|
|
175
172
|
"@types/jsdom": "^21.1.6",
|
|
176
|
-
"@types/micromatch": "^4.0.
|
|
177
|
-
"@types/node": "^20.11
|
|
173
|
+
"@types/micromatch": "^4.0.7",
|
|
174
|
+
"@types/node": "^20.12.11",
|
|
178
175
|
"@types/prompts": "^2.4.9",
|
|
179
176
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
180
|
-
"
|
|
177
|
+
"acorn-walk": "^8.3.2",
|
|
178
|
+
"birpc": "0.2.17",
|
|
181
179
|
"cac": "^6.7.14",
|
|
182
180
|
"chai-subset": "^1.6.0",
|
|
183
181
|
"cli-truncate": "^4.0.0",
|
|
184
|
-
"expect-type": "^0.
|
|
182
|
+
"expect-type": "^0.19.0",
|
|
185
183
|
"fast-glob": "^3.3.2",
|
|
186
184
|
"find-up": "^6.3.0",
|
|
187
|
-
"flatted": "^3.
|
|
188
|
-
"get-tsconfig": "^4.7.
|
|
189
|
-
"happy-dom": "^14.
|
|
185
|
+
"flatted": "^3.3.1",
|
|
186
|
+
"get-tsconfig": "^4.7.4",
|
|
187
|
+
"happy-dom": "^14.10.1",
|
|
190
188
|
"jsdom": "^24.0.0",
|
|
189
|
+
"local-pkg": "^0.5.0",
|
|
191
190
|
"log-update": "^5.0.1",
|
|
192
191
|
"micromatch": "^4.0.5",
|
|
193
192
|
"p-limit": "^5.0.0",
|
|
194
193
|
"pretty-format": "^29.7.0",
|
|
195
194
|
"prompts": "^2.4.2",
|
|
196
195
|
"strip-ansi": "^7.1.0",
|
|
197
|
-
"
|
|
196
|
+
"strip-literal": "^2.1.0",
|
|
197
|
+
"ws": "^8.17.0"
|
|
198
198
|
},
|
|
199
199
|
"scripts": {
|
|
200
200
|
"build": "rimraf dist && rollup -c",
|
package/vitest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import './dist/cli
|
|
2
|
+
import './dist/cli.js'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { g as globalApis } from '../vendor/constants.5J7I254_.js';
|
|
2
|
-
import { V as VitestIndex } from '../vendor/index.dI9lHwVn.js';
|
|
3
|
-
import '@vitest/runner';
|
|
4
|
-
import '../vendor/benchmark.yGkUTKnC.js';
|
|
5
|
-
import '@vitest/runner/utils';
|
|
6
|
-
import '@vitest/utils';
|
|
7
|
-
import '../vendor/index.SMVOaj7F.js';
|
|
8
|
-
import 'pathe';
|
|
9
|
-
import '../vendor/global.CkGT_TMy.js';
|
|
10
|
-
import '../vendor/env.AtSIuHFg.js';
|
|
11
|
-
import 'std-env';
|
|
12
|
-
import '../vendor/run-once.Olz_Zkd8.js';
|
|
13
|
-
import '../vendor/vi.YFlodzP_.js';
|
|
14
|
-
import 'chai';
|
|
15
|
-
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
16
|
-
import '@vitest/expect';
|
|
17
|
-
import '@vitest/snapshot';
|
|
18
|
-
import '@vitest/utils/error';
|
|
19
|
-
import '../vendor/tasks.IknbGB2n.js';
|
|
20
|
-
import '@vitest/utils/source-map';
|
|
21
|
-
import '../vendor/base.5NT-gWu5.js';
|
|
22
|
-
import '../vendor/date.Ns1pGd_X.js';
|
|
23
|
-
import '@vitest/spy';
|
|
24
|
-
|
|
25
|
-
function registerApiGlobally() {
|
|
26
|
-
globalApis.forEach((api) => {
|
|
27
|
-
globalThis[api] = VitestIndex[api];
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { registerApiGlobally };
|
package/dist/cli-wrapper.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
import c from 'picocolors';
|
|
3
|
-
import { execa } from 'execa';
|
|
4
|
-
import { E as EXIT_CODE_RESTART } from './vendor/constants.5J7I254_.js';
|
|
5
|
-
|
|
6
|
-
const ENTRY = new URL("./cli.js", import.meta.url);
|
|
7
|
-
const NODE_ARGS = [
|
|
8
|
-
"--trace-deprecation",
|
|
9
|
-
"--experimental-wasm-threads",
|
|
10
|
-
"--wasm-atomics-on-non-shared-memory"
|
|
11
|
-
];
|
|
12
|
-
const SegfaultErrors = [
|
|
13
|
-
{
|
|
14
|
-
trigger: "Check failed: result.second.",
|
|
15
|
-
url: "https://github.com/nodejs/node/issues/43617"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
trigger: "FATAL ERROR: v8::FromJust Maybe value is Nothing.",
|
|
19
|
-
url: "https://github.com/vitest-dev/vitest/issues/1191"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
trigger: "FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.",
|
|
23
|
-
url: "https://github.com/nodejs/node/issues/42407"
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
main();
|
|
27
|
-
async function main() {
|
|
28
|
-
var _a;
|
|
29
|
-
let retries = 0;
|
|
30
|
-
const args = process.argv.slice(2);
|
|
31
|
-
if (process.env.VITEST_SEGFAULT_RETRY) {
|
|
32
|
-
retries = +process.env.VITEST_SEGFAULT_RETRY;
|
|
33
|
-
} else {
|
|
34
|
-
for (let i = 0; i < args.length; i++) {
|
|
35
|
-
if (args[i].startsWith("--segfault-retry=") || args[i].startsWith("--segfaultRetry=")) {
|
|
36
|
-
retries = +args[i].split("=")[1];
|
|
37
|
-
break;
|
|
38
|
-
} else if ((args[i] === "--segfault-retry" || args[i] === "--segfaultRetry") && ((_a = args[i + 1]) == null ? void 0 : _a.match(/^\d+$/))) {
|
|
39
|
-
retries = +args[i + 1];
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (retries <= 0) {
|
|
45
|
-
await import('./cli.js');
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const nodeArgs = [];
|
|
49
|
-
const vitestArgs = [];
|
|
50
|
-
for (let i = 0; i < args.length; i++) {
|
|
51
|
-
let matched = false;
|
|
52
|
-
for (const nodeArg of NODE_ARGS) {
|
|
53
|
-
if (args[i] === nodeArg || args[i].startsWith(`${nodeArg}=`)) {
|
|
54
|
-
matched = true;
|
|
55
|
-
nodeArgs.push(args[i]);
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!matched)
|
|
60
|
-
vitestArgs.push(args[i]);
|
|
61
|
-
}
|
|
62
|
-
retries = Math.max(1, retries || 1);
|
|
63
|
-
for (let i = 1; i <= retries; i++) {
|
|
64
|
-
const result = await start(nodeArgs, vitestArgs);
|
|
65
|
-
if (result === "restart") {
|
|
66
|
-
i -= 1;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (i === 1 && retries === 1) {
|
|
70
|
-
console.log(c.yellow(`It seems to be an upstream bug of Node.js. To improve the test stability,
|
|
71
|
-
you could pass ${c.bold(c.green("--segfault-retry=3"))} or set env ${c.bold(c.green("VITEST_SEGFAULT_RETRY=3"))} to
|
|
72
|
-
have Vitest auto retries on flaky segfaults.
|
|
73
|
-
`));
|
|
74
|
-
}
|
|
75
|
-
if (i !== retries)
|
|
76
|
-
console.log(`${c.inverse(c.bold(c.magenta(" Retrying ")))} vitest ${args.join(" ")} ${c.gray(`(${i + 1} of ${retries})`)}`);
|
|
77
|
-
}
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
async function start(preArgs, postArgs) {
|
|
81
|
-
var _a;
|
|
82
|
-
const child = execa(
|
|
83
|
-
"node",
|
|
84
|
-
[
|
|
85
|
-
...preArgs,
|
|
86
|
-
fileURLToPath(ENTRY),
|
|
87
|
-
...postArgs
|
|
88
|
-
],
|
|
89
|
-
{
|
|
90
|
-
reject: false,
|
|
91
|
-
stderr: "pipe",
|
|
92
|
-
stdout: "inherit",
|
|
93
|
-
stdin: "inherit",
|
|
94
|
-
env: {
|
|
95
|
-
...process.env,
|
|
96
|
-
VITEST_CLI_WRAPPER: "true"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
(_a = child.stderr) == null ? void 0 : _a.pipe(process.stderr);
|
|
101
|
-
const { stderr = "" } = await child;
|
|
102
|
-
if (child.exitCode === EXIT_CODE_RESTART)
|
|
103
|
-
return "restart";
|
|
104
|
-
for (const error of SegfaultErrors) {
|
|
105
|
-
if (stderr.includes(error.trigger)) {
|
|
106
|
-
if (process.env.GITHUB_ACTIONS)
|
|
107
|
-
console.log(`::warning:: Segmentfault Error Detected: ${error.trigger}
|
|
108
|
-
Refer to ${error.url}`);
|
|
109
|
-
const RED_BLOCK = c.inverse(c.red(" "));
|
|
110
|
-
console.log(`
|
|
111
|
-
${c.inverse(c.bold(c.red(" Segmentfault Error Detected ")))}
|
|
112
|
-
${RED_BLOCK} ${c.red(error.trigger)}
|
|
113
|
-
${RED_BLOCK} ${c.red(`Refer to ${error.url}`)}
|
|
114
|
-
`);
|
|
115
|
-
return "error";
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
process.exit(child.exitCode);
|
|
119
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|