@vitest/runner 0.31.3 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-tasks.js +3 -141
- package/dist/index.d.ts +4 -4
- package/dist/index.js +21 -33
- package/dist/{runner-6af7d148.d.ts → runner-0b317aff.d.ts} +1 -1
- package/dist/{tasks-900f5000.d.ts → tasks-045d21eb.d.ts} +12 -12
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +3 -12
- package/dist/utils.js +2 -2
- package/package.json +2 -2
package/dist/chunk-tasks.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { processError } from '@vitest/utils/error';
|
2
|
+
import { toArray } from '@vitest/utils';
|
3
3
|
|
4
4
|
function partitionSuiteChildren(suite) {
|
5
5
|
let tasksGroup = [];
|
@@ -17,144 +17,6 @@ function partitionSuiteChildren(suite) {
|
|
17
17
|
return tasksGroups;
|
18
18
|
}
|
19
19
|
|
20
|
-
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
21
|
-
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
22
|
-
function isImmutable(v) {
|
23
|
-
return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
|
24
|
-
}
|
25
|
-
const OBJECT_PROTO = Object.getPrototypeOf({});
|
26
|
-
function getUnserializableMessage(err) {
|
27
|
-
if (err instanceof Error)
|
28
|
-
return `<unserializable>: ${err.message}`;
|
29
|
-
if (typeof err === "string")
|
30
|
-
return `<unserializable>: ${err}`;
|
31
|
-
return "<unserializable>";
|
32
|
-
}
|
33
|
-
function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
|
34
|
-
if (!val || typeof val === "string")
|
35
|
-
return val;
|
36
|
-
if (typeof val === "function")
|
37
|
-
return `Function<${val.name || "anonymous"}>`;
|
38
|
-
if (typeof val === "symbol")
|
39
|
-
return val.toString();
|
40
|
-
if (typeof val !== "object")
|
41
|
-
return val;
|
42
|
-
if (isImmutable(val))
|
43
|
-
return serializeError(val.toJSON(), seen);
|
44
|
-
if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction")
|
45
|
-
return "Promise";
|
46
|
-
if (typeof Element !== "undefined" && val instanceof Element)
|
47
|
-
return val.tagName;
|
48
|
-
if (typeof val.asymmetricMatch === "function")
|
49
|
-
return `${val.toString()} ${format(val.sample)}`;
|
50
|
-
if (seen.has(val))
|
51
|
-
return seen.get(val);
|
52
|
-
if (Array.isArray(val)) {
|
53
|
-
const clone = new Array(val.length);
|
54
|
-
seen.set(val, clone);
|
55
|
-
val.forEach((e, i) => {
|
56
|
-
try {
|
57
|
-
clone[i] = serializeError(e, seen);
|
58
|
-
} catch (err) {
|
59
|
-
clone[i] = getUnserializableMessage(err);
|
60
|
-
}
|
61
|
-
});
|
62
|
-
return clone;
|
63
|
-
} else {
|
64
|
-
const clone = /* @__PURE__ */ Object.create(null);
|
65
|
-
seen.set(val, clone);
|
66
|
-
let obj = val;
|
67
|
-
while (obj && obj !== OBJECT_PROTO) {
|
68
|
-
Object.getOwnPropertyNames(obj).forEach((key) => {
|
69
|
-
if (key in clone)
|
70
|
-
return;
|
71
|
-
try {
|
72
|
-
clone[key] = serializeError(val[key], seen);
|
73
|
-
} catch (err) {
|
74
|
-
delete clone[key];
|
75
|
-
clone[key] = getUnserializableMessage(err);
|
76
|
-
}
|
77
|
-
});
|
78
|
-
obj = Object.getPrototypeOf(obj);
|
79
|
-
}
|
80
|
-
return clone;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
function normalizeErrorMessage(message) {
|
84
|
-
return message.replace(/__vite_ssr_import_\d+__\./g, "");
|
85
|
-
}
|
86
|
-
function processError(err, options = {}) {
|
87
|
-
if (!err || typeof err !== "object")
|
88
|
-
return { message: err };
|
89
|
-
if (err.stack)
|
90
|
-
err.stackStr = String(err.stack);
|
91
|
-
if (err.name)
|
92
|
-
err.nameStr = String(err.name);
|
93
|
-
const clonedActual = deepClone(err.actual, { forceWritable: true });
|
94
|
-
const clonedExpected = deepClone(err.expected, { forceWritable: true });
|
95
|
-
const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
|
96
|
-
if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0)
|
97
|
-
err.diff = unifiedDiff(replacedActual, replacedExpected, options);
|
98
|
-
if (typeof err.expected !== "string")
|
99
|
-
err.expected = stringify(err.expected, 10);
|
100
|
-
if (typeof err.actual !== "string")
|
101
|
-
err.actual = stringify(err.actual, 10);
|
102
|
-
try {
|
103
|
-
if (typeof err.message === "string")
|
104
|
-
err.message = normalizeErrorMessage(err.message);
|
105
|
-
if (typeof err.cause === "object" && typeof err.cause.message === "string")
|
106
|
-
err.cause.message = normalizeErrorMessage(err.cause.message);
|
107
|
-
} catch {
|
108
|
-
}
|
109
|
-
try {
|
110
|
-
return serializeError(err);
|
111
|
-
} catch (e) {
|
112
|
-
return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
|
113
|
-
Inner error message: ${err == null ? void 0 : err.message}`));
|
114
|
-
}
|
115
|
-
}
|
116
|
-
function isAsymmetricMatcher(data) {
|
117
|
-
const type = getType(data);
|
118
|
-
return type === "Object" && typeof data.asymmetricMatch === "function";
|
119
|
-
}
|
120
|
-
function isReplaceable(obj1, obj2) {
|
121
|
-
const obj1Type = getType(obj1);
|
122
|
-
const obj2Type = getType(obj2);
|
123
|
-
return obj1Type === obj2Type && obj1Type === "Object";
|
124
|
-
}
|
125
|
-
function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
|
126
|
-
if (!isReplaceable(actual, expected))
|
127
|
-
return { replacedActual: actual, replacedExpected: expected };
|
128
|
-
if (actualReplaced.has(actual) || expectedReplaced.has(expected))
|
129
|
-
return { replacedActual: actual, replacedExpected: expected };
|
130
|
-
actualReplaced.add(actual);
|
131
|
-
expectedReplaced.add(expected);
|
132
|
-
getOwnProperties(expected).forEach((key) => {
|
133
|
-
const expectedValue = expected[key];
|
134
|
-
const actualValue = actual[key];
|
135
|
-
if (isAsymmetricMatcher(expectedValue)) {
|
136
|
-
if (expectedValue.asymmetricMatch(actualValue))
|
137
|
-
actual[key] = expectedValue;
|
138
|
-
} else if (isAsymmetricMatcher(actualValue)) {
|
139
|
-
if (actualValue.asymmetricMatch(expectedValue))
|
140
|
-
expected[key] = actualValue;
|
141
|
-
} else if (isReplaceable(actualValue, expectedValue)) {
|
142
|
-
const replaced = replaceAsymmetricMatcher(
|
143
|
-
actualValue,
|
144
|
-
expectedValue,
|
145
|
-
actualReplaced,
|
146
|
-
expectedReplaced
|
147
|
-
);
|
148
|
-
actual[key] = replaced.replacedActual;
|
149
|
-
expected[key] = replaced.replacedExpected;
|
150
|
-
}
|
151
|
-
});
|
152
|
-
return {
|
153
|
-
replacedActual: actual,
|
154
|
-
replacedExpected: expected
|
155
|
-
};
|
156
|
-
}
|
157
|
-
|
158
20
|
function interpretTaskModes(suite, namePattern, onlyMode, parentIsOnly, allowOnly) {
|
159
21
|
const suiteIsOnly = parentIsOnly || suite.mode === "only";
|
160
22
|
suite.tasks.forEach((t) => {
|
@@ -287,4 +149,4 @@ function getNames(task) {
|
|
287
149
|
return names;
|
288
150
|
}
|
289
151
|
|
290
|
-
export { calculateSuiteHash as a,
|
152
|
+
export { calculateSuiteHash as a, hasFailed as b, createChainable as c, getTests as d, getTasks as e, getSuites as f, generateHash as g, hasTests as h, interpretTaskModes as i, getNames as j, partitionSuiteChildren as p, someTasksAreOnly as s };
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { V as VitestRunner } from './runner-
|
2
|
-
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-
|
3
|
-
import { T as Task, F as File, S as SuiteAPI, a as TestAPI, b as SuiteCollector, c as SuiteHooks, O as OnTestFailedHandler, d as Test } from './tasks-
|
4
|
-
export { D as DoneCallback, n as HookCleanupCallback, H as HookListener, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, o as SuiteFactory, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-
|
1
|
+
import { V as VitestRunner } from './runner-0b317aff.js';
|
2
|
+
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-0b317aff.js';
|
3
|
+
import { T as Task, F as File, S as SuiteAPI, a as TestAPI, b as SuiteCollector, c as SuiteHooks, O as OnTestFailedHandler, d as Test } from './tasks-045d21eb.js';
|
4
|
+
export { D as DoneCallback, n as HookCleanupCallback, H as HookListener, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, o as SuiteFactory, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-045d21eb.js';
|
5
5
|
import { Awaitable } from '@vitest/utils';
|
6
6
|
|
7
7
|
declare function updateTask(task: Task, runner: VitestRunner): void;
|
package/dist/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import limit from 'p-limit';
|
2
2
|
import { getSafeTimers, format, isObject, objDisplay, objectAttr, noop, toArray, shuffle } from '@vitest/utils';
|
3
|
-
import {
|
3
|
+
import { processError } from '@vitest/utils/error';
|
4
|
+
import { c as createChainable, g as generateHash, a as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, p as partitionSuiteChildren, h as hasTests, b as hasFailed } from './chunk-tasks.js';
|
4
5
|
import { relative } from 'pathe';
|
5
|
-
import '@vitest/utils/diff';
|
6
6
|
|
7
7
|
const fnMap = /* @__PURE__ */ new WeakMap();
|
8
8
|
const hooksMap = /* @__PURE__ */ new WeakMap();
|
@@ -66,30 +66,10 @@ function makeTimeoutMsg(isHook, timeout) {
|
|
66
66
|
If this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
|
67
67
|
}
|
68
68
|
|
69
|
-
var version = "0.31.3";
|
70
|
-
|
71
|
-
function getVersion() {
|
72
|
-
return globalThis.__vitest_runner_version__ || version;
|
73
|
-
}
|
74
|
-
function markVersion() {
|
75
|
-
globalThis.__vitest_runner_version__ = version;
|
76
|
-
}
|
77
|
-
function checkVersion() {
|
78
|
-
const collectVersion = getVersion();
|
79
|
-
if (collectVersion !== version) {
|
80
|
-
const error = `Version mismatch: Vitest started as ${collectVersion}, but tests are collected with ${version} version.
|
81
|
-
|
82
|
-
- If you are using global Vitest, make sure your package has the same version.
|
83
|
-
- If you have a monorepo setup, make sure your main package has the same version as your test packages.`;
|
84
|
-
throw new Error(error);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
69
|
const suite = createSuite();
|
89
70
|
const test = createTest(
|
90
71
|
function(name, fn, options) {
|
91
|
-
|
92
|
-
getCurrentSuite().test.fn.call(this, name, fn, options);
|
72
|
+
getCurrentSuite().test.fn.call(this, formatName(name), fn, options);
|
93
73
|
}
|
94
74
|
);
|
95
75
|
const describe = suite;
|
@@ -142,7 +122,7 @@ function createSuiteCollector(name, factory = () => {
|
|
142
122
|
const test3 = {
|
143
123
|
id: "",
|
144
124
|
type: "test",
|
145
|
-
name: name2,
|
125
|
+
name: formatName(name2),
|
146
126
|
each: this.each,
|
147
127
|
mode: mode2,
|
148
128
|
suite: void 0,
|
@@ -234,14 +214,13 @@ function createSuiteCollector(name, factory = () => {
|
|
234
214
|
}
|
235
215
|
function createSuite() {
|
236
216
|
function suiteFn(name, factory, options) {
|
237
|
-
checkVersion();
|
238
217
|
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
239
218
|
const currentSuite = getCurrentSuite();
|
240
219
|
if (typeof options === "number")
|
241
220
|
options = { timeout: options };
|
242
221
|
if (currentSuite == null ? void 0 : currentSuite.options)
|
243
222
|
options = { ...currentSuite.options, ...options };
|
244
|
-
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, this.each, options);
|
223
|
+
return createSuiteCollector(formatName(name), factory, mode, this.concurrent, this.shuffle, this.each, options);
|
245
224
|
}
|
246
225
|
suiteFn.each = function(cases, ...args) {
|
247
226
|
const suite2 = this.withContext();
|
@@ -249,10 +228,11 @@ function createSuite() {
|
|
249
228
|
if (Array.isArray(cases) && args.length)
|
250
229
|
cases = formatTemplateString(cases, args);
|
251
230
|
return (name, fn, options) => {
|
231
|
+
const _name = formatName(name);
|
252
232
|
const arrayOnlyCases = cases.every(Array.isArray);
|
253
233
|
cases.forEach((i, idx) => {
|
254
234
|
const items = Array.isArray(i) ? i : [i];
|
255
|
-
arrayOnlyCases ? suite2(formatTitle(
|
235
|
+
arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => fn(...items), options) : suite2(formatTitle(_name, items, idx), () => fn(i), options);
|
256
236
|
});
|
257
237
|
this.setContext("each", void 0);
|
258
238
|
};
|
@@ -272,10 +252,11 @@ function createTest(fn) {
|
|
272
252
|
if (Array.isArray(cases) && args.length)
|
273
253
|
cases = formatTemplateString(cases, args);
|
274
254
|
return (name, fn2, options) => {
|
255
|
+
const _name = formatName(name);
|
275
256
|
const arrayOnlyCases = cases.every(Array.isArray);
|
276
257
|
cases.forEach((i, idx) => {
|
277
258
|
const items = Array.isArray(i) ? i : [i];
|
278
|
-
arrayOnlyCases ? test2(formatTitle(
|
259
|
+
arrayOnlyCases ? test2(formatTitle(_name, items, idx), () => fn2(...items), options) : test2(formatTitle(_name, items, idx), () => fn2(i), options);
|
279
260
|
});
|
280
261
|
this.setContext("each", void 0);
|
281
262
|
};
|
@@ -287,6 +268,9 @@ function createTest(fn) {
|
|
287
268
|
testFn
|
288
269
|
);
|
289
270
|
}
|
271
|
+
function formatName(name) {
|
272
|
+
return typeof name === "string" ? name : name instanceof Function ? name.name : String(name);
|
273
|
+
}
|
290
274
|
function formatTitle(template, items, idx) {
|
291
275
|
if (template.includes("%#")) {
|
292
276
|
template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/__vitest_escaped_%__/g, "%%");
|
@@ -514,10 +498,12 @@ async function runTest(test, runner) {
|
|
514
498
|
throw errors;
|
515
499
|
}
|
516
500
|
await ((_d = runner.onAfterTryTest) == null ? void 0 : _d.call(runner, test, { retry: retryCount, repeats: repeatCount }));
|
517
|
-
if (
|
518
|
-
test.
|
519
|
-
|
520
|
-
test.
|
501
|
+
if (test.result.state !== "fail") {
|
502
|
+
if (!test.repeats)
|
503
|
+
test.result.state = "pass";
|
504
|
+
else if (test.repeats && retry === retryCount)
|
505
|
+
test.result.state = "pass";
|
506
|
+
}
|
521
507
|
} catch (e) {
|
522
508
|
failTask(test.result, e);
|
523
509
|
}
|
@@ -529,6 +515,9 @@ async function runTest(test, runner) {
|
|
529
515
|
}
|
530
516
|
if (test.result.state === "pass")
|
531
517
|
break;
|
518
|
+
if (retryCount < retry - 1) {
|
519
|
+
test.result.state = "run";
|
520
|
+
}
|
532
521
|
updateTask(test, runner);
|
533
522
|
}
|
534
523
|
}
|
@@ -664,7 +653,6 @@ async function runFiles(files, runner) {
|
|
664
653
|
}
|
665
654
|
async function startTests(paths, runner) {
|
666
655
|
var _a, _b, _c, _d;
|
667
|
-
markVersion();
|
668
656
|
await ((_a = runner.onBeforeCollect) == null ? void 0 : _a.call(runner, paths));
|
669
657
|
const files = await collectTests(paths, runner);
|
670
658
|
(_b = runner.onCollected) == null ? void 0 : _b.call(runner, files);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { r as SequenceHooks, s as SequenceSetupFiles, F as File, d as Test, k as Suite, j as TaskResultPack, q as TestContext } from './tasks-
|
1
|
+
import { r as SequenceHooks, s as SequenceSetupFiles, F as File, d as Test, k as Suite, j as TaskResultPack, q as TestContext } from './tasks-045d21eb.js';
|
2
2
|
|
3
3
|
interface VitestRunnerConfig {
|
4
4
|
root: string;
|
@@ -86,23 +86,23 @@ type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
86
86
|
fallback: Array<T extends ReadonlyArray<infer U> ? U : any>;
|
87
87
|
}[T extends Readonly<[any]> ? 1 : T extends Readonly<[any, any]> ? 2 : T extends Readonly<[any, any, any]> ? 3 : T extends Readonly<[any, any, any, any]> ? 4 : T extends Readonly<[any, any, any, any, any]> ? 5 : T extends Readonly<[any, any, any, any, any, any]> ? 6 : T extends Readonly<[any, any, any, any, any, any, any]> ? 7 : T extends Readonly<[any, any, any, any, any, any, any, any]> ? 8 : T extends Readonly<[any, any, any, any, any, any, any, any, any]> ? 9 : T extends Readonly<[any, any, any, any, any, any, any, any, any, any]> ? 10 : 'fallback'];
|
88
88
|
interface SuiteEachFunction {
|
89
|
-
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>) => void;
|
90
|
-
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>) => void;
|
91
|
-
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>) => void;
|
89
|
+
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: T) => Awaitable<void>) => void;
|
90
|
+
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>) => void;
|
91
|
+
<T>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: T[]) => Awaitable<void>) => void;
|
92
92
|
}
|
93
93
|
interface TestEachFunction {
|
94
|
-
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
|
95
|
-
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
|
96
|
-
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
97
|
-
(...args: [TemplateStringsArray, ...any]): (name: string, fn: (...args: any[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
94
|
+
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
|
95
|
+
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
|
96
|
+
<T>(cases: ReadonlyArray<T>): (name: string | Function, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
97
|
+
(...args: [TemplateStringsArray, ...any]): (name: string | Function, fn: (...args: any[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
98
98
|
}
|
99
99
|
type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
100
|
-
name: string,
|
100
|
+
name: string | Function,
|
101
101
|
fn?: TestFunction<ExtraContext>,
|
102
102
|
options?: number | TestOptions
|
103
103
|
], void, {
|
104
104
|
each: TestEachFunction;
|
105
|
-
<T extends ExtraContext>(name: string, fn?: TestFunction<T>, options?: number | TestOptions): void;
|
105
|
+
<T extends ExtraContext>(name: string | Function, fn?: TestFunction<T>, options?: number | TestOptions): void;
|
106
106
|
}>;
|
107
107
|
interface TestOptions {
|
108
108
|
/**
|
@@ -131,12 +131,12 @@ type TestAPI<ExtraContext = {}> = ChainableTestAPI<ExtraContext> & {
|
|
131
131
|
runIf(condition: any): ChainableTestAPI<ExtraContext>;
|
132
132
|
};
|
133
133
|
type ChainableSuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'shuffle', [
|
134
|
-
name: string,
|
134
|
+
name: string | Function,
|
135
135
|
factory?: SuiteFactory<ExtraContext>,
|
136
136
|
options?: number | TestOptions
|
137
137
|
], SuiteCollector<ExtraContext>, {
|
138
138
|
each: TestEachFunction;
|
139
|
-
<T extends ExtraContext>(name: string, factory?: SuiteFactory<T>): SuiteCollector<T>;
|
139
|
+
<T extends ExtraContext>(name: string | Function, factory?: SuiteFactory<T>): SuiteCollector<T>;
|
140
140
|
}>;
|
141
141
|
type SuiteAPI<ExtraContext = {}> = ChainableSuiteAPI<ExtraContext> & {
|
142
142
|
each: SuiteEachFunction;
|
@@ -163,7 +163,7 @@ interface SuiteCollector<ExtraContext = {}> {
|
|
163
163
|
clear: () => void;
|
164
164
|
on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
|
165
165
|
}
|
166
|
-
type SuiteFactory<ExtraContext = {}> = (test: (name: string, fn: TestFunction<ExtraContext>) => void) => Awaitable<void>;
|
166
|
+
type SuiteFactory<ExtraContext = {}> = (test: (name: string | Function, fn: TestFunction<ExtraContext>) => void) => Awaitable<void>;
|
167
167
|
interface RuntimeContext {
|
168
168
|
tasks: (SuiteCollector | Test)[];
|
169
169
|
currentSuite: SuiteCollector | null;
|
package/dist/types.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export { D as DoneCallback, F as File, n as HookCleanupCallback, H as HookListener, O as OnTestFailedHandler, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, S as SuiteAPI, b as SuiteCollector, o as SuiteFactory, c as SuiteHooks, T as Task, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, d as Test, a as TestAPI, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-
|
2
|
-
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-
|
1
|
+
export { D as DoneCallback, F as File, n as HookCleanupCallback, H as HookListener, O as OnTestFailedHandler, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, S as SuiteAPI, b as SuiteCollector, o as SuiteFactory, c as SuiteHooks, T as Task, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, d as Test, a as TestAPI, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-045d21eb.js';
|
2
|
+
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-0b317aff.js';
|
3
3
|
import '@vitest/utils';
|
package/dist/utils.d.ts
CHANGED
@@ -1,15 +1,6 @@
|
|
1
|
-
import { k as Suite, T as Task, d as Test, h as TaskCustom } from './tasks-
|
2
|
-
export { C as ChainableFunction, t as createChainable } from './tasks-
|
1
|
+
import { k as Suite, T as Task, d as Test, h as TaskCustom } from './tasks-045d21eb.js';
|
2
|
+
export { C as ChainableFunction, t as createChainable } from './tasks-045d21eb.js';
|
3
3
|
import { Arrayable } from '@vitest/utils';
|
4
|
-
export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
|
5
|
-
import { DiffOptions } from '@vitest/utils/diff';
|
6
|
-
|
7
|
-
declare function serializeError(val: any, seen?: WeakMap<object, any>): any;
|
8
|
-
declare function processError(err: any, options?: DiffOptions): any;
|
9
|
-
declare function replaceAsymmetricMatcher(actual: any, expected: any, actualReplaced?: WeakSet<object>, expectedReplaced?: WeakSet<object>): {
|
10
|
-
replacedActual: any;
|
11
|
-
replacedExpected: any;
|
12
|
-
};
|
13
4
|
|
14
5
|
/**
|
15
6
|
* If any tasks been marked as `only`, mark all other tasks as `skip`.
|
@@ -31,4 +22,4 @@ declare function hasTests(suite: Arrayable<Suite>): boolean;
|
|
31
22
|
declare function hasFailed(suite: Arrayable<Task>): boolean;
|
32
23
|
declare function getNames(task: Task): string[];
|
33
24
|
|
34
|
-
export { calculateSuiteHash, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, partitionSuiteChildren,
|
25
|
+
export { calculateSuiteHash, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, partitionSuiteChildren, someTasksAreOnly };
|
package/dist/utils.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export { a as calculateSuiteHash, c as createChainable, g as generateHash,
|
1
|
+
export { a as calculateSuiteHash, c as createChainable, g as generateHash, j as getNames, f as getSuites, e as getTasks, d as getTests, b as hasFailed, h as hasTests, i as interpretTaskModes, p as partitionSuiteChildren, s as someTasksAreOnly } from './chunk-tasks.js';
|
2
|
+
import '@vitest/utils/error';
|
2
3
|
import '@vitest/utils';
|
3
|
-
import '@vitest/utils/diff';
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/runner",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.32.0",
|
5
5
|
"description": "Vitest test runner",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"concordance": "^5.0.4",
|
42
42
|
"p-limit": "^4.0.0",
|
43
43
|
"pathe": "^1.1.0",
|
44
|
-
"@vitest/utils": "0.
|
44
|
+
"@vitest/utils": "0.32.0"
|
45
45
|
},
|
46
46
|
"scripts": {
|
47
47
|
"build": "rimraf dist && rollup -c",
|