vitest 2.0.0-beta.10 → 2.0.0-beta.12
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/dist/browser.d.ts +1 -1
- package/dist/browser.js +3 -3
- package/dist/chunks/browser-creator.Bw94IHrL.js +673 -0
- package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
- package/dist/chunks/{integrations-globals.C6Ah-pUW.js → integrations-globals.DSNOaUHv.js} +10 -10
- 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.Cukyr5-I.js → runtime-runBaseTests.BDt9gQFB.js} +41 -33
- package/dist/cli.js +3 -3
- package/dist/config.cjs +45 -21
- package/dist/config.d.ts +1 -1
- package/dist/config.js +45 -22
- package/dist/coverage.d.ts +5 -4
- package/dist/coverage.js +100 -37
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +37 -11
- package/dist/index.js +10 -10
- package/dist/node.d.ts +20 -7
- package/dist/node.js +29 -20
- package/dist/path.js +4 -1
- package/dist/{reporters-CYVC6LOl.d.ts → reporters-Cd1vkLMZ.d.ts} +134 -182
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +99 -61
- package/dist/snapshot.js +2 -2
- package/dist/{suite-Dpu9EC_k.d.ts → suite-BS2CV79a.d.ts} +1 -1
- package/dist/suite.d.ts +2 -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.Dln9yllP.js → base.Cy97mmVC.js} +4 -3
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
- package/dist/vendor/{cac.CtYFkoSJ.js → cac.DRNUX42m.js} +82 -38
- package/dist/vendor/{cli-api.CUtJc4r3.js → cli-api.Bu-PSdzx.js} +5908 -13271
- package/dist/vendor/{constants.TCjCaw2D.js → constants.BWsVtsAj.js} +5 -22
- 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.T3gg2ZK6.js} +174 -60
- package/dist/vendor/{index.B5SKBLvV.js → index.B7pSlOSa.js} +18 -10
- package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
- package/dist/vendor/{index.CThipSqB.js → index.BMmMjLIQ.js} +2540 -2540
- package/dist/vendor/{index.kpsSqFiz.js → index.D4nqnQWz.js} +69 -73
- package/dist/vendor/index.D6GZqexG.js +6575 -0
- package/dist/vendor/{index.D3hs2WiI.js → index.Hqvcg1pf.js} +3 -3
- package/dist/vendor/{index.BOMEjpjj.js → index.ZtQtNPP2.js} +962 -471
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
- package/dist/vendor/{setup-common.DAu7t7mY.js → setup-common.CWnv_2-5.js} +30 -15
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.YuQ3LT2a.js → utils.DSO2UK15.js} +40 -25
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.hATFzZbX.js → vi.DXACdGTu.js} +267 -138
- package/dist/vendor/{vm.Ow-X2mkS.js → vm.D9wVR14y.js} +152 -87
- package/dist/worker.js +31 -15
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +15 -14
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +7 -7
- package/dist/workers/vmThreads.js +7 -7
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +10 -10
- package/package.json +11 -11
- package/suppress-warnings.cjs +1 -4
- package/dist/vendor/env.bmJgw1qP.js +0 -7
|
@@ -1,25 +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.BWsVtsAj.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/run-once.
|
|
13
|
-
import '../vendor/vi.
|
|
12
|
+
import '../vendor/run-once.Db8Hgq9X.js';
|
|
13
|
+
import '../vendor/vi.DXACdGTu.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
16
16
|
import '@vitest/expect';
|
|
17
17
|
import '@vitest/snapshot';
|
|
18
18
|
import '@vitest/utils/error';
|
|
19
|
-
import '../vendor/tasks.
|
|
19
|
+
import '../vendor/tasks.DhVtQBtW.js';
|
|
20
20
|
import '@vitest/utils/source-map';
|
|
21
|
-
import '../vendor/base.
|
|
22
|
-
import '../vendor/date.
|
|
21
|
+
import '../vendor/base.CTYV4Gnz.js';
|
|
22
|
+
import '../vendor/date.W2xKR2qe.js';
|
|
23
23
|
import '@vitest/spy';
|
|
24
24
|
|
|
25
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 {
|
|
@@ -4,17 +4,17 @@ 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.B7pSlOSa.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.CWnv_2-5.js';
|
|
18
18
|
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import 'chai';
|
|
@@ -22,18 +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.
|
|
36
|
-
import '../vendor/run-once.
|
|
34
|
+
import '../vendor/benchmark.B6pblCp2.js';
|
|
35
|
+
import '../vendor/index.BJmtb_7W.js';
|
|
36
|
+
import '../vendor/run-once.Db8Hgq9X.js';
|
|
37
37
|
|
|
38
38
|
let globalSetup = false;
|
|
39
39
|
async function setupGlobalEnv(config, { environment }, executor) {
|
|
@@ -43,10 +43,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
43
43
|
enumerable: false
|
|
44
44
|
});
|
|
45
45
|
const state = getWorkerState();
|
|
46
|
-
if (!state.config.snapshotOptions.snapshotEnvironment)
|
|
46
|
+
if (!state.config.snapshotOptions.snapshotEnvironment) {
|
|
47
47
|
state.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, executor);
|
|
48
|
-
|
|
48
|
+
}
|
|
49
|
+
if (globalSetup) {
|
|
49
50
|
return;
|
|
51
|
+
}
|
|
50
52
|
globalSetup = true;
|
|
51
53
|
setupColors(createColors(isatty(1)));
|
|
52
54
|
if (environment.transformMode === "web") {
|
|
@@ -66,11 +68,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
66
68
|
installSourcemapsSupport({
|
|
67
69
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
68
70
|
});
|
|
69
|
-
if (!config.disableConsoleIntercept)
|
|
71
|
+
if (!config.disableConsoleIntercept) {
|
|
70
72
|
await setupConsoleLogSpy();
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
async function setupConsoleLogSpy() {
|
|
73
|
-
const { createCustomConsole } = await import('./runtime-console.
|
|
76
|
+
const { createCustomConsole } = await import('./runtime-console.O41g23Zj.js');
|
|
74
77
|
globalThis.console = createCustomConsole();
|
|
75
78
|
}
|
|
76
79
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -92,8 +95,9 @@ async function run(files, config, environment, executor) {
|
|
|
92
95
|
const workerState = getWorkerState();
|
|
93
96
|
await setupGlobalEnv(config, environment, executor);
|
|
94
97
|
await startCoverageInsideWorker(config.coverage, executor);
|
|
95
|
-
if (config.chaiConfig)
|
|
98
|
+
if (config.chaiConfig) {
|
|
96
99
|
setupChaiConfig(config.chaiConfig);
|
|
100
|
+
}
|
|
97
101
|
const runner = await resolveTestRunner(config, executor);
|
|
98
102
|
workerState.onCancel.then((reason) => {
|
|
99
103
|
var _a;
|
|
@@ -102,23 +106,27 @@ async function run(files, config, environment, executor) {
|
|
|
102
106
|
});
|
|
103
107
|
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
|
|
104
108
|
workerState.durations.environment = performance.now();
|
|
105
|
-
await withEnv(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
await startTests([file], runner);
|
|
124
|
+
vi.resetConfig();
|
|
125
|
+
vi.restoreAllMocks();
|
|
114
126
|
}
|
|
115
|
-
|
|
116
|
-
await startTests([file], runner);
|
|
117
|
-
vi.resetConfig();
|
|
118
|
-
vi.restoreAllMocks();
|
|
127
|
+
await stopCoverageInsideWorker(config.coverage, executor);
|
|
119
128
|
}
|
|
120
|
-
|
|
121
|
-
});
|
|
129
|
+
);
|
|
122
130
|
workerState.environmentTeardownRun = true;
|
|
123
131
|
}
|
|
124
132
|
|
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.DRNUX42m.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.BWsVtsAj.js';
|
|
8
8
|
|
|
9
9
|
createCLI().parse();
|
package/dist/config.cjs
CHANGED
|
@@ -4,13 +4,30 @@ 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/**",
|
|
@@ -38,11 +55,31 @@ const coverageConfigDefaults = {
|
|
|
38
55
|
reportsDirectory: "./coverage",
|
|
39
56
|
exclude: defaultCoverageExcludes,
|
|
40
57
|
reportOnFailure: false,
|
|
41
|
-
reporter: [
|
|
42
|
-
|
|
58
|
+
reporter: [
|
|
59
|
+
["text", {}],
|
|
60
|
+
["html", {}],
|
|
61
|
+
["clover", {}],
|
|
62
|
+
["json", {}]
|
|
63
|
+
],
|
|
64
|
+
extension: [
|
|
65
|
+
".js",
|
|
66
|
+
".cjs",
|
|
67
|
+
".mjs",
|
|
68
|
+
".ts",
|
|
69
|
+
".mts",
|
|
70
|
+
".cts",
|
|
71
|
+
".tsx",
|
|
72
|
+
".jsx",
|
|
73
|
+
".vue",
|
|
74
|
+
".svelte",
|
|
75
|
+
".marko"
|
|
76
|
+
],
|
|
43
77
|
allowExternal: false,
|
|
44
78
|
ignoreEmptyLines: true,
|
|
45
|
-
processingConcurrency: Math.min(
|
|
79
|
+
processingConcurrency: Math.min(
|
|
80
|
+
20,
|
|
81
|
+
((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length
|
|
82
|
+
)
|
|
46
83
|
};
|
|
47
84
|
const fakeTimersDefaults = {
|
|
48
85
|
loopLimit: 1e4,
|
|
@@ -69,13 +106,8 @@ const config = {
|
|
|
69
106
|
mockReset: false,
|
|
70
107
|
include: defaultInclude,
|
|
71
108
|
exclude: defaultExclude,
|
|
72
|
-
testTimeout: 5e3,
|
|
73
|
-
hookTimeout: 1e4,
|
|
74
109
|
teardownTimeout: 1e4,
|
|
75
|
-
forceRerunTriggers: [
|
|
76
|
-
"**/package.json/**",
|
|
77
|
-
"**/{vitest,vite}.config.*/**"
|
|
78
|
-
],
|
|
110
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
79
111
|
update: false,
|
|
80
112
|
reporters: [],
|
|
81
113
|
silent: false,
|
|
@@ -101,15 +133,6 @@ const config = {
|
|
|
101
133
|
};
|
|
102
134
|
const configDefaults = Object.freeze(config);
|
|
103
135
|
|
|
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
136
|
function defineConfig(config) {
|
|
114
137
|
return config;
|
|
115
138
|
}
|
|
@@ -126,6 +149,7 @@ Object.defineProperty(exports, "mergeConfig", {
|
|
|
126
149
|
});
|
|
127
150
|
exports.configDefaults = configDefaults;
|
|
128
151
|
exports.coverageConfigDefaults = coverageConfigDefaults;
|
|
152
|
+
exports.defaultBrowserPort = defaultBrowserPort;
|
|
129
153
|
exports.defaultExclude = defaultExclude;
|
|
130
154
|
exports.defaultInclude = defaultInclude;
|
|
131
155
|
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-Cd1vkLMZ.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
5
5
|
import '@vitest/snapshot';
|
package/dist/config.js
CHANGED
|
@@ -2,13 +2,30 @@ 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/**",
|
|
@@ -36,11 +53,31 @@ const coverageConfigDefaults = {
|
|
|
36
53
|
reportsDirectory: "./coverage",
|
|
37
54
|
exclude: defaultCoverageExcludes,
|
|
38
55
|
reportOnFailure: false,
|
|
39
|
-
reporter: [
|
|
40
|
-
|
|
56
|
+
reporter: [
|
|
57
|
+
["text", {}],
|
|
58
|
+
["html", {}],
|
|
59
|
+
["clover", {}],
|
|
60
|
+
["json", {}]
|
|
61
|
+
],
|
|
62
|
+
extension: [
|
|
63
|
+
".js",
|
|
64
|
+
".cjs",
|
|
65
|
+
".mjs",
|
|
66
|
+
".ts",
|
|
67
|
+
".mts",
|
|
68
|
+
".cts",
|
|
69
|
+
".tsx",
|
|
70
|
+
".jsx",
|
|
71
|
+
".vue",
|
|
72
|
+
".svelte",
|
|
73
|
+
".marko"
|
|
74
|
+
],
|
|
41
75
|
allowExternal: false,
|
|
42
76
|
ignoreEmptyLines: true,
|
|
43
|
-
processingConcurrency: Math.min(
|
|
77
|
+
processingConcurrency: Math.min(
|
|
78
|
+
20,
|
|
79
|
+
((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length
|
|
80
|
+
)
|
|
44
81
|
};
|
|
45
82
|
const fakeTimersDefaults = {
|
|
46
83
|
loopLimit: 1e4,
|
|
@@ -67,13 +104,8 @@ const config = {
|
|
|
67
104
|
mockReset: false,
|
|
68
105
|
include: defaultInclude,
|
|
69
106
|
exclude: defaultExclude,
|
|
70
|
-
testTimeout: 5e3,
|
|
71
|
-
hookTimeout: 1e4,
|
|
72
107
|
teardownTimeout: 1e4,
|
|
73
|
-
forceRerunTriggers: [
|
|
74
|
-
"**/package.json/**",
|
|
75
|
-
"**/{vitest,vite}.config.*/**"
|
|
76
|
-
],
|
|
108
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
77
109
|
update: false,
|
|
78
110
|
reporters: [],
|
|
79
111
|
silent: false,
|
|
@@ -99,15 +131,6 @@ const config = {
|
|
|
99
131
|
};
|
|
100
132
|
const configDefaults = Object.freeze(config);
|
|
101
133
|
|
|
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
134
|
function defineConfig(config) {
|
|
112
135
|
return config;
|
|
113
136
|
}
|
|
@@ -118,4 +141,4 @@ function defineWorkspace(config) {
|
|
|
118
141
|
return config;
|
|
119
142
|
}
|
|
120
143
|
|
|
121
|
-
export { configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };
|
|
144
|
+
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-Cd1vkLMZ.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -129,7 +129,7 @@ declare class BaseCoverageProvider {
|
|
|
129
129
|
/**
|
|
130
130
|
* Check if current coverage is above configured thresholds and bump the thresholds if needed
|
|
131
131
|
*/
|
|
132
|
-
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate }: {
|
|
132
|
+
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate, }: {
|
|
133
133
|
thresholds: ResolvedThreshold[];
|
|
134
134
|
perFile?: boolean;
|
|
135
135
|
configurationFile: unknown;
|
|
@@ -138,16 +138,17 @@ declare class BaseCoverageProvider {
|
|
|
138
138
|
/**
|
|
139
139
|
* Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
|
|
140
140
|
*/
|
|
141
|
-
checkThresholds({ thresholds: allThresholds, perFile }: {
|
|
141
|
+
checkThresholds({ thresholds: allThresholds, perFile, onError, }: {
|
|
142
142
|
thresholds: ResolvedThreshold[];
|
|
143
143
|
perFile?: boolean;
|
|
144
|
+
onError: (error: string) => void;
|
|
144
145
|
}): void;
|
|
145
146
|
/**
|
|
146
147
|
* Constructs collected coverage and users' threshold options into separate sets
|
|
147
148
|
* where each threshold set holds their own coverage maps. Threshold set is either
|
|
148
149
|
* for specific files defined by glob pattern or global for all other files.
|
|
149
150
|
*/
|
|
150
|
-
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }: {
|
|
151
|
+
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root, }: {
|
|
151
152
|
coverageMap: CoverageMap;
|
|
152
153
|
thresholds: NonNullable<BaseCoverageOptions['thresholds']>;
|
|
153
154
|
createCoverageMap: () => CoverageMap;
|