@rstest/core 0.7.0 → 0.7.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 +1 -1
- package/dist/0~122.js +53 -23
- package/dist/0~151.js +303 -264
- package/dist/0~173.js +7 -2
- package/dist/0~346.js +46 -0
- package/dist/0~583.js +1 -1
- package/dist/0~588.js +1 -1
- package/dist/0~62.js +1 -1
- package/dist/0~634.js +3 -3
- package/dist/0~809.js +1 -1
- package/dist/0~835.js +143 -0
- package/dist/0~919.js +65 -33
- package/dist/0~923.js +149 -0
- package/dist/{155.js → 131.js} +14 -12
- package/dist/404.js +210 -0
- package/dist/{362.js → 554.js} +85 -233
- package/dist/734.js +1 -1
- package/dist/946.js +40 -30
- package/dist/index.d.ts +52 -18
- package/dist/index.js +1 -1
- package/dist/worker.d.ts +56 -24
- package/dist/worker.js +1 -1
- package/package.json +7 -6
- package/dist/770.js +0 -167
- /package/dist/{0~454.js → 0~907.js} +0 -0
- /package/dist/{362.js.LICENSE.txt → 554.js.LICENSE.txt} +0 -0
package/dist/0~151.js
CHANGED
|
@@ -3,9 +3,9 @@ import 'module';
|
|
|
3
3
|
/*#__PURE__*/ import.meta.url;
|
|
4
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
5
|
import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, resolve as pathe_M_eThtNZ_resolve, ROOT_SUITE_NAME } from "./946.js";
|
|
6
|
-
import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./
|
|
6
|
+
import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./554.js";
|
|
7
7
|
__webpack_require__.add({
|
|
8
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"
|
|
8
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
9
9
|
var every = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").every;
|
|
10
10
|
function hasCallsLeft(callMap, spy) {
|
|
11
11
|
if (void 0 === callMap[spy.id]) callMap[spy.id] = 0;
|
|
@@ -27,14 +27,14 @@ __webpack_require__.add({
|
|
|
27
27
|
}
|
|
28
28
|
module.exports = calledInOrder;
|
|
29
29
|
},
|
|
30
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js"
|
|
30
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js" (module) {
|
|
31
31
|
function className(value) {
|
|
32
32
|
const name = value.constructor && value.constructor.name;
|
|
33
33
|
return name || null;
|
|
34
34
|
}
|
|
35
35
|
module.exports = className;
|
|
36
36
|
},
|
|
37
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js"
|
|
37
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js" (__unused_webpack_module, exports) {
|
|
38
38
|
exports.wrap = function(func, msg) {
|
|
39
39
|
var wrapped = function() {
|
|
40
40
|
exports.printWarning(msg);
|
|
@@ -52,7 +52,7 @@ __webpack_require__.add({
|
|
|
52
52
|
else console.log(msg);
|
|
53
53
|
};
|
|
54
54
|
},
|
|
55
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js"
|
|
55
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js" (module) {
|
|
56
56
|
module.exports = function every(obj, fn) {
|
|
57
57
|
var pass = true;
|
|
58
58
|
try {
|
|
@@ -65,7 +65,7 @@ __webpack_require__.add({
|
|
|
65
65
|
return pass;
|
|
66
66
|
};
|
|
67
67
|
},
|
|
68
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js"
|
|
68
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js" (module) {
|
|
69
69
|
module.exports = function functionName(func) {
|
|
70
70
|
if (!func) return "";
|
|
71
71
|
try {
|
|
@@ -75,12 +75,12 @@ __webpack_require__.add({
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
},
|
|
78
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"
|
|
78
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js" (module) {
|
|
79
79
|
var globalObject;
|
|
80
80
|
globalObject = "undefined" != typeof global ? global : "undefined" != typeof window ? window : self;
|
|
81
81
|
module.exports = globalObject;
|
|
82
82
|
},
|
|
83
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js"
|
|
83
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
84
84
|
module.exports = {
|
|
85
85
|
global: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"),
|
|
86
86
|
calledInOrder: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"),
|
|
@@ -94,7 +94,7 @@ __webpack_require__.add({
|
|
|
94
94
|
valueToString: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js")
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js"
|
|
97
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
98
98
|
var sort = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").sort;
|
|
99
99
|
var slice = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").slice;
|
|
100
100
|
function comparator(a, b) {
|
|
@@ -109,11 +109,11 @@ __webpack_require__.add({
|
|
|
109
109
|
}
|
|
110
110
|
module.exports = orderByFirstCall;
|
|
111
111
|
},
|
|
112
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"
|
|
112
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
113
113
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
114
114
|
module.exports = copyPrototype(Array.prototype);
|
|
115
115
|
},
|
|
116
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js"
|
|
116
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
117
117
|
var call = Function.call;
|
|
118
118
|
var throwsOnProto = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js");
|
|
119
119
|
var disallowedProperties = [
|
|
@@ -132,11 +132,11 @@ __webpack_require__.add({
|
|
|
132
132
|
}, Object.create(null));
|
|
133
133
|
};
|
|
134
134
|
},
|
|
135
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"
|
|
135
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
136
136
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
137
137
|
module.exports = copyPrototype(Function.prototype);
|
|
138
138
|
},
|
|
139
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js"
|
|
139
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
140
140
|
module.exports = {
|
|
141
141
|
array: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"),
|
|
142
142
|
function: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"),
|
|
@@ -146,23 +146,23 @@ __webpack_require__.add({
|
|
|
146
146
|
string: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js")
|
|
147
147
|
};
|
|
148
148
|
},
|
|
149
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js"
|
|
149
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
150
150
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
151
151
|
module.exports = copyPrototype(Map.prototype);
|
|
152
152
|
},
|
|
153
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js"
|
|
153
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
154
154
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
155
155
|
module.exports = copyPrototype(Object.prototype);
|
|
156
156
|
},
|
|
157
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js"
|
|
157
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
158
158
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
159
159
|
module.exports = copyPrototype(Set.prototype);
|
|
160
160
|
},
|
|
161
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js"
|
|
161
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
162
162
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
163
163
|
module.exports = copyPrototype(String.prototype);
|
|
164
164
|
},
|
|
165
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js"
|
|
165
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js" (module) {
|
|
166
166
|
let throwsOnProto;
|
|
167
167
|
try {
|
|
168
168
|
const object = {};
|
|
@@ -173,20 +173,20 @@ __webpack_require__.add({
|
|
|
173
173
|
}
|
|
174
174
|
module.exports = throwsOnProto;
|
|
175
175
|
},
|
|
176
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js"
|
|
176
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
177
177
|
var type = __webpack_require__("../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js");
|
|
178
178
|
module.exports = function typeOf(value) {
|
|
179
179
|
return type(value).toLowerCase();
|
|
180
180
|
};
|
|
181
181
|
},
|
|
182
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js"
|
|
182
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js" (module) {
|
|
183
183
|
function valueToString(value) {
|
|
184
184
|
if (value && value.toString) return value.toString();
|
|
185
185
|
return String(value);
|
|
186
186
|
}
|
|
187
187
|
module.exports = valueToString;
|
|
188
188
|
},
|
|
189
|
-
"../../node_modules/.pnpm/@sinonjs+fake-timers@14.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js"
|
|
189
|
+
"../../node_modules/.pnpm/@sinonjs+fake-timers@14.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_webpack_module, exports, __webpack_require__) {
|
|
190
190
|
const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
|
|
191
191
|
let timersModule, timersPromisesModule;
|
|
192
192
|
try {
|
|
@@ -1241,7 +1241,7 @@ __webpack_require__.add({
|
|
|
1241
1241
|
defaultImplementation.install;
|
|
1242
1242
|
exports.withGlobal = withGlobal;
|
|
1243
1243
|
},
|
|
1244
|
-
"../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js"
|
|
1244
|
+
"../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js" (module) {
|
|
1245
1245
|
(function(global1, factory) {
|
|
1246
1246
|
module.exports = factory();
|
|
1247
1247
|
})(0, function() {
|
|
@@ -9547,102 +9547,6 @@ const JestExtend = (chai, utils)=>{
|
|
|
9547
9547
|
use(JestExtendPlugin(chai, expect, expects));
|
|
9548
9548
|
});
|
|
9549
9549
|
};
|
|
9550
|
-
const unsupported = [
|
|
9551
|
-
'matchSnapshot',
|
|
9552
|
-
'toMatchSnapshot',
|
|
9553
|
-
'toMatchInlineSnapshot',
|
|
9554
|
-
'toThrowErrorMatchingSnapshot',
|
|
9555
|
-
'toThrowErrorMatchingInlineSnapshot',
|
|
9556
|
-
'throws',
|
|
9557
|
-
'Throw',
|
|
9558
|
-
'throw',
|
|
9559
|
-
'toThrow',
|
|
9560
|
-
'toThrowError'
|
|
9561
|
-
];
|
|
9562
|
-
function createExpectPoll(expect) {
|
|
9563
|
-
return function poll(fn, options = {}) {
|
|
9564
|
-
const { interval = 50, timeout = 1000, message } = options;
|
|
9565
|
-
const assertion = expect(null, message).withContext({
|
|
9566
|
-
poll: true
|
|
9567
|
-
});
|
|
9568
|
-
fn = fn.bind(assertion);
|
|
9569
|
-
const test = utils_exports.flag(assertion, 'vitest-test');
|
|
9570
|
-
if (!test) throw new Error('expect.poll() must be called inside a test');
|
|
9571
|
-
const proxy = new Proxy(assertion, {
|
|
9572
|
-
get (target, key, receiver) {
|
|
9573
|
-
const assertionFunction = Reflect.get(target, key, receiver);
|
|
9574
|
-
if ('function' != typeof assertionFunction) return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
9575
|
-
if ('assert' === key) return assertionFunction;
|
|
9576
|
-
if ('string' == typeof key && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use rstest.waitFor() if your assertion condition is unstable.`);
|
|
9577
|
-
return function(...args) {
|
|
9578
|
-
const STACK_TRACE_ERROR = new Error('STACK_TRACE_ERROR');
|
|
9579
|
-
const promise = ()=>new Promise((resolve, reject)=>{
|
|
9580
|
-
let intervalId;
|
|
9581
|
-
let timeoutId;
|
|
9582
|
-
let lastError;
|
|
9583
|
-
const check = async ()=>{
|
|
9584
|
-
try {
|
|
9585
|
-
utils_exports.flag(assertion, '_name', key);
|
|
9586
|
-
const obj = await fn();
|
|
9587
|
-
utils_exports.flag(assertion, 'object', obj);
|
|
9588
|
-
resolve(await assertionFunction.call(assertion, ...args));
|
|
9589
|
-
clearTimeout(intervalId);
|
|
9590
|
-
clearTimeout(timeoutId);
|
|
9591
|
-
} catch (err) {
|
|
9592
|
-
lastError = err;
|
|
9593
|
-
if (!utils_exports.flag(assertion, '_isLastPollAttempt')) intervalId = getRealTimers().setTimeout(check, interval);
|
|
9594
|
-
}
|
|
9595
|
-
};
|
|
9596
|
-
timeoutId = getRealTimers().setTimeout(()=>{
|
|
9597
|
-
clearTimeout(intervalId);
|
|
9598
|
-
utils_exports.flag(assertion, '_isLastPollAttempt', true);
|
|
9599
|
-
const rejectWithCause = (cause)=>{
|
|
9600
|
-
reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
9601
|
-
cause
|
|
9602
|
-
}), STACK_TRACE_ERROR));
|
|
9603
|
-
};
|
|
9604
|
-
check().then(()=>rejectWithCause(lastError)).catch((e)=>rejectWithCause(e));
|
|
9605
|
-
}, timeout);
|
|
9606
|
-
check();
|
|
9607
|
-
});
|
|
9608
|
-
let awaited = false;
|
|
9609
|
-
test.onFinished ??= [];
|
|
9610
|
-
test.onFinished.push(()=>{
|
|
9611
|
-
if (!awaited) {
|
|
9612
|
-
const negated = utils_exports.flag(assertion, 'negate') ? 'not.' : '';
|
|
9613
|
-
const name = utils_exports.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
|
|
9614
|
-
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
9615
|
-
const error = new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
|
|
9616
|
-
throw copyStackTrace(error, STACK_TRACE_ERROR);
|
|
9617
|
-
}
|
|
9618
|
-
});
|
|
9619
|
-
let resultPromise;
|
|
9620
|
-
return {
|
|
9621
|
-
then (onFulfilled, onRejected) {
|
|
9622
|
-
awaited = true;
|
|
9623
|
-
resultPromise ||= promise();
|
|
9624
|
-
return resultPromise.then(onFulfilled, onRejected);
|
|
9625
|
-
},
|
|
9626
|
-
catch (onRejected) {
|
|
9627
|
-
resultPromise ||= promise();
|
|
9628
|
-
return resultPromise.catch(onRejected);
|
|
9629
|
-
},
|
|
9630
|
-
finally (onFinally) {
|
|
9631
|
-
resultPromise ||= promise();
|
|
9632
|
-
return resultPromise.finally(onFinally);
|
|
9633
|
-
},
|
|
9634
|
-
[Symbol.toStringTag]: 'Promise'
|
|
9635
|
-
};
|
|
9636
|
-
};
|
|
9637
|
-
}
|
|
9638
|
-
});
|
|
9639
|
-
return proxy;
|
|
9640
|
-
};
|
|
9641
|
-
}
|
|
9642
|
-
function copyStackTrace(target, source) {
|
|
9643
|
-
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
9644
|
-
return target;
|
|
9645
|
-
}
|
|
9646
9550
|
const comma = ','.charCodeAt(0);
|
|
9647
9551
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9648
9552
|
const intToChar = new Uint8Array(64);
|
|
@@ -10896,7 +10800,7 @@ function offsetToLineNumber(source, offset) {
|
|
|
10896
10800
|
return line + 1;
|
|
10897
10801
|
}
|
|
10898
10802
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
10899
|
-
const MagicString = (await import("./0~
|
|
10803
|
+
const MagicString = (await import("./0~907.js").then((mod)=>({
|
|
10900
10804
|
Bundle: mod.Bundle,
|
|
10901
10805
|
SourceMap: mod.SourceMap,
|
|
10902
10806
|
default: mod.MagicString
|
|
@@ -11643,135 +11547,247 @@ function getError(expected, promise) {
|
|
|
11643
11547
|
}
|
|
11644
11548
|
throw new Error("snapshot function didn't throw");
|
|
11645
11549
|
}
|
|
11646
|
-
function
|
|
11550
|
+
function getTestMeta(test) {
|
|
11647
11551
|
return {
|
|
11648
11552
|
filepath: test.testPath,
|
|
11649
11553
|
name: getTaskNameWithPrefix(test),
|
|
11650
11554
|
testId: test.testId
|
|
11651
11555
|
};
|
|
11652
11556
|
}
|
|
11653
|
-
const SnapshotPlugin = (chai, utils)=>{
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11557
|
+
const SnapshotPlugin = (workerState)=>(chai, utils)=>{
|
|
11558
|
+
function getTest(obj) {
|
|
11559
|
+
const test = utils.flag(obj, 'vitest-test');
|
|
11560
|
+
return test;
|
|
11561
|
+
}
|
|
11562
|
+
function getTestOrThrow(assertionName, obj) {
|
|
11563
|
+
const test = getTest(obj);
|
|
11564
|
+
if (!test) throw new Error(`'${assertionName}' cannot be used without test context`);
|
|
11565
|
+
return test;
|
|
11566
|
+
}
|
|
11567
|
+
for (const key of [
|
|
11568
|
+
'matchSnapshot',
|
|
11569
|
+
'toMatchSnapshot'
|
|
11570
|
+
])utils.addMethod(chai.Assertion.prototype, key, function(properties, message) {
|
|
11571
|
+
utils.flag(this, '_name', key);
|
|
11572
|
+
const isNot = utils.flag(this, 'negate');
|
|
11573
|
+
if (isNot) throw new Error(`${key} cannot be used with "not"`);
|
|
11574
|
+
const expected = utils.flag(this, 'object');
|
|
11575
|
+
const test = getTestOrThrow(key, this);
|
|
11576
|
+
if ('string' == typeof properties && void 0 === message) {
|
|
11577
|
+
message = properties;
|
|
11578
|
+
properties = void 0;
|
|
11579
|
+
}
|
|
11580
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11581
|
+
getSnapshotClient().assert({
|
|
11582
|
+
received: expected,
|
|
11583
|
+
message,
|
|
11584
|
+
isInline: false,
|
|
11585
|
+
properties,
|
|
11586
|
+
errorMessage,
|
|
11587
|
+
...getTestMeta(test)
|
|
11588
|
+
});
|
|
11680
11589
|
});
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11590
|
+
utils.addMethod(chai.Assertion.prototype, 'toMatchFileSnapshot', function(file, message) {
|
|
11591
|
+
utils.flag(this, '_name', 'toMatchFileSnapshot');
|
|
11592
|
+
const isNot = utils.flag(this, 'negate');
|
|
11593
|
+
if (isNot) throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
11594
|
+
const error = new Error('resolves');
|
|
11595
|
+
const expected = utils.flag(this, 'object');
|
|
11596
|
+
const test = getTestOrThrow('toMatchFileSnapshot', this);
|
|
11597
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11598
|
+
const promise = getSnapshotClient().assertRaw({
|
|
11599
|
+
received: expected,
|
|
11600
|
+
message,
|
|
11601
|
+
isInline: false,
|
|
11602
|
+
rawSnapshot: {
|
|
11603
|
+
file
|
|
11604
|
+
},
|
|
11605
|
+
errorMessage,
|
|
11606
|
+
...getTestMeta(test)
|
|
11607
|
+
});
|
|
11608
|
+
return snapshot_recordAsyncExpect(test, promise, snapshot_createAssertionMessage(utils, this, true), error);
|
|
11699
11609
|
});
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11610
|
+
utils.addMethod(chai.Assertion.prototype, 'toMatchInlineSnapshot', function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
11611
|
+
utils.flag(this, '_name', 'toMatchInlineSnapshot');
|
|
11612
|
+
const isNot = utils.flag(this, 'negate');
|
|
11613
|
+
if (isNot) throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
11614
|
+
const test = getTest(this);
|
|
11615
|
+
if (test) {
|
|
11616
|
+
const isInsideEach = test.each || test.inTestEach;
|
|
11617
|
+
if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
|
|
11618
|
+
}
|
|
11619
|
+
const expected = utils.flag(this, 'object');
|
|
11620
|
+
const error = utils.flag(this, 'error');
|
|
11621
|
+
if ('string' == typeof properties) {
|
|
11622
|
+
message = inlineSnapshot;
|
|
11623
|
+
inlineSnapshot = properties;
|
|
11624
|
+
properties = void 0;
|
|
11625
|
+
}
|
|
11626
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
11627
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11628
|
+
getSnapshotClient().assert({
|
|
11629
|
+
received: expected,
|
|
11630
|
+
message,
|
|
11631
|
+
isInline: true,
|
|
11632
|
+
properties,
|
|
11633
|
+
inlineSnapshot,
|
|
11634
|
+
error,
|
|
11635
|
+
errorMessage,
|
|
11636
|
+
...test ? getTestMeta(test) : {
|
|
11637
|
+
filepath: workerState.testPath,
|
|
11638
|
+
name: 'toMatchInlineSnapshot',
|
|
11639
|
+
testId: String(workerState.taskId)
|
|
11640
|
+
}
|
|
11641
|
+
});
|
|
11727
11642
|
});
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11643
|
+
utils.addMethod(chai.Assertion.prototype, 'toThrowErrorMatchingSnapshot', function(message) {
|
|
11644
|
+
utils.flag(this, '_name', 'toThrowErrorMatchingSnapshot');
|
|
11645
|
+
const isNot = utils.flag(this, 'negate');
|
|
11646
|
+
if (isNot) throw new Error('toThrowErrorMatchingSnapshot cannot be used with "not"');
|
|
11647
|
+
const expected = utils.flag(this, 'object');
|
|
11648
|
+
const test = getTestOrThrow('toThrowErrorMatchingSnapshot', this);
|
|
11649
|
+
const promise = utils.flag(this, 'promise');
|
|
11650
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11651
|
+
getSnapshotClient().assert({
|
|
11652
|
+
received: getError(expected, promise),
|
|
11653
|
+
message,
|
|
11654
|
+
errorMessage,
|
|
11655
|
+
...getTestMeta(test)
|
|
11656
|
+
});
|
|
11742
11657
|
});
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11658
|
+
utils.addMethod(chai.Assertion.prototype, 'toThrowErrorMatchingInlineSnapshot', function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
11659
|
+
const isNot = utils.flag(this, 'negate');
|
|
11660
|
+
if (isNot) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
11661
|
+
const test = getTest(this);
|
|
11662
|
+
if (test) {
|
|
11663
|
+
const isInsideEach = test.each || test.inTestEach;
|
|
11664
|
+
if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
|
|
11665
|
+
}
|
|
11666
|
+
const expected = utils.flag(this, 'object');
|
|
11667
|
+
const error = utils.flag(this, 'error');
|
|
11668
|
+
const promise = utils.flag(this, 'promise');
|
|
11669
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11670
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
11671
|
+
getSnapshotClient().assert({
|
|
11672
|
+
received: getError(expected, promise),
|
|
11673
|
+
message,
|
|
11674
|
+
inlineSnapshot,
|
|
11675
|
+
isInline: true,
|
|
11676
|
+
error,
|
|
11677
|
+
errorMessage,
|
|
11678
|
+
...test ? getTestMeta(test) : {
|
|
11679
|
+
name: 'toThrowErrorMatchingInlineSnapshot',
|
|
11680
|
+
filepath: workerState.testPath,
|
|
11681
|
+
testId: String(workerState.taskId)
|
|
11682
|
+
}
|
|
11683
|
+
});
|
|
11763
11684
|
});
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11685
|
+
utils.addMethod(chai.expect, 'addSnapshotSerializer', addSerializer);
|
|
11686
|
+
};
|
|
11687
|
+
const unsupported = [
|
|
11688
|
+
'matchSnapshot',
|
|
11689
|
+
'toMatchSnapshot',
|
|
11690
|
+
'toMatchInlineSnapshot',
|
|
11691
|
+
'toThrowErrorMatchingSnapshot',
|
|
11692
|
+
'toThrowErrorMatchingInlineSnapshot',
|
|
11693
|
+
'throws',
|
|
11694
|
+
'Throw',
|
|
11695
|
+
'throw',
|
|
11696
|
+
'toThrow',
|
|
11697
|
+
'toThrowError'
|
|
11698
|
+
];
|
|
11699
|
+
function createExpectPoll(expect) {
|
|
11700
|
+
return function poll(fn, options = {}) {
|
|
11701
|
+
const { interval = 50, timeout = 1000, message } = options;
|
|
11702
|
+
const assertion = expect(null, message).withContext({
|
|
11703
|
+
poll: true
|
|
11704
|
+
});
|
|
11705
|
+
fn = fn.bind(assertion);
|
|
11706
|
+
const test = utils_exports.flag(assertion, 'vitest-test');
|
|
11707
|
+
if (!test) throw new Error('expect.poll() must be called inside a test');
|
|
11708
|
+
const proxy = new Proxy(assertion, {
|
|
11709
|
+
get (target, key, receiver) {
|
|
11710
|
+
const assertionFunction = Reflect.get(target, key, receiver);
|
|
11711
|
+
if ('function' != typeof assertionFunction) return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
11712
|
+
if ('assert' === key) return assertionFunction;
|
|
11713
|
+
if ('string' == typeof key && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use rstest.waitFor() if your assertion condition is unstable.`);
|
|
11714
|
+
return function(...args) {
|
|
11715
|
+
const STACK_TRACE_ERROR = new Error('STACK_TRACE_ERROR');
|
|
11716
|
+
const promise = ()=>new Promise((resolve, reject)=>{
|
|
11717
|
+
let intervalId;
|
|
11718
|
+
let timeoutId;
|
|
11719
|
+
let lastError;
|
|
11720
|
+
const check = async ()=>{
|
|
11721
|
+
try {
|
|
11722
|
+
utils_exports.flag(assertion, '_name', key);
|
|
11723
|
+
const obj = await fn();
|
|
11724
|
+
utils_exports.flag(assertion, 'object', obj);
|
|
11725
|
+
resolve(await assertionFunction.call(assertion, ...args));
|
|
11726
|
+
clearTimeout(intervalId);
|
|
11727
|
+
clearTimeout(timeoutId);
|
|
11728
|
+
} catch (err) {
|
|
11729
|
+
lastError = err;
|
|
11730
|
+
if (!utils_exports.flag(assertion, '_isLastPollAttempt')) intervalId = getRealTimers().setTimeout(check, interval);
|
|
11731
|
+
}
|
|
11732
|
+
};
|
|
11733
|
+
timeoutId = getRealTimers().setTimeout(()=>{
|
|
11734
|
+
clearTimeout(intervalId);
|
|
11735
|
+
utils_exports.flag(assertion, '_isLastPollAttempt', true);
|
|
11736
|
+
const rejectWithCause = (cause)=>{
|
|
11737
|
+
reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
11738
|
+
cause
|
|
11739
|
+
}), STACK_TRACE_ERROR));
|
|
11740
|
+
};
|
|
11741
|
+
check().then(()=>rejectWithCause(lastError)).catch((e)=>rejectWithCause(e));
|
|
11742
|
+
}, timeout);
|
|
11743
|
+
check();
|
|
11744
|
+
});
|
|
11745
|
+
let awaited = false;
|
|
11746
|
+
test.onFinished ??= [];
|
|
11747
|
+
test.onFinished.push(()=>{
|
|
11748
|
+
if (!awaited) {
|
|
11749
|
+
const negated = utils_exports.flag(assertion, 'negate') ? 'not.' : '';
|
|
11750
|
+
const name = utils_exports.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
|
|
11751
|
+
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
11752
|
+
const error = new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
|
|
11753
|
+
throw copyStackTrace(error, STACK_TRACE_ERROR);
|
|
11754
|
+
}
|
|
11755
|
+
});
|
|
11756
|
+
let resultPromise;
|
|
11757
|
+
return {
|
|
11758
|
+
then (onFulfilled, onRejected) {
|
|
11759
|
+
awaited = true;
|
|
11760
|
+
resultPromise ||= promise();
|
|
11761
|
+
return resultPromise.then(onFulfilled, onRejected);
|
|
11762
|
+
},
|
|
11763
|
+
catch (onRejected) {
|
|
11764
|
+
resultPromise ||= promise();
|
|
11765
|
+
return resultPromise.catch(onRejected);
|
|
11766
|
+
},
|
|
11767
|
+
finally (onFinally) {
|
|
11768
|
+
resultPromise ||= promise();
|
|
11769
|
+
return resultPromise.finally(onFinally);
|
|
11770
|
+
},
|
|
11771
|
+
[Symbol.toStringTag]: 'Promise'
|
|
11772
|
+
};
|
|
11773
|
+
};
|
|
11774
|
+
}
|
|
11775
|
+
});
|
|
11776
|
+
return proxy;
|
|
11777
|
+
};
|
|
11778
|
+
}
|
|
11779
|
+
function copyStackTrace(target, source) {
|
|
11780
|
+
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
11781
|
+
return target;
|
|
11782
|
+
}
|
|
11771
11783
|
function setupChaiConfig(config) {
|
|
11772
11784
|
Object.assign(chai_config, config);
|
|
11773
11785
|
}
|
|
11774
11786
|
function createExpect({ getCurrentTest, workerState }) {
|
|
11787
|
+
use(JestExtend);
|
|
11788
|
+
use(JestChaiExpect);
|
|
11789
|
+
use(SnapshotPlugin(workerState));
|
|
11790
|
+
use(JestAsymmetricMatchers);
|
|
11775
11791
|
const expect = (value, message)=>{
|
|
11776
11792
|
const { assertionCalls } = getState(expect);
|
|
11777
11793
|
setState({
|
|
@@ -12011,10 +12027,13 @@ const updateTestModes = (tests, testNamePattern)=>{
|
|
|
12011
12027
|
else if (shouldTestSkip(test, hasOnly, testNamePattern)) test.runMode = 'skip';
|
|
12012
12028
|
};
|
|
12013
12029
|
const updateTestParents = (tests, parentNames = [])=>{
|
|
12014
|
-
for (const test of tests)
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12030
|
+
for (const test of tests){
|
|
12031
|
+
test.parentNames = parentNames;
|
|
12032
|
+
if ('suite' === test.type) {
|
|
12033
|
+
const names = test.name === ROOT_SUITE_NAME ? parentNames : parentNames.concat(test.name);
|
|
12034
|
+
updateTestParents(test.tests, names);
|
|
12035
|
+
}
|
|
12036
|
+
}
|
|
12018
12037
|
};
|
|
12019
12038
|
const traverseUpdateTest = (tests, testNamePattern)=>{
|
|
12020
12039
|
updateTestParents(tests);
|
|
@@ -12083,14 +12102,12 @@ const RealDate = Date;
|
|
|
12083
12102
|
class TestRunner {
|
|
12084
12103
|
_test;
|
|
12085
12104
|
workerState;
|
|
12086
|
-
async runTests({ tests, testPath, state, hooks, api }) {
|
|
12105
|
+
async runTests({ tests, testPath, state, hooks, api, snapshotClient }) {
|
|
12087
12106
|
this.workerState = state;
|
|
12088
|
-
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency, bail }, project
|
|
12107
|
+
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency, bail }, project } = state;
|
|
12089
12108
|
const results = [];
|
|
12090
12109
|
const errors = [];
|
|
12091
12110
|
let defaultStatus = 'pass';
|
|
12092
|
-
const snapshotClient = getSnapshotClient();
|
|
12093
|
-
await snapshotClient.setup(testPath, snapshotOptions);
|
|
12094
12111
|
const runTestsCase = async (test, parentHooks)=>{
|
|
12095
12112
|
if ('skip' === test.runMode) {
|
|
12096
12113
|
snapshotClient.skipTest(testPath, getTaskNameWithPrefix(test));
|
|
@@ -12220,6 +12237,7 @@ class TestRunner {
|
|
|
12220
12237
|
const tests = [
|
|
12221
12238
|
...allTest
|
|
12222
12239
|
];
|
|
12240
|
+
const results = [];
|
|
12223
12241
|
while(tests.length){
|
|
12224
12242
|
const suite = tests.shift();
|
|
12225
12243
|
if (suite.concurrent) {
|
|
@@ -12227,47 +12245,61 @@ class TestRunner {
|
|
|
12227
12245
|
suite
|
|
12228
12246
|
];
|
|
12229
12247
|
while(tests[0]?.concurrent)cases.push(tests.shift());
|
|
12230
|
-
await Promise.all(cases.map((test)=>{
|
|
12248
|
+
const result = await Promise.all(cases.map((test)=>{
|
|
12231
12249
|
if ('suite' === test.type) return runTest(test, parentHooks);
|
|
12232
12250
|
return limitMaxConcurrency(()=>runTest(test, parentHooks));
|
|
12233
12251
|
}));
|
|
12252
|
+
results.push(...result);
|
|
12234
12253
|
continue;
|
|
12235
12254
|
}
|
|
12236
|
-
await runTest(suite, parentHooks);
|
|
12255
|
+
const result = await runTest(suite, parentHooks);
|
|
12256
|
+
results.push(result);
|
|
12237
12257
|
}
|
|
12258
|
+
return results;
|
|
12238
12259
|
};
|
|
12239
12260
|
const runTest = async (test, parentHooks)=>{
|
|
12261
|
+
let result = {
|
|
12262
|
+
testId: test.testId,
|
|
12263
|
+
status: 'skip',
|
|
12264
|
+
parentNames: test.parentNames,
|
|
12265
|
+
name: test.name,
|
|
12266
|
+
testPath,
|
|
12267
|
+
project,
|
|
12268
|
+
duration: 0,
|
|
12269
|
+
errors: []
|
|
12270
|
+
};
|
|
12240
12271
|
if (bail && await hooks.getCountOfFailedTests() >= bail) {
|
|
12241
12272
|
defaultStatus = 'skip';
|
|
12242
|
-
return;
|
|
12273
|
+
return result;
|
|
12243
12274
|
}
|
|
12244
12275
|
if ('suite' === test.type) {
|
|
12276
|
+
const start = RealDate.now();
|
|
12277
|
+
hooks.onTestSuiteStart?.({
|
|
12278
|
+
parentNames: test.parentNames,
|
|
12279
|
+
name: test.name,
|
|
12280
|
+
testPath,
|
|
12281
|
+
project: test.project,
|
|
12282
|
+
testId: test.testId
|
|
12283
|
+
});
|
|
12245
12284
|
if (0 === test.tests.length) {
|
|
12246
12285
|
if ([
|
|
12247
12286
|
'todo',
|
|
12248
12287
|
'skip'
|
|
12249
12288
|
].includes(test.runMode)) {
|
|
12250
12289
|
defaultStatus = 'skip';
|
|
12251
|
-
|
|
12290
|
+
hooks.onTestSuiteResult?.(result);
|
|
12291
|
+
return result;
|
|
12292
|
+
}
|
|
12293
|
+
if (passWithNoTests) {
|
|
12294
|
+
result.status = 'pass';
|
|
12295
|
+
hooks.onTestSuiteResult?.(result);
|
|
12296
|
+
return result;
|
|
12252
12297
|
}
|
|
12253
|
-
if (passWithNoTests) return;
|
|
12254
12298
|
const noTestError = {
|
|
12255
12299
|
message: `No test found in suite: ${test.name}`,
|
|
12256
12300
|
name: 'No tests'
|
|
12257
12301
|
};
|
|
12258
|
-
errors
|
|
12259
|
-
const result = {
|
|
12260
|
-
testId: test.testId || '0',
|
|
12261
|
-
status: 'fail',
|
|
12262
|
-
parentNames: test.parentNames,
|
|
12263
|
-
name: test.name,
|
|
12264
|
-
testPath,
|
|
12265
|
-
errors: [
|
|
12266
|
-
noTestError
|
|
12267
|
-
],
|
|
12268
|
-
project
|
|
12269
|
-
};
|
|
12270
|
-
hooks.onTestCaseResult?.(result);
|
|
12302
|
+
result.errors?.push(noTestError);
|
|
12271
12303
|
}
|
|
12272
12304
|
const cleanups = [];
|
|
12273
12305
|
let hasBeforeAllError = false;
|
|
@@ -12283,10 +12315,10 @@ class TestRunner {
|
|
|
12283
12315
|
}
|
|
12284
12316
|
} catch (error) {
|
|
12285
12317
|
hasBeforeAllError = true;
|
|
12286
|
-
errors
|
|
12318
|
+
result.errors?.push(...formatTestError(error));
|
|
12287
12319
|
}
|
|
12288
12320
|
if (hasBeforeAllError) markAllTestAsSkipped(test.tests);
|
|
12289
|
-
await runTests(test.tests, {
|
|
12321
|
+
const results = await runTests(test.tests, {
|
|
12290
12322
|
beforeEachListeners: parentHooks.beforeEachListeners.concat(test.beforeEachListeners || []),
|
|
12291
12323
|
afterEachListeners: parentHooks.afterEachListeners.concat(test.afterEachListeners || [])
|
|
12292
12324
|
});
|
|
@@ -12301,11 +12333,14 @@ class TestRunner {
|
|
|
12301
12333
|
filepath: testPath
|
|
12302
12334
|
});
|
|
12303
12335
|
} catch (error) {
|
|
12304
|
-
errors
|
|
12336
|
+
result.errors?.push(...formatTestError(error));
|
|
12305
12337
|
}
|
|
12338
|
+
result.duration = RealDate.now() - start;
|
|
12339
|
+
result.status = result.errors?.length ? 'fail' : getTestStatus(results, defaultStatus);
|
|
12340
|
+
hooks.onTestSuiteResult?.(result);
|
|
12341
|
+
errors.push(...result.errors || []);
|
|
12306
12342
|
} else {
|
|
12307
12343
|
const start = RealDate.now();
|
|
12308
|
-
let result;
|
|
12309
12344
|
let retryCount = 0;
|
|
12310
12345
|
hooks.onTestCaseStart?.({
|
|
12311
12346
|
testId: test.testId,
|
|
@@ -12330,6 +12365,7 @@ class TestRunner {
|
|
|
12330
12365
|
hooks.onTestCaseResult?.(result);
|
|
12331
12366
|
results.push(result);
|
|
12332
12367
|
}
|
|
12368
|
+
return result;
|
|
12333
12369
|
};
|
|
12334
12370
|
const start = RealDate.now();
|
|
12335
12371
|
if (0 === tests.length) {
|
|
@@ -12882,6 +12918,8 @@ function createRunner({ workerState }) {
|
|
|
12882
12918
|
},
|
|
12883
12919
|
runner: {
|
|
12884
12920
|
runTests: async (testPath, hooks, api)=>{
|
|
12921
|
+
const snapshotClient = getSnapshotClient();
|
|
12922
|
+
await snapshotClient.setup(testPath, workerState.snapshotOptions);
|
|
12885
12923
|
const tests = await runtime.instance.getTests();
|
|
12886
12924
|
traverseUpdateTest(tests, testNamePattern);
|
|
12887
12925
|
runtime.instance.updateStatus('running');
|
|
@@ -12890,7 +12928,8 @@ function createRunner({ workerState }) {
|
|
|
12890
12928
|
testPath,
|
|
12891
12929
|
state: workerState,
|
|
12892
12930
|
hooks,
|
|
12893
|
-
api
|
|
12931
|
+
api,
|
|
12932
|
+
snapshotClient
|
|
12894
12933
|
});
|
|
12895
12934
|
return results;
|
|
12896
12935
|
},
|