vitest 3.1.1 → 3.1.2
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 +0 -44
- package/dist/browser.d.ts +4 -3
- package/dist/browser.js +3 -3
- package/dist/chunks/{base.bV8rwssx.js → base.k5EeHg0m.js} +2 -2
- package/dist/chunks/{benchmark.BKUatJGy.js → benchmark.BoF7jW0Q.js} +1 -1
- package/dist/chunks/{cac.DK21mt6F.js → cac.C5_4mAsf.js} +8 -8
- package/dist/chunks/{cli-api.bwYuoT4p.js → cli-api.z029PxYZ.js} +221 -3494
- package/dist/chunks/{config.d.DevWltVl.d.ts → config.d.UqE-KR0o.d.ts} +2 -2
- package/dist/chunks/{console.D6t261w0.js → console.K1NMVOSc.js} +1 -1
- package/dist/chunks/{coverage.SfnlalVs.js → coverage.BUdIvXbr.js} +9 -6
- package/dist/chunks/{defaults.DmfNPoe5.js → defaults.DSxsTG0h.js} +1 -1
- package/dist/chunks/{environment.d.C8UItCbf.d.ts → environment.d.Dmw5ulng.d.ts} +5 -58
- package/dist/chunks/{global.d.Cg2sEPIm.d.ts → global.d.CXRAxnWc.d.ts} +1 -1
- package/dist/chunks/{globals.DCbUWjip.js → globals.CZAEe_Gf.js} +5 -5
- package/dist/chunks/{index.BDobFbcz.js → index.B0uVAVvx.js} +3 -3
- package/dist/chunks/{index.68735LiX.js → index.CJ0plNrh.js} +37 -8
- package/dist/chunks/{index.VfYQ6MXY.js → index.Cu2UlluP.js} +4 -4
- package/dist/chunks/{index.CwHmn5H5.js → index._vwY_KdO.js} +5 -8
- package/dist/chunks/{node.IqGoMrm4.js → node.3xsWotC9.js} +1 -1
- package/dist/chunks/{reporters.d.CfRkRKN2.d.ts → reporters.d.79o4mouw.d.ts} +14 -9
- package/dist/chunks/{rpc.DGgL5dw7.js → rpc.D9_013TY.js} +2 -2
- package/dist/chunks/{run-once.I7PpBOk1.js → run-once.Dimr7O9f.js} +1 -1
- package/dist/chunks/{runBaseTests.CqmKSG99.js → runBaseTests.BV8m0B-u.js} +10 -10
- package/dist/chunks/{setup-common.DEGDGBiA.js → setup-common.AQcDs321.js} +2 -2
- package/dist/chunks/{typechecker.CG0zmr19.js → typechecker.DYQbn8uK.js} +2 -2
- package/dist/chunks/{utils.Lot3J_8U.js → utils.Cc45eY3L.js} +10 -4
- package/dist/chunks/{utils.CtocqOoE.js → utils.CgTj3MsC.js} +1 -1
- package/dist/chunks/{vi.B-PuvDzu.js → vi.ClIskdbk.js} +1 -1
- package/dist/chunks/{vite.d.4pkSbgmp.d.ts → vite.d.BVr6Nvdj.d.ts} +1 -1
- package/dist/chunks/{vm.Lp7mPCVW.js → vm.BmHENIuV.js} +16 -8
- package/dist/chunks/{worker.d.CSFlSYJg.d.ts → worker.d.C-KN07Ls.d.ts} +1 -1
- package/dist/chunks/{worker.d.C58isfFm.d.ts → worker.d.CHGSOG0s.d.ts} +21 -4
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +9 -7
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +6 -4
- package/dist/coverage.js +4 -4
- package/dist/environments.d.ts +3 -2
- package/dist/execute.d.ts +4 -3
- package/dist/index.d.ts +12 -10
- package/dist/index.js +5 -5
- package/dist/node.d.ts +10 -8
- package/dist/node.js +12 -11
- package/dist/reporters.d.ts +6 -4
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +5 -5
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +3 -3
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +9 -9
- 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 +5 -4
- package/dist/workers.js +6 -6
- package/globals.d.ts +1 -0
- package/optional-types.d.ts +7 -0
- package/package.json +17 -17
|
@@ -195,9 +195,9 @@ interface SerializedConfig {
|
|
|
195
195
|
standalone: boolean;
|
|
196
196
|
logHeapUsage: boolean | undefined;
|
|
197
197
|
coverage: SerializedCoverageConfig;
|
|
198
|
-
benchmark
|
|
198
|
+
benchmark: {
|
|
199
199
|
includeSamples: boolean
|
|
200
|
-
};
|
|
200
|
+
} | undefined;
|
|
201
201
|
}
|
|
202
202
|
interface SerializedCoverageConfig {
|
|
203
203
|
provider: "istanbul" | "v8" | "custom" | undefined;
|
|
@@ -4,7 +4,7 @@ import { Writable } from 'node:stream';
|
|
|
4
4
|
import { getSafeTimers } from '@vitest/utils';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
6
|
import { R as RealDate } from './date.CDOsz-HY.js';
|
|
7
|
-
import { g as getWorkerState } from './utils.
|
|
7
|
+
import { g as getWorkerState } from './utils.CgTj3MsC.js';
|
|
8
8
|
|
|
9
9
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
10
10
|
function getTaskIdByStack(root) {
|
|
@@ -4,7 +4,7 @@ import require$$0 from 'util';
|
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import { relative, resolve, dirname, isAbsolute, join as join$1, normalize } from 'pathe';
|
|
6
6
|
import c from 'tinyrainbow';
|
|
7
|
-
import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.
|
|
7
|
+
import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.DSxsTG0h.js';
|
|
8
8
|
import crypto from 'node:crypto';
|
|
9
9
|
import { slash, createDefer, shuffle, toArray } from '@vitest/utils';
|
|
10
10
|
import { builtinModules, createRequire } from 'node:module';
|
|
@@ -22,9 +22,9 @@ import nodeos__default from 'node:os';
|
|
|
22
22
|
import { isatty } from 'node:tty';
|
|
23
23
|
import { version } from 'vite';
|
|
24
24
|
import EventEmitter from 'node:events';
|
|
25
|
-
import { c as createBirpc } from './index.
|
|
25
|
+
import { c as createBirpc } from './index.CJ0plNrh.js';
|
|
26
26
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
27
|
-
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.
|
|
27
|
+
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.DYQbn8uK.js';
|
|
28
28
|
import { MessageChannel } from 'node:worker_threads';
|
|
29
29
|
import { hasFailed } from '@vitest/runner/utils';
|
|
30
30
|
import { rootDir } from '../path.js';
|
|
@@ -8002,8 +8002,11 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
8002
8002
|
resolved.deps.web.transformGlobPattern ??= [];
|
|
8003
8003
|
resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root));
|
|
8004
8004
|
resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root));
|
|
8005
|
-
resolved.coverage.exclude
|
|
8006
|
-
|
|
8005
|
+
resolved.coverage.exclude = [
|
|
8006
|
+
...resolved.coverage.exclude,
|
|
8007
|
+
...resolved.setupFiles.map((file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(resolved.root, file)}`),
|
|
8008
|
+
...resolved.include
|
|
8009
|
+
];
|
|
8007
8010
|
resolved.forceRerunTriggers = [...resolved.forceRerunTriggers, ...resolved.setupFiles];
|
|
8008
8011
|
resolved.server ??= {};
|
|
8009
8012
|
resolved.server.deps ??= {};
|
|
@@ -8477,7 +8480,7 @@ class BaseCoverageProvider {
|
|
|
8477
8480
|
for (const chunk of this.toSlices(filenames, this.options.processingConcurrency)) {
|
|
8478
8481
|
if (onDebug.enabled) {
|
|
8479
8482
|
index += chunk.length;
|
|
8480
|
-
onDebug(
|
|
8483
|
+
onDebug(`Reading coverage results ${index}/${total}`);
|
|
8481
8484
|
}
|
|
8482
8485
|
await Promise.all(chunk.map(async (filename) => {
|
|
8483
8486
|
const contents = await promises$1.readFile(filename, "utf-8");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
|
|
2
|
+
|
|
1
3
|
type Awaitable<T> = T | PromiseLike<T>;
|
|
2
4
|
type Nullable<T> = T | null | undefined;
|
|
3
5
|
type Arrayable<T> = T | Array<T>;
|
|
@@ -35,31 +37,10 @@ interface ModuleGraphData {
|
|
|
35
37
|
}
|
|
36
38
|
interface ProvidedContext {}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
* Happy DOM options.
|
|
40
|
-
*/
|
|
41
|
-
interface HappyDOMOptions {
|
|
42
|
-
width?: number;
|
|
43
|
-
height?: number;
|
|
44
|
-
url?: string;
|
|
45
|
-
settings?: {
|
|
46
|
-
disableJavaScriptEvaluation?: boolean
|
|
47
|
-
disableJavaScriptFileLoading?: boolean
|
|
48
|
-
disableCSSFileLoading?: boolean
|
|
49
|
-
disableIframePageLoading?: boolean
|
|
50
|
-
disableComputedStyleRendering?: boolean
|
|
51
|
-
enableFileSystemHttpRequests?: boolean
|
|
52
|
-
navigator?: {
|
|
53
|
-
userAgent?: string
|
|
54
|
-
}
|
|
55
|
-
device?: {
|
|
56
|
-
prefersColorScheme?: string
|
|
57
|
-
mediaType?: string
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
40
|
+
type HappyDOMOptions = Omit<NonNullable<ConstructorParameters<typeof happyDomTypes.Window>[0]>, "console">;
|
|
61
41
|
|
|
62
|
-
|
|
42
|
+
type JSDOMOptions = ConstructorOptionsOverride & Omit<jsdomTypes.ConstructorOptions, keyof ConstructorOptionsOverride>;
|
|
43
|
+
interface ConstructorOptionsOverride {
|
|
63
44
|
/**
|
|
64
45
|
* The html content for the test.
|
|
65
46
|
*
|
|
@@ -67,11 +48,6 @@ interface JSDOMOptions {
|
|
|
67
48
|
*/
|
|
68
49
|
html?: string | ArrayBufferLike;
|
|
69
50
|
/**
|
|
70
|
-
* referrer just affects the value read from document.referrer.
|
|
71
|
-
* It defaults to no referrer (which reflects as the empty string).
|
|
72
|
-
*/
|
|
73
|
-
referrer?: string;
|
|
74
|
-
/**
|
|
75
51
|
* userAgent affects the value read from navigator.userAgent, as well as the User-Agent header sent while fetching subresources.
|
|
76
52
|
*
|
|
77
53
|
* @default `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}`
|
|
@@ -86,21 +62,6 @@ interface JSDOMOptions {
|
|
|
86
62
|
*/
|
|
87
63
|
url?: string;
|
|
88
64
|
/**
|
|
89
|
-
* contentType affects the value read from document.contentType, and how the document is parsed: as HTML or as XML.
|
|
90
|
-
* Values that are not "text/html" or an XML mime type will throw.
|
|
91
|
-
*
|
|
92
|
-
* @default 'text/html'.
|
|
93
|
-
*/
|
|
94
|
-
contentType?: string;
|
|
95
|
-
/**
|
|
96
|
-
* The maximum size in code units for the separate storage areas used by localStorage and sessionStorage.
|
|
97
|
-
* Attempts to store data larger than this limit will cause a DOMException to be thrown. By default, it is set
|
|
98
|
-
* to 5,000,000 code units per origin, as inspired by the HTML specification.
|
|
99
|
-
*
|
|
100
|
-
* @default 5_000_000
|
|
101
|
-
*/
|
|
102
|
-
storageQuota?: number;
|
|
103
|
-
/**
|
|
104
65
|
* Enable console?
|
|
105
66
|
*
|
|
106
67
|
* @default false
|
|
@@ -117,20 +78,6 @@ interface JSDOMOptions {
|
|
|
117
78
|
*/
|
|
118
79
|
pretendToBeVisual?: boolean;
|
|
119
80
|
/**
|
|
120
|
-
* `includeNodeLocations` preserves the location info produced by the HTML parser,
|
|
121
|
-
* allowing you to retrieve it with the nodeLocation() method (described below).
|
|
122
|
-
*
|
|
123
|
-
* It defaults to false to give the best performance,
|
|
124
|
-
* and cannot be used with an XML content type since our XML parser does not support location info.
|
|
125
|
-
*
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
includeNodeLocations?: boolean | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* @default 'dangerously'
|
|
131
|
-
*/
|
|
132
|
-
runScripts?: "dangerously" | "outside-only";
|
|
133
|
-
/**
|
|
134
81
|
* Enable CookieJar
|
|
135
82
|
*
|
|
136
83
|
* @default false
|
|
@@ -2,7 +2,7 @@ import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
|
2
2
|
import { Plugin } from '@vitest/pretty-format';
|
|
3
3
|
import { SnapshotState } from '@vitest/snapshot';
|
|
4
4
|
import { B as BenchmarkResult } from './benchmark.d.BwvBVTda.js';
|
|
5
|
-
import { U as UserConsoleLog } from './environment.d.
|
|
5
|
+
import { U as UserConsoleLog } from './environment.d.Dmw5ulng.js';
|
|
6
6
|
|
|
7
7
|
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
8
8
|
interface TscErrorInfo {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.BZZyIeIE.js';
|
|
2
|
-
import { V as VitestIndex } from './index.
|
|
3
|
-
import './vi.
|
|
2
|
+
import { V as VitestIndex } from './index.B0uVAVvx.js';
|
|
3
|
+
import './vi.ClIskdbk.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
7
|
import 'chai';
|
|
8
|
-
import './utils.
|
|
8
|
+
import './utils.CgTj3MsC.js';
|
|
9
9
|
import '@vitest/utils';
|
|
10
10
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
11
11
|
import '@vitest/snapshot';
|
|
@@ -13,8 +13,8 @@ import '@vitest/utils/error';
|
|
|
13
13
|
import '@vitest/spy';
|
|
14
14
|
import '@vitest/utils/source-map';
|
|
15
15
|
import './date.CDOsz-HY.js';
|
|
16
|
-
import './run-once.
|
|
17
|
-
import './benchmark.
|
|
16
|
+
import './run-once.Dimr7O9f.js';
|
|
17
|
+
import './benchmark.BoF7jW0Q.js';
|
|
18
18
|
import 'expect-type';
|
|
19
19
|
|
|
20
20
|
function registerApiGlobally() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.
|
|
2
|
-
import { i as isFirstRun, a as runOnce } from './run-once.
|
|
3
|
-
import { b as bench } from './benchmark.
|
|
1
|
+
import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.ClIskdbk.js';
|
|
2
|
+
import { i as isFirstRun, a as runOnce } from './run-once.Dimr7O9f.js';
|
|
3
|
+
import { b as bench } from './benchmark.BoF7jW0Q.js';
|
|
4
4
|
import { expectTypeOf } from 'expect-type';
|
|
5
5
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
6
|
import * as chai from 'chai';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const TYPE_REQUEST = "q";
|
|
2
|
+
const TYPE_RESPONSE = "s";
|
|
1
3
|
const DEFAULT_TIMEOUT = 6e4;
|
|
2
4
|
function defaultSerialize(i) {
|
|
3
5
|
return i;
|
|
@@ -30,7 +32,7 @@ function createBirpc(functions, options) {
|
|
|
30
32
|
if (method === "then" && !eventNames.includes("then") && !("then" in functions))
|
|
31
33
|
return void 0;
|
|
32
34
|
const sendEvent = (...args) => {
|
|
33
|
-
post(serialize({ m: method, a: args, t:
|
|
35
|
+
post(serialize({ m: method, a: args, t: TYPE_REQUEST }));
|
|
34
36
|
};
|
|
35
37
|
if (eventNames.includes(method)) {
|
|
36
38
|
sendEvent.asEvent = sendEvent;
|
|
@@ -52,8 +54,9 @@ function createBirpc(functions, options) {
|
|
|
52
54
|
if (timeout >= 0) {
|
|
53
55
|
timeoutId = setTimeout(() => {
|
|
54
56
|
try {
|
|
55
|
-
options.onTimeoutError?.(method, args);
|
|
56
|
-
|
|
57
|
+
const handleResult = options.onTimeoutError?.(method, args);
|
|
58
|
+
if (handleResult !== true)
|
|
59
|
+
throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
57
60
|
} catch (e) {
|
|
58
61
|
reject(e);
|
|
59
62
|
}
|
|
@@ -70,17 +73,24 @@ function createBirpc(functions, options) {
|
|
|
70
73
|
return sendCall;
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
|
-
function close() {
|
|
76
|
+
function close(error) {
|
|
74
77
|
closed = true;
|
|
75
78
|
rpcPromiseMap.forEach(({ reject, method }) => {
|
|
76
|
-
reject(new Error(`[birpc] rpc is closed, cannot call "${method}"`));
|
|
79
|
+
reject(error || new Error(`[birpc] rpc is closed, cannot call "${method}"`));
|
|
77
80
|
});
|
|
78
81
|
rpcPromiseMap.clear();
|
|
79
82
|
off(onMessage);
|
|
80
83
|
}
|
|
81
84
|
async function onMessage(data, ...extra) {
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
let msg;
|
|
86
|
+
try {
|
|
87
|
+
msg = deserialize(data);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
if (options.onGeneralError?.(e) !== true)
|
|
90
|
+
throw e;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (msg.t === TYPE_REQUEST) {
|
|
84
94
|
const { m: method, a: args } = msg;
|
|
85
95
|
let result, error;
|
|
86
96
|
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
@@ -96,7 +106,26 @@ function createBirpc(functions, options) {
|
|
|
96
106
|
if (msg.i) {
|
|
97
107
|
if (error && options.onError)
|
|
98
108
|
options.onError(error, method, args);
|
|
99
|
-
|
|
109
|
+
if (error && options.onFunctionError) {
|
|
110
|
+
if (options.onFunctionError(error, method, args) === true)
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!error) {
|
|
114
|
+
try {
|
|
115
|
+
post(serialize({ t: TYPE_RESPONSE, i: msg.i, r: result }), ...extra);
|
|
116
|
+
return;
|
|
117
|
+
} catch (e) {
|
|
118
|
+
error = e;
|
|
119
|
+
if (options.onGeneralError?.(e, method, args) !== true)
|
|
120
|
+
throw e;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
post(serialize({ t: TYPE_RESPONSE, i: msg.i, e: error }), ...extra);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
if (options.onGeneralError?.(e, method, args) !== true)
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
100
129
|
}
|
|
101
130
|
} else {
|
|
102
131
|
const { i: ack, r: result, e: error } = msg;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.
|
|
3
|
+
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.AQcDs321.js';
|
|
4
4
|
import { distDir } from '../path.js';
|
|
5
|
-
import { r as rpc } from './rpc.
|
|
6
|
-
import { g as getWorkerState } from './utils.
|
|
5
|
+
import { r as rpc } from './rpc.D9_013TY.js';
|
|
6
|
+
import { g as getWorkerState } from './utils.CgTj3MsC.js';
|
|
7
7
|
|
|
8
8
|
function setupChaiConfig(config) {
|
|
9
9
|
Object.assign(chai.config, config);
|
|
@@ -11,7 +11,7 @@ function setupChaiConfig(config) {
|
|
|
11
11
|
|
|
12
12
|
async function resolveSnapshotEnvironment(config, executor) {
|
|
13
13
|
if (!config.snapshotEnvironment) {
|
|
14
|
-
const { VitestNodeSnapshotEnvironment } = await import('./node.
|
|
14
|
+
const { VitestNodeSnapshotEnvironment } = await import('./node.3xsWotC9.js');
|
|
15
15
|
return new VitestNodeSnapshotEnvironment();
|
|
16
16
|
}
|
|
17
17
|
const mod = await executor.executeId(config.snapshotEnvironment);
|
|
@@ -3,13 +3,13 @@ import { getTestName, hasFailed, getFullName, getTests, getSuites, getTasks } fr
|
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import { relative, normalize, resolve, dirname } from 'pathe';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
|
-
import { t as truncateString,
|
|
6
|
+
import { t as truncateString, e as errorBanner, F as F_POINTER, d as divider, f as formatTimeString, a as taskFail, b as F_CHECK, g as getStateSymbol, c as formatProjectName, h as F_RIGHT, w as withLabel, r as renderSnapshotSummary, p as padSummaryTitle, i as getStateString$1, j as formatTime, k as countTestErrors, l as F_TREE_NODE_END, m as F_TREE_NODE_MIDDLE } from './utils.Cc45eY3L.js';
|
|
7
7
|
import { stripVTControlCharacters } from 'node:util';
|
|
8
8
|
import { positionToOffset, lineSplitRE, isPrimitive, inspect, toArray, notNullish } from '@vitest/utils';
|
|
9
9
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
10
10
|
import { parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map';
|
|
11
11
|
import { i as isTTY } from './env.Dq0hM4Xv.js';
|
|
12
|
-
import { T as TypeCheckError, g as getOutputFile, h as hasFailedSnapshot } from './typechecker.
|
|
12
|
+
import { T as TypeCheckError, g as getOutputFile, h as hasFailedSnapshot } from './typechecker.DYQbn8uK.js';
|
|
13
13
|
import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
|
|
14
14
|
import { Console } from 'node:console';
|
|
15
15
|
import { Writable } from 'node:stream';
|
|
@@ -252,7 +252,7 @@ function printErrorInner(error, project, options) {
|
|
|
252
252
|
return { nearest };
|
|
253
253
|
}
|
|
254
254
|
function printErrorType(type, ctx) {
|
|
255
|
-
ctx.logger.error(`\n${
|
|
255
|
+
ctx.logger.error(`\n${errorBanner(type)}`);
|
|
256
256
|
}
|
|
257
257
|
const skipErrorProperties = new Set([
|
|
258
258
|
"nameStr",
|
|
@@ -917,7 +917,7 @@ class BaseReporter {
|
|
|
917
917
|
if (filepath) {
|
|
918
918
|
name += c.dim(` [ ${this.relative(filepath)} ]`);
|
|
919
919
|
}
|
|
920
|
-
this.ctx.logger.error(`${c.
|
|
920
|
+
this.ctx.logger.error(`${c.bgRed(c.bold(" FAIL "))} ${formatProjectName(projectName)}${name}`);
|
|
921
921
|
}
|
|
922
922
|
const screenshotPaths = tasks.map((t) => t.meta?.failScreenshotPath).filter((screenshot) => screenshot != null);
|
|
923
923
|
this.ctx.logger.printError(error, {
|
|
@@ -930,9 +930,6 @@ class BaseReporter {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function errorBanner(message) {
|
|
934
|
-
return c.red(divider(c.bold(c.inverse(` ${message} `))));
|
|
935
|
-
}
|
|
936
933
|
function sum(items, cb) {
|
|
937
934
|
return items.reduce((total, next) => {
|
|
938
935
|
return total + Math.max(cb(next) || 0, 0);
|
|
@@ -946,7 +943,7 @@ class BasicReporter extends BaseReporter {
|
|
|
946
943
|
}
|
|
947
944
|
onInit(ctx) {
|
|
948
945
|
super.onInit(ctx);
|
|
949
|
-
ctx.logger.log(c.
|
|
946
|
+
ctx.logger.log(c.bold(c.bgYellow(" DEPRECATED ")), c.yellow(`'basic' reporter is deprecated and will be removed in Vitest v3.\n` + `Remove 'basic' from 'reporters' option. To match 'basic' reporter 100%, use configuration:\n${JSON.stringify({ test: { reporters: [["default", { summary: false }]] } }, null, 2)}`));
|
|
950
947
|
}
|
|
951
948
|
reportSummary(files, errors) {
|
|
952
949
|
this.ctx.logger.log();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
2
|
-
import { g as getWorkerState } from './utils.
|
|
2
|
+
import { g as getWorkerState } from './utils.CgTj3MsC.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
|
|
5
5
|
class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Task, TaskMeta, Suite, File, TaskResultPack, SequenceSetupFiles, SequenceHooks, CancelReason } from '@vitest/runner';
|
|
2
|
-
import { b as Awaitable, U as UserConsoleLog, c as Arrayable$1, A as AfterSuiteRunMeta, f as EnvironmentOptions, P as ProvidedContext } from './environment.d.
|
|
2
|
+
import { b as Awaitable, U as UserConsoleLog, c as Arrayable$1, A as AfterSuiteRunMeta, f as EnvironmentOptions, P as ProvidedContext } from './environment.d.Dmw5ulng.js';
|
|
3
3
|
import { ParsedStack, TestError, SerializedError, ErrorWithDiff, Arrayable, Awaitable as Awaitable$1 } from '@vitest/utils';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
5
|
import { TransformResult as TransformResult$1, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions, ViteDevServer, ModuleNode } from 'vite';
|
|
6
6
|
import { Console } from 'node:console';
|
|
7
7
|
import { MockedModule } from '@vitest/mocker';
|
|
8
8
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
9
|
-
import {
|
|
9
|
+
import { T as TestExecutionMethod } from './worker.d.CHGSOG0s.js';
|
|
10
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.UqE-KR0o.js';
|
|
10
11
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
11
12
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
12
13
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
@@ -1037,6 +1038,12 @@ interface BuiltinReporterOptions {
|
|
|
1037
1038
|
"html": HTMLOptions;
|
|
1038
1039
|
}
|
|
1039
1040
|
|
|
1041
|
+
interface BrowserTesterOptions {
|
|
1042
|
+
method: TestExecutionMethod;
|
|
1043
|
+
files: string[];
|
|
1044
|
+
providedContext: string;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1040
1047
|
type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys">;
|
|
1041
1048
|
|
|
1042
1049
|
interface TestSequencer {
|
|
@@ -2442,15 +2449,13 @@ interface BrowserCommandContext {
|
|
|
2442
2449
|
sessionId: string;
|
|
2443
2450
|
}
|
|
2444
2451
|
interface BrowserServerStateSession {
|
|
2445
|
-
files: string[];
|
|
2446
|
-
method: "run" | "collect";
|
|
2447
2452
|
project: TestProject;
|
|
2448
2453
|
connected: () => void;
|
|
2449
|
-
|
|
2450
|
-
reject: (v: unknown) => void;
|
|
2454
|
+
fail: (v: Error) => void;
|
|
2451
2455
|
}
|
|
2452
2456
|
interface BrowserOrchestrator {
|
|
2453
|
-
|
|
2457
|
+
cleanupTesters: () => Promise<void>;
|
|
2458
|
+
createTesters: (options: BrowserTesterOptions) => Promise<void>;
|
|
2454
2459
|
onCancel: (reason: CancelReason) => Promise<void>;
|
|
2455
2460
|
$close: () => void;
|
|
2456
2461
|
}
|
|
@@ -3040,5 +3045,5 @@ declare class Vitest {
|
|
|
3040
3045
|
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
3041
3046
|
type OnTestsRerunHandler = (testFiles: TestSpecification[]) => Promise<void> | void;
|
|
3042
3047
|
|
|
3043
|
-
export { CoverageMap as C, TestSpecification as
|
|
3044
|
-
export type {
|
|
3048
|
+
export { CoverageMap as C, TestSpecification as J, TestModule as K, Logger as L, VitestPackageInstaller as Q, TestProject as T, Vitest as V, getFilePoolName as Z, TestCase as a3, TestCollection as a4, BasicReporter as aB, BenchmarkReporter as aC, BenchmarkReportsMap as aD, DefaultReporter as aE, DotReporter as aF, GithubActionsReporter as aG, HangingProcessReporter as aH, JsonReporter as aI, JUnitReporter as aJ, ReportersMap as aK, TapFlatReporter as aL, TapReporter as aM, VerboseBenchmarkReporter as aN, VerboseReporter as aO, BaseReporter as aP, TestSuite as ac };
|
|
3049
|
+
export type { HTMLOptions as $, ApiConfig as A, BaseCoverageOptions as B, DepsOptimizationOptions as D, BenchmarkUserOptions as E, BrowserTesterOptions as F, VitestOptions as G, TestSequencer as H, InlineConfig as I, ModuleDiagnostic as M, OnTestsRerunHandler as N, OnServerRestartHandler as O, Pool as P, ResolvedCoverageOptions as R, SerializedTestSpecification as S, UserWorkspaceConfig as U, WorkspaceProjectConfiguration as W, ProcessPool as X, WorkspaceSpec as Y, SerializedTestProject as _, ReportContext as a, JsonOptions$1 as a0, JUnitOptions as a1, TaskOptions as a2, TestDiagnostic as a5, TestModuleState as a6, TestResult as a7, TestResultFailed as a8, TestResultPassed as a9, TestRunEndReason as aA, BenchmarkBuiltinReporters as aQ, BuiltinReporterOptions as aR, BuiltinReporters as aS, JsonAssertionResult as aT, JsonTestResult as aU, JsonTestResults as aV, TestResultSkipped as aa, TestState as ab, TestSuiteState as ad, TestSequencerConstructor as ae, BrowserBuiltinProvider as af, BrowserCommand as ag, BrowserCommandContext as ah, BrowserInstanceOption as ai, BrowserModuleMocker as aj, BrowserOrchestrator as ak, BrowserProvider as al, BrowserProviderInitializationOptions as am, BrowserProviderModule as an, BrowserProviderOptions as ao, BrowserServerState as ap, BrowserServerStateSession as aq, CDPSession as ar, ParentProjectBrowser as as, ProjectBrowser as at, ResolvedBrowserOptions as au, ResolvedProjectConfig as av, ResolveSnapshotPathHandler as aw, ResolveSnapshotPathHandlerContext as ax, TestRunResult as ay, ReportedHookContext as az, TestProjectConfiguration as b, CoverageV8Options as c, UserProjectConfigFn as d, UserProjectConfigExport as e, TestProjectInlineConfiguration as f, CoverageProvider as g, CoverageProviderModule as h, CoverageReporter as i, CoverageProviderName as j, CoverageOptions as k, CoverageIstanbulOptions as l, CustomProviderOptions as m, Reporter as n, BrowserScript as o, BrowserConfigOptions as p, BuiltinEnvironment as q, VitestEnvironment as r, PoolOptions as s, CSSModuleScopeStrategy as t, VitestRunMode as u, TransformModePatterns as v, TypecheckConfig as w, UserConfig as x, ResolvedConfig as y, ProjectConfig as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { c as createBirpc } from './index.
|
|
3
|
-
import { g as getWorkerState } from './utils.
|
|
2
|
+
import { c as createBirpc } from './index.CJ0plNrh.js';
|
|
3
|
+
import { g as getWorkerState } from './utils.CgTj3MsC.js';
|
|
4
4
|
|
|
5
5
|
const { get } = Reflect;
|
|
6
6
|
function withSafeTimers(fn) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
4
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.Cu2UlluP.js';
|
|
4
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.AQcDs321.js';
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.ClIskdbk.js';
|
|
6
6
|
import { c as closeInspector } from './inspector.DbDkSkFn.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
@@ -11,17 +11,17 @@ import util from 'node:util';
|
|
|
11
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
12
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
13
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
14
|
-
import { V as VitestIndex } from './index.
|
|
15
|
-
import { g as getWorkerState, r as resetModules } from './utils.
|
|
14
|
+
import { V as VitestIndex } from './index.B0uVAVvx.js';
|
|
15
|
+
import { g as getWorkerState, r as resetModules } from './utils.CgTj3MsC.js';
|
|
16
16
|
import 'chai';
|
|
17
17
|
import 'node:path';
|
|
18
18
|
import '../path.js';
|
|
19
19
|
import 'node:url';
|
|
20
|
-
import './rpc.
|
|
21
|
-
import './index.
|
|
20
|
+
import './rpc.D9_013TY.js';
|
|
21
|
+
import './index.CJ0plNrh.js';
|
|
22
22
|
import './coverage.0iPg4Wrz.js';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
|
-
import './run-once.
|
|
24
|
+
import './run-once.Dimr7O9f.js';
|
|
25
25
|
import '@vitest/expect';
|
|
26
26
|
import '@vitest/runner/utils';
|
|
27
27
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
@@ -29,7 +29,7 @@ import '@vitest/utils/error';
|
|
|
29
29
|
import '@vitest/spy';
|
|
30
30
|
import '@vitest/utils/source-map';
|
|
31
31
|
import './date.CDOsz-HY.js';
|
|
32
|
-
import './benchmark.
|
|
32
|
+
import './benchmark.BoF7jW0Q.js';
|
|
33
33
|
import 'expect-type';
|
|
34
34
|
|
|
35
35
|
let globalSetup = false;
|
|
@@ -77,7 +77,7 @@ function resolveAsset(mod, url) {
|
|
|
77
77
|
mod.exports = url;
|
|
78
78
|
}
|
|
79
79
|
async function setupConsoleLogSpy() {
|
|
80
|
-
const { createCustomConsole } = await import('./console.
|
|
80
|
+
const { createCustomConsole } = await import('./console.K1NMVOSc.js');
|
|
81
81
|
globalThis.console = createCustomConsole();
|
|
82
82
|
}
|
|
83
83
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as resolveCoverageProviderModule } from './coverage.0iPg4Wrz.js';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
3
|
import { setSafeTimers } from '@vitest/utils';
|
|
4
|
-
import { r as resetRunOnceCounter } from './run-once.
|
|
4
|
+
import { r as resetRunOnceCounter } from './run-once.Dimr7O9f.js';
|
|
5
5
|
|
|
6
6
|
async function startCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
7
7
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
@@ -36,7 +36,7 @@ async function setupCommonEnv(config) {
|
|
|
36
36
|
globalSetup = true;
|
|
37
37
|
setSafeTimers();
|
|
38
38
|
if (config.globals) {
|
|
39
|
-
(await import('./globals.
|
|
39
|
+
(await import('./globals.CZAEe_Gf.js')).registerApiGlobally();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function setupDefines(defines) {
|