vitest 2.0.0-beta.9 → 2.0.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 +1 -22
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +5 -19
- package/dist/chunks/browser-creator.DSqYDthP.js +673 -0
- package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
- package/dist/chunks/{integrations-globals.BK0Cn4q1.js → integrations-globals.CzYWb38r.js} +10 -9
- package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
- package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
- package/dist/chunks/{runtime-runBaseTests.C-Bkopka.js → runtime-runBaseTests.DX3h28Mp.js} +47 -34
- package/dist/cli.js +3 -3
- package/dist/config.cjs +48 -23
- package/dist/config.d.ts +2 -1
- package/dist/config.js +48 -24
- package/dist/coverage.d.ts +6 -4
- package/dist/coverage.js +102 -38
- package/dist/environments.d.ts +2 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +4 -3
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +1437 -7
- package/dist/index.js +10 -9
- package/dist/node.d.ts +34 -7
- package/dist/node.js +31 -20
- package/dist/path.js +4 -1
- package/dist/{reporters-DaDey3o0.d.ts → reporters-DrhyxxXt.d.ts} +213 -206
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +3 -1
- package/dist/runners.js +100 -61
- package/dist/snapshot.js +2 -2
- package/dist/{suite-BHSUxUib.d.ts → suite-DCPwkk7G.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/suite.js +3 -3
- package/dist/utils.d.ts +1 -5
- package/dist/utils.js +1 -6
- package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
- package/dist/vendor/{base.D4XK-wRp.js → base.CdA1i5tB.js} +6 -4
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
- package/dist/vendor/{cac.DCg3FnEs.js → cac.5nBDv26-.js} +142 -47
- package/dist/vendor/{cli-api.LMvYagQ5.js → cli-api.BT4NJtxX.js} +4162 -9514
- package/dist/vendor/{constants.TCjCaw2D.js → constants.CsnA4eRy.js} +5 -23
- package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
- package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
- package/dist/vendor/env.2ltrQNq0.js +8 -0
- package/dist/vendor/{execute.BHj6OMh4.js → execute.Dx503nGn.js} +186 -64
- package/dist/vendor/{index.TBU3GqRP.js → index.3x3MdmUV.js} +1075 -526
- package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
- package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
- package/dist/vendor/{index.DHRpy7zp.js → index.CROIsoiT.js} +18 -10
- package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
- package/dist/vendor/index.D6GZqexG.js +6575 -0
- package/dist/vendor/{index.DwR86H5i.js → index.Hqvcg1pf.js} +4 -27
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/run-once.Db8Hgq9X.js +28 -0
- package/dist/vendor/{setup-common.BhJvzjns.js → setup-common.yHaxjRhz.js} +30 -15
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.YuQ3LT2a.js → utils.BVMrsl6E.js} +55 -30
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.C6AfDXK6.js → vi.DXACdGTu.js} +269 -136
- package/dist/vendor/{vm.Ow-X2mkS.js → vm.BrDS6p7h.js} +157 -90
- package/dist/worker.js +41 -18
- package/dist/workers/forks.js +12 -6
- package/dist/workers/runVmTests.js +22 -16
- package/dist/workers/threads.js +8 -5
- package/dist/workers/vmForks.js +15 -9
- package/dist/workers/vmThreads.js +11 -8
- package/dist/workers.d.ts +8 -5
- package/dist/workers.js +11 -11
- package/package.json +22 -21
- package/suppress-warnings.cjs +2 -4
- package/dist/index-B0dCycbN.d.ts +0 -1571
- package/dist/vendor/env.bmJgw1qP.js +0 -7
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { g as globalApis } from '../vendor/constants.
|
|
2
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
1
|
+
import { g as globalApis } from '../vendor/constants.CsnA4eRy.js';
|
|
2
|
+
import { V as VitestIndex } from '../vendor/index.Hqvcg1pf.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import '../vendor/benchmark.
|
|
4
|
+
import '../vendor/benchmark.B6pblCp2.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import '../vendor/index.
|
|
7
|
+
import '../vendor/index.BJmtb_7W.js';
|
|
8
8
|
import 'pathe';
|
|
9
9
|
import '../vendor/global.7bFbnyXl.js';
|
|
10
|
-
import '../vendor/env.
|
|
10
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
11
11
|
import 'std-env';
|
|
12
|
-
import '../vendor/
|
|
12
|
+
import '../vendor/run-once.Db8Hgq9X.js';
|
|
13
|
+
import '../vendor/vi.DXACdGTu.js';
|
|
13
14
|
import 'chai';
|
|
14
15
|
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
15
16
|
import '@vitest/expect';
|
|
16
17
|
import '@vitest/snapshot';
|
|
17
18
|
import '@vitest/utils/error';
|
|
18
|
-
import '../vendor/tasks.
|
|
19
|
+
import '../vendor/tasks.DhVtQBtW.js';
|
|
19
20
|
import '@vitest/utils/source-map';
|
|
20
|
-
import '../vendor/base.
|
|
21
|
-
import '../vendor/date.
|
|
21
|
+
import '../vendor/base.CTYV4Gnz.js';
|
|
22
|
+
import '../vendor/date.W2xKR2qe.js';
|
|
22
23
|
import '@vitest/spy';
|
|
23
24
|
|
|
24
25
|
function registerApiGlobally() {
|
|
@@ -18,8 +18,9 @@ class VitestGit {
|
|
|
18
18
|
}
|
|
19
19
|
async findChangedFiles(options) {
|
|
20
20
|
const root = await this.getRoot(this.cwd);
|
|
21
|
-
if (!root)
|
|
21
|
+
if (!root) {
|
|
22
22
|
return null;
|
|
23
|
+
}
|
|
23
24
|
this.root = root;
|
|
24
25
|
const changedSince = options.changedSince;
|
|
25
26
|
if (typeof changedSince === "string") {
|
|
@@ -37,24 +38,22 @@ class VitestGit {
|
|
|
37
38
|
return [...staged, ...unstaged];
|
|
38
39
|
}
|
|
39
40
|
getFilesSince(hash) {
|
|
40
|
-
return this.resolveFilesWithGitCommand(
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
return this.resolveFilesWithGitCommand([
|
|
42
|
+
"diff",
|
|
43
|
+
"--name-only",
|
|
44
|
+
`${hash}...HEAD`
|
|
45
|
+
]);
|
|
43
46
|
}
|
|
44
47
|
getStagedFiles() {
|
|
45
|
-
return this.resolveFilesWithGitCommand(
|
|
46
|
-
["diff", "--cached", "--name-only"]
|
|
47
|
-
);
|
|
48
|
+
return this.resolveFilesWithGitCommand(["diff", "--cached", "--name-only"]);
|
|
48
49
|
}
|
|
49
50
|
getUnstagedFiles() {
|
|
50
|
-
return this.resolveFilesWithGitCommand(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]
|
|
57
|
-
);
|
|
51
|
+
return this.resolveFilesWithGitCommand([
|
|
52
|
+
"ls-files",
|
|
53
|
+
"--other",
|
|
54
|
+
"--modified",
|
|
55
|
+
"--exclude-standard"
|
|
56
|
+
]);
|
|
58
57
|
}
|
|
59
58
|
async getRoot(cwd) {
|
|
60
59
|
const options = ["rev-parse", "--show-cdup"];
|
|
@@ -2,26 +2,29 @@ import { Writable } from 'node:stream';
|
|
|
2
2
|
import { Console } from 'node:console';
|
|
3
3
|
import { relative } from 'node:path';
|
|
4
4
|
import { getSafeTimers, getColors } from '@vitest/utils';
|
|
5
|
-
import { R as RealDate } from '../vendor/date.
|
|
5
|
+
import { R as RealDate } from '../vendor/date.W2xKR2qe.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
|
|
9
|
-
import '../vendor/env.
|
|
9
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
10
10
|
import 'std-env';
|
|
11
11
|
|
|
12
12
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
13
13
|
function getTaskIdByStack(root) {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const stack = (_a = new Error("STACK_TRACE_ERROR").stack) == null ? void 0 : _a.split("\n");
|
|
16
|
-
if (!stack)
|
|
16
|
+
if (!stack) {
|
|
17
17
|
return UNKNOWN_TEST_ID;
|
|
18
|
+
}
|
|
18
19
|
const index = stack.findIndex((line2) => line2.includes("at Console.value"));
|
|
19
20
|
const line = index === -1 ? null : stack[index + 2];
|
|
20
|
-
if (!line)
|
|
21
|
+
if (!line) {
|
|
21
22
|
return UNKNOWN_TEST_ID;
|
|
23
|
+
}
|
|
22
24
|
const filepath = (_b = line.match(/at\s(.*)\s?/)) == null ? void 0 : _b[1];
|
|
23
|
-
if (filepath)
|
|
25
|
+
if (filepath) {
|
|
24
26
|
return relative(root, filepath);
|
|
27
|
+
}
|
|
25
28
|
return UNKNOWN_TEST_ID;
|
|
26
29
|
}
|
|
27
30
|
function createCustomConsole(defaultState) {
|
|
@@ -53,8 +56,9 @@ function createCustomConsole(defaultState) {
|
|
|
53
56
|
function sendBuffer(type, taskId) {
|
|
54
57
|
const buffers = type === "stdout" ? stdoutBuffer : stderrBuffer;
|
|
55
58
|
const buffer = buffers.get(taskId);
|
|
56
|
-
if (!buffer)
|
|
59
|
+
if (!buffer) {
|
|
57
60
|
return;
|
|
61
|
+
}
|
|
58
62
|
if (state().config.printConsoleTrace) {
|
|
59
63
|
buffer.forEach(([buffer2, origin]) => {
|
|
60
64
|
sendLog(type, taskId, String(buffer2), buffer2.length, origin);
|
|
@@ -65,10 +69,11 @@ function createCustomConsole(defaultState) {
|
|
|
65
69
|
}
|
|
66
70
|
const timer = timers.get(taskId);
|
|
67
71
|
buffers.set(taskId, []);
|
|
68
|
-
if (type === "stderr")
|
|
72
|
+
if (type === "stderr") {
|
|
69
73
|
timer.stderrTime = 0;
|
|
70
|
-
else
|
|
74
|
+
} else {
|
|
71
75
|
timer.stdoutTime = 0;
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
function sendLog(type, taskId, content, size, origin) {
|
|
74
79
|
const timer = timers.get(taskId);
|
|
@@ -91,7 +96,11 @@ function createCustomConsole(defaultState) {
|
|
|
91
96
|
if (timer) {
|
|
92
97
|
timer.stdoutTime = timer.stdoutTime || RealDate.now();
|
|
93
98
|
} else {
|
|
94
|
-
timer = {
|
|
99
|
+
timer = {
|
|
100
|
+
stdoutTime: RealDate.now(),
|
|
101
|
+
stderrTime: RealDate.now(),
|
|
102
|
+
timer: 0
|
|
103
|
+
};
|
|
95
104
|
timers.set(id, timer);
|
|
96
105
|
}
|
|
97
106
|
let buffer = stdoutBuffer.get(id);
|
|
@@ -122,7 +131,11 @@ function createCustomConsole(defaultState) {
|
|
|
122
131
|
if (timer) {
|
|
123
132
|
timer.stderrTime = timer.stderrTime || RealDate.now();
|
|
124
133
|
} else {
|
|
125
|
-
timer = {
|
|
134
|
+
timer = {
|
|
135
|
+
stderrTime: RealDate.now(),
|
|
136
|
+
stdoutTime: RealDate.now(),
|
|
137
|
+
timer: 0
|
|
138
|
+
};
|
|
126
139
|
timers.set(id, timer);
|
|
127
140
|
}
|
|
128
141
|
let buffer = stderrBuffer.get(id);
|
|
@@ -135,7 +148,9 @@ function createCustomConsole(defaultState) {
|
|
|
135
148
|
Error.stackTraceLimit = limit + 6;
|
|
136
149
|
const stack = (_e = new Error("STACK_TRACE").stack) == null ? void 0 : _e.split("\n");
|
|
137
150
|
Error.stackTraceLimit = limit;
|
|
138
|
-
const isTrace = stack == null ? void 0 : stack.some(
|
|
151
|
+
const isTrace = stack == null ? void 0 : stack.some(
|
|
152
|
+
(line) => line.includes("at Console.trace")
|
|
153
|
+
);
|
|
139
154
|
if (isTrace) {
|
|
140
155
|
buffer.push([data, void 0]);
|
|
141
156
|
} else {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
|
-
import { startTests } from '@vitest/runner';
|
|
2
|
+
import { startTests, collectTests } from '@vitest/runner';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import '@vitest/runner/utils';
|
|
5
5
|
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
6
6
|
import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
|
|
7
|
-
import '../vendor/env.
|
|
8
|
-
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.
|
|
9
|
-
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.
|
|
10
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.
|
|
7
|
+
import '../vendor/env.2ltrQNq0.js';
|
|
8
|
+
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.DXACdGTu.js';
|
|
9
|
+
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.BhYSDdTT.js';
|
|
10
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.CROIsoiT.js';
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
12
|
import util from 'node:util';
|
|
13
13
|
import timers from 'node:timers';
|
|
14
14
|
import { isatty } from 'node:tty';
|
|
15
15
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
16
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
17
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
16
|
+
import { V as VitestIndex } from '../vendor/index.Hqvcg1pf.js';
|
|
17
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.yHaxjRhz.js';
|
|
18
18
|
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import 'chai';
|
|
@@ -22,17 +22,18 @@ import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
|
22
22
|
import '@vitest/expect';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
24
|
import '@vitest/utils/error';
|
|
25
|
-
import '../vendor/tasks.
|
|
25
|
+
import '../vendor/tasks.DhVtQBtW.js';
|
|
26
26
|
import '@vitest/utils/source-map';
|
|
27
|
-
import '../vendor/base.
|
|
28
|
-
import '../vendor/date.
|
|
27
|
+
import '../vendor/base.CTYV4Gnz.js';
|
|
28
|
+
import '../vendor/date.W2xKR2qe.js';
|
|
29
29
|
import '@vitest/spy';
|
|
30
30
|
import '../path.js';
|
|
31
31
|
import 'node:url';
|
|
32
|
-
import '../vendor/rpc.
|
|
32
|
+
import '../vendor/rpc.BGx7q_k2.js';
|
|
33
33
|
import '../vendor/index.BpSiYbpB.js';
|
|
34
|
-
import '../vendor/benchmark.
|
|
35
|
-
import '../vendor/index.
|
|
34
|
+
import '../vendor/benchmark.B6pblCp2.js';
|
|
35
|
+
import '../vendor/index.BJmtb_7W.js';
|
|
36
|
+
import '../vendor/run-once.Db8Hgq9X.js';
|
|
36
37
|
|
|
37
38
|
let globalSetup = false;
|
|
38
39
|
async function setupGlobalEnv(config, { environment }, executor) {
|
|
@@ -42,10 +43,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
42
43
|
enumerable: false
|
|
43
44
|
});
|
|
44
45
|
const state = getWorkerState();
|
|
45
|
-
if (!state.config.snapshotOptions.snapshotEnvironment)
|
|
46
|
+
if (!state.config.snapshotOptions.snapshotEnvironment) {
|
|
46
47
|
state.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, executor);
|
|
47
|
-
|
|
48
|
+
}
|
|
49
|
+
if (globalSetup) {
|
|
48
50
|
return;
|
|
51
|
+
}
|
|
49
52
|
globalSetup = true;
|
|
50
53
|
setupColors(createColors(isatty(1)));
|
|
51
54
|
if (environment.transformMode === "web") {
|
|
@@ -65,11 +68,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
65
68
|
installSourcemapsSupport({
|
|
66
69
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
67
70
|
});
|
|
68
|
-
if (!config.disableConsoleIntercept)
|
|
71
|
+
if (!config.disableConsoleIntercept) {
|
|
69
72
|
await setupConsoleLogSpy();
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
async function setupConsoleLogSpy() {
|
|
72
|
-
const { createCustomConsole } = await import('./runtime-console.
|
|
76
|
+
const { createCustomConsole } = await import('./runtime-console.O41g23Zj.js');
|
|
73
77
|
globalThis.console = createCustomConsole();
|
|
74
78
|
}
|
|
75
79
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -87,12 +91,13 @@ async function withEnv({ environment }, options, fn) {
|
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
90
|
-
async function run(files, config, environment, executor) {
|
|
94
|
+
async function run(method, files, config, environment, executor) {
|
|
91
95
|
const workerState = getWorkerState();
|
|
92
96
|
await setupGlobalEnv(config, environment, executor);
|
|
93
97
|
await startCoverageInsideWorker(config.coverage, executor);
|
|
94
|
-
if (config.chaiConfig)
|
|
98
|
+
if (config.chaiConfig) {
|
|
95
99
|
setupChaiConfig(config.chaiConfig);
|
|
100
|
+
}
|
|
96
101
|
const runner = await resolveTestRunner(config, executor);
|
|
97
102
|
workerState.onCancel.then((reason) => {
|
|
98
103
|
var _a;
|
|
@@ -101,23 +106,31 @@ async function run(files, config, environment, executor) {
|
|
|
101
106
|
});
|
|
102
107
|
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
|
|
103
108
|
workerState.durations.environment = performance.now();
|
|
104
|
-
await withEnv(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
await withEnv(
|
|
110
|
+
environment,
|
|
111
|
+
environment.options || config.environmentOptions || {},
|
|
112
|
+
async () => {
|
|
113
|
+
var _a, _b, _c, _d;
|
|
114
|
+
workerState.durations.environment = performance.now() - workerState.durations.environment;
|
|
115
|
+
for (const file of files) {
|
|
116
|
+
const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
|
|
117
|
+
const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
|
|
118
|
+
if (isIsolatedThreads || isIsolatedForks) {
|
|
119
|
+
workerState.mockMap.clear();
|
|
120
|
+
resetModules(workerState.moduleCache, true);
|
|
121
|
+
}
|
|
122
|
+
workerState.filepath = file;
|
|
123
|
+
if (method === "run") {
|
|
124
|
+
await startTests([file], runner);
|
|
125
|
+
} else {
|
|
126
|
+
await collectTests([file], runner);
|
|
127
|
+
}
|
|
128
|
+
vi.resetConfig();
|
|
129
|
+
vi.restoreAllMocks();
|
|
113
130
|
}
|
|
114
|
-
|
|
115
|
-
await startTests([file], runner);
|
|
116
|
-
vi.resetConfig();
|
|
117
|
-
vi.restoreAllMocks();
|
|
131
|
+
await stopCoverageInsideWorker(config.coverage, executor);
|
|
118
132
|
}
|
|
119
|
-
|
|
120
|
-
});
|
|
133
|
+
);
|
|
121
134
|
workerState.environmentTeardownRun = true;
|
|
122
135
|
}
|
|
123
136
|
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as createCLI } from './vendor/cac.
|
|
1
|
+
import { c as createCLI } from './vendor/cac.5nBDv26-.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'picocolors';
|
|
5
|
-
import './vendor/base.
|
|
5
|
+
import './vendor/base.CTYV4Gnz.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import './vendor/constants.
|
|
7
|
+
import './vendor/constants.CsnA4eRy.js';
|
|
8
8
|
|
|
9
9
|
createCLI().parse();
|
package/dist/config.cjs
CHANGED
|
@@ -4,16 +4,34 @@ var os = require('node:os');
|
|
|
4
4
|
var stdEnv = require('std-env');
|
|
5
5
|
var vite = require('vite');
|
|
6
6
|
|
|
7
|
-
var _a$1;
|
|
7
|
+
var _a$1, _b$1;
|
|
8
8
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
|
|
9
|
-
|
|
9
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && ((_b$1 = process.versions) == null ? void 0 : _b$1.deno) !== void 0;
|
|
10
|
+
(isNode || isDeno) && process.platform === "win32";
|
|
11
|
+
|
|
12
|
+
const defaultBrowserPort = 63315;
|
|
13
|
+
const extraInlineDeps = [
|
|
14
|
+
/^(?!.*node_modules).*\.mjs$/,
|
|
15
|
+
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
16
|
+
// Vite client
|
|
17
|
+
/vite\w*\/dist\/client\/env.mjs/,
|
|
18
|
+
// Nuxt
|
|
19
|
+
"@nuxt/test-utils"
|
|
20
|
+
];
|
|
10
21
|
|
|
11
22
|
var _a, _b;
|
|
12
23
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
13
|
-
const defaultExclude = [
|
|
24
|
+
const defaultExclude = [
|
|
25
|
+
"**/node_modules/**",
|
|
26
|
+
"**/dist/**",
|
|
27
|
+
"**/cypress/**",
|
|
28
|
+
"**/.{idea,git,cache,output,temp}/**",
|
|
29
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
|
|
30
|
+
];
|
|
14
31
|
const defaultCoverageExcludes = [
|
|
15
32
|
"coverage/**",
|
|
16
33
|
"dist/**",
|
|
34
|
+
"**/node_modules/**",
|
|
17
35
|
"**/[.]**",
|
|
18
36
|
"packages/*/test?(s)/**",
|
|
19
37
|
"**/*.d.ts",
|
|
@@ -23,9 +41,9 @@ const defaultCoverageExcludes = [
|
|
|
23
41
|
"cypress/**",
|
|
24
42
|
"test?(s)/**",
|
|
25
43
|
"test?(-*).?(c|m)[jt]s?(x)",
|
|
26
|
-
"**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)",
|
|
44
|
+
"**/*{.,-}{test,spec,bench,benchmark}?(-d).?(c|m)[jt]s?(x)",
|
|
27
45
|
"**/__tests__/**",
|
|
28
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
|
|
46
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
|
|
29
47
|
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
30
48
|
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
31
49
|
];
|
|
@@ -38,11 +56,31 @@ const coverageConfigDefaults = {
|
|
|
38
56
|
reportsDirectory: "./coverage",
|
|
39
57
|
exclude: defaultCoverageExcludes,
|
|
40
58
|
reportOnFailure: false,
|
|
41
|
-
reporter: [
|
|
42
|
-
|
|
59
|
+
reporter: [
|
|
60
|
+
["text", {}],
|
|
61
|
+
["html", {}],
|
|
62
|
+
["clover", {}],
|
|
63
|
+
["json", {}]
|
|
64
|
+
],
|
|
65
|
+
extension: [
|
|
66
|
+
".js",
|
|
67
|
+
".cjs",
|
|
68
|
+
".mjs",
|
|
69
|
+
".ts",
|
|
70
|
+
".mts",
|
|
71
|
+
".cts",
|
|
72
|
+
".tsx",
|
|
73
|
+
".jsx",
|
|
74
|
+
".vue",
|
|
75
|
+
".svelte",
|
|
76
|
+
".marko"
|
|
77
|
+
],
|
|
43
78
|
allowExternal: false,
|
|
44
79
|
ignoreEmptyLines: true,
|
|
45
|
-
processingConcurrency: Math.min(
|
|
80
|
+
processingConcurrency: Math.min(
|
|
81
|
+
20,
|
|
82
|
+
((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length
|
|
83
|
+
)
|
|
46
84
|
};
|
|
47
85
|
const fakeTimersDefaults = {
|
|
48
86
|
loopLimit: 1e4,
|
|
@@ -69,13 +107,8 @@ const config = {
|
|
|
69
107
|
mockReset: false,
|
|
70
108
|
include: defaultInclude,
|
|
71
109
|
exclude: defaultExclude,
|
|
72
|
-
testTimeout: 5e3,
|
|
73
|
-
hookTimeout: 1e4,
|
|
74
110
|
teardownTimeout: 1e4,
|
|
75
|
-
forceRerunTriggers: [
|
|
76
|
-
"**/package.json/**",
|
|
77
|
-
"**/{vitest,vite}.config.*/**"
|
|
78
|
-
],
|
|
111
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
79
112
|
update: false,
|
|
80
113
|
reporters: [],
|
|
81
114
|
silent: false,
|
|
@@ -101,15 +134,6 @@ const config = {
|
|
|
101
134
|
};
|
|
102
135
|
const configDefaults = Object.freeze(config);
|
|
103
136
|
|
|
104
|
-
const extraInlineDeps = [
|
|
105
|
-
/^(?!.*node_modules).*\.mjs$/,
|
|
106
|
-
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
107
|
-
// Vite client
|
|
108
|
-
/vite\w*\/dist\/client\/env.mjs/,
|
|
109
|
-
// Nuxt
|
|
110
|
-
"@nuxt/test-utils"
|
|
111
|
-
];
|
|
112
|
-
|
|
113
137
|
function defineConfig(config) {
|
|
114
138
|
return config;
|
|
115
139
|
}
|
|
@@ -126,6 +150,7 @@ Object.defineProperty(exports, "mergeConfig", {
|
|
|
126
150
|
});
|
|
127
151
|
exports.configDefaults = configDefaults;
|
|
128
152
|
exports.coverageConfigDefaults = coverageConfigDefaults;
|
|
153
|
+
exports.defaultBrowserPort = defaultBrowserPort;
|
|
129
154
|
exports.defaultExclude = defaultExclude;
|
|
130
155
|
exports.defaultInclude = defaultInclude;
|
|
131
156
|
exports.defineConfig = defineConfig;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ConfigEnv, Plugin, UserConfig, mergeConfig } from 'vite';
|
|
2
|
-
export {
|
|
2
|
+
export { aO as UserConfigExport, aN as UserConfigFn, aL as UserConfigFnObject, aM as UserConfigFnPromise, aQ as UserProjectConfigExport, aP as UserProjectConfigFn, K as UserWorkspaceConfig, aV as configDefaults, aY as coverageConfigDefaults, aU as defaultBrowserPort, aX as defaultExclude, aW as defaultInclude, aR as defineConfig, aS as defineProject, aT as defineWorkspace, aZ as extraInlineDeps } from './reporters-DrhyxxXt.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
5
5
|
import '@vitest/snapshot';
|
|
@@ -12,5 +12,6 @@ import 'vite-node/client';
|
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
+
import '@vitest/utils/source-map';
|
|
15
16
|
import 'node:fs';
|
|
16
17
|
import 'chai';
|
package/dist/config.js
CHANGED
|
@@ -2,16 +2,34 @@ import os from 'node:os';
|
|
|
2
2
|
import { isCI } from 'std-env';
|
|
3
3
|
export { mergeConfig } from 'vite';
|
|
4
4
|
|
|
5
|
-
var _a$1;
|
|
5
|
+
var _a$1, _b$1;
|
|
6
6
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
|
|
7
|
-
|
|
7
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && ((_b$1 = process.versions) == null ? void 0 : _b$1.deno) !== void 0;
|
|
8
|
+
(isNode || isDeno) && process.platform === "win32";
|
|
9
|
+
|
|
10
|
+
const defaultBrowserPort = 63315;
|
|
11
|
+
const extraInlineDeps = [
|
|
12
|
+
/^(?!.*node_modules).*\.mjs$/,
|
|
13
|
+
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
14
|
+
// Vite client
|
|
15
|
+
/vite\w*\/dist\/client\/env.mjs/,
|
|
16
|
+
// Nuxt
|
|
17
|
+
"@nuxt/test-utils"
|
|
18
|
+
];
|
|
8
19
|
|
|
9
20
|
var _a, _b;
|
|
10
21
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
11
|
-
const defaultExclude = [
|
|
22
|
+
const defaultExclude = [
|
|
23
|
+
"**/node_modules/**",
|
|
24
|
+
"**/dist/**",
|
|
25
|
+
"**/cypress/**",
|
|
26
|
+
"**/.{idea,git,cache,output,temp}/**",
|
|
27
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
|
|
28
|
+
];
|
|
12
29
|
const defaultCoverageExcludes = [
|
|
13
30
|
"coverage/**",
|
|
14
31
|
"dist/**",
|
|
32
|
+
"**/node_modules/**",
|
|
15
33
|
"**/[.]**",
|
|
16
34
|
"packages/*/test?(s)/**",
|
|
17
35
|
"**/*.d.ts",
|
|
@@ -21,9 +39,9 @@ const defaultCoverageExcludes = [
|
|
|
21
39
|
"cypress/**",
|
|
22
40
|
"test?(s)/**",
|
|
23
41
|
"test?(-*).?(c|m)[jt]s?(x)",
|
|
24
|
-
"**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)",
|
|
42
|
+
"**/*{.,-}{test,spec,bench,benchmark}?(-d).?(c|m)[jt]s?(x)",
|
|
25
43
|
"**/__tests__/**",
|
|
26
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
|
|
44
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
|
|
27
45
|
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
28
46
|
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
29
47
|
];
|
|
@@ -36,11 +54,31 @@ const coverageConfigDefaults = {
|
|
|
36
54
|
reportsDirectory: "./coverage",
|
|
37
55
|
exclude: defaultCoverageExcludes,
|
|
38
56
|
reportOnFailure: false,
|
|
39
|
-
reporter: [
|
|
40
|
-
|
|
57
|
+
reporter: [
|
|
58
|
+
["text", {}],
|
|
59
|
+
["html", {}],
|
|
60
|
+
["clover", {}],
|
|
61
|
+
["json", {}]
|
|
62
|
+
],
|
|
63
|
+
extension: [
|
|
64
|
+
".js",
|
|
65
|
+
".cjs",
|
|
66
|
+
".mjs",
|
|
67
|
+
".ts",
|
|
68
|
+
".mts",
|
|
69
|
+
".cts",
|
|
70
|
+
".tsx",
|
|
71
|
+
".jsx",
|
|
72
|
+
".vue",
|
|
73
|
+
".svelte",
|
|
74
|
+
".marko"
|
|
75
|
+
],
|
|
41
76
|
allowExternal: false,
|
|
42
77
|
ignoreEmptyLines: true,
|
|
43
|
-
processingConcurrency: Math.min(
|
|
78
|
+
processingConcurrency: Math.min(
|
|
79
|
+
20,
|
|
80
|
+
((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length
|
|
81
|
+
)
|
|
44
82
|
};
|
|
45
83
|
const fakeTimersDefaults = {
|
|
46
84
|
loopLimit: 1e4,
|
|
@@ -67,13 +105,8 @@ const config = {
|
|
|
67
105
|
mockReset: false,
|
|
68
106
|
include: defaultInclude,
|
|
69
107
|
exclude: defaultExclude,
|
|
70
|
-
testTimeout: 5e3,
|
|
71
|
-
hookTimeout: 1e4,
|
|
72
108
|
teardownTimeout: 1e4,
|
|
73
|
-
forceRerunTriggers: [
|
|
74
|
-
"**/package.json/**",
|
|
75
|
-
"**/{vitest,vite}.config.*/**"
|
|
76
|
-
],
|
|
109
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
77
110
|
update: false,
|
|
78
111
|
reporters: [],
|
|
79
112
|
silent: false,
|
|
@@ -99,15 +132,6 @@ const config = {
|
|
|
99
132
|
};
|
|
100
133
|
const configDefaults = Object.freeze(config);
|
|
101
134
|
|
|
102
|
-
const extraInlineDeps = [
|
|
103
|
-
/^(?!.*node_modules).*\.mjs$/,
|
|
104
|
-
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
105
|
-
// Vite client
|
|
106
|
-
/vite\w*\/dist\/client\/env.mjs/,
|
|
107
|
-
// Nuxt
|
|
108
|
-
"@nuxt/test-utils"
|
|
109
|
-
];
|
|
110
|
-
|
|
111
135
|
function defineConfig(config) {
|
|
112
136
|
return config;
|
|
113
137
|
}
|
|
@@ -118,4 +142,4 @@ function defineWorkspace(config) {
|
|
|
118
142
|
return config;
|
|
119
143
|
}
|
|
120
144
|
|
|
121
|
-
export { configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };
|
|
145
|
+
export { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-
|
|
1
|
+
import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-DrhyxxXt.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -12,6 +12,7 @@ import 'vite-node/client';
|
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
+
import '@vitest/utils/source-map';
|
|
15
16
|
import 'node:fs';
|
|
16
17
|
import 'chai';
|
|
17
18
|
|
|
@@ -129,7 +130,7 @@ declare class BaseCoverageProvider {
|
|
|
129
130
|
/**
|
|
130
131
|
* Check if current coverage is above configured thresholds and bump the thresholds if needed
|
|
131
132
|
*/
|
|
132
|
-
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate }: {
|
|
133
|
+
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate, }: {
|
|
133
134
|
thresholds: ResolvedThreshold[];
|
|
134
135
|
perFile?: boolean;
|
|
135
136
|
configurationFile: unknown;
|
|
@@ -138,16 +139,17 @@ declare class BaseCoverageProvider {
|
|
|
138
139
|
/**
|
|
139
140
|
* Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
|
|
140
141
|
*/
|
|
141
|
-
checkThresholds({ thresholds: allThresholds, perFile }: {
|
|
142
|
+
checkThresholds({ thresholds: allThresholds, perFile, onError, }: {
|
|
142
143
|
thresholds: ResolvedThreshold[];
|
|
143
144
|
perFile?: boolean;
|
|
145
|
+
onError: (error: string) => void;
|
|
144
146
|
}): void;
|
|
145
147
|
/**
|
|
146
148
|
* Constructs collected coverage and users' threshold options into separate sets
|
|
147
149
|
* where each threshold set holds their own coverage maps. Threshold set is either
|
|
148
150
|
* for specific files defined by glob pattern or global for all other files.
|
|
149
151
|
*/
|
|
150
|
-
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }: {
|
|
152
|
+
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root, }: {
|
|
151
153
|
coverageMap: CoverageMap;
|
|
152
154
|
thresholds: NonNullable<BaseCoverageOptions['thresholds']>;
|
|
153
155
|
createCoverageMap: () => CoverageMap;
|