vitest 2.0.0-beta.1 → 2.0.0-beta.10
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 -1
- package/dist/browser.d.ts +22 -2
- package/dist/browser.js +3 -1
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.C6Ah-pUW.js} +3 -3
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.DiVMr5d4.js} +54 -24
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.Cukyr5-I.js} +5 -5
- package/dist/cli.js +2 -2
- package/dist/config.cjs +3 -3
- package/dist/config.d.ts +2 -2
- package/dist/config.js +3 -3
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +33 -7
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +11 -47
- package/dist/index.js +3 -3
- package/dist/node.d.ts +7 -7
- package/dist/node.js +12 -10
- package/dist/{reporters-MGvT5U9f.d.ts → reporters-CYVC6LOl.d.ts} +424 -201
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +9 -1
- package/dist/{suite-8WAe-urM.d.ts → suite-Dpu9EC_k.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.VFkIJ66g.js → base.Dln9yllP.js} +2 -2
- package/dist/vendor/{cac.DzKZaJu2.js → cac.CtYFkoSJ.js} +65 -23
- package/dist/vendor/{cli-api.DTeni0Qq.js → cli-api.CUtJc4r3.js} +2425 -549
- package/dist/vendor/{constants.5SOfHUj0.js → constants.TCjCaw2D.js} +4 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.BHj6OMh4.js} +3 -3
- package/dist/vendor/{index.BfoZyXD1.js → index.B5SKBLvV.js} +1 -1
- package/dist/vendor/{index.CRxYS9H3.js → index.BOMEjpjj.js} +271 -52
- package/dist/vendor/{index.DP-km6lF.js → index.CThipSqB.js} +2537 -2524
- package/dist/vendor/{index.CmILuxzC.js → index.D3hs2WiI.js} +1 -1
- package/dist/vendor/{index.DeR1hhfY.js → index.kpsSqFiz.js} +2 -1
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.DAu7t7mY.js} +1 -1
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{utils.D5gGkwyH.js → utils.YuQ3LT2a.js} +1 -1
- package/dist/vendor/{vi.ClD3hi7L.js → vi.hATFzZbX.js} +101 -46
- package/dist/vendor/{vm.Bi3bljci.js → vm.Ow-X2mkS.js} +2 -2
- package/dist/worker.js +1 -1
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +5 -5
- package/package.json +20 -20
- package/suppress-warnings.cjs +2 -1
package/LICENSE.md
CHANGED
|
@@ -312,7 +312,7 @@ Repository: micromatch/braces
|
|
|
312
312
|
|
|
313
313
|
> The MIT License (MIT)
|
|
314
314
|
>
|
|
315
|
-
> Copyright (c) 2014-
|
|
315
|
+
> Copyright (c) 2014-present, Jon Schlinkert.
|
|
316
316
|
>
|
|
317
317
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
318
318
|
> of this software and associated documentation files (the "Software"), to deal
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { processError, startTests } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-CYVC6LOl.js';
|
|
3
3
|
import { VitestExecutor } from './execute.js';
|
|
4
|
+
import * as spy$1 from '@vitest/spy';
|
|
4
5
|
import 'vite';
|
|
5
6
|
import 'vite-node';
|
|
6
7
|
import '@vitest/snapshot';
|
|
@@ -17,6 +18,25 @@ import 'node:fs';
|
|
|
17
18
|
import 'chai';
|
|
18
19
|
import 'node:vm';
|
|
19
20
|
|
|
21
|
+
function _mergeNamespaces(n, m) {
|
|
22
|
+
m.forEach(function (e) {
|
|
23
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default' && !(k in n)) {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return Object.freeze(n);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var spy = /*#__PURE__*/_mergeNamespaces({
|
|
37
|
+
__proto__: null
|
|
38
|
+
}, [spy$1]);
|
|
39
|
+
|
|
20
40
|
type Formatter = (input: string | number | null | undefined) => string;
|
|
21
41
|
|
|
22
42
|
interface DiffOptions {
|
|
@@ -57,4 +77,4 @@ declare function startCoverageInsideWorker(options: CoverageOptions | undefined,
|
|
|
57
77
|
declare function takeCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
|
|
58
78
|
declare function stopCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
|
|
59
79
|
|
|
60
|
-
export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
|
80
|
+
export { spy as SpyModule, getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { processError, startTests } from '@vitest/runner';
|
|
2
|
-
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.
|
|
2
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.DAu7t7mY.js';
|
|
3
3
|
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.ChSqD-qS.js';
|
|
4
|
+
export { s as SpyModule } from './vendor/spy.Cf_4R5Oe.js';
|
|
4
5
|
import '@vitest/utils';
|
|
5
6
|
import '@vitest/snapshot';
|
|
6
7
|
import './vendor/run-once.DLomgGUH.js';
|
|
7
8
|
import './vendor/global.7bFbnyXl.js';
|
|
9
|
+
import '@vitest/spy';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as globalApis } from '../vendor/constants.
|
|
2
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
1
|
+
import { g as globalApis } from '../vendor/constants.TCjCaw2D.js';
|
|
2
|
+
import { V as VitestIndex } from '../vendor/index.D3hs2WiI.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import '../vendor/benchmark.BNLebNi5.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
@@ -10,7 +10,7 @@ import '../vendor/global.7bFbnyXl.js';
|
|
|
10
10
|
import '../vendor/env.bmJgw1qP.js';
|
|
11
11
|
import 'std-env';
|
|
12
12
|
import '../vendor/run-once.DLomgGUH.js';
|
|
13
|
-
import '../vendor/vi.
|
|
13
|
+
import '../vendor/vi.hATFzZbX.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
16
16
|
import '@vitest/expect';
|
|
@@ -45,36 +45,42 @@ function createCustomConsole(defaultState) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
function sendStdout(taskId) {
|
|
48
|
-
|
|
49
|
-
if (!buffer)
|
|
50
|
-
return;
|
|
51
|
-
const content = buffer.map((i) => String(i)).join("");
|
|
52
|
-
const timer = timers.get(taskId);
|
|
53
|
-
state().rpc.onUserConsoleLog({
|
|
54
|
-
type: "stdout",
|
|
55
|
-
content: content || "<empty line>",
|
|
56
|
-
taskId,
|
|
57
|
-
time: timer.stdoutTime || RealDate.now(),
|
|
58
|
-
size: buffer.length
|
|
59
|
-
});
|
|
60
|
-
stdoutBuffer.set(taskId, []);
|
|
61
|
-
timer.stdoutTime = 0;
|
|
48
|
+
sendBuffer("stdout", taskId);
|
|
62
49
|
}
|
|
63
50
|
function sendStderr(taskId) {
|
|
64
|
-
|
|
51
|
+
sendBuffer("stderr", taskId);
|
|
52
|
+
}
|
|
53
|
+
function sendBuffer(type, taskId) {
|
|
54
|
+
const buffers = type === "stdout" ? stdoutBuffer : stderrBuffer;
|
|
55
|
+
const buffer = buffers.get(taskId);
|
|
65
56
|
if (!buffer)
|
|
66
57
|
return;
|
|
67
|
-
|
|
58
|
+
if (state().config.printConsoleTrace) {
|
|
59
|
+
buffer.forEach(([buffer2, origin]) => {
|
|
60
|
+
sendLog(type, taskId, String(buffer2), buffer2.length, origin);
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
const content = buffer.map((i) => String(i[0])).join("");
|
|
64
|
+
sendLog(type, taskId, content, buffer.length);
|
|
65
|
+
}
|
|
66
|
+
const timer = timers.get(taskId);
|
|
67
|
+
buffers.set(taskId, []);
|
|
68
|
+
if (type === "stderr")
|
|
69
|
+
timer.stderrTime = 0;
|
|
70
|
+
else
|
|
71
|
+
timer.stdoutTime = 0;
|
|
72
|
+
}
|
|
73
|
+
function sendLog(type, taskId, content, size, origin) {
|
|
68
74
|
const timer = timers.get(taskId);
|
|
75
|
+
const time = type === "stderr" ? timer.stderrTime : timer.stdoutTime;
|
|
69
76
|
state().rpc.onUserConsoleLog({
|
|
70
|
-
type
|
|
77
|
+
type,
|
|
71
78
|
content: content || "<empty line>",
|
|
72
79
|
taskId,
|
|
73
|
-
time:
|
|
74
|
-
size
|
|
80
|
+
time: time || RealDate.now(),
|
|
81
|
+
size,
|
|
82
|
+
origin
|
|
75
83
|
});
|
|
76
|
-
stderrBuffer.set(taskId, []);
|
|
77
|
-
timer.stderrTime = 0;
|
|
78
84
|
}
|
|
79
85
|
const stdout = new Writable({
|
|
80
86
|
write(data, encoding, callback) {
|
|
@@ -93,14 +99,23 @@ function createCustomConsole(defaultState) {
|
|
|
93
99
|
buffer = [];
|
|
94
100
|
stdoutBuffer.set(id, buffer);
|
|
95
101
|
}
|
|
96
|
-
|
|
102
|
+
if (state().config.printConsoleTrace) {
|
|
103
|
+
const limit = Error.stackTraceLimit;
|
|
104
|
+
Error.stackTraceLimit = limit + 6;
|
|
105
|
+
const stack = new Error("STACK_TRACE").stack;
|
|
106
|
+
const trace = stack == null ? void 0 : stack.split("\n").slice(7).join("\n");
|
|
107
|
+
Error.stackTraceLimit = limit;
|
|
108
|
+
buffer.push([data, trace]);
|
|
109
|
+
} else {
|
|
110
|
+
buffer.push([data, void 0]);
|
|
111
|
+
}
|
|
97
112
|
schedule(id);
|
|
98
113
|
callback();
|
|
99
114
|
}
|
|
100
115
|
});
|
|
101
116
|
const stderr = new Writable({
|
|
102
117
|
write(data, encoding, callback) {
|
|
103
|
-
var _a, _b, _c, _d;
|
|
118
|
+
var _a, _b, _c, _d, _e;
|
|
104
119
|
const s = state();
|
|
105
120
|
const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.suite) == null ? void 0 : _c.id) || ((_d = s.current) == null ? void 0 : _d.file.id) || getTaskIdByStack(s.config.root);
|
|
106
121
|
let timer = timers.get(id);
|
|
@@ -115,7 +130,22 @@ function createCustomConsole(defaultState) {
|
|
|
115
130
|
buffer = [];
|
|
116
131
|
stderrBuffer.set(id, buffer);
|
|
117
132
|
}
|
|
118
|
-
|
|
133
|
+
if (state().config.printConsoleTrace) {
|
|
134
|
+
const limit = Error.stackTraceLimit;
|
|
135
|
+
Error.stackTraceLimit = limit + 6;
|
|
136
|
+
const stack = (_e = new Error("STACK_TRACE").stack) == null ? void 0 : _e.split("\n");
|
|
137
|
+
Error.stackTraceLimit = limit;
|
|
138
|
+
const isTrace = stack == null ? void 0 : stack.some((line) => line.includes("at Console.trace"));
|
|
139
|
+
if (isTrace) {
|
|
140
|
+
buffer.push([data, void 0]);
|
|
141
|
+
} else {
|
|
142
|
+
const trace = stack == null ? void 0 : stack.slice(7).join("\n");
|
|
143
|
+
Error.stackTraceLimit = limit;
|
|
144
|
+
buffer.push([data, trace]);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
buffer.push([data, void 0]);
|
|
148
|
+
}
|
|
119
149
|
schedule(id);
|
|
120
150
|
callback();
|
|
121
151
|
}
|
|
@@ -5,16 +5,16 @@ 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
7
|
import '../vendor/env.bmJgw1qP.js';
|
|
8
|
-
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.
|
|
8
|
+
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.hATFzZbX.js';
|
|
9
9
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.ChSqD-qS.js';
|
|
10
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.
|
|
10
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.B5SKBLvV.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.D3hs2WiI.js';
|
|
17
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.DAu7t7mY.js';
|
|
18
18
|
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import 'chai';
|
|
@@ -70,7 +70,7 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
70
70
|
await setupConsoleLogSpy();
|
|
71
71
|
}
|
|
72
72
|
async function setupConsoleLogSpy() {
|
|
73
|
-
const { createCustomConsole } = await import('./runtime-console.
|
|
73
|
+
const { createCustomConsole } = await import('./runtime-console.DiVMr5d4.js');
|
|
74
74
|
globalThis.console = createCustomConsole();
|
|
75
75
|
}
|
|
76
76
|
async function withEnv({ environment }, options, fn) {
|
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.CtYFkoSJ.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'picocolors';
|
|
5
5
|
import './vendor/base._gnK9Slw.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import './vendor/constants.
|
|
7
|
+
import './vendor/constants.TCjCaw2D.js';
|
|
8
8
|
|
|
9
9
|
createCLI().parse();
|
package/dist/config.cjs
CHANGED
|
@@ -63,7 +63,7 @@ const config = {
|
|
|
63
63
|
watch: !stdEnv.isCI,
|
|
64
64
|
globals: false,
|
|
65
65
|
environment: "node",
|
|
66
|
-
pool: "
|
|
66
|
+
pool: "forks",
|
|
67
67
|
clearMocks: false,
|
|
68
68
|
restoreMocks: false,
|
|
69
69
|
mockReset: false,
|
|
@@ -102,8 +102,8 @@ const config = {
|
|
|
102
102
|
const configDefaults = Object.freeze(config);
|
|
103
103
|
|
|
104
104
|
const extraInlineDeps = [
|
|
105
|
-
/^(?!.*
|
|
106
|
-
/^(?!.*
|
|
105
|
+
/^(?!.*node_modules).*\.mjs$/,
|
|
106
|
+
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
107
107
|
// Vite client
|
|
108
108
|
/vite\w*\/dist\/client\/env.mjs/,
|
|
109
109
|
// Nuxt
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
2
|
-
export {
|
|
1
|
+
export { ConfigEnv, Plugin, UserConfig, mergeConfig } from 'vite';
|
|
2
|
+
export { aL as UserConfigExport, aK as UserConfigFn, aI as UserConfigFnObject, aJ as UserConfigFnPromise, aN as UserProjectConfigExport, aM as UserProjectConfigFn, y as UserWorkspaceConfig, aR as configDefaults, aU as coverageConfigDefaults, aT as defaultExclude, aS as defaultInclude, aO as defineConfig, aP as defineProject, aQ as defineWorkspace, aV as extraInlineDeps } from './reporters-CYVC6LOl.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
5
5
|
import '@vitest/snapshot';
|
package/dist/config.js
CHANGED
|
@@ -61,7 +61,7 @@ const config = {
|
|
|
61
61
|
watch: !isCI,
|
|
62
62
|
globals: false,
|
|
63
63
|
environment: "node",
|
|
64
|
-
pool: "
|
|
64
|
+
pool: "forks",
|
|
65
65
|
clearMocks: false,
|
|
66
66
|
restoreMocks: false,
|
|
67
67
|
mockReset: false,
|
|
@@ -100,8 +100,8 @@ const config = {
|
|
|
100
100
|
const configDefaults = Object.freeze(config);
|
|
101
101
|
|
|
102
102
|
const extraInlineDeps = [
|
|
103
|
-
/^(?!.*
|
|
104
|
-
/^(?!.*
|
|
103
|
+
/^(?!.*node_modules).*\.mjs$/,
|
|
104
|
+
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
105
105
|
// Vite client
|
|
106
106
|
/vite\w*\/dist\/client\/env.mjs/,
|
|
107
107
|
// Nuxt
|
package/dist/coverage.d.ts
CHANGED
package/dist/coverage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from 'pathe';
|
|
2
|
-
import { m as mm } from './vendor/index.
|
|
2
|
+
import { m as mm } from './vendor/index.CThipSqB.js';
|
|
3
3
|
import './vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
4
4
|
import 'util';
|
|
5
5
|
import 'path';
|
|
@@ -45,8 +45,9 @@ class BaseCoverageProvider {
|
|
|
45
45
|
*/
|
|
46
46
|
checkThresholds({ thresholds: allThresholds, perFile }) {
|
|
47
47
|
for (const { coverageMap, thresholds, name } of allThresholds) {
|
|
48
|
-
if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0)
|
|
48
|
+
if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0) {
|
|
49
49
|
continue;
|
|
50
|
+
}
|
|
50
51
|
const summaries = perFile ? coverageMap.files().map((file) => ({
|
|
51
52
|
file,
|
|
52
53
|
summary: coverageMap.fileCoverageFor(file).toSummary()
|
|
@@ -171,16 +172,41 @@ function resolveConfig(configModule) {
|
|
|
171
172
|
try {
|
|
172
173
|
if (mod.$type === "object")
|
|
173
174
|
return mod;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
let config = resolveDefineConfig(mod);
|
|
176
|
+
if (config)
|
|
177
|
+
return config;
|
|
178
|
+
if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
|
|
179
|
+
config = resolveMergeConfig(mod);
|
|
180
|
+
if (config)
|
|
181
|
+
return config;
|
|
179
182
|
}
|
|
180
183
|
} catch (error) {
|
|
181
184
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
182
185
|
}
|
|
183
186
|
throw new Error("Failed to update coverage thresholds. Configuration file is too complex.");
|
|
184
187
|
}
|
|
188
|
+
function resolveDefineConfig(mod) {
|
|
189
|
+
if (mod.$type === "function-call" && mod.$callee === "defineConfig") {
|
|
190
|
+
if (mod.$args[0].$type === "object")
|
|
191
|
+
return mod.$args[0];
|
|
192
|
+
if (mod.$args[0].$type === "arrow-function-expression") {
|
|
193
|
+
if (mod.$args[0].$body.$type === "object") {
|
|
194
|
+
return mod.$args[0].$body;
|
|
195
|
+
}
|
|
196
|
+
const config = resolveMergeConfig(mod.$args[0].$body);
|
|
197
|
+
if (config)
|
|
198
|
+
return config;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function resolveMergeConfig(mod) {
|
|
203
|
+
if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
|
|
204
|
+
for (const arg of mod.$args) {
|
|
205
|
+
const config = resolveDefineConfig(arg);
|
|
206
|
+
if (config)
|
|
207
|
+
return config;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
185
211
|
|
|
186
212
|
export { BaseCoverageProvider };
|
package/dist/environments.d.ts
CHANGED
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.kpsSqFiz.js';
|
|
2
2
|
import 'node:console';
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import vm from 'node:vm';
|
|
2
2
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
3
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
4
|
-
import {
|
|
4
|
+
import { aF as PendingSuiteMock, aG as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, aH as MockMap } from './reporters-CYVC6LOl.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import '@vitest/runner';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -38,7 +38,7 @@ declare class VitestMocker {
|
|
|
38
38
|
private get moduleDirectories();
|
|
39
39
|
initializeSpyModule(): Promise<void>;
|
|
40
40
|
private deleteCachedItem;
|
|
41
|
-
private
|
|
41
|
+
private isModuleDirectory;
|
|
42
42
|
getSuiteFilepath(): string;
|
|
43
43
|
private createError;
|
|
44
44
|
getMocks(): {
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { TaskPopulated
|
|
1
|
+
import { TaskPopulated } from '@vitest/runner';
|
|
2
2
|
export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
3
|
-
export { b as bench } from './suite-
|
|
3
|
+
export { b as bench } from './suite-Dpu9EC_k.js';
|
|
4
4
|
import { ExpectStatic } from '@vitest/expect';
|
|
5
5
|
export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
|
|
6
|
-
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper,
|
|
7
|
-
export { Q as ApiConfig,
|
|
6
|
+
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, h as RuntimeConfig, P as ProvidedContext } from './reporters-CYVC6LOl.js';
|
|
7
|
+
export { Q as AfterSuiteRunMeta, A as ApiConfig, $ as ArgumentsType, _ as Arrayable, Y as Awaitable, B as BaseCoverageOptions, ag as BenchFunction, ae as Benchmark, ah as BenchmarkAPI, af as BenchmarkResult, ad as BenchmarkUserOptions, x as BrowserConfigOptions, w as BrowserScript, p as BuiltinEnvironment, q as CSSModuleScopeStrategy, j as CollectLineNumbers, k as CollectLines, a1 as Constructable, m as Context, f as ContextRPC, G as ContextTestEnvironment, aa as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, a9 as CoverageReporter, ab as CoverageV8Options, ac as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, r as EnvironmentOptions, a3 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a2 as ModuleCache, a6 as ModuleGraphData, a0 as MutableArray, Z as Nullable, a7 as OnServerRestartHandler, n as Pool, o as PoolOptions, v as ProjectConfig, i as RawErrsMap, a8 as ReportContext, N as Reporter, O as ResolveIdFunction, R as ResolvedConfig, a as ResolvedCoverageOptions, K as ResolvedTestEnvironment, l as RootAndTarget, z as RunnerRPC, e as RuntimeRPC, S as SerializableSpec, t as TransformModePatterns, ai as TransformResultWithSource, T as TscErrorInfo, u as TypecheckConfig, U as UserConfig, a5 as UserConsoleLog, y as UserWorkspaceConfig, L as Vitest, V as VitestEnvironment, s as VitestRunMode, a4 as VmEnvironmentReturn, am as WebSocketBrowserEvents, ak as WebSocketBrowserHandlers, ao as WebSocketBrowserRPC, al as WebSocketEvents, aj as WebSocketHandlers, an as WebSocketRPC, g as WorkerContext, W as WorkerGlobalState, X as WorkerRPC } from './reporters-CYVC6LOl.js';
|
|
8
8
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
9
9
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
|
|
10
|
-
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
11
|
-
import { SnapshotResult } from '@vitest/snapshot';
|
|
12
10
|
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
|
|
13
11
|
export { DiffOptions } from '@vitest/utils/diff';
|
|
14
|
-
import { TransformResult } from 'vite';
|
|
15
12
|
import * as chai from 'chai';
|
|
16
13
|
export { chai };
|
|
17
14
|
export { assert, should } from 'chai';
|
|
18
15
|
export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
|
|
19
16
|
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
|
|
20
17
|
import '@vitest/runner/utils';
|
|
18
|
+
import 'vite';
|
|
21
19
|
import 'vite-node';
|
|
22
20
|
import 'node:stream';
|
|
23
21
|
import 'vite-node/client';
|
|
@@ -1056,6 +1054,11 @@ interface AssertType {
|
|
|
1056
1054
|
}
|
|
1057
1055
|
declare const assertType: AssertType;
|
|
1058
1056
|
|
|
1057
|
+
interface BrowserUI {
|
|
1058
|
+
setCurrentFileId: (fileId: string) => void;
|
|
1059
|
+
setIframeViewport: (width: number, height: number) => Promise<void>;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1059
1062
|
/**
|
|
1060
1063
|
* This utils allows computational intensive tasks to only be ran once
|
|
1061
1064
|
* across test reruns to improve the watch mode performance.
|
|
@@ -1419,43 +1422,4 @@ declare function isWatchMode(): boolean;
|
|
|
1419
1422
|
*/
|
|
1420
1423
|
declare function inject<T extends keyof ProvidedContext>(key: T): ProvidedContext[T];
|
|
1421
1424
|
|
|
1422
|
-
|
|
1423
|
-
source?: string;
|
|
1424
|
-
}
|
|
1425
|
-
interface WebSocketHandlers {
|
|
1426
|
-
onUnhandledError: (error: unknown, type: string) => Promise<void>;
|
|
1427
|
-
onCollected: (files?: File[]) => Promise<void>;
|
|
1428
|
-
onTaskUpdate: (packs: TaskResultPack[]) => void;
|
|
1429
|
-
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
1430
|
-
onCancel: (reason: CancelReason) => void;
|
|
1431
|
-
getCountOfFailedTests: () => number;
|
|
1432
|
-
sendLog: (log: UserConsoleLog) => void;
|
|
1433
|
-
getFiles: () => File[];
|
|
1434
|
-
getTestFiles: () => Promise<[name: string, file: string][]>;
|
|
1435
|
-
getPaths: () => string[];
|
|
1436
|
-
getConfig: () => ResolvedConfig;
|
|
1437
|
-
resolveSnapshotPath: (testPath: string) => string;
|
|
1438
|
-
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
|
|
1439
|
-
getModuleGraph: (id: string) => Promise<ModuleGraphData>;
|
|
1440
|
-
getBrowserFileSourceMap: (id: string) => Promise<TransformResult['map'] | undefined>;
|
|
1441
|
-
getTransformResult: (id: string) => Promise<TransformResultWithSource | undefined>;
|
|
1442
|
-
readSnapshotFile: (id: string) => Promise<string | null>;
|
|
1443
|
-
readTestFile: (id: string) => Promise<string | null>;
|
|
1444
|
-
saveTestFile: (id: string, content: string) => Promise<void>;
|
|
1445
|
-
saveSnapshotFile: (id: string, content: string) => Promise<void>;
|
|
1446
|
-
removeSnapshotFile: (id: string) => Promise<void>;
|
|
1447
|
-
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
1448
|
-
rerun: (files: string[]) => Promise<void>;
|
|
1449
|
-
updateSnapshot: (file?: File) => Promise<void>;
|
|
1450
|
-
getProvidedContext: () => ProvidedContext;
|
|
1451
|
-
getUnhandledErrors: () => unknown[];
|
|
1452
|
-
finishBrowserTests: () => void;
|
|
1453
|
-
getBrowserFiles: () => string[];
|
|
1454
|
-
debug: (...args: string[]) => void;
|
|
1455
|
-
}
|
|
1456
|
-
interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected'> {
|
|
1457
|
-
onCancel: (reason: CancelReason) => void;
|
|
1458
|
-
onFinishedReportCoverage: () => void;
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
export { AfterSuiteRunMeta, type AssertType, type ExpectTypeOf, ModuleGraphData, ProvidedContext, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, UserConsoleLog, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
|
|
1425
|
+
export { type AssertType, type BrowserUI, type ExpectTypeOf, ProvidedContext, RuntimeConfig, type VitestUtils, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
2
|
export { b as bench } from './vendor/benchmark.BNLebNi5.js';
|
|
3
3
|
export { i as isFirstRun, a as runOnce } from './vendor/run-once.DLomgGUH.js';
|
|
4
|
-
export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.
|
|
5
|
-
import { d as dist } from './vendor/index.
|
|
6
|
-
export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.
|
|
4
|
+
export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.hATFzZbX.js';
|
|
5
|
+
import { d as dist } from './vendor/index.D3hs2WiI.js';
|
|
6
|
+
export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.D3hs2WiI.js';
|
|
7
7
|
import * as chai from 'chai';
|
|
8
8
|
export { chai };
|
|
9
9
|
export { assert, should } from 'chai';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { s as VitestRunMode, U as UserConfig, ap as VitestOptions, L as Vitest, R as ResolvedConfig, P as ProvidedContext, aq as WorkspaceProject, e as RuntimeRPC, ar as TestSequencer, as as WorkspaceSpec } from './reporters-CYVC6LOl.js';
|
|
2
|
+
export { aA as BrowserCommand, aB as BrowserCommandContext, ay as BrowserProvider, ax as BrowserProviderInitializationOptions, az as BrowserProviderOptions, w as BrowserScript, aE as HTMLOptions, aD as JUnitOptions, aC as JsonOptions, at as ProcessPool, aw as TestSequencerConstructor, av as VitestPackageInstaller, au as getFilePoolName } from './reporters-CYVC6LOl.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
|
+
export { isFileServingAllowed } from 'vite';
|
|
4
5
|
import { Writable } from 'node:stream';
|
|
5
6
|
import '@vitest/runner';
|
|
6
7
|
import 'vite-node';
|
|
@@ -25,10 +26,6 @@ interface CliOptions extends UserConfig {
|
|
|
25
26
|
* Override the watch mode
|
|
26
27
|
*/
|
|
27
28
|
run?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Retry the test suite if it crashes due to a segfault (default: true)
|
|
30
|
-
*/
|
|
31
|
-
segfaultRetry?: number;
|
|
32
29
|
/**
|
|
33
30
|
* Removes colors from the console output
|
|
34
31
|
*/
|
|
@@ -58,6 +55,9 @@ interface GlobalSetupContext {
|
|
|
58
55
|
|
|
59
56
|
declare function createMethodsRPC(project: WorkspaceProject): RuntimeRPC;
|
|
60
57
|
|
|
58
|
+
declare const rootDir: string;
|
|
59
|
+
declare const distDir: string;
|
|
60
|
+
|
|
61
61
|
declare class BaseSequencer implements TestSequencer {
|
|
62
62
|
protected ctx: Vitest;
|
|
63
63
|
constructor(ctx: Vitest);
|
|
@@ -65,4 +65,4 @@ declare class BaseSequencer implements TestSequencer {
|
|
|
65
65
|
sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts, startVitest };
|
|
68
|
+
export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, distDir, parseCLI, registerConsoleShortcuts, rootDir, startVitest };
|
package/dist/node.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api.
|
|
2
|
-
export { p as parseCLI } from './vendor/cac.
|
|
3
|
-
export {
|
|
1
|
+
export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, g as getFilePoolName, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api.CUtJc4r3.js';
|
|
2
|
+
export { p as parseCLI } from './vendor/cac.CtYFkoSJ.js';
|
|
3
|
+
export { distDir, rootDir } from './path.js';
|
|
4
|
+
export { B as BaseSequencer } from './vendor/index.BOMEjpjj.js';
|
|
5
|
+
export { isFileServingAllowed } from 'vite';
|
|
4
6
|
import 'pathe';
|
|
5
|
-
import './vendor/constants.
|
|
7
|
+
import './vendor/constants.TCjCaw2D.js';
|
|
6
8
|
import './vendor/coverage.ChSqD-qS.js';
|
|
7
|
-
import './vendor/index.
|
|
9
|
+
import './vendor/index.kpsSqFiz.js';
|
|
8
10
|
import 'node:console';
|
|
9
|
-
import 'vite';
|
|
10
11
|
import 'node:path';
|
|
11
12
|
import 'node:url';
|
|
12
13
|
import 'node:process';
|
|
@@ -15,8 +16,8 @@ import 'node:worker_threads';
|
|
|
15
16
|
import './vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
16
17
|
import 'os';
|
|
17
18
|
import 'path';
|
|
18
|
-
import './vendor/index.DP-km6lF.js';
|
|
19
19
|
import 'util';
|
|
20
|
+
import './vendor/index.CThipSqB.js';
|
|
20
21
|
import 'stream';
|
|
21
22
|
import 'events';
|
|
22
23
|
import 'fs';
|
|
@@ -29,7 +30,6 @@ import './vendor/base._gnK9Slw.js';
|
|
|
29
30
|
import '@vitest/utils';
|
|
30
31
|
import './vendor/env.bmJgw1qP.js';
|
|
31
32
|
import 'std-env';
|
|
32
|
-
import './path.js';
|
|
33
33
|
import './vendor/index.BpSiYbpB.js';
|
|
34
34
|
import 'zlib';
|
|
35
35
|
import 'buffer';
|
|
@@ -46,20 +46,22 @@ import 'node:events';
|
|
|
46
46
|
import 'tinypool';
|
|
47
47
|
import 'node:crypto';
|
|
48
48
|
import 'node:fs/promises';
|
|
49
|
+
import 'debug';
|
|
49
50
|
import 'node:module';
|
|
50
51
|
import 'node:assert';
|
|
51
52
|
import 'node:util';
|
|
52
53
|
import 'vite-node/utils';
|
|
53
54
|
import 'magic-string';
|
|
54
55
|
import '@vitest/utils/ast';
|
|
55
|
-
import '
|
|
56
|
+
import '@ampproject/remapping';
|
|
56
57
|
import './vendor/index._7XLd8Kd.js';
|
|
57
58
|
import './vendor/global.7bFbnyXl.js';
|
|
58
59
|
import 'node:readline';
|
|
59
60
|
import 'readline';
|
|
61
|
+
import './vendor/utils.YuQ3LT2a.js';
|
|
60
62
|
import './vendor/tasks.WC7M-K-v.js';
|
|
61
63
|
import 'node:perf_hooks';
|
|
62
|
-
import './chunks/runtime-console.
|
|
64
|
+
import './chunks/runtime-console.DiVMr5d4.js';
|
|
63
65
|
import 'node:stream';
|
|
64
66
|
import './vendor/date.BKM1wewY.js';
|
|
65
67
|
import 'execa';
|