@vitest/runner 4.0.0-beta.3 → 4.0.0-beta.5
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-hooks.js +22 -14
- package/package.json +2 -2
package/dist/chunk-hooks.js
CHANGED
|
@@ -869,7 +869,7 @@ function createSuiteHooks() {
|
|
|
869
869
|
}
|
|
870
870
|
function parseArguments(optionsOrFn, optionsOrTest) {
|
|
871
871
|
let options = {};
|
|
872
|
-
let fn
|
|
872
|
+
let fn;
|
|
873
873
|
// it('', () => {}, { retry: 2 })
|
|
874
874
|
if (typeof optionsOrTest === "object") {
|
|
875
875
|
// it('', { retry: 2 }, { retry: 3 })
|
|
@@ -921,6 +921,9 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
921
921
|
annotations: []
|
|
922
922
|
};
|
|
923
923
|
const handler = options.handler;
|
|
924
|
+
if (task.mode === "run" && !handler) {
|
|
925
|
+
task.mode = "todo";
|
|
926
|
+
}
|
|
924
927
|
if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) {
|
|
925
928
|
task.concurrent = true;
|
|
926
929
|
}
|
|
@@ -1070,9 +1073,12 @@ function withAwaitAsyncAssertions(fn, task) {
|
|
|
1070
1073
|
function createSuite() {
|
|
1071
1074
|
function suiteFn(name, factoryOrOptions, optionsOrFactory) {
|
|
1072
1075
|
var _currentSuite$options;
|
|
1073
|
-
|
|
1076
|
+
let mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
1074
1077
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
1075
1078
|
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
1079
|
+
if (mode === "run" && !factory) {
|
|
1080
|
+
mode = "todo";
|
|
1081
|
+
}
|
|
1076
1082
|
const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
|
|
1077
1083
|
const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
|
|
1078
1084
|
// inherit options from current suite
|
|
@@ -1103,15 +1109,15 @@ function createSuite() {
|
|
|
1103
1109
|
const items = Array.isArray(i) ? i : [i];
|
|
1104
1110
|
if (fnFirst) {
|
|
1105
1111
|
if (arrayOnlyCases) {
|
|
1106
|
-
suite(formatTitle(_name, items, idx), () => handler(...items), options);
|
|
1112
|
+
suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : undefined, options);
|
|
1107
1113
|
} else {
|
|
1108
|
-
suite(formatTitle(_name, items, idx), () => handler(i), options);
|
|
1114
|
+
suite(formatTitle(_name, items, idx), handler ? () => handler(i) : undefined, options);
|
|
1109
1115
|
}
|
|
1110
1116
|
} else {
|
|
1111
1117
|
if (arrayOnlyCases) {
|
|
1112
|
-
suite(formatTitle(_name, items, idx), options, () => handler(...items));
|
|
1118
|
+
suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : undefined);
|
|
1113
1119
|
} else {
|
|
1114
|
-
suite(formatTitle(_name, items, idx), options, () => handler(i));
|
|
1120
|
+
suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : undefined);
|
|
1115
1121
|
}
|
|
1116
1122
|
}
|
|
1117
1123
|
});
|
|
@@ -1126,7 +1132,7 @@ function createSuite() {
|
|
|
1126
1132
|
const name_ = formatName(name);
|
|
1127
1133
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
1128
1134
|
cases.forEach((item, idx) => {
|
|
1129
|
-
suite(formatTitle(name_, toArray(item), idx), options, () => handler(item));
|
|
1135
|
+
suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : undefined);
|
|
1130
1136
|
});
|
|
1131
1137
|
};
|
|
1132
1138
|
};
|
|
@@ -1158,15 +1164,15 @@ function createTaskCollector(fn, context) {
|
|
|
1158
1164
|
const items = Array.isArray(i) ? i : [i];
|
|
1159
1165
|
if (fnFirst) {
|
|
1160
1166
|
if (arrayOnlyCases) {
|
|
1161
|
-
test(formatTitle(_name, items, idx), () => handler(...items), options);
|
|
1167
|
+
test(formatTitle(_name, items, idx), handler ? () => handler(...items) : undefined, options);
|
|
1162
1168
|
} else {
|
|
1163
|
-
test(formatTitle(_name, items, idx), () => handler(i), options);
|
|
1169
|
+
test(formatTitle(_name, items, idx), handler ? () => handler(i) : undefined, options);
|
|
1164
1170
|
}
|
|
1165
1171
|
} else {
|
|
1166
1172
|
if (arrayOnlyCases) {
|
|
1167
|
-
test(formatTitle(_name, items, idx), options, () => handler(...items));
|
|
1173
|
+
test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : undefined);
|
|
1168
1174
|
} else {
|
|
1169
|
-
test(formatTitle(_name, items, idx), options, () => handler(i));
|
|
1175
|
+
test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : undefined);
|
|
1170
1176
|
}
|
|
1171
1177
|
}
|
|
1172
1178
|
});
|
|
@@ -1183,9 +1189,11 @@ function createTaskCollector(fn, context) {
|
|
|
1183
1189
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
1184
1190
|
cases.forEach((item, idx) => {
|
|
1185
1191
|
// monkey-patch handler to allow parsing fixture
|
|
1186
|
-
const handlerWrapper = (ctx) => handler(item, ctx);
|
|
1187
|
-
handlerWrapper
|
|
1188
|
-
|
|
1192
|
+
const handlerWrapper = handler ? (ctx) => handler(item, ctx) : undefined;
|
|
1193
|
+
if (handlerWrapper) {
|
|
1194
|
+
handlerWrapper.__VITEST_FIXTURE_INDEX__ = 1;
|
|
1195
|
+
handlerWrapper.toString = () => handler.toString();
|
|
1196
|
+
}
|
|
1189
1197
|
test(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
|
|
1190
1198
|
});
|
|
1191
1199
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/runner",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.5",
|
|
5
5
|
"description": "Vitest test runner",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"pathe": "^2.0.3",
|
|
42
42
|
"strip-literal": "^3.0.0",
|
|
43
|
-
"@vitest/utils": "4.0.0-beta.
|
|
43
|
+
"@vitest/utils": "4.0.0-beta.5"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rimraf dist && rollup -c",
|