@rstest/core 0.7.1 → 0.7.3
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 +16 -6
- package/dist/0~151.js +485 -307
- package/dist/0~173.js +27 -27
- package/dist/0~403.js +7 -7
- package/dist/0~583.js +2 -2
- package/dist/0~588.js +6 -6
- package/dist/0~62.js +1 -1
- package/dist/0~634.js +20 -18
- package/dist/0~809.js +1 -1
- package/dist/0~835.js +4 -4
- package/dist/0~919.js +65 -33
- package/dist/0~923.js +4 -4
- package/dist/{155.js → 131.js} +62 -144
- package/dist/404.js +210 -0
- package/dist/{362.js → 554.js} +134 -111
- package/dist/672.js +91 -0
- package/dist/734.js +1 -1
- package/dist/946.js +47 -31
- package/dist/index.d.ts +163 -22
- package/dist/index.js +1 -1
- package/dist/mockRuntimeCode.js +1 -0
- package/dist/worker.d.ts +86 -30
- package/dist/worker.js +1 -1
- package/package.json +8 -7
- 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,11 @@ 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
|
+
import { fileURLToPath } from "./404.js";
|
|
8
|
+
import { parse } from "./672.js";
|
|
7
9
|
__webpack_require__.add({
|
|
8
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"
|
|
10
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
9
11
|
var every = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").every;
|
|
10
12
|
function hasCallsLeft(callMap, spy) {
|
|
11
13
|
if (void 0 === callMap[spy.id]) callMap[spy.id] = 0;
|
|
@@ -27,14 +29,14 @@ __webpack_require__.add({
|
|
|
27
29
|
}
|
|
28
30
|
module.exports = calledInOrder;
|
|
29
31
|
},
|
|
30
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js"
|
|
32
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js" (module) {
|
|
31
33
|
function className(value) {
|
|
32
34
|
const name = value.constructor && value.constructor.name;
|
|
33
35
|
return name || null;
|
|
34
36
|
}
|
|
35
37
|
module.exports = className;
|
|
36
38
|
},
|
|
37
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js"
|
|
39
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js" (__unused_rspack_module, exports) {
|
|
38
40
|
exports.wrap = function(func, msg) {
|
|
39
41
|
var wrapped = function() {
|
|
40
42
|
exports.printWarning(msg);
|
|
@@ -52,7 +54,7 @@ __webpack_require__.add({
|
|
|
52
54
|
else console.log(msg);
|
|
53
55
|
};
|
|
54
56
|
},
|
|
55
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js"
|
|
57
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js" (module) {
|
|
56
58
|
module.exports = function every(obj, fn) {
|
|
57
59
|
var pass = true;
|
|
58
60
|
try {
|
|
@@ -65,7 +67,7 @@ __webpack_require__.add({
|
|
|
65
67
|
return pass;
|
|
66
68
|
};
|
|
67
69
|
},
|
|
68
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js"
|
|
70
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js" (module) {
|
|
69
71
|
module.exports = function functionName(func) {
|
|
70
72
|
if (!func) return "";
|
|
71
73
|
try {
|
|
@@ -75,12 +77,12 @@ __webpack_require__.add({
|
|
|
75
77
|
}
|
|
76
78
|
};
|
|
77
79
|
},
|
|
78
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"
|
|
80
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js" (module) {
|
|
79
81
|
var globalObject;
|
|
80
82
|
globalObject = "undefined" != typeof global ? global : "undefined" != typeof window ? window : self;
|
|
81
83
|
module.exports = globalObject;
|
|
82
84
|
},
|
|
83
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js"
|
|
85
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
84
86
|
module.exports = {
|
|
85
87
|
global: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"),
|
|
86
88
|
calledInOrder: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"),
|
|
@@ -94,7 +96,7 @@ __webpack_require__.add({
|
|
|
94
96
|
valueToString: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js")
|
|
95
97
|
};
|
|
96
98
|
},
|
|
97
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js"
|
|
99
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
98
100
|
var sort = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").sort;
|
|
99
101
|
var slice = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").slice;
|
|
100
102
|
function comparator(a, b) {
|
|
@@ -109,11 +111,11 @@ __webpack_require__.add({
|
|
|
109
111
|
}
|
|
110
112
|
module.exports = orderByFirstCall;
|
|
111
113
|
},
|
|
112
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"
|
|
114
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
113
115
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
114
116
|
module.exports = copyPrototype(Array.prototype);
|
|
115
117
|
},
|
|
116
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js"
|
|
118
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
117
119
|
var call = Function.call;
|
|
118
120
|
var throwsOnProto = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js");
|
|
119
121
|
var disallowedProperties = [
|
|
@@ -132,11 +134,11 @@ __webpack_require__.add({
|
|
|
132
134
|
}, Object.create(null));
|
|
133
135
|
};
|
|
134
136
|
},
|
|
135
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"
|
|
137
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
136
138
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
137
139
|
module.exports = copyPrototype(Function.prototype);
|
|
138
140
|
},
|
|
139
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js"
|
|
141
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
140
142
|
module.exports = {
|
|
141
143
|
array: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"),
|
|
142
144
|
function: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"),
|
|
@@ -146,23 +148,23 @@ __webpack_require__.add({
|
|
|
146
148
|
string: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js")
|
|
147
149
|
};
|
|
148
150
|
},
|
|
149
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js"
|
|
151
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
150
152
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
151
153
|
module.exports = copyPrototype(Map.prototype);
|
|
152
154
|
},
|
|
153
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js"
|
|
155
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
154
156
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
155
157
|
module.exports = copyPrototype(Object.prototype);
|
|
156
158
|
},
|
|
157
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js"
|
|
159
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
158
160
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
159
161
|
module.exports = copyPrototype(Set.prototype);
|
|
160
162
|
},
|
|
161
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js"
|
|
163
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
162
164
|
var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
|
|
163
165
|
module.exports = copyPrototype(String.prototype);
|
|
164
166
|
},
|
|
165
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js"
|
|
167
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js" (module) {
|
|
166
168
|
let throwsOnProto;
|
|
167
169
|
try {
|
|
168
170
|
const object = {};
|
|
@@ -173,20 +175,20 @@ __webpack_require__.add({
|
|
|
173
175
|
}
|
|
174
176
|
module.exports = throwsOnProto;
|
|
175
177
|
},
|
|
176
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js"
|
|
178
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
177
179
|
var type = __webpack_require__("../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js");
|
|
178
180
|
module.exports = function typeOf(value) {
|
|
179
181
|
return type(value).toLowerCase();
|
|
180
182
|
};
|
|
181
183
|
},
|
|
182
|
-
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js"
|
|
184
|
+
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js" (module) {
|
|
183
185
|
function valueToString(value) {
|
|
184
186
|
if (value && value.toString) return value.toString();
|
|
185
187
|
return String(value);
|
|
186
188
|
}
|
|
187
189
|
module.exports = valueToString;
|
|
188
190
|
},
|
|
189
|
-
"../../node_modules/.pnpm/@sinonjs+fake-timers@
|
|
191
|
+
"../../node_modules/.pnpm/@sinonjs+fake-timers@15.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
190
192
|
const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
|
|
191
193
|
let timersModule, timersPromisesModule;
|
|
192
194
|
try {
|
|
@@ -532,7 +534,7 @@ __webpack_require__.add({
|
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
|
-
function uninstall(clock
|
|
537
|
+
function uninstall(clock) {
|
|
536
538
|
let method, i, l;
|
|
537
539
|
const installedHrTime = "_hrtime";
|
|
538
540
|
const installedNextTick = "_nextTick";
|
|
@@ -557,7 +559,7 @@ __webpack_require__.add({
|
|
|
557
559
|
timersPromisesModule[entry.methodName] = entry.original;
|
|
558
560
|
}
|
|
559
561
|
}
|
|
560
|
-
|
|
562
|
+
clock.setTickMode("manual");
|
|
561
563
|
clock.methods = [];
|
|
562
564
|
for (const [listener, signal] of clock.abortListenerMap.entries()){
|
|
563
565
|
signal.removeEventListener("abort", listener);
|
|
@@ -610,6 +612,8 @@ __webpack_require__.add({
|
|
|
610
612
|
if (isPresent.cancelIdleCallback) timers.cancelIdleCallback = _global.cancelIdleCallback;
|
|
611
613
|
if (isPresent.Intl) timers.Intl = NativeIntl;
|
|
612
614
|
const originalSetTimeout = _global.setImmediate || _global.setTimeout;
|
|
615
|
+
const originalClearInterval = _global.clearInterval;
|
|
616
|
+
const originalSetInterval = _global.setInterval;
|
|
613
617
|
function createClock(start, loopLimit) {
|
|
614
618
|
start = Math.floor(getEpoch(start));
|
|
615
619
|
loopLimit = loopLimit || 1000;
|
|
@@ -621,7 +625,12 @@ __webpack_require__.add({
|
|
|
621
625
|
const clock = {
|
|
622
626
|
now: start,
|
|
623
627
|
Date: createDate(),
|
|
624
|
-
loopLimit: loopLimit
|
|
628
|
+
loopLimit: loopLimit,
|
|
629
|
+
tickMode: {
|
|
630
|
+
mode: "manual",
|
|
631
|
+
counter: 0,
|
|
632
|
+
delta: void 0
|
|
633
|
+
}
|
|
625
634
|
};
|
|
626
635
|
clock.Date.clock = clock;
|
|
627
636
|
function getTimeToNextFrame() {
|
|
@@ -663,6 +672,53 @@ __webpack_require__.add({
|
|
|
663
672
|
clock.Intl = createIntl();
|
|
664
673
|
clock.Intl.clock = clock;
|
|
665
674
|
}
|
|
675
|
+
clock.setTickMode = function(tickModeConfig) {
|
|
676
|
+
const { mode: newMode, delta: newDelta } = tickModeConfig;
|
|
677
|
+
const { mode: oldMode, delta: oldDelta } = clock.tickMode;
|
|
678
|
+
if (newMode === oldMode && newDelta === oldDelta) return;
|
|
679
|
+
if ("interval" === oldMode) originalClearInterval(clock.attachedInterval);
|
|
680
|
+
clock.tickMode = {
|
|
681
|
+
counter: clock.tickMode.counter + 1,
|
|
682
|
+
mode: newMode,
|
|
683
|
+
delta: newDelta
|
|
684
|
+
};
|
|
685
|
+
if ("nextAsync" === newMode) advanceUntilModeChanges();
|
|
686
|
+
else if ("interval" === newMode) createIntervalTick(clock, newDelta || 20);
|
|
687
|
+
};
|
|
688
|
+
async function advanceUntilModeChanges() {
|
|
689
|
+
async function newMacrotask() {
|
|
690
|
+
const channel = new MessageChannel();
|
|
691
|
+
await new Promise((resolve)=>{
|
|
692
|
+
channel.port1.onmessage = ()=>{
|
|
693
|
+
resolve();
|
|
694
|
+
channel.port1.close();
|
|
695
|
+
};
|
|
696
|
+
channel.port2.postMessage(void 0);
|
|
697
|
+
});
|
|
698
|
+
channel.port1.close();
|
|
699
|
+
channel.port2.close();
|
|
700
|
+
await new Promise((resolve)=>{
|
|
701
|
+
originalSetTimeout(resolve);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
const { counter } = clock.tickMode;
|
|
705
|
+
while(clock.tickMode.counter === counter){
|
|
706
|
+
await newMacrotask();
|
|
707
|
+
if (clock.tickMode.counter !== counter) return;
|
|
708
|
+
clock.next();
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
function pauseAutoTickUntilFinished(promise) {
|
|
712
|
+
if ("nextAsync" !== clock.tickMode.mode) return promise;
|
|
713
|
+
clock.setTickMode({
|
|
714
|
+
mode: "manual"
|
|
715
|
+
});
|
|
716
|
+
return promise.finally(()=>{
|
|
717
|
+
clock.setTickMode({
|
|
718
|
+
mode: "nextAsync"
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
}
|
|
666
722
|
clock.requestIdleCallback = function requestIdleCallback(func, timeout) {
|
|
667
723
|
let timeToNextIdlePeriod = 0;
|
|
668
724
|
if (clock.countTimers() > 0) timeToNextIdlePeriod = 50;
|
|
@@ -852,7 +908,7 @@ __webpack_require__.add({
|
|
|
852
908
|
return doTick(tickValue, false);
|
|
853
909
|
};
|
|
854
910
|
if (void 0 !== _global.Promise) clock.tickAsync = function tickAsync(tickValue) {
|
|
855
|
-
return new _global.Promise(function(resolve, reject) {
|
|
911
|
+
return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
|
|
856
912
|
originalSetTimeout(function() {
|
|
857
913
|
try {
|
|
858
914
|
doTick(tickValue, true, resolve, reject);
|
|
@@ -860,7 +916,7 @@ __webpack_require__.add({
|
|
|
860
916
|
reject(e);
|
|
861
917
|
}
|
|
862
918
|
});
|
|
863
|
-
});
|
|
919
|
+
}));
|
|
864
920
|
};
|
|
865
921
|
clock.next = function next() {
|
|
866
922
|
runJobs(clock);
|
|
@@ -877,7 +933,7 @@ __webpack_require__.add({
|
|
|
877
933
|
}
|
|
878
934
|
};
|
|
879
935
|
if (void 0 !== _global.Promise) clock.nextAsync = function nextAsync() {
|
|
880
|
-
return new _global.Promise(function(resolve, reject) {
|
|
936
|
+
return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
|
|
881
937
|
originalSetTimeout(function() {
|
|
882
938
|
try {
|
|
883
939
|
const timer = firstTimer(clock);
|
|
@@ -899,7 +955,7 @@ __webpack_require__.add({
|
|
|
899
955
|
reject(e);
|
|
900
956
|
}
|
|
901
957
|
});
|
|
902
|
-
});
|
|
958
|
+
}));
|
|
903
959
|
};
|
|
904
960
|
clock.runAll = function runAll() {
|
|
905
961
|
let numTimers, i;
|
|
@@ -924,7 +980,7 @@ __webpack_require__.add({
|
|
|
924
980
|
return clock.tick(getTimeToNextFrame());
|
|
925
981
|
};
|
|
926
982
|
if (void 0 !== _global.Promise) clock.runAllAsync = function runAllAsync() {
|
|
927
|
-
return new _global.Promise(function(resolve, reject) {
|
|
983
|
+
return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
|
|
928
984
|
let i = 0;
|
|
929
985
|
function doRun() {
|
|
930
986
|
originalSetTimeout(function() {
|
|
@@ -957,7 +1013,7 @@ __webpack_require__.add({
|
|
|
957
1013
|
});
|
|
958
1014
|
}
|
|
959
1015
|
doRun();
|
|
960
|
-
});
|
|
1016
|
+
}));
|
|
961
1017
|
};
|
|
962
1018
|
clock.runToLast = function runToLast() {
|
|
963
1019
|
const timer = lastTimer(clock);
|
|
@@ -968,7 +1024,7 @@ __webpack_require__.add({
|
|
|
968
1024
|
return clock.tick(timer.callAt - clock.now);
|
|
969
1025
|
};
|
|
970
1026
|
if (void 0 !== _global.Promise) clock.runToLastAsync = function runToLastAsync() {
|
|
971
|
-
return new _global.Promise(function(resolve, reject) {
|
|
1027
|
+
return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
|
|
972
1028
|
originalSetTimeout(function() {
|
|
973
1029
|
try {
|
|
974
1030
|
const timer = lastTimer(clock);
|
|
@@ -981,7 +1037,7 @@ __webpack_require__.add({
|
|
|
981
1037
|
reject(e);
|
|
982
1038
|
}
|
|
983
1039
|
});
|
|
984
|
-
});
|
|
1040
|
+
}));
|
|
985
1041
|
};
|
|
986
1042
|
clock.reset = function reset() {
|
|
987
1043
|
nanos = 0;
|
|
@@ -1016,6 +1072,11 @@ __webpack_require__.add({
|
|
|
1016
1072
|
if (isPresent.hrtime) clock.hrtime = hrtime;
|
|
1017
1073
|
return clock;
|
|
1018
1074
|
}
|
|
1075
|
+
function createIntervalTick(clock, delta) {
|
|
1076
|
+
const intervalTick = doIntervalTick.bind(null, clock, delta);
|
|
1077
|
+
const intervalId = originalSetInterval(intervalTick, delta);
|
|
1078
|
+
clock.attachedInterval = intervalId;
|
|
1079
|
+
}
|
|
1019
1080
|
function install(config) {
|
|
1020
1081
|
if (arguments.length > 1 || config instanceof Date || Array.isArray(config) || "number" == typeof config) throw new TypeError(`FakeTimers.install called with ${String(config)} install requires an object parameter`);
|
|
1021
1082
|
if (true === _global.Date.isFake) throw new TypeError("Can't install fake timers twice on the same global object.");
|
|
@@ -1032,16 +1093,15 @@ __webpack_require__.add({
|
|
|
1032
1093
|
const clock = createClock(config.now, config.loopLimit);
|
|
1033
1094
|
clock.shouldClearNativeTimers = config.shouldClearNativeTimers;
|
|
1034
1095
|
clock.uninstall = function() {
|
|
1035
|
-
return uninstall(clock
|
|
1096
|
+
return uninstall(clock);
|
|
1036
1097
|
};
|
|
1037
1098
|
clock.abortListenerMap = new Map();
|
|
1038
1099
|
clock.methods = config.toFake || [];
|
|
1039
1100
|
if (0 === clock.methods.length) clock.methods = Object.keys(timers);
|
|
1040
|
-
if (true === config.shouldAdvanceTime) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1101
|
+
if (true === config.shouldAdvanceTime) clock.setTickMode({
|
|
1102
|
+
mode: "interval",
|
|
1103
|
+
delta: config.advanceTimeDelta
|
|
1104
|
+
});
|
|
1045
1105
|
if (clock.methods.includes("performance")) {
|
|
1046
1106
|
const proto = (()=>{
|
|
1047
1107
|
if (hasPerformanceConstructorPrototype) return _global.performance.constructor.prototype;
|
|
@@ -1241,7 +1301,7 @@ __webpack_require__.add({
|
|
|
1241
1301
|
defaultImplementation.install;
|
|
1242
1302
|
exports.withGlobal = withGlobal;
|
|
1243
1303
|
},
|
|
1244
|
-
"../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js"
|
|
1304
|
+
"../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js" (module) {
|
|
1245
1305
|
(function(global1, factory) {
|
|
1246
1306
|
module.exports = factory();
|
|
1247
1307
|
})(0, function() {
|
|
@@ -9547,102 +9607,6 @@ const JestExtend = (chai, utils)=>{
|
|
|
9547
9607
|
use(JestExtendPlugin(chai, expect, expects));
|
|
9548
9608
|
});
|
|
9549
9609
|
};
|
|
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
9610
|
const comma = ','.charCodeAt(0);
|
|
9647
9611
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9648
9612
|
const intToChar = new Uint8Array(64);
|
|
@@ -10896,7 +10860,7 @@ function offsetToLineNumber(source, offset) {
|
|
|
10896
10860
|
return line + 1;
|
|
10897
10861
|
}
|
|
10898
10862
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
10899
|
-
const MagicString = (await import("./0~
|
|
10863
|
+
const MagicString = (await import("./0~907.js").then((mod)=>({
|
|
10900
10864
|
Bundle: mod.Bundle,
|
|
10901
10865
|
SourceMap: mod.SourceMap,
|
|
10902
10866
|
default: mod.MagicString
|
|
@@ -11643,135 +11607,247 @@ function getError(expected, promise) {
|
|
|
11643
11607
|
}
|
|
11644
11608
|
throw new Error("snapshot function didn't throw");
|
|
11645
11609
|
}
|
|
11646
|
-
function
|
|
11610
|
+
function getTestMeta(test) {
|
|
11647
11611
|
return {
|
|
11648
11612
|
filepath: test.testPath,
|
|
11649
11613
|
name: getTaskNameWithPrefix(test),
|
|
11650
11614
|
testId: test.testId
|
|
11651
11615
|
};
|
|
11652
11616
|
}
|
|
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
|
-
|
|
11617
|
+
const SnapshotPlugin = (workerState)=>(chai, utils)=>{
|
|
11618
|
+
function getTest(obj) {
|
|
11619
|
+
const test = utils.flag(obj, 'vitest-test');
|
|
11620
|
+
return test;
|
|
11621
|
+
}
|
|
11622
|
+
function getTestOrThrow(assertionName, obj) {
|
|
11623
|
+
const test = getTest(obj);
|
|
11624
|
+
if (!test) throw new Error(`'${assertionName}' cannot be used without test context`);
|
|
11625
|
+
return test;
|
|
11626
|
+
}
|
|
11627
|
+
for (const key of [
|
|
11628
|
+
'matchSnapshot',
|
|
11629
|
+
'toMatchSnapshot'
|
|
11630
|
+
])utils.addMethod(chai.Assertion.prototype, key, function(properties, message) {
|
|
11631
|
+
utils.flag(this, '_name', key);
|
|
11632
|
+
const isNot = utils.flag(this, 'negate');
|
|
11633
|
+
if (isNot) throw new Error(`${key} cannot be used with "not"`);
|
|
11634
|
+
const expected = utils.flag(this, 'object');
|
|
11635
|
+
const test = getTestOrThrow(key, this);
|
|
11636
|
+
if ('string' == typeof properties && void 0 === message) {
|
|
11637
|
+
message = properties;
|
|
11638
|
+
properties = void 0;
|
|
11639
|
+
}
|
|
11640
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11641
|
+
getSnapshotClient().assert({
|
|
11642
|
+
received: expected,
|
|
11643
|
+
message,
|
|
11644
|
+
isInline: false,
|
|
11645
|
+
properties,
|
|
11646
|
+
errorMessage,
|
|
11647
|
+
...getTestMeta(test)
|
|
11648
|
+
});
|
|
11680
11649
|
});
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11650
|
+
utils.addMethod(chai.Assertion.prototype, 'toMatchFileSnapshot', function(file, message) {
|
|
11651
|
+
utils.flag(this, '_name', 'toMatchFileSnapshot');
|
|
11652
|
+
const isNot = utils.flag(this, 'negate');
|
|
11653
|
+
if (isNot) throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
11654
|
+
const error = new Error('resolves');
|
|
11655
|
+
const expected = utils.flag(this, 'object');
|
|
11656
|
+
const test = getTestOrThrow('toMatchFileSnapshot', this);
|
|
11657
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11658
|
+
const promise = getSnapshotClient().assertRaw({
|
|
11659
|
+
received: expected,
|
|
11660
|
+
message,
|
|
11661
|
+
isInline: false,
|
|
11662
|
+
rawSnapshot: {
|
|
11663
|
+
file
|
|
11664
|
+
},
|
|
11665
|
+
errorMessage,
|
|
11666
|
+
...getTestMeta(test)
|
|
11667
|
+
});
|
|
11668
|
+
return snapshot_recordAsyncExpect(test, promise, snapshot_createAssertionMessage(utils, this, true), error);
|
|
11699
11669
|
});
|
|
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
|
-
|
|
11670
|
+
utils.addMethod(chai.Assertion.prototype, 'toMatchInlineSnapshot', function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
11671
|
+
utils.flag(this, '_name', 'toMatchInlineSnapshot');
|
|
11672
|
+
const isNot = utils.flag(this, 'negate');
|
|
11673
|
+
if (isNot) throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
11674
|
+
const test = getTest(this);
|
|
11675
|
+
if (test) {
|
|
11676
|
+
const isInsideEach = test.each || test.inTestEach;
|
|
11677
|
+
if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
|
|
11678
|
+
}
|
|
11679
|
+
const expected = utils.flag(this, 'object');
|
|
11680
|
+
const error = utils.flag(this, 'error');
|
|
11681
|
+
if ('string' == typeof properties) {
|
|
11682
|
+
message = inlineSnapshot;
|
|
11683
|
+
inlineSnapshot = properties;
|
|
11684
|
+
properties = void 0;
|
|
11685
|
+
}
|
|
11686
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
11687
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11688
|
+
getSnapshotClient().assert({
|
|
11689
|
+
received: expected,
|
|
11690
|
+
message,
|
|
11691
|
+
isInline: true,
|
|
11692
|
+
properties,
|
|
11693
|
+
inlineSnapshot,
|
|
11694
|
+
error,
|
|
11695
|
+
errorMessage,
|
|
11696
|
+
...test ? getTestMeta(test) : {
|
|
11697
|
+
filepath: workerState.testPath,
|
|
11698
|
+
name: 'toMatchInlineSnapshot',
|
|
11699
|
+
testId: String(workerState.taskId)
|
|
11700
|
+
}
|
|
11701
|
+
});
|
|
11727
11702
|
});
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11703
|
+
utils.addMethod(chai.Assertion.prototype, 'toThrowErrorMatchingSnapshot', function(message) {
|
|
11704
|
+
utils.flag(this, '_name', 'toThrowErrorMatchingSnapshot');
|
|
11705
|
+
const isNot = utils.flag(this, 'negate');
|
|
11706
|
+
if (isNot) throw new Error('toThrowErrorMatchingSnapshot cannot be used with "not"');
|
|
11707
|
+
const expected = utils.flag(this, 'object');
|
|
11708
|
+
const test = getTestOrThrow('toThrowErrorMatchingSnapshot', this);
|
|
11709
|
+
const promise = utils.flag(this, 'promise');
|
|
11710
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11711
|
+
getSnapshotClient().assert({
|
|
11712
|
+
received: getError(expected, promise),
|
|
11713
|
+
message,
|
|
11714
|
+
errorMessage,
|
|
11715
|
+
...getTestMeta(test)
|
|
11716
|
+
});
|
|
11742
11717
|
});
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11718
|
+
utils.addMethod(chai.Assertion.prototype, 'toThrowErrorMatchingInlineSnapshot', function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
11719
|
+
const isNot = utils.flag(this, 'negate');
|
|
11720
|
+
if (isNot) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
11721
|
+
const test = getTest(this);
|
|
11722
|
+
if (test) {
|
|
11723
|
+
const isInsideEach = test.each || test.inTestEach;
|
|
11724
|
+
if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
|
|
11725
|
+
}
|
|
11726
|
+
const expected = utils.flag(this, 'object');
|
|
11727
|
+
const error = utils.flag(this, 'error');
|
|
11728
|
+
const promise = utils.flag(this, 'promise');
|
|
11729
|
+
const errorMessage = utils.flag(this, 'message');
|
|
11730
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
11731
|
+
getSnapshotClient().assert({
|
|
11732
|
+
received: getError(expected, promise),
|
|
11733
|
+
message,
|
|
11734
|
+
inlineSnapshot,
|
|
11735
|
+
isInline: true,
|
|
11736
|
+
error,
|
|
11737
|
+
errorMessage,
|
|
11738
|
+
...test ? getTestMeta(test) : {
|
|
11739
|
+
name: 'toThrowErrorMatchingInlineSnapshot',
|
|
11740
|
+
filepath: workerState.testPath,
|
|
11741
|
+
testId: String(workerState.taskId)
|
|
11742
|
+
}
|
|
11743
|
+
});
|
|
11763
11744
|
});
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11745
|
+
utils.addMethod(chai.expect, 'addSnapshotSerializer', addSerializer);
|
|
11746
|
+
};
|
|
11747
|
+
const unsupported = [
|
|
11748
|
+
'matchSnapshot',
|
|
11749
|
+
'toMatchSnapshot',
|
|
11750
|
+
'toMatchInlineSnapshot',
|
|
11751
|
+
'toThrowErrorMatchingSnapshot',
|
|
11752
|
+
'toThrowErrorMatchingInlineSnapshot',
|
|
11753
|
+
'throws',
|
|
11754
|
+
'Throw',
|
|
11755
|
+
'throw',
|
|
11756
|
+
'toThrow',
|
|
11757
|
+
'toThrowError'
|
|
11758
|
+
];
|
|
11759
|
+
function createExpectPoll(expect) {
|
|
11760
|
+
return function poll(fn, options = {}) {
|
|
11761
|
+
const { interval = 50, timeout = 1000, message } = options;
|
|
11762
|
+
const assertion = expect(null, message).withContext({
|
|
11763
|
+
poll: true
|
|
11764
|
+
});
|
|
11765
|
+
fn = fn.bind(assertion);
|
|
11766
|
+
const test = utils_exports.flag(assertion, 'vitest-test');
|
|
11767
|
+
if (!test) throw new Error('expect.poll() must be called inside a test');
|
|
11768
|
+
const proxy = new Proxy(assertion, {
|
|
11769
|
+
get (target, key, receiver) {
|
|
11770
|
+
const assertionFunction = Reflect.get(target, key, receiver);
|
|
11771
|
+
if ('function' != typeof assertionFunction) return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
11772
|
+
if ('assert' === key) return assertionFunction;
|
|
11773
|
+
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.`);
|
|
11774
|
+
return function(...args) {
|
|
11775
|
+
const STACK_TRACE_ERROR = new Error('STACK_TRACE_ERROR');
|
|
11776
|
+
const promise = ()=>new Promise((resolve, reject)=>{
|
|
11777
|
+
let intervalId;
|
|
11778
|
+
let timeoutId;
|
|
11779
|
+
let lastError;
|
|
11780
|
+
const check = async ()=>{
|
|
11781
|
+
try {
|
|
11782
|
+
utils_exports.flag(assertion, '_name', key);
|
|
11783
|
+
const obj = await fn();
|
|
11784
|
+
utils_exports.flag(assertion, 'object', obj);
|
|
11785
|
+
resolve(await assertionFunction.call(assertion, ...args));
|
|
11786
|
+
clearTimeout(intervalId);
|
|
11787
|
+
clearTimeout(timeoutId);
|
|
11788
|
+
} catch (err) {
|
|
11789
|
+
lastError = err;
|
|
11790
|
+
if (!utils_exports.flag(assertion, '_isLastPollAttempt')) intervalId = getRealTimers().setTimeout(check, interval);
|
|
11791
|
+
}
|
|
11792
|
+
};
|
|
11793
|
+
timeoutId = getRealTimers().setTimeout(()=>{
|
|
11794
|
+
clearTimeout(intervalId);
|
|
11795
|
+
utils_exports.flag(assertion, '_isLastPollAttempt', true);
|
|
11796
|
+
const rejectWithCause = (cause)=>{
|
|
11797
|
+
reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
11798
|
+
cause
|
|
11799
|
+
}), STACK_TRACE_ERROR));
|
|
11800
|
+
};
|
|
11801
|
+
check().then(()=>rejectWithCause(lastError)).catch((e)=>rejectWithCause(e));
|
|
11802
|
+
}, timeout);
|
|
11803
|
+
check();
|
|
11804
|
+
});
|
|
11805
|
+
let awaited = false;
|
|
11806
|
+
test.onFinished ??= [];
|
|
11807
|
+
test.onFinished.push(()=>{
|
|
11808
|
+
if (!awaited) {
|
|
11809
|
+
const negated = utils_exports.flag(assertion, 'negate') ? 'not.' : '';
|
|
11810
|
+
const name = utils_exports.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
|
|
11811
|
+
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
11812
|
+
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`);
|
|
11813
|
+
throw copyStackTrace(error, STACK_TRACE_ERROR);
|
|
11814
|
+
}
|
|
11815
|
+
});
|
|
11816
|
+
let resultPromise;
|
|
11817
|
+
return {
|
|
11818
|
+
then (onFulfilled, onRejected) {
|
|
11819
|
+
awaited = true;
|
|
11820
|
+
resultPromise ||= promise();
|
|
11821
|
+
return resultPromise.then(onFulfilled, onRejected);
|
|
11822
|
+
},
|
|
11823
|
+
catch (onRejected) {
|
|
11824
|
+
resultPromise ||= promise();
|
|
11825
|
+
return resultPromise.catch(onRejected);
|
|
11826
|
+
},
|
|
11827
|
+
finally (onFinally) {
|
|
11828
|
+
resultPromise ||= promise();
|
|
11829
|
+
return resultPromise.finally(onFinally);
|
|
11830
|
+
},
|
|
11831
|
+
[Symbol.toStringTag]: 'Promise'
|
|
11832
|
+
};
|
|
11833
|
+
};
|
|
11834
|
+
}
|
|
11835
|
+
});
|
|
11836
|
+
return proxy;
|
|
11837
|
+
};
|
|
11838
|
+
}
|
|
11839
|
+
function copyStackTrace(target, source) {
|
|
11840
|
+
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
11841
|
+
return target;
|
|
11842
|
+
}
|
|
11771
11843
|
function setupChaiConfig(config) {
|
|
11772
11844
|
Object.assign(chai_config, config);
|
|
11773
11845
|
}
|
|
11774
11846
|
function createExpect({ getCurrentTest, workerState }) {
|
|
11847
|
+
use(JestExtend);
|
|
11848
|
+
use(JestChaiExpect);
|
|
11849
|
+
use(SnapshotPlugin(workerState));
|
|
11850
|
+
use(JestAsymmetricMatchers);
|
|
11775
11851
|
const expect = (value, message)=>{
|
|
11776
11852
|
const { assertionCalls } = getState(expect);
|
|
11777
11853
|
setState({
|
|
@@ -12011,10 +12087,13 @@ const updateTestModes = (tests, testNamePattern)=>{
|
|
|
12011
12087
|
else if (shouldTestSkip(test, hasOnly, testNamePattern)) test.runMode = 'skip';
|
|
12012
12088
|
};
|
|
12013
12089
|
const updateTestParents = (tests, parentNames = [])=>{
|
|
12014
|
-
for (const test of tests)
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12090
|
+
for (const test of tests){
|
|
12091
|
+
test.parentNames = parentNames;
|
|
12092
|
+
if ('suite' === test.type) {
|
|
12093
|
+
const names = test.name === ROOT_SUITE_NAME ? parentNames : parentNames.concat(test.name);
|
|
12094
|
+
updateTestParents(test.tests, names);
|
|
12095
|
+
}
|
|
12096
|
+
}
|
|
12018
12097
|
};
|
|
12019
12098
|
const traverseUpdateTest = (tests, testNamePattern)=>{
|
|
12020
12099
|
updateTestParents(tests);
|
|
@@ -12036,12 +12115,17 @@ function makeError(message, stackTraceError) {
|
|
|
12036
12115
|
if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
|
|
12037
12116
|
return error;
|
|
12038
12117
|
}
|
|
12039
|
-
function wrapTimeout({ name, fn, timeout, stackTraceError }) {
|
|
12118
|
+
function wrapTimeout({ name, fn, timeout, getAssertionCalls, stackTraceError }) {
|
|
12040
12119
|
if (!timeout) return fn;
|
|
12041
12120
|
return async (...args)=>{
|
|
12042
12121
|
let timeoutId;
|
|
12043
12122
|
const timeoutPromise = new Promise((_, reject)=>{
|
|
12044
|
-
timeoutId = getRealTimers().setTimeout(()=>
|
|
12123
|
+
timeoutId = getRealTimers().setTimeout(()=>{
|
|
12124
|
+
const assertionCalls = getAssertionCalls?.() || 0;
|
|
12125
|
+
const assertionInfo = assertionCalls > 0 ? ` (completed ${assertionCalls} expect assertion${1 === assertionCalls ? '' : 's'})` : ' (no expect assertions completed)';
|
|
12126
|
+
const message = `${name} timed out in ${timeout}ms${getAssertionCalls ? assertionInfo : ''}`;
|
|
12127
|
+
reject(makeError(message, stackTraceError));
|
|
12128
|
+
}, timeout);
|
|
12045
12129
|
});
|
|
12046
12130
|
try {
|
|
12047
12131
|
const result = await Promise.race([
|
|
@@ -12083,14 +12167,12 @@ const RealDate = Date;
|
|
|
12083
12167
|
class TestRunner {
|
|
12084
12168
|
_test;
|
|
12085
12169
|
workerState;
|
|
12086
|
-
async runTests({ tests, testPath, state, hooks, api }) {
|
|
12170
|
+
async runTests({ tests, testPath, state, hooks, api, snapshotClient }) {
|
|
12087
12171
|
this.workerState = state;
|
|
12088
|
-
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency, bail }, project
|
|
12172
|
+
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency, bail }, project } = state;
|
|
12089
12173
|
const results = [];
|
|
12090
12174
|
const errors = [];
|
|
12091
12175
|
let defaultStatus = 'pass';
|
|
12092
|
-
const snapshotClient = getSnapshotClient();
|
|
12093
|
-
await snapshotClient.setup(testPath, snapshotOptions);
|
|
12094
12176
|
const runTestsCase = async (test, parentHooks)=>{
|
|
12095
12177
|
if ('skip' === test.runMode) {
|
|
12096
12178
|
snapshotClient.skipTest(testPath, getTaskNameWithPrefix(test));
|
|
@@ -12165,7 +12247,20 @@ class TestRunner {
|
|
|
12165
12247
|
else try {
|
|
12166
12248
|
const fixtureCleanups = await this.beforeRunTest(test, snapshotClient.getSnapshotState(testPath));
|
|
12167
12249
|
cleanups.push(...fixtureCleanups);
|
|
12168
|
-
|
|
12250
|
+
if (test.fn) {
|
|
12251
|
+
const fn = wrapTimeout({
|
|
12252
|
+
name: 'test',
|
|
12253
|
+
fn: test.fn,
|
|
12254
|
+
timeout: test.timeout,
|
|
12255
|
+
stackTraceError: test.stackTraceError,
|
|
12256
|
+
getAssertionCalls: ()=>{
|
|
12257
|
+
const expect = test.context._useLocalExpect ? test.context.expect : globalThis[GLOBAL_EXPECT];
|
|
12258
|
+
const { assertionCalls } = getState(expect);
|
|
12259
|
+
return assertionCalls;
|
|
12260
|
+
}
|
|
12261
|
+
});
|
|
12262
|
+
await fn(test.context);
|
|
12263
|
+
}
|
|
12169
12264
|
this.afterRunTest(test);
|
|
12170
12265
|
result = {
|
|
12171
12266
|
testId: test.testId,
|
|
@@ -12220,6 +12315,7 @@ class TestRunner {
|
|
|
12220
12315
|
const tests = [
|
|
12221
12316
|
...allTest
|
|
12222
12317
|
];
|
|
12318
|
+
const results = [];
|
|
12223
12319
|
while(tests.length){
|
|
12224
12320
|
const suite = tests.shift();
|
|
12225
12321
|
if (suite.concurrent) {
|
|
@@ -12227,47 +12323,63 @@ class TestRunner {
|
|
|
12227
12323
|
suite
|
|
12228
12324
|
];
|
|
12229
12325
|
while(tests[0]?.concurrent)cases.push(tests.shift());
|
|
12230
|
-
await Promise.all(cases.map((test)=>{
|
|
12326
|
+
const result = await Promise.all(cases.map((test)=>{
|
|
12231
12327
|
if ('suite' === test.type) return runTest(test, parentHooks);
|
|
12232
12328
|
return limitMaxConcurrency(()=>runTest(test, parentHooks));
|
|
12233
12329
|
}));
|
|
12330
|
+
results.push(...result);
|
|
12234
12331
|
continue;
|
|
12235
12332
|
}
|
|
12236
|
-
await runTest(suite, parentHooks);
|
|
12333
|
+
const result = await runTest(suite, parentHooks);
|
|
12334
|
+
results.push(result);
|
|
12237
12335
|
}
|
|
12336
|
+
return results;
|
|
12238
12337
|
};
|
|
12239
12338
|
const runTest = async (test, parentHooks)=>{
|
|
12339
|
+
let result = {
|
|
12340
|
+
testId: test.testId,
|
|
12341
|
+
status: 'skip',
|
|
12342
|
+
parentNames: test.parentNames,
|
|
12343
|
+
name: test.name,
|
|
12344
|
+
testPath,
|
|
12345
|
+
project,
|
|
12346
|
+
duration: 0,
|
|
12347
|
+
errors: []
|
|
12348
|
+
};
|
|
12240
12349
|
if (bail && await hooks.getCountOfFailedTests() >= bail) {
|
|
12241
12350
|
defaultStatus = 'skip';
|
|
12242
|
-
return;
|
|
12351
|
+
return result;
|
|
12243
12352
|
}
|
|
12244
12353
|
if ('suite' === test.type) {
|
|
12354
|
+
const start = RealDate.now();
|
|
12355
|
+
hooks.onTestSuiteStart?.({
|
|
12356
|
+
parentNames: test.parentNames,
|
|
12357
|
+
name: test.name,
|
|
12358
|
+
testPath,
|
|
12359
|
+
project: test.project,
|
|
12360
|
+
testId: test.testId,
|
|
12361
|
+
type: 'suite',
|
|
12362
|
+
location: test.location
|
|
12363
|
+
});
|
|
12245
12364
|
if (0 === test.tests.length) {
|
|
12246
12365
|
if ([
|
|
12247
12366
|
'todo',
|
|
12248
12367
|
'skip'
|
|
12249
12368
|
].includes(test.runMode)) {
|
|
12250
12369
|
defaultStatus = 'skip';
|
|
12251
|
-
|
|
12370
|
+
hooks.onTestSuiteResult?.(result);
|
|
12371
|
+
return result;
|
|
12372
|
+
}
|
|
12373
|
+
if (passWithNoTests) {
|
|
12374
|
+
result.status = 'pass';
|
|
12375
|
+
hooks.onTestSuiteResult?.(result);
|
|
12376
|
+
return result;
|
|
12252
12377
|
}
|
|
12253
|
-
if (passWithNoTests) return;
|
|
12254
12378
|
const noTestError = {
|
|
12255
12379
|
message: `No test found in suite: ${test.name}`,
|
|
12256
12380
|
name: 'No tests'
|
|
12257
12381
|
};
|
|
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);
|
|
12382
|
+
result.errors?.push(noTestError);
|
|
12271
12383
|
}
|
|
12272
12384
|
const cleanups = [];
|
|
12273
12385
|
let hasBeforeAllError = false;
|
|
@@ -12283,10 +12395,10 @@ class TestRunner {
|
|
|
12283
12395
|
}
|
|
12284
12396
|
} catch (error) {
|
|
12285
12397
|
hasBeforeAllError = true;
|
|
12286
|
-
errors
|
|
12398
|
+
result.errors?.push(...formatTestError(error));
|
|
12287
12399
|
}
|
|
12288
12400
|
if (hasBeforeAllError) markAllTestAsSkipped(test.tests);
|
|
12289
|
-
await runTests(test.tests, {
|
|
12401
|
+
const results = await runTests(test.tests, {
|
|
12290
12402
|
beforeEachListeners: parentHooks.beforeEachListeners.concat(test.beforeEachListeners || []),
|
|
12291
12403
|
afterEachListeners: parentHooks.afterEachListeners.concat(test.afterEachListeners || [])
|
|
12292
12404
|
});
|
|
@@ -12301,11 +12413,14 @@ class TestRunner {
|
|
|
12301
12413
|
filepath: testPath
|
|
12302
12414
|
});
|
|
12303
12415
|
} catch (error) {
|
|
12304
|
-
errors
|
|
12416
|
+
result.errors?.push(...formatTestError(error));
|
|
12305
12417
|
}
|
|
12418
|
+
result.duration = RealDate.now() - start;
|
|
12419
|
+
result.status = result.errors?.length ? 'fail' : getTestStatus(results, defaultStatus);
|
|
12420
|
+
hooks.onTestSuiteResult?.(result);
|
|
12421
|
+
errors.push(...result.errors || []);
|
|
12306
12422
|
} else {
|
|
12307
12423
|
const start = RealDate.now();
|
|
12308
|
-
let result;
|
|
12309
12424
|
let retryCount = 0;
|
|
12310
12425
|
hooks.onTestCaseStart?.({
|
|
12311
12426
|
testId: test.testId,
|
|
@@ -12314,7 +12429,9 @@ class TestRunner {
|
|
|
12314
12429
|
name: test.name,
|
|
12315
12430
|
timeout: test.timeout,
|
|
12316
12431
|
parentNames: test.parentNames,
|
|
12317
|
-
project: test.project
|
|
12432
|
+
project: test.project,
|
|
12433
|
+
type: 'case',
|
|
12434
|
+
location: test.location
|
|
12318
12435
|
});
|
|
12319
12436
|
do {
|
|
12320
12437
|
const currentResult = await runTestsCase(test, parentHooks);
|
|
@@ -12330,6 +12447,7 @@ class TestRunner {
|
|
|
12330
12447
|
hooks.onTestCaseResult?.(result);
|
|
12331
12448
|
results.push(result);
|
|
12332
12449
|
}
|
|
12450
|
+
return result;
|
|
12333
12451
|
};
|
|
12334
12452
|
const start = RealDate.now();
|
|
12335
12453
|
if (0 === tests.length) {
|
|
@@ -12470,6 +12588,7 @@ class TestRunner {
|
|
|
12470
12588
|
if (true === isExpectingAssertions && 0 === assertionCalls) throw isExpectingAssertionsError;
|
|
12471
12589
|
}
|
|
12472
12590
|
}
|
|
12591
|
+
const external_node_path_ = __webpack_require__("path");
|
|
12473
12592
|
class RunnerRuntime {
|
|
12474
12593
|
tests = [];
|
|
12475
12594
|
_currentTest = [];
|
|
@@ -12540,7 +12659,7 @@ class RunnerRuntime {
|
|
|
12540
12659
|
type: 'suite'
|
|
12541
12660
|
};
|
|
12542
12661
|
}
|
|
12543
|
-
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential }) {
|
|
12662
|
+
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential, location }) {
|
|
12544
12663
|
this.checkStatus(name, 'suite');
|
|
12545
12664
|
const currentSuite = {
|
|
12546
12665
|
project: this.project,
|
|
@@ -12551,7 +12670,8 @@ class RunnerRuntime {
|
|
|
12551
12670
|
each,
|
|
12552
12671
|
testPath: this.testPath,
|
|
12553
12672
|
concurrent,
|
|
12554
|
-
sequential
|
|
12673
|
+
sequential,
|
|
12674
|
+
location
|
|
12555
12675
|
};
|
|
12556
12676
|
if (!fn) {
|
|
12557
12677
|
this.addTest(currentSuite);
|
|
@@ -12620,18 +12740,14 @@ class RunnerRuntime {
|
|
|
12620
12740
|
ensureRootSuite() {
|
|
12621
12741
|
if (0 === this._currentTest.length) this.addTest(this.getDefaultRootSuite());
|
|
12622
12742
|
}
|
|
12623
|
-
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential }) {
|
|
12743
|
+
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential, location }) {
|
|
12624
12744
|
this.checkStatus(name, 'case');
|
|
12625
12745
|
this.addTestCase({
|
|
12626
12746
|
project: this.project,
|
|
12627
12747
|
name,
|
|
12628
12748
|
originalFn,
|
|
12629
|
-
fn
|
|
12630
|
-
|
|
12631
|
-
fn,
|
|
12632
|
-
timeout,
|
|
12633
|
-
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
12634
|
-
}) : fn,
|
|
12749
|
+
fn,
|
|
12750
|
+
stackTraceError: new Error('STACK_TRACE_ERROR'),
|
|
12635
12751
|
runMode,
|
|
12636
12752
|
type: 'case',
|
|
12637
12753
|
timeout,
|
|
@@ -12641,7 +12757,8 @@ class RunnerRuntime {
|
|
|
12641
12757
|
each,
|
|
12642
12758
|
fails,
|
|
12643
12759
|
onFinished: [],
|
|
12644
|
-
onFailed: []
|
|
12760
|
+
onFailed: [],
|
|
12761
|
+
location
|
|
12645
12762
|
});
|
|
12646
12763
|
}
|
|
12647
12764
|
describeEach({ cases, ...options }) {
|
|
@@ -12717,12 +12834,33 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12717
12834
|
testPath,
|
|
12718
12835
|
runtimeConfig
|
|
12719
12836
|
});
|
|
12837
|
+
const getLocation = ()=>{
|
|
12838
|
+
if (!runtimeConfig.includeTaskLocation) return;
|
|
12839
|
+
const stack = new Error().stack;
|
|
12840
|
+
if (stack) {
|
|
12841
|
+
const frames = parse(stack);
|
|
12842
|
+
for (const frame of frames){
|
|
12843
|
+
let filename = frame.file ?? '';
|
|
12844
|
+
if (filename.startsWith('file://')) filename = fileURLToPath(filename);
|
|
12845
|
+
filename = filename.replaceAll(external_node_path_["default"].sep, '/');
|
|
12846
|
+
if (filename === testPath) {
|
|
12847
|
+
const line = frame.lineNumber;
|
|
12848
|
+
const column = frame.column;
|
|
12849
|
+
if (null != line && null != column) return {
|
|
12850
|
+
line,
|
|
12851
|
+
column
|
|
12852
|
+
};
|
|
12853
|
+
}
|
|
12854
|
+
}
|
|
12855
|
+
}
|
|
12856
|
+
};
|
|
12720
12857
|
const createTestAPI = (options = {})=>{
|
|
12721
12858
|
const testFn = (name, fn, timeout)=>runtimeInstance.it({
|
|
12722
12859
|
name,
|
|
12723
12860
|
fn,
|
|
12724
12861
|
timeout,
|
|
12725
|
-
...options
|
|
12862
|
+
...options,
|
|
12863
|
+
location: options.location ?? getLocation()
|
|
12726
12864
|
});
|
|
12727
12865
|
for (const { name, overrides } of [
|
|
12728
12866
|
{
|
|
@@ -12768,15 +12906,25 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12768
12906
|
}),
|
|
12769
12907
|
enumerable: true
|
|
12770
12908
|
});
|
|
12771
|
-
testFn.runIf = (condition)=>
|
|
12772
|
-
|
|
12909
|
+
testFn.runIf = (condition)=>createTestAPI({
|
|
12910
|
+
...options,
|
|
12911
|
+
location: getLocation(),
|
|
12912
|
+
runMode: condition ? options.runMode : 'skip'
|
|
12913
|
+
});
|
|
12914
|
+
testFn.skipIf = (condition)=>createTestAPI({
|
|
12915
|
+
...options,
|
|
12916
|
+
location: getLocation(),
|
|
12917
|
+
runMode: condition ? 'skip' : options.runMode
|
|
12918
|
+
});
|
|
12773
12919
|
testFn.each = (cases)=>runtimeInstance.each({
|
|
12774
12920
|
cases,
|
|
12775
|
-
...options
|
|
12921
|
+
...options,
|
|
12922
|
+
location: getLocation()
|
|
12776
12923
|
});
|
|
12777
12924
|
testFn.for = (cases)=>runtimeInstance.for({
|
|
12778
12925
|
cases,
|
|
12779
|
-
...options
|
|
12926
|
+
...options,
|
|
12927
|
+
location: getLocation()
|
|
12780
12928
|
});
|
|
12781
12929
|
return testFn;
|
|
12782
12930
|
};
|
|
@@ -12796,7 +12944,8 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12796
12944
|
const describeFn = (name, fn)=>runtimeInstance.describe({
|
|
12797
12945
|
name,
|
|
12798
12946
|
fn,
|
|
12799
|
-
...options
|
|
12947
|
+
...options,
|
|
12948
|
+
location: options.location ?? getLocation()
|
|
12800
12949
|
});
|
|
12801
12950
|
for (const { name, overrides } of [
|
|
12802
12951
|
{
|
|
@@ -12836,15 +12985,25 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12836
12985
|
}),
|
|
12837
12986
|
enumerable: true
|
|
12838
12987
|
});
|
|
12839
|
-
describeFn.skipIf = (condition)=>
|
|
12840
|
-
|
|
12988
|
+
describeFn.skipIf = (condition)=>createDescribeAPI({
|
|
12989
|
+
...options,
|
|
12990
|
+
location: getLocation(),
|
|
12991
|
+
runMode: condition ? 'skip' : options.runMode
|
|
12992
|
+
});
|
|
12993
|
+
describeFn.runIf = (condition)=>createDescribeAPI({
|
|
12994
|
+
...options,
|
|
12995
|
+
location: getLocation(),
|
|
12996
|
+
runMode: condition ? options.runMode : 'skip'
|
|
12997
|
+
});
|
|
12841
12998
|
describeFn.each = (cases)=>runtimeInstance.describeEach({
|
|
12842
12999
|
cases,
|
|
12843
|
-
...options
|
|
13000
|
+
...options,
|
|
13001
|
+
location: getLocation()
|
|
12844
13002
|
});
|
|
12845
13003
|
describeFn.for = (cases)=>runtimeInstance.describeFor({
|
|
12846
13004
|
cases,
|
|
12847
|
-
...options
|
|
13005
|
+
...options,
|
|
13006
|
+
location: getLocation()
|
|
12848
13007
|
});
|
|
12849
13008
|
return describeFn;
|
|
12850
13009
|
};
|
|
@@ -12882,15 +13041,33 @@ function createRunner({ workerState }) {
|
|
|
12882
13041
|
},
|
|
12883
13042
|
runner: {
|
|
12884
13043
|
runTests: async (testPath, hooks, api)=>{
|
|
13044
|
+
const snapshotClient = getSnapshotClient();
|
|
13045
|
+
await snapshotClient.setup(testPath, workerState.snapshotOptions);
|
|
12885
13046
|
const tests = await runtime.instance.getTests();
|
|
12886
13047
|
traverseUpdateTest(tests, testNamePattern);
|
|
13048
|
+
hooks.onTestFileReady?.({
|
|
13049
|
+
testPath,
|
|
13050
|
+
tests: tests.map(function toTestInfo(test) {
|
|
13051
|
+
return {
|
|
13052
|
+
testId: test.testId,
|
|
13053
|
+
name: test.name,
|
|
13054
|
+
parentNames: test.parentNames,
|
|
13055
|
+
testPath: test.testPath,
|
|
13056
|
+
project: test.project,
|
|
13057
|
+
type: test.type,
|
|
13058
|
+
location: test.location,
|
|
13059
|
+
tests: 'suite' === test.type ? test.tests.map(toTestInfo) : []
|
|
13060
|
+
};
|
|
13061
|
+
})
|
|
13062
|
+
});
|
|
12887
13063
|
runtime.instance.updateStatus('running');
|
|
12888
13064
|
const results = await testRunner.runTests({
|
|
12889
13065
|
tests,
|
|
12890
13066
|
testPath,
|
|
12891
13067
|
state: workerState,
|
|
12892
13068
|
hooks,
|
|
12893
|
-
api
|
|
13069
|
+
api,
|
|
13070
|
+
snapshotClient
|
|
12894
13071
|
});
|
|
12895
13072
|
return results;
|
|
12896
13073
|
},
|
|
@@ -12903,7 +13080,7 @@ function createRunner({ workerState }) {
|
|
|
12903
13080
|
}
|
|
12904
13081
|
};
|
|
12905
13082
|
}
|
|
12906
|
-
const fake_timers_src = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@
|
|
13083
|
+
const fake_timers_src = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
|
|
12907
13084
|
const fakeTimers_RealDate = Date;
|
|
12908
13085
|
class FakeTimers {
|
|
12909
13086
|
_clock;
|
|
@@ -13185,7 +13362,8 @@ const createRstestUtilities = (workerState)=>{
|
|
|
13185
13362
|
requireMock: ()=>({}),
|
|
13186
13363
|
importActual: async ()=>({}),
|
|
13187
13364
|
requireActual: ()=>({}),
|
|
13188
|
-
resetModules: ()=>
|
|
13365
|
+
resetModules: ()=>({}),
|
|
13366
|
+
hoisted: ()=>({}),
|
|
13189
13367
|
setConfig: (config)=>{
|
|
13190
13368
|
if (!originalConfig) originalConfig = {
|
|
13191
13369
|
...workerState.runtimeConfig
|