vitest 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +5 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{integrations-globals.trMeEBob.js → integrations-globals.k0N5-dd1.js} +3 -3
- package/dist/chunks/{runtime-console.tUKE_2UJ.js → runtime-console.kbFEN7E-.js} +14 -6
- package/dist/chunks/{runtime-runBaseTests.SKlFOhuq.js → runtime-runBaseTests.-x-nNuJ_.js} +11 -9
- package/dist/cli-wrapper.js +1 -1
- package/dist/cli.js +3 -61
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +4 -2
- package/dist/coverage.js +2 -2
- package/dist/environments.d.ts +2 -1
- package/dist/execute.d.ts +2 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -3
- package/dist/node.d.ts +26 -4
- package/dist/node.js +15 -13
- package/dist/{reporters-P7C2ytIv.d.ts → reporters-xEmem8D4.d.ts} +124 -49
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +5 -4
- package/dist/runners.d.ts +2 -1
- package/dist/runners.js +3 -3
- package/dist/{suite-a18diDsI.d.ts → suite-HPAKvIxA.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/vendor/{base.nhvUBzQY.js → base.gAwDs8Jc.js} +1 -1
- package/dist/vendor/cac.4YOY8W-L.js +1406 -0
- package/dist/vendor/{cac.RvTIWZBK.js → cli-api.5cFYj0Lq.js} +178 -1499
- package/dist/vendor/{constants.K-Wf1PUy.js → constants.5J7I254_.js} +2 -1
- package/dist/vendor/{index.BeX1oZht.js → index.0RrMQKD8.js} +1 -1
- package/dist/vendor/{index.LNWuEnUT.js → index.gHZzsRJQ.js} +1 -1
- package/dist/vendor/{index.e9RDLAeW.js → index.waF5pgqJ.js} +52 -214
- package/dist/vendor/inspector.IgLX3ur5.js +54 -0
- package/dist/vendor/{setup-common.vyF1kALR.js → setup-common.7SXMSI--.js} +11 -1
- package/dist/vendor/{utils.w0xgzP1h.js → utils.0uYuCbzo.js} +5 -2
- package/dist/vendor/utils.VYmeMh-u.js +217 -0
- package/dist/vendor/{vi.JYQecGiw.js → vi.Y_w82WR8.js} +26 -21
- package/dist/vendor/{vm.cAHVDF92.js → vm.I_IsyNig.js} +2 -2
- package/dist/worker.js +2 -39
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +10 -4
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +7 -7
- package/dist/workers/vmThreads.js +7 -7
- package/dist/workers.d.ts +2 -1
- package/dist/workers.js +8 -7
- package/package.json +11 -11
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-xEmem8D4.js';
|
|
3
3
|
import { VitestExecutor } from './execute.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -8,6 +8,7 @@ import '@vitest/expect';
|
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
9
|
import '@vitest/utils';
|
|
10
10
|
import 'tinybench';
|
|
11
|
+
import 'node:stream';
|
|
11
12
|
import 'vite-node/client';
|
|
12
13
|
import '@vitest/snapshot/manager';
|
|
13
14
|
import 'vite-node/server';
|
|
@@ -37,6 +38,9 @@ interface DiffOptions {
|
|
|
37
38
|
omitAnnotationLines?: boolean;
|
|
38
39
|
patchColor?: Formatter;
|
|
39
40
|
compareKeys?: any;
|
|
41
|
+
truncateThreshold?: number;
|
|
42
|
+
truncateAnnotation?: string;
|
|
43
|
+
truncateAnnotationColor?: Formatter;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.7SXMSI--.js';
|
|
3
3
|
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import '@vitest/snapshot';
|
|
@@ -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.5J7I254_.js';
|
|
2
|
+
import { V as VitestIndex } from '../vendor/index.0RrMQKD8.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import '../vendor/benchmark.eeqk2rd8.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
@@ -9,7 +9,7 @@ import 'pathe';
|
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import '../vendor/global.CkGT_TMy.js';
|
|
11
11
|
import '../vendor/run-once.Olz_Zkd8.js';
|
|
12
|
-
import '../vendor/vi.
|
|
12
|
+
import '../vendor/vi.Y_w82WR8.js';
|
|
13
13
|
import 'chai';
|
|
14
14
|
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
15
|
import '@vitest/expect';
|
|
@@ -3,6 +3,11 @@ import { Console } from 'node:console';
|
|
|
3
3
|
import { relative } from 'node:path';
|
|
4
4
|
import { getSafeTimers, getColors } from '@vitest/utils';
|
|
5
5
|
import { R as RealDate } from '../vendor/date.Ns1pGd_X.js';
|
|
6
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
7
|
+
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
|
|
8
|
+
import 'pathe';
|
|
9
|
+
import 'std-env';
|
|
10
|
+
import '@vitest/runner/utils';
|
|
6
11
|
|
|
7
12
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
8
13
|
function getTaskIdByStack(root) {
|
|
@@ -10,7 +15,7 @@ function getTaskIdByStack(root) {
|
|
|
10
15
|
const stack = (_a = new Error("STACK_TRACE_ERROR").stack) == null ? void 0 : _a.split("\n");
|
|
11
16
|
if (!stack)
|
|
12
17
|
return UNKNOWN_TEST_ID;
|
|
13
|
-
const index = stack.findIndex((line2) => line2.includes("at Console.value
|
|
18
|
+
const index = stack.findIndex((line2) => line2.includes("at Console.value"));
|
|
14
19
|
const line = index === -1 ? null : stack[index + 2];
|
|
15
20
|
if (!line)
|
|
16
21
|
return UNKNOWN_TEST_ID;
|
|
@@ -19,11 +24,12 @@ function getTaskIdByStack(root) {
|
|
|
19
24
|
return relative(root, filepath);
|
|
20
25
|
return UNKNOWN_TEST_ID;
|
|
21
26
|
}
|
|
22
|
-
function createCustomConsole(
|
|
27
|
+
function createCustomConsole() {
|
|
23
28
|
const stdoutBuffer = /* @__PURE__ */ new Map();
|
|
24
29
|
const stderrBuffer = /* @__PURE__ */ new Map();
|
|
25
30
|
const timers = /* @__PURE__ */ new Map();
|
|
26
31
|
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
32
|
+
const state = () => getWorkerState();
|
|
27
33
|
function schedule(taskId) {
|
|
28
34
|
const timer = timers.get(taskId);
|
|
29
35
|
const { stdoutTime, stderrTime } = timer;
|
|
@@ -44,7 +50,7 @@ function createCustomConsole(state) {
|
|
|
44
50
|
return;
|
|
45
51
|
const content = buffer.map((i) => String(i)).join("");
|
|
46
52
|
const timer = timers.get(taskId);
|
|
47
|
-
state.rpc.onUserConsoleLog({
|
|
53
|
+
state().rpc.onUserConsoleLog({
|
|
48
54
|
type: "stdout",
|
|
49
55
|
content: content || "<empty line>",
|
|
50
56
|
taskId,
|
|
@@ -60,7 +66,7 @@ function createCustomConsole(state) {
|
|
|
60
66
|
return;
|
|
61
67
|
const content = buffer.map((i) => String(i)).join("");
|
|
62
68
|
const timer = timers.get(taskId);
|
|
63
|
-
state.rpc.onUserConsoleLog({
|
|
69
|
+
state().rpc.onUserConsoleLog({
|
|
64
70
|
type: "stderr",
|
|
65
71
|
content: content || "<empty line>",
|
|
66
72
|
taskId,
|
|
@@ -73,7 +79,8 @@ function createCustomConsole(state) {
|
|
|
73
79
|
const stdout = new Writable({
|
|
74
80
|
write(data, encoding, callback) {
|
|
75
81
|
var _a, _b, _c;
|
|
76
|
-
const
|
|
82
|
+
const s = state();
|
|
83
|
+
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.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
|
|
77
84
|
let timer = timers.get(id);
|
|
78
85
|
if (timer) {
|
|
79
86
|
timer.stdoutTime = timer.stdoutTime || RealDate.now();
|
|
@@ -94,7 +101,8 @@ function createCustomConsole(state) {
|
|
|
94
101
|
const stderr = new Writable({
|
|
95
102
|
write(data, encoding, callback) {
|
|
96
103
|
var _a, _b, _c;
|
|
97
|
-
const
|
|
104
|
+
const s = state();
|
|
105
|
+
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.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
|
|
98
106
|
let timer = timers.get(id);
|
|
99
107
|
if (timer) {
|
|
100
108
|
timer.stderrTime = timer.stderrTime || RealDate.now();
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests } from '@vitest/runner';
|
|
3
3
|
import '../vendor/index.ir9i0ywP.js';
|
|
4
|
-
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.
|
|
4
|
+
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.Y_w82WR8.js';
|
|
5
5
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
|
|
6
|
-
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.
|
|
6
|
+
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.gHZzsRJQ.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import util from 'node:util';
|
|
9
9
|
import timers from 'node:timers';
|
|
10
10
|
import { isatty } from 'node:tty';
|
|
11
11
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
12
12
|
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
13
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
14
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
13
|
+
import { V as VitestIndex } from '../vendor/index.0RrMQKD8.js';
|
|
14
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.7SXMSI--.js';
|
|
15
15
|
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
|
|
16
|
+
import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
|
|
16
17
|
import 'pathe';
|
|
17
18
|
import 'std-env';
|
|
18
19
|
import '@vitest/runner/utils';
|
|
@@ -66,11 +67,11 @@ async function setupGlobalEnv(config, { environment }) {
|
|
|
66
67
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
67
68
|
});
|
|
68
69
|
if (!config.disableConsoleIntercept)
|
|
69
|
-
await setupConsoleLogSpy(
|
|
70
|
+
await setupConsoleLogSpy();
|
|
70
71
|
}
|
|
71
|
-
async function setupConsoleLogSpy(
|
|
72
|
-
const { createCustomConsole } = await import('./runtime-console.
|
|
73
|
-
globalThis.console = createCustomConsole(
|
|
72
|
+
async function setupConsoleLogSpy() {
|
|
73
|
+
const { createCustomConsole } = await import('./runtime-console.kbFEN7E-.js');
|
|
74
|
+
globalThis.console = createCustomConsole();
|
|
74
75
|
}
|
|
75
76
|
async function withEnv({ environment }, options, fn) {
|
|
76
77
|
globalThis.__vitest_environment__ = environment.name;
|
|
@@ -96,7 +97,8 @@ async function run(files, config, environment, executor) {
|
|
|
96
97
|
const runner = await resolveTestRunner(config, executor);
|
|
97
98
|
workerState.onCancel.then((reason) => {
|
|
98
99
|
var _a;
|
|
99
|
-
|
|
100
|
+
closeInspector(config);
|
|
101
|
+
(_a = runner.onCancel) == null ? void 0 : _a.call(runner, reason);
|
|
100
102
|
});
|
|
101
103
|
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
|
|
102
104
|
workerState.durations.environment = performance.now();
|
package/dist/cli-wrapper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import c from 'picocolors';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
|
-
import { E as EXIT_CODE_RESTART } from './vendor/constants.
|
|
4
|
+
import { E as EXIT_CODE_RESTART } from './vendor/constants.5J7I254_.js';
|
|
5
5
|
|
|
6
6
|
const ENTRY = new URL("./cli.js", import.meta.url);
|
|
7
7
|
const NODE_ARGS = [
|
package/dist/cli.js
CHANGED
|
@@ -1,67 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as createCLI } from './vendor/cac.4YOY8W-L.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'picocolors';
|
|
5
|
-
import './vendor/index.ir9i0ywP.js';
|
|
6
|
-
import 'std-env';
|
|
7
|
-
import '@vitest/runner/utils';
|
|
8
|
-
import '@vitest/utils';
|
|
9
|
-
import './vendor/global.CkGT_TMy.js';
|
|
10
|
-
import './vendor/index.e9RDLAeW.js';
|
|
11
|
-
import 'node:fs';
|
|
12
|
-
import 'node:perf_hooks';
|
|
13
|
-
import './chunks/runtime-console.tUKE_2UJ.js';
|
|
14
|
-
import 'node:stream';
|
|
15
|
-
import 'node:console';
|
|
16
|
-
import 'node:path';
|
|
17
|
-
import './vendor/date.Ns1pGd_X.js';
|
|
18
5
|
import './vendor/base.Xt0Omgh7.js';
|
|
19
|
-
import '
|
|
20
|
-
import '
|
|
21
|
-
import 'node:os';
|
|
22
|
-
import 'node:module';
|
|
23
|
-
import 'node:fs/promises';
|
|
24
|
-
import 'execa';
|
|
25
|
-
import 'node:url';
|
|
26
|
-
import 'path';
|
|
27
|
-
import 'fs';
|
|
28
|
-
import 'module';
|
|
29
|
-
import 'vite';
|
|
30
|
-
import 'acorn-walk';
|
|
31
|
-
import 'node:process';
|
|
32
|
-
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
33
|
-
import 'assert';
|
|
34
|
-
import 'node:crypto';
|
|
35
|
-
import 'vite-node/utils';
|
|
36
|
-
import './vendor/constants.K-Wf1PUy.js';
|
|
37
|
-
import './vendor/coverage.E7sG1b3r.js';
|
|
38
|
-
import './vendor/index.GVFv9dZ0.js';
|
|
39
|
-
import 'os';
|
|
40
|
-
import './vendor/index.xL8XjTLv.js';
|
|
41
|
-
import 'util';
|
|
42
|
-
import 'stream';
|
|
43
|
-
import 'vite-node/client';
|
|
44
|
-
import '@vitest/snapshot/manager';
|
|
45
|
-
import 'vite-node/server';
|
|
46
|
-
import './path.js';
|
|
47
|
-
import './vendor/index.8bPxjt7g.js';
|
|
48
|
-
import 'zlib';
|
|
49
|
-
import 'buffer';
|
|
50
|
-
import 'crypto';
|
|
51
|
-
import 'https';
|
|
52
|
-
import 'http';
|
|
53
|
-
import 'net';
|
|
54
|
-
import 'tls';
|
|
55
|
-
import 'url';
|
|
56
|
-
import 'node:v8';
|
|
57
|
-
import 'node:events';
|
|
58
|
-
import 'tinypool';
|
|
59
|
-
import 'node:worker_threads';
|
|
60
|
-
import 'local-pkg';
|
|
61
|
-
import 'magic-string';
|
|
62
|
-
import '@vitest/utils/ast';
|
|
63
|
-
import 'strip-literal';
|
|
64
|
-
import 'node:readline';
|
|
65
|
-
import 'readline';
|
|
6
|
+
import '@vitest/utils';
|
|
7
|
+
import './vendor/constants.5J7I254_.js';
|
|
66
8
|
|
|
67
9
|
createCLI().parse();
|
package/dist/config.cjs
CHANGED
|
@@ -40,6 +40,7 @@ const coverageConfigDefaults = {
|
|
|
40
40
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
41
41
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
|
|
42
42
|
allowExternal: false,
|
|
43
|
+
ignoreEmptyLines: false,
|
|
43
44
|
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
|
|
44
45
|
};
|
|
45
46
|
const fakeTimersDefaults = {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
2
|
-
export {
|
|
2
|
+
export { av as UserConfigExport, au as UserConfigFn, as as UserConfigFnObject, at as UserConfigFnPromise, ax as UserProjectConfigExport, aw as UserProjectConfigFn, $ as UserWorkspaceConfig, aB as configDefaults, aE as coverageConfigDefaults, aD as defaultExclude, aC as defaultInclude, ay as defineConfig, az as defineProject, aA as defineWorkspace, aF as extraInlineDeps } from './reporters-xEmem8D4.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
5
5
|
import '@vitest/snapshot';
|
|
@@ -7,6 +7,7 @@ import '@vitest/expect';
|
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
|
10
|
+
import 'node:stream';
|
|
10
11
|
import 'vite-node/client';
|
|
11
12
|
import '@vitest/snapshot/manager';
|
|
12
13
|
import 'vite-node/server';
|
package/dist/config.js
CHANGED
|
@@ -38,6 +38,7 @@ const coverageConfigDefaults = {
|
|
|
38
38
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
39
39
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
|
|
40
40
|
allowExternal: false,
|
|
41
|
+
ignoreEmptyLines: false,
|
|
41
42
|
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
|
|
42
43
|
};
|
|
43
44
|
const fakeTimersDefaults = {
|
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-xEmem8D4.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -7,6 +7,7 @@ import '@vitest/expect';
|
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
|
10
|
+
import 'node:stream';
|
|
10
11
|
import 'vite-node/client';
|
|
11
12
|
import '@vitest/snapshot/manager';
|
|
12
13
|
import 'vite-node/server';
|
|
@@ -146,10 +147,11 @@ declare class BaseCoverageProvider {
|
|
|
146
147
|
* where each threshold set holds their own coverage maps. Threshold set is either
|
|
147
148
|
* for specific files defined by glob pattern or global for all other files.
|
|
148
149
|
*/
|
|
149
|
-
resolveThresholds({ coverageMap, thresholds, createCoverageMap }: {
|
|
150
|
+
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }: {
|
|
150
151
|
coverageMap: CoverageMap;
|
|
151
152
|
thresholds: NonNullable<BaseCoverageOptions['thresholds']>;
|
|
152
153
|
createCoverageMap: () => CoverageMap;
|
|
154
|
+
root: string;
|
|
153
155
|
}): ResolvedThreshold[];
|
|
154
156
|
/**
|
|
155
157
|
* Resolve reporters from various configuration options
|
package/dist/coverage.js
CHANGED
|
@@ -76,7 +76,7 @@ class BaseCoverageProvider {
|
|
|
76
76
|
* where each threshold set holds their own coverage maps. Threshold set is either
|
|
77
77
|
* for specific files defined by glob pattern or global for all other files.
|
|
78
78
|
*/
|
|
79
|
-
resolveThresholds({ coverageMap, thresholds, createCoverageMap }) {
|
|
79
|
+
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }) {
|
|
80
80
|
const resolvedThresholds = [];
|
|
81
81
|
const files = coverageMap.files();
|
|
82
82
|
const filesMatchedByGlobs = [];
|
|
@@ -87,7 +87,7 @@ class BaseCoverageProvider {
|
|
|
87
87
|
const glob = key;
|
|
88
88
|
const globThresholds = resolveGlobThresholds(thresholds[glob]);
|
|
89
89
|
const globCoverageMap = createCoverageMap();
|
|
90
|
-
const matchingFiles = files.filter((file) => mm.isMatch(file, glob));
|
|
90
|
+
const matchingFiles = files.filter((file) => mm.isMatch(relative(root, file), glob));
|
|
91
91
|
filesMatchedByGlobs.push(...matchingFiles);
|
|
92
92
|
for (const file of matchingFiles) {
|
|
93
93
|
const fileCoverage = coverageMap.fileCoverageFor(file);
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Environment } from './reporters-
|
|
1
|
+
import { E as Environment } from './reporters-xEmem8D4.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -7,6 +7,7 @@ import '@vitest/expect';
|
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
|
10
|
+
import 'node:stream';
|
|
10
11
|
import 'vite-node/client';
|
|
11
12
|
import '@vitest/snapshot/manager';
|
|
12
13
|
import 'vite-node/server';
|
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 { ap as PendingSuiteMock, aq as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, ar as MockMap } from './reporters-xEmem8D4.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import '@vitest/runner';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -9,6 +9,7 @@ import '@vitest/expect';
|
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils';
|
|
11
11
|
import 'tinybench';
|
|
12
|
+
import 'node:stream';
|
|
12
13
|
import '@vitest/snapshot/manager';
|
|
13
14
|
import 'vite-node/server';
|
|
14
15
|
import 'node:worker_threads';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TaskPopulated, File, TaskResultPack, CancelReason } 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-HPAKvIxA.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 {
|
|
6
|
+
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, r as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, s as UserConsoleLog, R as ResolvedConfig, t as ModuleGraphData, u as Reporter } from './reporters-xEmem8D4.js';
|
|
7
|
+
export { O as ApiConfig, a8 as ArgumentsType, a7 as Arrayable, a5 as Awaitable, B as BaseCoverageOptions, an as BenchFunction, al as Benchmark, ao as BenchmarkAPI, am as BenchmarkResult, ak as BenchmarkUserOptions, K as BuiltinEnvironment, N as CSSModuleScopeStrategy, x as CollectLineNumbers, y as CollectLines, aa as Constructable, D as Context, f as ContextRPC, a1 as ContextTestEnvironment, ah as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ag as CoverageReporter, ai as CoverageV8Options, aj as CustomProviderOptions, S as DepsOptimizationOptions, E as Environment, Q as EnvironmentOptions, ac as EnvironmentReturn, I as HappyDOMOptions, Y as InlineConfig, J as JSDOMOptions, ab as ModuleCache, a9 as MutableArray, a6 as Nullable, ae as OnServerRestartHandler, G as Pool, H as PoolOptions, _ as ProjectConfig, v as RawErrsMap, af as ReportContext, a3 as ResolveIdFunction, a as ResolvedCoverageOptions, a2 as ResolvedTestEnvironment, z as RootAndTarget, a0 as RunnerRPC, e as RuntimeRPC, X as TransformModePatterns, w as TscErrorInfo, Z as TypecheckConfig, U as UserConfig, $ as UserWorkspaceConfig, i as Vitest, L as VitestEnvironment, V as VitestRunMode, ad as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, a4 as WorkerRPC } from './reporters-xEmem8D4.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
10
|
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
@@ -19,6 +19,7 @@ export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
|
|
|
19
19
|
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
|
|
20
20
|
import '@vitest/runner/utils';
|
|
21
21
|
import 'vite-node';
|
|
22
|
+
import 'node:stream';
|
|
22
23
|
import 'vite-node/client';
|
|
23
24
|
import '@vitest/snapshot/manager';
|
|
24
25
|
import 'vite-node/server';
|
|
@@ -627,7 +628,7 @@ interface VitestUtils {
|
|
|
627
628
|
* Changes the value of `import.meta.env` and `process.env`.
|
|
628
629
|
* You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
|
|
629
630
|
*/
|
|
630
|
-
stubEnv: (name:
|
|
631
|
+
stubEnv: <T extends string>(name: T, value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string) => VitestUtils;
|
|
631
632
|
/**
|
|
632
633
|
* Reset the value to original value that was available before first `vi.stubGlobal` was called.
|
|
633
634
|
*/
|
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.eeqk2rd8.js';
|
|
3
3
|
export { i as isFirstRun, a as runOnce } from './vendor/run-once.Olz_Zkd8.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.Y_w82WR8.js';
|
|
5
|
+
import { d as dist } from './vendor/index.0RrMQKD8.js';
|
|
6
|
+
export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.0RrMQKD8.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 { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest,
|
|
2
|
-
export {
|
|
1
|
+
import { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest, R as ResolvedConfig, P as ProvidedContext, j as WorkspaceProject, e as RuntimeRPC, T as TestSequencer, k as WorkspaceSpec } from './reporters-xEmem8D4.js';
|
|
2
|
+
export { p as BrowserProvider, o as BrowserProviderInitializationOptions, q as BrowserProviderOptions, l as ProcessPool, n as TestSequencerConstructor, m as VitestPackageInstaller } from './reporters-xEmem8D4.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
|
+
import { Writable } from 'node:stream';
|
|
4
5
|
import '@vitest/runner';
|
|
5
6
|
import 'vite-node';
|
|
6
7
|
import '@vitest/snapshot';
|
|
@@ -19,6 +20,27 @@ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOver
|
|
|
19
20
|
|
|
20
21
|
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
|
|
21
22
|
|
|
23
|
+
interface CliOptions extends UserConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Override the watch mode
|
|
26
|
+
*/
|
|
27
|
+
run?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Retry the test suite if it crashes due to a segfault (default: true)
|
|
30
|
+
*/
|
|
31
|
+
segfaultRetry?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Removes colors from the console output
|
|
34
|
+
*/
|
|
35
|
+
color?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Start Vitest programmatically
|
|
39
|
+
*
|
|
40
|
+
* Returns a Vitest instance if initialized successfully.
|
|
41
|
+
*/
|
|
42
|
+
declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest | undefined>;
|
|
43
|
+
|
|
22
44
|
interface CLIOptions {
|
|
23
45
|
allowUnknownOptions?: boolean;
|
|
24
46
|
}
|
|
@@ -27,7 +49,7 @@ declare function parseCLI(argv: string | string[], config?: CLIOptions): {
|
|
|
27
49
|
options: CliOptions;
|
|
28
50
|
};
|
|
29
51
|
|
|
30
|
-
declare function registerConsoleShortcuts(ctx: Vitest): () => void;
|
|
52
|
+
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
|
|
31
53
|
|
|
32
54
|
interface GlobalSetupContext {
|
|
33
55
|
config: ResolvedConfig;
|
|
@@ -43,4 +65,4 @@ declare class BaseSequencer implements TestSequencer {
|
|
|
43
65
|
sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
44
66
|
}
|
|
45
67
|
|
|
46
|
-
export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts };
|
|
68
|
+
export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts, startVitest };
|
package/dist/node.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest,
|
|
2
|
-
export {
|
|
1
|
+
export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api.5cFYj0Lq.js';
|
|
2
|
+
export { p as parseCLI } from './vendor/cac.4YOY8W-L.js';
|
|
3
|
+
export { B as BaseSequencer } from './vendor/index.waF5pgqJ.js';
|
|
3
4
|
import 'pathe';
|
|
4
|
-
import '
|
|
5
|
-
import 'picocolors';
|
|
6
|
-
import './vendor/index.ir9i0ywP.js';
|
|
7
|
-
import 'std-env';
|
|
8
|
-
import '@vitest/runner/utils';
|
|
9
|
-
import '@vitest/utils';
|
|
10
|
-
import './vendor/global.CkGT_TMy.js';
|
|
11
|
-
import './vendor/constants.K-Wf1PUy.js';
|
|
5
|
+
import './vendor/constants.5J7I254_.js';
|
|
12
6
|
import './vendor/coverage.E7sG1b3r.js';
|
|
13
7
|
import './vendor/index.GVFv9dZ0.js';
|
|
14
8
|
import 'node:console';
|
|
@@ -17,16 +11,24 @@ import 'node:path';
|
|
|
17
11
|
import 'node:url';
|
|
18
12
|
import 'node:process';
|
|
19
13
|
import 'node:fs';
|
|
14
|
+
import 'node:worker_threads';
|
|
20
15
|
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
21
16
|
import 'os';
|
|
22
17
|
import 'path';
|
|
23
18
|
import './vendor/index.xL8XjTLv.js';
|
|
24
19
|
import 'util';
|
|
25
20
|
import 'stream';
|
|
21
|
+
import 'events';
|
|
26
22
|
import 'fs';
|
|
23
|
+
import 'picocolors';
|
|
27
24
|
import 'vite-node/client';
|
|
28
25
|
import '@vitest/snapshot/manager';
|
|
29
26
|
import 'vite-node/server';
|
|
27
|
+
import './vendor/index.ir9i0ywP.js';
|
|
28
|
+
import 'std-env';
|
|
29
|
+
import '@vitest/runner/utils';
|
|
30
|
+
import '@vitest/utils';
|
|
31
|
+
import './vendor/global.CkGT_TMy.js';
|
|
30
32
|
import './path.js';
|
|
31
33
|
import './vendor/index.8bPxjt7g.js';
|
|
32
34
|
import 'zlib';
|
|
@@ -43,7 +45,6 @@ import 'node:v8';
|
|
|
43
45
|
import 'node:os';
|
|
44
46
|
import 'node:events';
|
|
45
47
|
import 'tinypool';
|
|
46
|
-
import 'node:worker_threads';
|
|
47
48
|
import 'local-pkg';
|
|
48
49
|
import 'node:crypto';
|
|
49
50
|
import 'vite-node/utils';
|
|
@@ -51,14 +52,15 @@ import 'magic-string';
|
|
|
51
52
|
import 'acorn-walk';
|
|
52
53
|
import '@vitest/utils/ast';
|
|
53
54
|
import 'strip-literal';
|
|
55
|
+
import './vendor/utils.VYmeMh-u.js';
|
|
54
56
|
import 'node:module';
|
|
55
57
|
import 'node:readline';
|
|
56
58
|
import 'readline';
|
|
59
|
+
import './vendor/tasks.IknbGB2n.js';
|
|
57
60
|
import 'node:perf_hooks';
|
|
58
|
-
import './chunks/runtime-console.
|
|
61
|
+
import './chunks/runtime-console.kbFEN7E-.js';
|
|
59
62
|
import 'node:stream';
|
|
60
63
|
import './vendor/date.Ns1pGd_X.js';
|
|
61
|
-
import './vendor/tasks.IknbGB2n.js';
|
|
62
64
|
import 'node:fs/promises';
|
|
63
65
|
import 'execa';
|
|
64
66
|
import 'module';
|