@rstest/core 0.7.2 → 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/dist/0~122.js +7 -3
- package/dist/0~151.js +197 -58
- package/dist/0~173.js +27 -27
- package/dist/0~403.js +7 -7
- package/dist/0~583.js +1 -1
- package/dist/0~588.js +5 -5
- package/dist/0~634.js +19 -17
- package/dist/0~835.js +3 -3
- package/dist/0~919.js +5 -5
- package/dist/0~923.js +3 -3
- package/dist/131.js +55 -137
- package/dist/554.js +88 -84
- package/dist/672.js +91 -0
- package/dist/946.js +14 -8
- package/dist/index.d.ts +114 -5
- package/dist/mockRuntimeCode.js +1 -0
- package/dist/worker.d.ts +34 -7
- package/package.json +2 -2
package/dist/0~122.js
CHANGED
|
@@ -102,7 +102,7 @@ const parseWorkers = (maxWorkers)=>{
|
|
|
102
102
|
return parsed > 0 ? parsed : 1;
|
|
103
103
|
};
|
|
104
104
|
const getRuntimeConfig = (context)=>{
|
|
105
|
-
const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage, snapshotFormat, env, logHeapUsage, bail, chaiConfig } = context.normalizedConfig;
|
|
105
|
+
const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage, snapshotFormat, env, logHeapUsage, bail, chaiConfig, includeTaskLocation } = context.normalizedConfig;
|
|
106
106
|
return {
|
|
107
107
|
env,
|
|
108
108
|
testNamePattern,
|
|
@@ -125,7 +125,8 @@ const getRuntimeConfig = (context)=>{
|
|
|
125
125
|
snapshotFormat,
|
|
126
126
|
logHeapUsage,
|
|
127
127
|
bail,
|
|
128
|
-
chaiConfig
|
|
128
|
+
chaiConfig,
|
|
129
|
+
includeTaskLocation
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
132
|
const filterAssetsByEntry = async (entryInfo, getAssetFiles, getSourceMaps, setupAssets)=>{
|
|
@@ -185,6 +186,9 @@ const createPool = async ({ context, recommendWorkerCount = 1 / 0 })=>{
|
|
|
185
186
|
context.stateManager.onTestFileStart(test.testPath);
|
|
186
187
|
await Promise.all(reporters.map((reporter)=>reporter.onTestFileStart?.(test)));
|
|
187
188
|
},
|
|
189
|
+
onTestFileReady: async (test)=>{
|
|
190
|
+
await Promise.all(reporters.map((reporter)=>reporter.onTestFileReady?.(test)));
|
|
191
|
+
},
|
|
188
192
|
onTestSuiteStart: async (test)=>{
|
|
189
193
|
await Promise.all(reporters.map((reporter)=>reporter.onTestSuiteStart?.(test)));
|
|
190
194
|
},
|
|
@@ -413,7 +417,7 @@ const pluginBasic = (context)=>({
|
|
|
413
417
|
});
|
|
414
418
|
}
|
|
415
419
|
});
|
|
416
|
-
const external_node_path_ = __webpack_require__("
|
|
420
|
+
const external_node_path_ = __webpack_require__("path");
|
|
417
421
|
const PLUGIN_CSS_FILTER = 'rstest:css-filter';
|
|
418
422
|
const css_filter_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
|
|
419
423
|
const pluginCSSFilter = ()=>({
|
package/dist/0~151.js
CHANGED
|
@@ -4,8 +4,10 @@ import 'module';
|
|
|
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
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" (module,
|
|
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;
|
|
@@ -34,7 +36,7 @@ __webpack_require__.add({
|
|
|
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);
|
|
@@ -80,7 +82,7 @@ __webpack_require__.add({
|
|
|
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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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,19 +148,19 @@ __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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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" (module,
|
|
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
|
},
|
|
@@ -173,7 +175,7 @@ __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" (module,
|
|
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();
|
|
@@ -186,7 +188,7 @@ __webpack_require__.add({
|
|
|
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;
|
|
@@ -12055,12 +12115,17 @@ function makeError(message, stackTraceError) {
|
|
|
12055
12115
|
if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
|
|
12056
12116
|
return error;
|
|
12057
12117
|
}
|
|
12058
|
-
function wrapTimeout({ name, fn, timeout, stackTraceError }) {
|
|
12118
|
+
function wrapTimeout({ name, fn, timeout, getAssertionCalls, stackTraceError }) {
|
|
12059
12119
|
if (!timeout) return fn;
|
|
12060
12120
|
return async (...args)=>{
|
|
12061
12121
|
let timeoutId;
|
|
12062
12122
|
const timeoutPromise = new Promise((_, reject)=>{
|
|
12063
|
-
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);
|
|
12064
12129
|
});
|
|
12065
12130
|
try {
|
|
12066
12131
|
const result = await Promise.race([
|
|
@@ -12182,7 +12247,20 @@ class TestRunner {
|
|
|
12182
12247
|
else try {
|
|
12183
12248
|
const fixtureCleanups = await this.beforeRunTest(test, snapshotClient.getSnapshotState(testPath));
|
|
12184
12249
|
cleanups.push(...fixtureCleanups);
|
|
12185
|
-
|
|
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
|
+
}
|
|
12186
12264
|
this.afterRunTest(test);
|
|
12187
12265
|
result = {
|
|
12188
12266
|
testId: test.testId,
|
|
@@ -12279,7 +12357,9 @@ class TestRunner {
|
|
|
12279
12357
|
name: test.name,
|
|
12280
12358
|
testPath,
|
|
12281
12359
|
project: test.project,
|
|
12282
|
-
testId: test.testId
|
|
12360
|
+
testId: test.testId,
|
|
12361
|
+
type: 'suite',
|
|
12362
|
+
location: test.location
|
|
12283
12363
|
});
|
|
12284
12364
|
if (0 === test.tests.length) {
|
|
12285
12365
|
if ([
|
|
@@ -12349,7 +12429,9 @@ class TestRunner {
|
|
|
12349
12429
|
name: test.name,
|
|
12350
12430
|
timeout: test.timeout,
|
|
12351
12431
|
parentNames: test.parentNames,
|
|
12352
|
-
project: test.project
|
|
12432
|
+
project: test.project,
|
|
12433
|
+
type: 'case',
|
|
12434
|
+
location: test.location
|
|
12353
12435
|
});
|
|
12354
12436
|
do {
|
|
12355
12437
|
const currentResult = await runTestsCase(test, parentHooks);
|
|
@@ -12506,6 +12588,7 @@ class TestRunner {
|
|
|
12506
12588
|
if (true === isExpectingAssertions && 0 === assertionCalls) throw isExpectingAssertionsError;
|
|
12507
12589
|
}
|
|
12508
12590
|
}
|
|
12591
|
+
const external_node_path_ = __webpack_require__("path");
|
|
12509
12592
|
class RunnerRuntime {
|
|
12510
12593
|
tests = [];
|
|
12511
12594
|
_currentTest = [];
|
|
@@ -12576,7 +12659,7 @@ class RunnerRuntime {
|
|
|
12576
12659
|
type: 'suite'
|
|
12577
12660
|
};
|
|
12578
12661
|
}
|
|
12579
|
-
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential }) {
|
|
12662
|
+
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential, location }) {
|
|
12580
12663
|
this.checkStatus(name, 'suite');
|
|
12581
12664
|
const currentSuite = {
|
|
12582
12665
|
project: this.project,
|
|
@@ -12587,7 +12670,8 @@ class RunnerRuntime {
|
|
|
12587
12670
|
each,
|
|
12588
12671
|
testPath: this.testPath,
|
|
12589
12672
|
concurrent,
|
|
12590
|
-
sequential
|
|
12673
|
+
sequential,
|
|
12674
|
+
location
|
|
12591
12675
|
};
|
|
12592
12676
|
if (!fn) {
|
|
12593
12677
|
this.addTest(currentSuite);
|
|
@@ -12656,18 +12740,14 @@ class RunnerRuntime {
|
|
|
12656
12740
|
ensureRootSuite() {
|
|
12657
12741
|
if (0 === this._currentTest.length) this.addTest(this.getDefaultRootSuite());
|
|
12658
12742
|
}
|
|
12659
|
-
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 }) {
|
|
12660
12744
|
this.checkStatus(name, 'case');
|
|
12661
12745
|
this.addTestCase({
|
|
12662
12746
|
project: this.project,
|
|
12663
12747
|
name,
|
|
12664
12748
|
originalFn,
|
|
12665
|
-
fn
|
|
12666
|
-
|
|
12667
|
-
fn,
|
|
12668
|
-
timeout,
|
|
12669
|
-
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
12670
|
-
}) : fn,
|
|
12749
|
+
fn,
|
|
12750
|
+
stackTraceError: new Error('STACK_TRACE_ERROR'),
|
|
12671
12751
|
runMode,
|
|
12672
12752
|
type: 'case',
|
|
12673
12753
|
timeout,
|
|
@@ -12677,7 +12757,8 @@ class RunnerRuntime {
|
|
|
12677
12757
|
each,
|
|
12678
12758
|
fails,
|
|
12679
12759
|
onFinished: [],
|
|
12680
|
-
onFailed: []
|
|
12760
|
+
onFailed: [],
|
|
12761
|
+
location
|
|
12681
12762
|
});
|
|
12682
12763
|
}
|
|
12683
12764
|
describeEach({ cases, ...options }) {
|
|
@@ -12753,12 +12834,33 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12753
12834
|
testPath,
|
|
12754
12835
|
runtimeConfig
|
|
12755
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
|
+
};
|
|
12756
12857
|
const createTestAPI = (options = {})=>{
|
|
12757
12858
|
const testFn = (name, fn, timeout)=>runtimeInstance.it({
|
|
12758
12859
|
name,
|
|
12759
12860
|
fn,
|
|
12760
12861
|
timeout,
|
|
12761
|
-
...options
|
|
12862
|
+
...options,
|
|
12863
|
+
location: options.location ?? getLocation()
|
|
12762
12864
|
});
|
|
12763
12865
|
for (const { name, overrides } of [
|
|
12764
12866
|
{
|
|
@@ -12804,15 +12906,25 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12804
12906
|
}),
|
|
12805
12907
|
enumerable: true
|
|
12806
12908
|
});
|
|
12807
|
-
testFn.runIf = (condition)=>
|
|
12808
|
-
|
|
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
|
+
});
|
|
12809
12919
|
testFn.each = (cases)=>runtimeInstance.each({
|
|
12810
12920
|
cases,
|
|
12811
|
-
...options
|
|
12921
|
+
...options,
|
|
12922
|
+
location: getLocation()
|
|
12812
12923
|
});
|
|
12813
12924
|
testFn.for = (cases)=>runtimeInstance.for({
|
|
12814
12925
|
cases,
|
|
12815
|
-
...options
|
|
12926
|
+
...options,
|
|
12927
|
+
location: getLocation()
|
|
12816
12928
|
});
|
|
12817
12929
|
return testFn;
|
|
12818
12930
|
};
|
|
@@ -12832,7 +12944,8 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12832
12944
|
const describeFn = (name, fn)=>runtimeInstance.describe({
|
|
12833
12945
|
name,
|
|
12834
12946
|
fn,
|
|
12835
|
-
...options
|
|
12947
|
+
...options,
|
|
12948
|
+
location: options.location ?? getLocation()
|
|
12836
12949
|
});
|
|
12837
12950
|
for (const { name, overrides } of [
|
|
12838
12951
|
{
|
|
@@ -12872,15 +12985,25 @@ const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
|
12872
12985
|
}),
|
|
12873
12986
|
enumerable: true
|
|
12874
12987
|
});
|
|
12875
|
-
describeFn.skipIf = (condition)=>
|
|
12876
|
-
|
|
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
|
+
});
|
|
12877
12998
|
describeFn.each = (cases)=>runtimeInstance.describeEach({
|
|
12878
12999
|
cases,
|
|
12879
|
-
...options
|
|
13000
|
+
...options,
|
|
13001
|
+
location: getLocation()
|
|
12880
13002
|
});
|
|
12881
13003
|
describeFn.for = (cases)=>runtimeInstance.describeFor({
|
|
12882
13004
|
cases,
|
|
12883
|
-
...options
|
|
13005
|
+
...options,
|
|
13006
|
+
location: getLocation()
|
|
12884
13007
|
});
|
|
12885
13008
|
return describeFn;
|
|
12886
13009
|
};
|
|
@@ -12922,6 +13045,21 @@ function createRunner({ workerState }) {
|
|
|
12922
13045
|
await snapshotClient.setup(testPath, workerState.snapshotOptions);
|
|
12923
13046
|
const tests = await runtime.instance.getTests();
|
|
12924
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
|
+
});
|
|
12925
13063
|
runtime.instance.updateStatus('running');
|
|
12926
13064
|
const results = await testRunner.runTests({
|
|
12927
13065
|
tests,
|
|
@@ -12942,7 +13080,7 @@ function createRunner({ workerState }) {
|
|
|
12942
13080
|
}
|
|
12943
13081
|
};
|
|
12944
13082
|
}
|
|
12945
|
-
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");
|
|
12946
13084
|
const fakeTimers_RealDate = Date;
|
|
12947
13085
|
class FakeTimers {
|
|
12948
13086
|
_clock;
|
|
@@ -13224,7 +13362,8 @@ const createRstestUtilities = (workerState)=>{
|
|
|
13224
13362
|
requireMock: ()=>({}),
|
|
13225
13363
|
importActual: async ()=>({}),
|
|
13226
13364
|
requireActual: ()=>({}),
|
|
13227
|
-
resetModules: ()=>
|
|
13365
|
+
resetModules: ()=>({}),
|
|
13366
|
+
hoisted: ()=>({}),
|
|
13228
13367
|
setConfig: (config)=>{
|
|
13229
13368
|
if (!originalConfig) originalConfig = {
|
|
13230
13369
|
...workerState.runtimeConfig
|