@rstest/core 0.7.4 → 0.7.6
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~130.js +2 -2
- package/dist/{0~173.js → 0~2173.js} +15 -8
- package/dist/{0~255.js → 0~2255.js} +1 -1
- package/dist/{0~346.js → 0~3346.js} +2 -2
- package/dist/{0~919.js → 0~3919.js} +1 -1
- package/dist/{0~403.js → 0~4403.js} +3 -3
- package/dist/{0~809.js → 0~4809.js} +2 -2
- package/dist/{0~835.js → 0~5835.js} +12 -7
- package/dist/{0~151.js → 0~6151.js} +163 -292
- package/dist/0~62.js +2 -2
- package/dist/{0~588.js → 0~6588.js} +6 -6
- package/dist/{0~907.js → 0~6907.js} +2 -2
- package/dist/{0~923.js → 0~6923.js} +11 -7
- package/dist/0~6973.js +50 -0
- package/dist/{0~583.js → 0~7583.js} +4 -4
- package/dist/{0~426.js → 0~8426.js} +3 -3
- package/dist/0~89.js +81 -40
- package/dist/0~8957.js +149 -0
- package/dist/{0~634.js → 0~9634.js} +9 -5
- package/dist/{157.js → 1157.js} +5 -42
- package/dist/{216.js → 3216.js} +2 -2
- package/dist/{278.js → 3278.js} +2 -2
- package/dist/{397.js → 4397.js} +1 -1
- package/dist/4881.js +3 -0
- package/dist/554.js +26 -21
- package/dist/{664.js → 5693.js} +0 -2
- package/dist/{734.js → 5734.js} +4 -3
- package/dist/6198.js +3 -0
- package/dist/{913.js → 7913.js} +7 -6
- package/dist/{131.js → 9131.js} +31 -20
- package/dist/globalSetupWorker.js +8 -6
- package/dist/index.d.ts +21 -1
- package/dist/index.js +1 -1
- package/dist/rslib-runtime.js +1 -1
- package/dist/worker.d.ts +21 -1
- package/package.json +5 -5
- package/dist/198.js +0 -4
- /package/dist/{0~681.js → 0~3062.js} +0 -0
- /package/dist/{0~151.js.LICENSE.txt → 0~6151.js.LICENSE.txt} +0 -0
- /package/dist/{0~583.js.LICENSE.txt → 0~7583.js.LICENSE.txt} +0 -0
- /package/dist/{672.js → 1672.js} +0 -0
- /package/dist/{913.js.LICENSE.txt → 7913.js.LICENSE.txt} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! For license information please see 0~
|
|
1
|
+
/*! For license information please see 0~6151.js.LICENSE.txt */
|
|
2
2
|
import 'module';
|
|
3
3
|
/*#__PURE__*/ import.meta.url;
|
|
4
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { fileURLToPath } from "./
|
|
10
|
-
import { parse } from "./
|
|
5
|
+
import "./5693.js";
|
|
6
|
+
import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./7913.js";
|
|
7
|
+
import { resolve as pathe_M_eThtNZ_resolve } from "./3278.js";
|
|
8
|
+
import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, ROOT_SUITE_NAME } from "./1157.js";
|
|
9
|
+
import { fileURLToPath } from "./6198.js";
|
|
10
|
+
import { parse } from "./1672.js";
|
|
11
11
|
import "./554.js";
|
|
12
12
|
__webpack_require__.add({
|
|
13
13
|
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
@@ -82,7 +82,7 @@ __webpack_require__.add({
|
|
|
82
82
|
},
|
|
83
83
|
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js" (module) {
|
|
84
84
|
var globalObject;
|
|
85
|
-
globalObject = "
|
|
85
|
+
globalObject = "u" > typeof global ? global : "u" > typeof window ? window : self;
|
|
86
86
|
module.exports = globalObject;
|
|
87
87
|
},
|
|
88
88
|
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
@@ -191,7 +191,7 @@ __webpack_require__.add({
|
|
|
191
191
|
}
|
|
192
192
|
module.exports = valueToString;
|
|
193
193
|
},
|
|
194
|
-
"../../node_modules/.pnpm/@sinonjs+fake-timers@15.
|
|
194
|
+
"../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
195
195
|
const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
|
|
196
196
|
let timersModule, timersPromisesModule;
|
|
197
197
|
try {
|
|
@@ -525,7 +525,8 @@ __webpack_require__.add({
|
|
|
525
525
|
const nativeHandler = clock[`_${handlerName}`];
|
|
526
526
|
return "function" == typeof nativeHandler ? nativeHandler(timerId) : void 0;
|
|
527
527
|
}
|
|
528
|
-
|
|
528
|
+
const stackTrace = new Error().stack.split("\n").slice(1).join("\n");
|
|
529
|
+
warnOnce(`FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.\nTo automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${stackTrace}`);
|
|
529
530
|
}
|
|
530
531
|
if (clock.timers.hasOwnProperty(id)) {
|
|
531
532
|
const timer = clock.timers[id];
|
|
@@ -1311,12 +1312,12 @@ __webpack_require__.add({
|
|
|
1311
1312
|
'use strict';
|
|
1312
1313
|
var promiseExists = 'function' == typeof Promise;
|
|
1313
1314
|
var globalObject = 'object' == typeof self ? self : global;
|
|
1314
|
-
var symbolExists =
|
|
1315
|
-
var mapExists =
|
|
1316
|
-
var setExists =
|
|
1317
|
-
var weakMapExists =
|
|
1318
|
-
var weakSetExists =
|
|
1319
|
-
var dataViewExists =
|
|
1315
|
+
var symbolExists = "u" > typeof Symbol;
|
|
1316
|
+
var mapExists = "u" > typeof Map;
|
|
1317
|
+
var setExists = "u" > typeof Set;
|
|
1318
|
+
var weakMapExists = "u" > typeof WeakMap;
|
|
1319
|
+
var weakSetExists = "u" > typeof WeakSet;
|
|
1320
|
+
var dataViewExists = "u" > typeof DataView;
|
|
1320
1321
|
var symbolIteratorExists = symbolExists && void 0 !== Symbol.iterator;
|
|
1321
1322
|
var symbolToStringTagExists = symbolExists && void 0 !== Symbol.toStringTag;
|
|
1322
1323
|
var setEntriesExists = setExists && 'function' == typeof Set.prototype.entries;
|
|
@@ -1544,8 +1545,8 @@ function chunk_BVHSVHOK_a(n) {
|
|
|
1544
1545
|
chunk_BVHSVHOK_a.open = "";
|
|
1545
1546
|
chunk_BVHSVHOK_a.close = "";
|
|
1546
1547
|
function C(n = !1) {
|
|
1547
|
-
let e = "
|
|
1548
|
-
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (null == e ? void 0 : e.platform) === "win32" || n && "dumb" !== i.TERM || "CI" in i) || "
|
|
1548
|
+
let e = "u" > typeof process ? process : void 0, i = (null == e ? void 0 : e.env) || {}, g = (null == e ? void 0 : e.argv) || [];
|
|
1549
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (null == e ? void 0 : e.platform) === "win32" || n && "dumb" !== i.TERM || "CI" in i) || "u" > typeof window && !!window.chrome;
|
|
1549
1550
|
}
|
|
1550
1551
|
function chunk_BVHSVHOK_p(n = !1) {
|
|
1551
1552
|
let e = C(n), i = (r, t, c, o)=>{
|
|
@@ -2472,7 +2473,7 @@ function getConstructorName(val) {
|
|
|
2472
2473
|
return "function" == typeof val.constructor && val.constructor.name || "Object";
|
|
2473
2474
|
}
|
|
2474
2475
|
function isWindow(val) {
|
|
2475
|
-
return "
|
|
2476
|
+
return "u" > typeof window && val === window;
|
|
2476
2477
|
}
|
|
2477
2478
|
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
2478
2479
|
const NEWLINE_REGEXP = /\n/g;
|
|
@@ -3052,7 +3053,7 @@ function inspectObject(object, options) {
|
|
|
3052
3053
|
if (propertyContents && symbolContents) sep = ', ';
|
|
3053
3054
|
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
3054
3055
|
}
|
|
3055
|
-
const toStringTag =
|
|
3056
|
+
const toStringTag = "u" > typeof Symbol && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
3056
3057
|
function inspectClass(value, options) {
|
|
3057
3058
|
let name = '';
|
|
3058
3059
|
if (toStringTag && toStringTag in value) name = value[toStringTag];
|
|
@@ -4819,7 +4820,7 @@ function dist_j(e) {
|
|
|
4819
4820
|
return dist_v(e) && "getOriginal" in e[dist_y];
|
|
4820
4821
|
}
|
|
4821
4822
|
new Set();
|
|
4822
|
-
function
|
|
4823
|
+
function dist_isMockFunction(fn) {
|
|
4823
4824
|
return "function" == typeof fn && "_isMockFunction" in fn && fn._isMockFunction;
|
|
4824
4825
|
}
|
|
4825
4826
|
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
@@ -4848,11 +4849,11 @@ function serializeValue(val, seen = new WeakMap()) {
|
|
|
4848
4849
|
if ("function" == typeof val) return `Function<${val.name || "anonymous"}>`;
|
|
4849
4850
|
if ("symbol" == typeof val) return val.toString();
|
|
4850
4851
|
if ("object" != typeof val) return val;
|
|
4851
|
-
if ("
|
|
4852
|
-
if ("
|
|
4852
|
+
if ("u" > typeof Buffer && val instanceof Buffer) return `<Buffer(${val.length}) ...>`;
|
|
4853
|
+
if ("u" > typeof Uint8Array && val instanceof Uint8Array) return `<Uint8Array(${val.length}) ...>`;
|
|
4853
4854
|
if (isImmutable(val)) return serializeValue(val.toJSON(), seen);
|
|
4854
4855
|
if (val instanceof Promise || val.constructor && "AsyncFunction" === val.constructor.prototype) return "Promise";
|
|
4855
|
-
if ("
|
|
4856
|
+
if ("u" > typeof Element && val instanceof Element) return val.tagName;
|
|
4856
4857
|
if ("function" == typeof val.asymmetricMatch) return `${val.toString()} ${chunk_commonjsHelpers_format(val.sample)}`;
|
|
4857
4858
|
if ("function" == typeof val.toJSON) return serializeValue(val.toJSON(), seen);
|
|
4858
4859
|
if (seen.has(val)) return seen.get(val);
|
|
@@ -5461,7 +5462,7 @@ function chai_inspectObject(object, options) {
|
|
|
5461
5462
|
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
5462
5463
|
}
|
|
5463
5464
|
__name(chai_inspectObject, "inspectObject");
|
|
5464
|
-
var chai_toStringTag = "
|
|
5465
|
+
var chai_toStringTag = "u" > typeof Symbol && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
5465
5466
|
function chai_inspectClass(value, options) {
|
|
5466
5467
|
let name = "";
|
|
5467
5468
|
if (chai_toStringTag && chai_toStringTag in value) name = value[chai_toStringTag];
|
|
@@ -5884,7 +5885,7 @@ function generatorEqual(leftHandOperand, rightHandOperand, options) {
|
|
|
5884
5885
|
}
|
|
5885
5886
|
__name(generatorEqual, "generatorEqual");
|
|
5886
5887
|
function hasIteratorFunction(target) {
|
|
5887
|
-
return "
|
|
5888
|
+
return "u" > typeof Symbol && "object" == typeof target && void 0 !== Symbol.iterator && "function" == typeof target[Symbol.iterator];
|
|
5888
5889
|
}
|
|
5889
5890
|
__name(hasIteratorFunction, "hasIteratorFunction");
|
|
5890
5891
|
function getIteratorEntries(target) {
|
|
@@ -6083,7 +6084,7 @@ var Assertion = class _Assertion {
|
|
|
6083
6084
|
}
|
|
6084
6085
|
};
|
|
6085
6086
|
function isProxyEnabled() {
|
|
6086
|
-
return chai_config.useProxy && "
|
|
6087
|
+
return chai_config.useProxy && "u" > typeof Proxy && "u" > typeof Reflect;
|
|
6087
6088
|
}
|
|
6088
6089
|
__name(isProxyEnabled, "isProxyEnabled");
|
|
6089
6090
|
function addProperty(ctx, name, getter) {
|
|
@@ -8969,11 +8970,11 @@ const JestChaiExpect = (chai, utils)=>{
|
|
|
8969
8970
|
});
|
|
8970
8971
|
def("toContain", function(item) {
|
|
8971
8972
|
const actual = this._obj;
|
|
8972
|
-
if ("
|
|
8973
|
+
if ("u" > typeof Node && actual instanceof Node) {
|
|
8973
8974
|
if (!(item instanceof Node)) throw new TypeError(`toContain() expected a DOM node as the argument, but got ${typeof item}`);
|
|
8974
8975
|
return this.assert(actual.contains(item), "expected #{this} to contain element #{exp}", "expected #{this} not to contain element #{exp}", item, actual);
|
|
8975
8976
|
}
|
|
8976
|
-
if ("
|
|
8977
|
+
if ("u" > typeof DOMTokenList && actual instanceof DOMTokenList) {
|
|
8977
8978
|
assertTypes(item, "class name", [
|
|
8978
8979
|
"string"
|
|
8979
8980
|
]);
|
|
@@ -9105,7 +9106,7 @@ const JestChaiExpect = (chai, utils)=>{
|
|
|
9105
9106
|
return this.assert(pass, `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, received, expected, false);
|
|
9106
9107
|
});
|
|
9107
9108
|
function assertIsMock(assertion) {
|
|
9108
|
-
if (!
|
|
9109
|
+
if (!dist_isMockFunction(assertion._obj)) throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
|
|
9109
9110
|
}
|
|
9110
9111
|
function getSpy(assertion) {
|
|
9111
9112
|
assertIsMock(assertion);
|
|
@@ -9213,14 +9214,14 @@ const JestChaiExpect = (chai, utils)=>{
|
|
|
9213
9214
|
"toHaveBeenCalledBefore"
|
|
9214
9215
|
], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
9215
9216
|
const expectSpy = getSpy(this);
|
|
9216
|
-
if (!
|
|
9217
|
+
if (!dist_isMockFunction(resultSpy)) throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
9217
9218
|
this.assert(isSpyCalledBeforeAnotherSpy(expectSpy, resultSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called before "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called before "${resultSpy.getMockName()}"`, resultSpy, expectSpy);
|
|
9218
9219
|
});
|
|
9219
9220
|
def([
|
|
9220
9221
|
"toHaveBeenCalledAfter"
|
|
9221
9222
|
], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
9222
9223
|
const expectSpy = getSpy(this);
|
|
9223
|
-
if (!
|
|
9224
|
+
if (!dist_isMockFunction(resultSpy)) throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
9224
9225
|
this.assert(isSpyCalledBeforeAnotherSpy(resultSpy, expectSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called after "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called after "${resultSpy.getMockName()}"`, resultSpy, expectSpy);
|
|
9225
9226
|
});
|
|
9226
9227
|
def([
|
|
@@ -9610,6 +9611,102 @@ const JestExtend = (chai, utils)=>{
|
|
|
9610
9611
|
use(JestExtendPlugin(chai, expect, expects));
|
|
9611
9612
|
});
|
|
9612
9613
|
};
|
|
9614
|
+
const unsupported = [
|
|
9615
|
+
'matchSnapshot',
|
|
9616
|
+
'toMatchSnapshot',
|
|
9617
|
+
'toMatchInlineSnapshot',
|
|
9618
|
+
'toThrowErrorMatchingSnapshot',
|
|
9619
|
+
'toThrowErrorMatchingInlineSnapshot',
|
|
9620
|
+
'throws',
|
|
9621
|
+
'Throw',
|
|
9622
|
+
'throw',
|
|
9623
|
+
'toThrow',
|
|
9624
|
+
'toThrowError'
|
|
9625
|
+
];
|
|
9626
|
+
function createExpectPoll(expect) {
|
|
9627
|
+
return function poll(fn, options = {}) {
|
|
9628
|
+
const { interval = 50, timeout = 1000, message } = options;
|
|
9629
|
+
const assertion = expect(null, message).withContext({
|
|
9630
|
+
poll: true
|
|
9631
|
+
});
|
|
9632
|
+
fn = fn.bind(assertion);
|
|
9633
|
+
const test = utils_exports.flag(assertion, 'vitest-test');
|
|
9634
|
+
if (!test) throw new Error('expect.poll() must be called inside a test');
|
|
9635
|
+
const proxy = new Proxy(assertion, {
|
|
9636
|
+
get (target, key, receiver) {
|
|
9637
|
+
const assertionFunction = Reflect.get(target, key, receiver);
|
|
9638
|
+
if ('function' != typeof assertionFunction) return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
9639
|
+
if ('assert' === key) return assertionFunction;
|
|
9640
|
+
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.`);
|
|
9641
|
+
return function(...args) {
|
|
9642
|
+
const STACK_TRACE_ERROR = new Error('STACK_TRACE_ERROR');
|
|
9643
|
+
const promise = ()=>new Promise((resolve, reject)=>{
|
|
9644
|
+
let intervalId;
|
|
9645
|
+
let timeoutId;
|
|
9646
|
+
let lastError;
|
|
9647
|
+
const check = async ()=>{
|
|
9648
|
+
try {
|
|
9649
|
+
utils_exports.flag(assertion, '_name', key);
|
|
9650
|
+
const obj = await fn();
|
|
9651
|
+
utils_exports.flag(assertion, 'object', obj);
|
|
9652
|
+
resolve(await assertionFunction.call(assertion, ...args));
|
|
9653
|
+
clearTimeout(intervalId);
|
|
9654
|
+
clearTimeout(timeoutId);
|
|
9655
|
+
} catch (err) {
|
|
9656
|
+
lastError = err;
|
|
9657
|
+
if (!utils_exports.flag(assertion, '_isLastPollAttempt')) intervalId = getRealTimers().setTimeout(check, interval);
|
|
9658
|
+
}
|
|
9659
|
+
};
|
|
9660
|
+
timeoutId = getRealTimers().setTimeout(()=>{
|
|
9661
|
+
clearTimeout(intervalId);
|
|
9662
|
+
utils_exports.flag(assertion, '_isLastPollAttempt', true);
|
|
9663
|
+
const rejectWithCause = (cause)=>{
|
|
9664
|
+
reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
9665
|
+
cause
|
|
9666
|
+
}), STACK_TRACE_ERROR));
|
|
9667
|
+
};
|
|
9668
|
+
check().then(()=>rejectWithCause(lastError)).catch((e)=>rejectWithCause(e));
|
|
9669
|
+
}, timeout);
|
|
9670
|
+
check();
|
|
9671
|
+
});
|
|
9672
|
+
let awaited = false;
|
|
9673
|
+
test.onFinished ??= [];
|
|
9674
|
+
test.onFinished.push(()=>{
|
|
9675
|
+
if (!awaited) {
|
|
9676
|
+
const negated = utils_exports.flag(assertion, 'negate') ? 'not.' : '';
|
|
9677
|
+
const name = utils_exports.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
|
|
9678
|
+
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
9679
|
+
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`);
|
|
9680
|
+
throw copyStackTrace(error, STACK_TRACE_ERROR);
|
|
9681
|
+
}
|
|
9682
|
+
});
|
|
9683
|
+
let resultPromise;
|
|
9684
|
+
return {
|
|
9685
|
+
then (onFulfilled, onRejected) {
|
|
9686
|
+
awaited = true;
|
|
9687
|
+
resultPromise ||= promise();
|
|
9688
|
+
return resultPromise.then(onFulfilled, onRejected);
|
|
9689
|
+
},
|
|
9690
|
+
catch (onRejected) {
|
|
9691
|
+
resultPromise ||= promise();
|
|
9692
|
+
return resultPromise.catch(onRejected);
|
|
9693
|
+
},
|
|
9694
|
+
finally (onFinally) {
|
|
9695
|
+
resultPromise ||= promise();
|
|
9696
|
+
return resultPromise.finally(onFinally);
|
|
9697
|
+
},
|
|
9698
|
+
[Symbol.toStringTag]: 'Promise'
|
|
9699
|
+
};
|
|
9700
|
+
};
|
|
9701
|
+
}
|
|
9702
|
+
});
|
|
9703
|
+
return proxy;
|
|
9704
|
+
};
|
|
9705
|
+
}
|
|
9706
|
+
function copyStackTrace(target, source) {
|
|
9707
|
+
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
9708
|
+
return target;
|
|
9709
|
+
}
|
|
9613
9710
|
const comma = ','.charCodeAt(0);
|
|
9614
9711
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9615
9712
|
const intToChar = new Uint8Array(64);
|
|
@@ -10818,8 +10915,8 @@ function dist_a(n) {
|
|
|
10818
10915
|
dist_a.open = "";
|
|
10819
10916
|
dist_a.close = "";
|
|
10820
10917
|
function dist_C(n = false) {
|
|
10821
|
-
let e = "
|
|
10822
|
-
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (null == e ? void 0 : e.platform) === "win32" || n && "dumb" !== i.TERM || "CI" in i) || "
|
|
10918
|
+
let e = "u" > typeof process ? process : void 0, i = (null == e ? void 0 : e.env) || {}, g = (null == e ? void 0 : e.argv) || [];
|
|
10919
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (null == e ? void 0 : e.platform) === "win32" || n && "dumb" !== i.TERM || "CI" in i) || "u" > typeof window && !!window.chrome;
|
|
10823
10920
|
}
|
|
10824
10921
|
function dist_p(n = false) {
|
|
10825
10922
|
let e = dist_C(n), i = (r, t, c, o)=>{
|
|
@@ -10863,7 +10960,7 @@ function offsetToLineNumber(source, offset) {
|
|
|
10863
10960
|
return line + 1;
|
|
10864
10961
|
}
|
|
10865
10962
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
10866
|
-
const MagicString = (await import("./0~
|
|
10963
|
+
const MagicString = (await import("./0~6907.js").then((mod)=>({
|
|
10867
10964
|
Bundle: mod.Bundle,
|
|
10868
10965
|
SourceMap: mod.SourceMap,
|
|
10869
10966
|
default: mod.MagicString
|
|
@@ -11541,16 +11638,6 @@ class SnapshotClient {
|
|
|
11541
11638
|
this.snapshotStateMap.clear();
|
|
11542
11639
|
}
|
|
11543
11640
|
}
|
|
11544
|
-
let _client;
|
|
11545
|
-
function getSnapshotClient() {
|
|
11546
|
-
if (!_client) _client = new SnapshotClient({
|
|
11547
|
-
isEqual: (received, expected)=>dist_equals(received, expected, [
|
|
11548
|
-
iterableEquality,
|
|
11549
|
-
subsetEquality
|
|
11550
|
-
])
|
|
11551
|
-
});
|
|
11552
|
-
return _client;
|
|
11553
|
-
}
|
|
11554
11641
|
function snapshot_recordAsyncExpect(_test, promise, assertion, error) {
|
|
11555
11642
|
const test = _test;
|
|
11556
11643
|
if (test && promise instanceof Promise) {
|
|
@@ -11617,7 +11704,19 @@ function getTestMeta(test) {
|
|
|
11617
11704
|
testId: test.testId
|
|
11618
11705
|
};
|
|
11619
11706
|
}
|
|
11620
|
-
const SnapshotPlugin = (workerState)=>
|
|
11707
|
+
const SnapshotPlugin = (workerState)=>{
|
|
11708
|
+
let _client;
|
|
11709
|
+
if (!workerState.snapshotClient) workerState.snapshotClient = new SnapshotClient({
|
|
11710
|
+
isEqual: (received, expected)=>dist_equals(received, expected, [
|
|
11711
|
+
iterableEquality,
|
|
11712
|
+
subsetEquality
|
|
11713
|
+
])
|
|
11714
|
+
});
|
|
11715
|
+
_client = workerState.snapshotClient;
|
|
11716
|
+
function getSnapshotClient() {
|
|
11717
|
+
return _client;
|
|
11718
|
+
}
|
|
11719
|
+
return (chai, utils)=>{
|
|
11621
11720
|
function getTest(obj) {
|
|
11622
11721
|
const test = utils.flag(obj, 'vitest-test');
|
|
11623
11722
|
return test;
|
|
@@ -11747,102 +11846,7 @@ const SnapshotPlugin = (workerState)=>(chai, utils)=>{
|
|
|
11747
11846
|
});
|
|
11748
11847
|
utils.addMethod(chai.expect, 'addSnapshotSerializer', addSerializer);
|
|
11749
11848
|
};
|
|
11750
|
-
|
|
11751
|
-
'matchSnapshot',
|
|
11752
|
-
'toMatchSnapshot',
|
|
11753
|
-
'toMatchInlineSnapshot',
|
|
11754
|
-
'toThrowErrorMatchingSnapshot',
|
|
11755
|
-
'toThrowErrorMatchingInlineSnapshot',
|
|
11756
|
-
'throws',
|
|
11757
|
-
'Throw',
|
|
11758
|
-
'throw',
|
|
11759
|
-
'toThrow',
|
|
11760
|
-
'toThrowError'
|
|
11761
|
-
];
|
|
11762
|
-
function createExpectPoll(expect) {
|
|
11763
|
-
return function poll(fn, options = {}) {
|
|
11764
|
-
const { interval = 50, timeout = 1000, message } = options;
|
|
11765
|
-
const assertion = expect(null, message).withContext({
|
|
11766
|
-
poll: true
|
|
11767
|
-
});
|
|
11768
|
-
fn = fn.bind(assertion);
|
|
11769
|
-
const test = utils_exports.flag(assertion, 'vitest-test');
|
|
11770
|
-
if (!test) throw new Error('expect.poll() must be called inside a test');
|
|
11771
|
-
const proxy = new Proxy(assertion, {
|
|
11772
|
-
get (target, key, receiver) {
|
|
11773
|
-
const assertionFunction = Reflect.get(target, key, receiver);
|
|
11774
|
-
if ('function' != typeof assertionFunction) return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
11775
|
-
if ('assert' === key) return assertionFunction;
|
|
11776
|
-
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.`);
|
|
11777
|
-
return function(...args) {
|
|
11778
|
-
const STACK_TRACE_ERROR = new Error('STACK_TRACE_ERROR');
|
|
11779
|
-
const promise = ()=>new Promise((resolve, reject)=>{
|
|
11780
|
-
let intervalId;
|
|
11781
|
-
let timeoutId;
|
|
11782
|
-
let lastError;
|
|
11783
|
-
const check = async ()=>{
|
|
11784
|
-
try {
|
|
11785
|
-
utils_exports.flag(assertion, '_name', key);
|
|
11786
|
-
const obj = await fn();
|
|
11787
|
-
utils_exports.flag(assertion, 'object', obj);
|
|
11788
|
-
resolve(await assertionFunction.call(assertion, ...args));
|
|
11789
|
-
clearTimeout(intervalId);
|
|
11790
|
-
clearTimeout(timeoutId);
|
|
11791
|
-
} catch (err) {
|
|
11792
|
-
lastError = err;
|
|
11793
|
-
if (!utils_exports.flag(assertion, '_isLastPollAttempt')) intervalId = getRealTimers().setTimeout(check, interval);
|
|
11794
|
-
}
|
|
11795
|
-
};
|
|
11796
|
-
timeoutId = getRealTimers().setTimeout(()=>{
|
|
11797
|
-
clearTimeout(intervalId);
|
|
11798
|
-
utils_exports.flag(assertion, '_isLastPollAttempt', true);
|
|
11799
|
-
const rejectWithCause = (cause)=>{
|
|
11800
|
-
reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
11801
|
-
cause
|
|
11802
|
-
}), STACK_TRACE_ERROR));
|
|
11803
|
-
};
|
|
11804
|
-
check().then(()=>rejectWithCause(lastError)).catch((e)=>rejectWithCause(e));
|
|
11805
|
-
}, timeout);
|
|
11806
|
-
check();
|
|
11807
|
-
});
|
|
11808
|
-
let awaited = false;
|
|
11809
|
-
test.onFinished ??= [];
|
|
11810
|
-
test.onFinished.push(()=>{
|
|
11811
|
-
if (!awaited) {
|
|
11812
|
-
const negated = utils_exports.flag(assertion, 'negate') ? 'not.' : '';
|
|
11813
|
-
const name = utils_exports.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
|
|
11814
|
-
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
11815
|
-
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`);
|
|
11816
|
-
throw copyStackTrace(error, STACK_TRACE_ERROR);
|
|
11817
|
-
}
|
|
11818
|
-
});
|
|
11819
|
-
let resultPromise;
|
|
11820
|
-
return {
|
|
11821
|
-
then (onFulfilled, onRejected) {
|
|
11822
|
-
awaited = true;
|
|
11823
|
-
resultPromise ||= promise();
|
|
11824
|
-
return resultPromise.then(onFulfilled, onRejected);
|
|
11825
|
-
},
|
|
11826
|
-
catch (onRejected) {
|
|
11827
|
-
resultPromise ||= promise();
|
|
11828
|
-
return resultPromise.catch(onRejected);
|
|
11829
|
-
},
|
|
11830
|
-
finally (onFinally) {
|
|
11831
|
-
resultPromise ||= promise();
|
|
11832
|
-
return resultPromise.finally(onFinally);
|
|
11833
|
-
},
|
|
11834
|
-
[Symbol.toStringTag]: 'Promise'
|
|
11835
|
-
};
|
|
11836
|
-
};
|
|
11837
|
-
}
|
|
11838
|
-
});
|
|
11839
|
-
return proxy;
|
|
11840
|
-
};
|
|
11841
|
-
}
|
|
11842
|
-
function copyStackTrace(target, source) {
|
|
11843
|
-
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
11844
|
-
return target;
|
|
11845
|
-
}
|
|
11849
|
+
};
|
|
11846
11850
|
function setupChaiConfig(config) {
|
|
11847
11851
|
Object.assign(chai_config, config);
|
|
11848
11852
|
}
|
|
@@ -13038,7 +13042,7 @@ function createRunner({ workerState }) {
|
|
|
13038
13042
|
},
|
|
13039
13043
|
runner: {
|
|
13040
13044
|
runTests: async (testPath, hooks, api)=>{
|
|
13041
|
-
const snapshotClient =
|
|
13045
|
+
const snapshotClient = workerState.snapshotClient;
|
|
13042
13046
|
await snapshotClient.setup(testPath, workerState.snapshotOptions);
|
|
13043
13047
|
const tests = await runtime.instance.getTests();
|
|
13044
13048
|
traverseUpdateTest(tests, testNamePattern);
|
|
@@ -13077,7 +13081,7 @@ function createRunner({ workerState }) {
|
|
|
13077
13081
|
}
|
|
13078
13082
|
};
|
|
13079
13083
|
}
|
|
13080
|
-
const fake_timers_src = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.
|
|
13084
|
+
const fake_timers_src = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
|
|
13081
13085
|
const fakeTimers_RealDate = Date;
|
|
13082
13086
|
class FakeTimers {
|
|
13083
13087
|
_clock;
|
|
@@ -13142,7 +13146,7 @@ class FakeTimers {
|
|
|
13142
13146
|
useFakeTimers(fakeTimersConfig = {}) {
|
|
13143
13147
|
if (this._fakingTime) this._clock.uninstall();
|
|
13144
13148
|
const toFake = Object.keys(this._fakeTimers.timers).filter((timer)=>'nextTick' !== timer && 'queueMicrotask' !== timer);
|
|
13145
|
-
const isChildProcess =
|
|
13149
|
+
const isChildProcess = "u" > typeof process && !!process.send;
|
|
13146
13150
|
if (this._config?.toFake?.includes('nextTick') && isChildProcess) throw new Error('process.nextTick cannot be mocked inside child_process');
|
|
13147
13151
|
this._clock = this._fakeTimers.install({
|
|
13148
13152
|
loopLimit: 10000,
|
|
@@ -13185,144 +13189,7 @@ class FakeTimers {
|
|
|
13185
13189
|
return this._fakingTime;
|
|
13186
13190
|
}
|
|
13187
13191
|
}
|
|
13188
|
-
|
|
13189
|
-
const spy_mocks = new Set();
|
|
13190
|
-
const wrapSpy = (obj, methodName, mockFn)=>{
|
|
13191
|
-
const spyImpl = M(obj, methodName, mockFn);
|
|
13192
|
-
const spyFn = spyImpl;
|
|
13193
|
-
let mockImplementationOnce = [];
|
|
13194
|
-
let implementation = mockFn;
|
|
13195
|
-
let mockName = mockFn?.name;
|
|
13196
|
-
const initMockState = ()=>({
|
|
13197
|
-
instances: [],
|
|
13198
|
-
contexts: [],
|
|
13199
|
-
invocationCallOrder: []
|
|
13200
|
-
});
|
|
13201
|
-
let mockState = initMockState();
|
|
13202
|
-
const spyState = T(spyImpl);
|
|
13203
|
-
spyFn.getMockName = ()=>mockName || methodName;
|
|
13204
|
-
spyFn.mockName = (name)=>{
|
|
13205
|
-
mockName = name;
|
|
13206
|
-
return spyFn;
|
|
13207
|
-
};
|
|
13208
|
-
spyFn.getMockImplementation = ()=>mockImplementationOnce.length ? mockImplementationOnce[mockImplementationOnce.length - 1] : implementation;
|
|
13209
|
-
function withImplementation(fn, cb) {
|
|
13210
|
-
const originalImplementation = implementation;
|
|
13211
|
-
const originalMockImplementationOnce = mockImplementationOnce;
|
|
13212
|
-
implementation = fn;
|
|
13213
|
-
mockImplementationOnce = [];
|
|
13214
|
-
spyState.willCall(willCall);
|
|
13215
|
-
const reset = ()=>{
|
|
13216
|
-
implementation = originalImplementation;
|
|
13217
|
-
mockImplementationOnce = originalMockImplementationOnce;
|
|
13218
|
-
};
|
|
13219
|
-
const result = cb();
|
|
13220
|
-
if (result instanceof Promise) return result.then(()=>{
|
|
13221
|
-
reset();
|
|
13222
|
-
});
|
|
13223
|
-
reset();
|
|
13224
|
-
}
|
|
13225
|
-
spyFn.withImplementation = withImplementation;
|
|
13226
|
-
spyFn.mockImplementation = (fn)=>{
|
|
13227
|
-
implementation = fn;
|
|
13228
|
-
return spyFn;
|
|
13229
|
-
};
|
|
13230
|
-
spyFn.mockImplementationOnce = (fn)=>{
|
|
13231
|
-
mockImplementationOnce.push(fn);
|
|
13232
|
-
return spyFn;
|
|
13233
|
-
};
|
|
13234
|
-
spyFn.mockReturnValue = (value)=>spyFn.mockImplementation(()=>value);
|
|
13235
|
-
spyFn.mockReturnValueOnce = (value)=>spyFn.mockImplementationOnce(()=>value);
|
|
13236
|
-
spyFn.mockResolvedValue = (value)=>spyFn.mockImplementation(()=>Promise.resolve(value));
|
|
13237
|
-
spyFn.mockResolvedValueOnce = (value)=>spyFn.mockImplementationOnce(()=>Promise.resolve(value));
|
|
13238
|
-
spyFn.mockRejectedValue = (value)=>spyFn.mockImplementation(()=>Promise.reject(value));
|
|
13239
|
-
spyFn.mockRejectedValueOnce = (value)=>spyFn.mockImplementationOnce(()=>Promise.reject(value));
|
|
13240
|
-
spyFn.mockReturnThis = ()=>spyFn.mockImplementation(function() {
|
|
13241
|
-
return this;
|
|
13242
|
-
});
|
|
13243
|
-
function willCall(...args) {
|
|
13244
|
-
let impl = implementation || spyState.getOriginal();
|
|
13245
|
-
mockState.instances.push(this);
|
|
13246
|
-
mockState.contexts.push(this);
|
|
13247
|
-
mockState.invocationCallOrder.push(++spy_callOrder);
|
|
13248
|
-
if (mockImplementationOnce.length) impl = mockImplementationOnce.shift();
|
|
13249
|
-
return impl?.apply(this, args);
|
|
13250
|
-
}
|
|
13251
|
-
spyState.willCall(willCall);
|
|
13252
|
-
Object.defineProperty(spyFn, 'mock', {
|
|
13253
|
-
get: ()=>({
|
|
13254
|
-
get calls () {
|
|
13255
|
-
return spyState.calls;
|
|
13256
|
-
},
|
|
13257
|
-
get lastCall () {
|
|
13258
|
-
return spyState.calls[spyState.callCount - 1];
|
|
13259
|
-
},
|
|
13260
|
-
get instances () {
|
|
13261
|
-
return mockState.instances;
|
|
13262
|
-
},
|
|
13263
|
-
get contexts () {
|
|
13264
|
-
return mockState.contexts;
|
|
13265
|
-
},
|
|
13266
|
-
get invocationCallOrder () {
|
|
13267
|
-
return mockState.invocationCallOrder;
|
|
13268
|
-
},
|
|
13269
|
-
get results () {
|
|
13270
|
-
return spyState.results.map(([resultType, value])=>{
|
|
13271
|
-
const type = 'error' === resultType ? 'throw' : 'return';
|
|
13272
|
-
return {
|
|
13273
|
-
type: type,
|
|
13274
|
-
value
|
|
13275
|
-
};
|
|
13276
|
-
});
|
|
13277
|
-
},
|
|
13278
|
-
get settledResults () {
|
|
13279
|
-
return spyState.resolves.map(([resultType, value])=>{
|
|
13280
|
-
const type = 'error' === resultType ? 'rejected' : 'fulfilled';
|
|
13281
|
-
return {
|
|
13282
|
-
type,
|
|
13283
|
-
value
|
|
13284
|
-
};
|
|
13285
|
-
});
|
|
13286
|
-
}
|
|
13287
|
-
})
|
|
13288
|
-
});
|
|
13289
|
-
spyFn.mockClear = ()=>{
|
|
13290
|
-
mockState = initMockState();
|
|
13291
|
-
spyState.reset();
|
|
13292
|
-
return spyFn;
|
|
13293
|
-
};
|
|
13294
|
-
spyFn.mockReset = ()=>{
|
|
13295
|
-
spyFn.mockClear();
|
|
13296
|
-
implementation = mockFn;
|
|
13297
|
-
mockImplementationOnce = [];
|
|
13298
|
-
return spyFn;
|
|
13299
|
-
};
|
|
13300
|
-
spyFn.mockRestore = ()=>{
|
|
13301
|
-
spyFn.mockReset();
|
|
13302
|
-
spyState.restore();
|
|
13303
|
-
mockName = mockFn?.name;
|
|
13304
|
-
};
|
|
13305
|
-
spy_mocks.add(spyFn);
|
|
13306
|
-
return spyFn;
|
|
13307
|
-
};
|
|
13308
|
-
const spy_fn = (mockFn)=>{
|
|
13309
|
-
const defaultName = 'rstest.fn()';
|
|
13310
|
-
return wrapSpy({
|
|
13311
|
-
[defaultName]: mockFn
|
|
13312
|
-
}, defaultName, mockFn);
|
|
13313
|
-
};
|
|
13314
|
-
const spy_spyOn = (obj, methodName, accessType)=>{
|
|
13315
|
-
const accessTypeMap = {
|
|
13316
|
-
get: 'getter',
|
|
13317
|
-
set: 'setter'
|
|
13318
|
-
};
|
|
13319
|
-
const method = accessType ? {
|
|
13320
|
-
[accessTypeMap[accessType]]: methodName
|
|
13321
|
-
} : methodName;
|
|
13322
|
-
return wrapSpy(obj, method);
|
|
13323
|
-
};
|
|
13324
|
-
const spy_isMockFunction = (fn)=>'function' == typeof fn && '_isMockFunction' in fn && fn._isMockFunction;
|
|
13325
|
-
const createRstestUtilities = (workerState)=>{
|
|
13192
|
+
const createRstestUtilities = async (workerState)=>{
|
|
13326
13193
|
const originalEnvValues = new Map();
|
|
13327
13194
|
const originalGlobalValues = new Map();
|
|
13328
13195
|
let _timers;
|
|
@@ -13333,20 +13200,24 @@ const createRstestUtilities = (workerState)=>{
|
|
|
13333
13200
|
});
|
|
13334
13201
|
return _timers;
|
|
13335
13202
|
};
|
|
13203
|
+
const { initSpy } = await import("./0~8957.js").then((mod)=>({
|
|
13204
|
+
initSpy: mod.initSpy
|
|
13205
|
+
}));
|
|
13206
|
+
const { fn, spyOn, isMockFunction, mocks } = initSpy();
|
|
13336
13207
|
const rstest = {
|
|
13337
|
-
fn
|
|
13338
|
-
spyOn
|
|
13339
|
-
isMockFunction
|
|
13208
|
+
fn,
|
|
13209
|
+
spyOn,
|
|
13210
|
+
isMockFunction,
|
|
13340
13211
|
clearAllMocks: ()=>{
|
|
13341
|
-
for (const mock of
|
|
13212
|
+
for (const mock of mocks)mock.mockClear();
|
|
13342
13213
|
return rstest;
|
|
13343
13214
|
},
|
|
13344
13215
|
resetAllMocks: ()=>{
|
|
13345
|
-
for (const mock of
|
|
13216
|
+
for (const mock of mocks)mock.mockReset();
|
|
13346
13217
|
return rstest;
|
|
13347
13218
|
},
|
|
13348
13219
|
restoreAllMocks: ()=>{
|
|
13349
|
-
for (const mock of
|
|
13220
|
+
for (const mock of mocks)mock.mockRestore();
|
|
13350
13221
|
return rstest;
|
|
13351
13222
|
},
|
|
13352
13223
|
mock: ()=>{},
|
|
@@ -13474,7 +13345,7 @@ const createRstestUtilities = (workerState)=>{
|
|
|
13474
13345
|
};
|
|
13475
13346
|
return rstest;
|
|
13476
13347
|
};
|
|
13477
|
-
const createRstestRuntime = (workerState)=>{
|
|
13348
|
+
const createRstestRuntime = async (workerState)=>{
|
|
13478
13349
|
const { runner, api: runnerAPI } = createRunner({
|
|
13479
13350
|
workerState
|
|
13480
13351
|
});
|
|
@@ -13488,7 +13359,7 @@ const createRstestRuntime = (workerState)=>{
|
|
|
13488
13359
|
writable: true,
|
|
13489
13360
|
configurable: true
|
|
13490
13361
|
});
|
|
13491
|
-
const rstest = createRstestUtilities(workerState);
|
|
13362
|
+
const rstest = await createRstestUtilities(workerState);
|
|
13492
13363
|
const runtime = {
|
|
13493
13364
|
runner,
|
|
13494
13365
|
api: {
|
|
@@ -13502,4 +13373,4 @@ const createRstestRuntime = (workerState)=>{
|
|
|
13502
13373
|
globalThis.RSTEST_API = runtime.api;
|
|
13503
13374
|
return runtime;
|
|
13504
13375
|
};
|
|
13505
|
-
export { createRstestRuntime };
|
|
13376
|
+
export { M, T, createRstestRuntime };
|