@mastra/evals 0.10.2 → 0.10.3-alpha.0
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/{dist-YYPBHO2W.cjs → dist-3G6XWAZH.cjs} +1145 -978
- package/dist/{dist-TRBEMZ6L.js → dist-AAQNVZVJ.js} +1145 -974
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +10 -10
|
@@ -34,21 +34,21 @@ var require_utils = chunkCVPOREIE_cjs.__commonJS({
|
|
|
34
34
|
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js
|
|
35
35
|
var require_dist = chunkCVPOREIE_cjs.__commonJS({
|
|
36
36
|
"../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js"(exports) {
|
|
37
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
38
|
-
if (
|
|
39
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
40
|
-
if (!desc || ("get" in desc ? !
|
|
37
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
38
|
+
if (k2 === void 0) k2 = k;
|
|
39
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
40
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
41
41
|
desc = { enumerable: true, get: function() {
|
|
42
|
-
return
|
|
42
|
+
return m2[k];
|
|
43
43
|
} };
|
|
44
44
|
}
|
|
45
|
-
Object.defineProperty(o,
|
|
46
|
-
} : function(o,
|
|
47
|
-
if (
|
|
48
|
-
o[
|
|
45
|
+
Object.defineProperty(o, k2, desc);
|
|
46
|
+
} : function(o, m2, k, k2) {
|
|
47
|
+
if (k2 === void 0) k2 = k;
|
|
48
|
+
o[k2] = m2[k];
|
|
49
49
|
});
|
|
50
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
51
|
-
for (var p3 in
|
|
50
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
51
|
+
for (var p3 in m2) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p3)) __createBinding(exports2, m2, p3);
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.expectTypeOf = void 0;
|
|
@@ -166,41 +166,41 @@ function C(n = false) {
|
|
|
166
166
|
}
|
|
167
167
|
function p(n = false) {
|
|
168
168
|
let e = C(n), i = (r2, t, c, o) => {
|
|
169
|
-
let
|
|
169
|
+
let l = "", s2 = 0;
|
|
170
170
|
do
|
|
171
|
-
|
|
171
|
+
l += r2.substring(s2, o) + c, s2 = o + t.length, o = r2.indexOf(t, s2);
|
|
172
172
|
while (~o);
|
|
173
|
-
return
|
|
173
|
+
return l + r2.substring(s2);
|
|
174
174
|
}, g = (r2, t, c = r2) => {
|
|
175
|
-
let o = (
|
|
176
|
-
let s2 = String(
|
|
175
|
+
let o = (l) => {
|
|
176
|
+
let s2 = String(l), b = s2.indexOf(t, r2.length);
|
|
177
177
|
return ~b ? r2 + i(s2, t, c, b) + t : r2 + s2 + t;
|
|
178
178
|
};
|
|
179
179
|
return o.open = r2, o.close = t, o;
|
|
180
|
-
},
|
|
180
|
+
}, u2 = {
|
|
181
181
|
isColorSupported: e
|
|
182
|
-
},
|
|
182
|
+
}, d = (r2) => `\x1B[${r2}m`;
|
|
183
183
|
for (let [r2, t] of h)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
u2[r2] = e ? g(
|
|
185
|
+
d(t[0]),
|
|
186
|
+
d(t[1]),
|
|
187
187
|
t[2]
|
|
188
188
|
) : a;
|
|
189
|
-
return
|
|
189
|
+
return u2;
|
|
190
190
|
}
|
|
191
191
|
var r = process.env.FORCE_TTY !== void 0 || tty.isatty(1);
|
|
192
192
|
var u = p(r);
|
|
193
193
|
|
|
194
|
-
// ../../node_modules/.pnpm/@vitest+pretty-format@3.
|
|
195
|
-
function _mergeNamespaces$1(n,
|
|
196
|
-
|
|
197
|
-
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(
|
|
198
|
-
if (
|
|
199
|
-
var
|
|
200
|
-
Object.defineProperty(n,
|
|
194
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@3.2.2/node_modules/@vitest/pretty-format/dist/index.js
|
|
195
|
+
function _mergeNamespaces$1(n, m2) {
|
|
196
|
+
m2.forEach(function(e) {
|
|
197
|
+
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
198
|
+
if (k !== "default" && !(k in n)) {
|
|
199
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
200
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
201
201
|
enumerable: true,
|
|
202
202
|
get: function() {
|
|
203
|
-
return e[
|
|
203
|
+
return e[k];
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}
|
|
@@ -275,7 +275,7 @@ function printIteratorValues(iterator, config2, indentation, depth, refs, printe
|
|
|
275
275
|
function printListItems(list, config2, indentation, depth, refs, printer2) {
|
|
276
276
|
let result = "";
|
|
277
277
|
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
278
|
-
const isDataView = (
|
|
278
|
+
const isDataView = (l) => l instanceof DataView;
|
|
279
279
|
const length = isDataView(list) ? list.byteLength : list.length;
|
|
280
280
|
if (length > 0) {
|
|
281
281
|
result += config2.spacingOuter;
|
|
@@ -536,8 +536,8 @@ var plugin$2 = {
|
|
|
536
536
|
serialize: serialize$2,
|
|
537
537
|
test: test$2
|
|
538
538
|
};
|
|
539
|
-
function getDefaultExportFromCjs(
|
|
540
|
-
return
|
|
539
|
+
function getDefaultExportFromCjs(x) {
|
|
540
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
541
541
|
}
|
|
542
542
|
var reactIs$1 = { exports: {} };
|
|
543
543
|
var reactIs_production = {};
|
|
@@ -749,25 +749,25 @@ var hasRequiredReactIs_production_min;
|
|
|
749
749
|
function requireReactIs_production_min() {
|
|
750
750
|
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
751
751
|
hasRequiredReactIs_production_min = 1;
|
|
752
|
-
var b = Symbol.for("react.element"), c = Symbol.for("react.portal"),
|
|
753
|
-
|
|
752
|
+
var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f3 = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h3 = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m2 = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p3 = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u2;
|
|
753
|
+
u2 = Symbol.for("react.module.reference");
|
|
754
754
|
function v(a3) {
|
|
755
755
|
if ("object" === typeof a3 && null !== a3) {
|
|
756
756
|
var r2 = a3.$$typeof;
|
|
757
757
|
switch (r2) {
|
|
758
758
|
case b:
|
|
759
759
|
switch (a3 = a3.type, a3) {
|
|
760
|
-
case
|
|
761
|
-
case
|
|
760
|
+
case d:
|
|
761
|
+
case f3:
|
|
762
762
|
case e:
|
|
763
|
-
case
|
|
763
|
+
case m2:
|
|
764
764
|
case n:
|
|
765
765
|
return a3;
|
|
766
766
|
default:
|
|
767
767
|
switch (a3 = a3 && a3.$$typeof, a3) {
|
|
768
|
-
case
|
|
768
|
+
case k:
|
|
769
769
|
case h3:
|
|
770
|
-
case
|
|
770
|
+
case l:
|
|
771
771
|
case q:
|
|
772
772
|
case p3:
|
|
773
773
|
case g:
|
|
@@ -784,14 +784,14 @@ function requireReactIs_production_min() {
|
|
|
784
784
|
reactIs_production_min.ContextConsumer = h3;
|
|
785
785
|
reactIs_production_min.ContextProvider = g;
|
|
786
786
|
reactIs_production_min.Element = b;
|
|
787
|
-
reactIs_production_min.ForwardRef =
|
|
788
|
-
reactIs_production_min.Fragment =
|
|
787
|
+
reactIs_production_min.ForwardRef = l;
|
|
788
|
+
reactIs_production_min.Fragment = d;
|
|
789
789
|
reactIs_production_min.Lazy = q;
|
|
790
790
|
reactIs_production_min.Memo = p3;
|
|
791
791
|
reactIs_production_min.Portal = c;
|
|
792
|
-
reactIs_production_min.Profiler =
|
|
792
|
+
reactIs_production_min.Profiler = f3;
|
|
793
793
|
reactIs_production_min.StrictMode = e;
|
|
794
|
-
reactIs_production_min.Suspense =
|
|
794
|
+
reactIs_production_min.Suspense = m2;
|
|
795
795
|
reactIs_production_min.SuspenseList = n;
|
|
796
796
|
reactIs_production_min.isAsyncMode = function() {
|
|
797
797
|
return false;
|
|
@@ -809,10 +809,10 @@ function requireReactIs_production_min() {
|
|
|
809
809
|
return "object" === typeof a3 && null !== a3 && a3.$$typeof === b;
|
|
810
810
|
};
|
|
811
811
|
reactIs_production_min.isForwardRef = function(a3) {
|
|
812
|
-
return v(a3) ===
|
|
812
|
+
return v(a3) === l;
|
|
813
813
|
};
|
|
814
814
|
reactIs_production_min.isFragment = function(a3) {
|
|
815
|
-
return v(a3) ===
|
|
815
|
+
return v(a3) === d;
|
|
816
816
|
};
|
|
817
817
|
reactIs_production_min.isLazy = function(a3) {
|
|
818
818
|
return v(a3) === q;
|
|
@@ -824,19 +824,19 @@ function requireReactIs_production_min() {
|
|
|
824
824
|
return v(a3) === c;
|
|
825
825
|
};
|
|
826
826
|
reactIs_production_min.isProfiler = function(a3) {
|
|
827
|
-
return v(a3) ===
|
|
827
|
+
return v(a3) === f3;
|
|
828
828
|
};
|
|
829
829
|
reactIs_production_min.isStrictMode = function(a3) {
|
|
830
830
|
return v(a3) === e;
|
|
831
831
|
};
|
|
832
832
|
reactIs_production_min.isSuspense = function(a3) {
|
|
833
|
-
return v(a3) ===
|
|
833
|
+
return v(a3) === m2;
|
|
834
834
|
};
|
|
835
835
|
reactIs_production_min.isSuspenseList = function(a3) {
|
|
836
836
|
return v(a3) === n;
|
|
837
837
|
};
|
|
838
838
|
reactIs_production_min.isValidElementType = function(a3) {
|
|
839
|
-
return "string" === typeof a3 || "function" === typeof a3 || a3 ===
|
|
839
|
+
return "string" === typeof a3 || "function" === typeof a3 || a3 === d || a3 === f3 || a3 === e || a3 === m2 || a3 === n || a3 === t || "object" === typeof a3 && null !== a3 && (a3.$$typeof === q || a3.$$typeof === p3 || a3.$$typeof === g || a3.$$typeof === h3 || a3.$$typeof === l || a3.$$typeof === u2 || void 0 !== a3.getModuleId) ? true : false;
|
|
840
840
|
};
|
|
841
841
|
reactIs_production_min.typeOf = v;
|
|
842
842
|
return reactIs_production_min;
|
|
@@ -1056,7 +1056,7 @@ var reactIsMethods = [
|
|
|
1056
1056
|
"isSuspenseList",
|
|
1057
1057
|
"isValidElementType"
|
|
1058
1058
|
];
|
|
1059
|
-
var ReactIs = Object.fromEntries(reactIsMethods.map((
|
|
1059
|
+
var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v) => ReactIs18[m2](v) || ReactIs19[m2](v)]));
|
|
1060
1060
|
function getChildren(arg, children = []) {
|
|
1061
1061
|
if (Array.isArray(arg)) {
|
|
1062
1062
|
for (const item of arg) {
|
|
@@ -1988,7 +1988,7 @@ function inspect(value, opts = {}) {
|
|
|
1988
1988
|
return options.stylize(String(value), type3);
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.
|
|
1991
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.2.2/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
|
|
1992
1992
|
var { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
|
|
1993
1993
|
var PLUGINS = [
|
|
1994
1994
|
ReactTestComponent,
|
|
@@ -2037,14 +2037,14 @@ function format2(...args) {
|
|
|
2037
2037
|
const len = args.length;
|
|
2038
2038
|
let i = 1;
|
|
2039
2039
|
const template = args[0];
|
|
2040
|
-
let str = String(template).replace(formatRegExp, (
|
|
2041
|
-
if (
|
|
2040
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
2041
|
+
if (x === "%%") {
|
|
2042
2042
|
return "%";
|
|
2043
2043
|
}
|
|
2044
2044
|
if (i >= len) {
|
|
2045
|
-
return
|
|
2045
|
+
return x;
|
|
2046
2046
|
}
|
|
2047
|
-
switch (
|
|
2047
|
+
switch (x) {
|
|
2048
2048
|
case "%s": {
|
|
2049
2049
|
const value = args[i++];
|
|
2050
2050
|
if (typeof value === "bigint") {
|
|
@@ -2095,21 +2095,21 @@ function format2(...args) {
|
|
|
2095
2095
|
try {
|
|
2096
2096
|
return JSON.stringify(args[i++]);
|
|
2097
2097
|
} catch (err) {
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2098
|
+
const m2 = err.message;
|
|
2099
|
+
if (m2.includes("circular structure") || m2.includes("cyclic structures") || m2.includes("cyclic object")) {
|
|
2100
2100
|
return "[Circular]";
|
|
2101
2101
|
}
|
|
2102
2102
|
throw err;
|
|
2103
2103
|
}
|
|
2104
2104
|
default:
|
|
2105
|
-
return
|
|
2105
|
+
return x;
|
|
2106
2106
|
}
|
|
2107
2107
|
});
|
|
2108
|
-
for (let
|
|
2109
|
-
if (
|
|
2110
|
-
str += ` ${
|
|
2108
|
+
for (let x = args[i]; i < len; x = args[++i]) {
|
|
2109
|
+
if (x === null || typeof x !== "object") {
|
|
2110
|
+
str += ` ${x}`;
|
|
2111
2111
|
} else {
|
|
2112
|
-
str += ` ${inspect2(
|
|
2112
|
+
str += ` ${inspect2(x)}`;
|
|
2113
2113
|
}
|
|
2114
2114
|
}
|
|
2115
2115
|
return str;
|
|
@@ -2142,11 +2142,11 @@ function objDisplay(obj, options = {}) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
return str;
|
|
2144
2144
|
}
|
|
2145
|
-
function getDefaultExportFromCjs2(
|
|
2146
|
-
return
|
|
2145
|
+
function getDefaultExportFromCjs2(x) {
|
|
2146
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2147
2147
|
}
|
|
2148
2148
|
|
|
2149
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.
|
|
2149
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.2.2/node_modules/@vitest/utils/dist/helpers.js
|
|
2150
2150
|
function createSimpleStackTrace(options) {
|
|
2151
2151
|
const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
|
|
2152
2152
|
const limit = Error.stackTraceLimit;
|
|
@@ -2203,15 +2203,15 @@ function deepClone(val, options = defaultCloneOptions) {
|
|
|
2203
2203
|
return clone(val, seen, options);
|
|
2204
2204
|
}
|
|
2205
2205
|
function clone(val, seen, options = defaultCloneOptions) {
|
|
2206
|
-
let
|
|
2206
|
+
let k, out;
|
|
2207
2207
|
if (seen.has(val)) {
|
|
2208
2208
|
return seen.get(val);
|
|
2209
2209
|
}
|
|
2210
2210
|
if (Array.isArray(val)) {
|
|
2211
|
-
out = Array.from({ length:
|
|
2211
|
+
out = Array.from({ length: k = val.length });
|
|
2212
2212
|
seen.set(val, out);
|
|
2213
|
-
while (
|
|
2214
|
-
out[
|
|
2213
|
+
while (k--) {
|
|
2214
|
+
out[k] = clone(val[k], seen, options);
|
|
2215
2215
|
}
|
|
2216
2216
|
return out;
|
|
2217
2217
|
}
|
|
@@ -2219,28 +2219,28 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
2219
2219
|
out = Object.create(Object.getPrototypeOf(val));
|
|
2220
2220
|
seen.set(val, out);
|
|
2221
2221
|
const props = getOwnProperties(val);
|
|
2222
|
-
for (const
|
|
2223
|
-
const descriptor = Object.getOwnPropertyDescriptor(val,
|
|
2222
|
+
for (const k2 of props) {
|
|
2223
|
+
const descriptor = Object.getOwnPropertyDescriptor(val, k2);
|
|
2224
2224
|
if (!descriptor) {
|
|
2225
2225
|
continue;
|
|
2226
2226
|
}
|
|
2227
|
-
const cloned = clone(val[
|
|
2227
|
+
const cloned = clone(val[k2], seen, options);
|
|
2228
2228
|
if (options.forceWritable) {
|
|
2229
|
-
Object.defineProperty(out,
|
|
2229
|
+
Object.defineProperty(out, k2, {
|
|
2230
2230
|
enumerable: descriptor.enumerable,
|
|
2231
2231
|
configurable: true,
|
|
2232
2232
|
writable: true,
|
|
2233
2233
|
value: cloned
|
|
2234
2234
|
});
|
|
2235
2235
|
} else if ("get" in descriptor) {
|
|
2236
|
-
Object.defineProperty(out,
|
|
2236
|
+
Object.defineProperty(out, k2, {
|
|
2237
2237
|
...descriptor,
|
|
2238
2238
|
get() {
|
|
2239
2239
|
return cloned;
|
|
2240
2240
|
}
|
|
2241
2241
|
});
|
|
2242
2242
|
} else {
|
|
2243
|
-
Object.defineProperty(out,
|
|
2243
|
+
Object.defineProperty(out, k2, {
|
|
2244
2244
|
...descriptor,
|
|
2245
2245
|
value: cloned
|
|
2246
2246
|
});
|
|
@@ -2352,7 +2352,7 @@ function getSafeTimers() {
|
|
|
2352
2352
|
};
|
|
2353
2353
|
}
|
|
2354
2354
|
|
|
2355
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.
|
|
2355
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.2.2/node_modules/@vitest/utils/dist/diff.js
|
|
2356
2356
|
var DIFF_DELETE = -1;
|
|
2357
2357
|
var DIFF_INSERT = 1;
|
|
2358
2358
|
var DIFF_EQUAL = 0;
|
|
@@ -2707,9 +2707,9 @@ function requireBuild() {
|
|
|
2707
2707
|
}
|
|
2708
2708
|
return nCommon;
|
|
2709
2709
|
};
|
|
2710
|
-
const extendPathsF = (
|
|
2710
|
+
const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
|
|
2711
2711
|
let iF = 0;
|
|
2712
|
-
let kF = -
|
|
2712
|
+
let kF = -d;
|
|
2713
2713
|
let aFirst = aIndexesF[iF];
|
|
2714
2714
|
let aIndexPrev1 = aFirst;
|
|
2715
2715
|
aIndexesF[iF] += countCommonItemsF(
|
|
@@ -2719,9 +2719,9 @@ function requireBuild() {
|
|
|
2719
2719
|
bEnd,
|
|
2720
2720
|
isCommon
|
|
2721
2721
|
);
|
|
2722
|
-
const nF =
|
|
2722
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
2723
2723
|
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
|
|
2724
|
-
if (iF !==
|
|
2724
|
+
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
|
|
2725
2725
|
aFirst = aIndexesF[iF];
|
|
2726
2726
|
} else {
|
|
2727
2727
|
aFirst = aIndexPrev1 + 1;
|
|
@@ -2734,9 +2734,9 @@ function requireBuild() {
|
|
|
2734
2734
|
}
|
|
2735
2735
|
return iMaxF;
|
|
2736
2736
|
};
|
|
2737
|
-
const extendPathsR = (
|
|
2737
|
+
const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) => {
|
|
2738
2738
|
let iR = 0;
|
|
2739
|
-
let kR =
|
|
2739
|
+
let kR = d;
|
|
2740
2740
|
let aFirst = aIndexesR[iR];
|
|
2741
2741
|
let aIndexPrev1 = aFirst;
|
|
2742
2742
|
aIndexesR[iR] -= countCommonItemsR(
|
|
@@ -2746,9 +2746,9 @@ function requireBuild() {
|
|
|
2746
2746
|
bR + aFirst - kR - 1,
|
|
2747
2747
|
isCommon
|
|
2748
2748
|
);
|
|
2749
|
-
const nR =
|
|
2749
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
2750
2750
|
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
|
|
2751
|
-
if (iR !==
|
|
2751
|
+
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
|
|
2752
2752
|
aFirst = aIndexesR[iR];
|
|
2753
2753
|
} else {
|
|
2754
2754
|
aFirst = aIndexPrev1 - 1;
|
|
@@ -2767,17 +2767,17 @@ function requireBuild() {
|
|
|
2767
2767
|
}
|
|
2768
2768
|
return iMaxR;
|
|
2769
2769
|
};
|
|
2770
|
-
const extendOverlappablePathsF = (
|
|
2770
|
+
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
|
|
2771
2771
|
const bF = bStart - aStart;
|
|
2772
2772
|
const aLength = aEnd - aStart;
|
|
2773
2773
|
const bLength = bEnd - bStart;
|
|
2774
2774
|
const baDeltaLength = bLength - aLength;
|
|
2775
|
-
const kMinOverlapF = -baDeltaLength - (
|
|
2776
|
-
const kMaxOverlapF = -baDeltaLength + (
|
|
2775
|
+
const kMinOverlapF = -baDeltaLength - (d - 1);
|
|
2776
|
+
const kMaxOverlapF = -baDeltaLength + (d - 1);
|
|
2777
2777
|
let aIndexPrev1 = NOT_YET_SET;
|
|
2778
|
-
const nF =
|
|
2779
|
-
for (let iF = 0, kF = -
|
|
2780
|
-
const insert = iF === 0 || iF !==
|
|
2778
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
2779
|
+
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
|
|
2780
|
+
const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
|
|
2781
2781
|
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
|
|
2782
2782
|
const aFirst = insert ? aLastPrev : aLastPrev + 1;
|
|
2783
2783
|
const bFirst = bF + aFirst - kF;
|
|
@@ -2792,7 +2792,7 @@ function requireBuild() {
|
|
|
2792
2792
|
aIndexPrev1 = aIndexesF[iF];
|
|
2793
2793
|
aIndexesF[iF] = aLast;
|
|
2794
2794
|
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
|
|
2795
|
-
const iR = (
|
|
2795
|
+
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
|
|
2796
2796
|
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
|
|
2797
2797
|
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
|
|
2798
2798
|
const nCommonR = countCommonItemsR(
|
|
@@ -2806,8 +2806,8 @@ function requireBuild() {
|
|
|
2806
2806
|
const bIndexPrevFirst = bLastPrev - nCommonR;
|
|
2807
2807
|
const aEndPreceding = aIndexPrevFirst + 1;
|
|
2808
2808
|
const bEndPreceding = bIndexPrevFirst + 1;
|
|
2809
|
-
division.nChangePreceding =
|
|
2810
|
-
if (
|
|
2809
|
+
division.nChangePreceding = d - 1;
|
|
2810
|
+
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
|
|
2811
2811
|
division.aEndPreceding = aStart;
|
|
2812
2812
|
division.bEndPreceding = bStart;
|
|
2813
2813
|
} else {
|
|
@@ -2826,8 +2826,8 @@ function requireBuild() {
|
|
|
2826
2826
|
}
|
|
2827
2827
|
const aStartFollowing = aLast + 1;
|
|
2828
2828
|
const bStartFollowing = bFirst + nCommonF + 1;
|
|
2829
|
-
division.nChangeFollowing =
|
|
2830
|
-
if (
|
|
2829
|
+
division.nChangeFollowing = d - 1;
|
|
2830
|
+
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
2831
2831
|
division.aStartFollowing = aEnd;
|
|
2832
2832
|
division.bStartFollowing = bEnd;
|
|
2833
2833
|
} else {
|
|
@@ -2840,17 +2840,17 @@ function requireBuild() {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
return false;
|
|
2842
2842
|
};
|
|
2843
|
-
const extendOverlappablePathsR = (
|
|
2843
|
+
const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
|
|
2844
2844
|
const bR = bEnd - aEnd;
|
|
2845
2845
|
const aLength = aEnd - aStart;
|
|
2846
2846
|
const bLength = bEnd - bStart;
|
|
2847
2847
|
const baDeltaLength = bLength - aLength;
|
|
2848
|
-
const kMinOverlapR = baDeltaLength -
|
|
2849
|
-
const kMaxOverlapR = baDeltaLength +
|
|
2848
|
+
const kMinOverlapR = baDeltaLength - d;
|
|
2849
|
+
const kMaxOverlapR = baDeltaLength + d;
|
|
2850
2850
|
let aIndexPrev1 = NOT_YET_SET;
|
|
2851
|
-
const nR =
|
|
2852
|
-
for (let iR = 0, kR =
|
|
2853
|
-
const insert = iR === 0 || iR !==
|
|
2851
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
2852
|
+
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
|
|
2853
|
+
const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
|
|
2854
2854
|
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
|
|
2855
2855
|
const aFirst = insert ? aLastPrev : aLastPrev - 1;
|
|
2856
2856
|
const bFirst = bR + aFirst - kR;
|
|
@@ -2865,11 +2865,11 @@ function requireBuild() {
|
|
|
2865
2865
|
aIndexPrev1 = aIndexesR[iR];
|
|
2866
2866
|
aIndexesR[iR] = aLast;
|
|
2867
2867
|
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
|
|
2868
|
-
const iF = (
|
|
2868
|
+
const iF = (d + (kR - baDeltaLength)) / 2;
|
|
2869
2869
|
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
|
|
2870
2870
|
const bLast = bFirst - nCommonR;
|
|
2871
|
-
division.nChangePreceding =
|
|
2872
|
-
if (
|
|
2871
|
+
division.nChangePreceding = d;
|
|
2872
|
+
if (d === aLast + bLast - aStart - bStart) {
|
|
2873
2873
|
division.aEndPreceding = aStart;
|
|
2874
2874
|
division.bEndPreceding = bStart;
|
|
2875
2875
|
} else {
|
|
@@ -2881,8 +2881,8 @@ function requireBuild() {
|
|
|
2881
2881
|
division.aCommonPreceding = aLast;
|
|
2882
2882
|
division.bCommonPreceding = bLast;
|
|
2883
2883
|
}
|
|
2884
|
-
division.nChangeFollowing =
|
|
2885
|
-
if (
|
|
2884
|
+
division.nChangeFollowing = d - 1;
|
|
2885
|
+
if (d === 1) {
|
|
2886
2886
|
division.nCommonFollowing = 0;
|
|
2887
2887
|
division.aStartFollowing = aEnd;
|
|
2888
2888
|
division.bStartFollowing = bEnd;
|
|
@@ -2902,7 +2902,7 @@ function requireBuild() {
|
|
|
2902
2902
|
}
|
|
2903
2903
|
const aStartFollowing = aLastPrev + nCommonF;
|
|
2904
2904
|
const bStartFollowing = bLastPrev + nCommonF;
|
|
2905
|
-
if (
|
|
2905
|
+
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
2906
2906
|
division.aStartFollowing = aEnd;
|
|
2907
2907
|
division.bStartFollowing = bEnd;
|
|
2908
2908
|
} else {
|
|
@@ -2929,15 +2929,15 @@ function requireBuild() {
|
|
|
2929
2929
|
if (baDeltaLength % 2 === 0) {
|
|
2930
2930
|
const dMin = (nChange || baDeltaLength) / 2;
|
|
2931
2931
|
const dMax = (aLength + bLength) / 2;
|
|
2932
|
-
for (let
|
|
2933
|
-
iMaxF = extendPathsF(
|
|
2934
|
-
if (
|
|
2935
|
-
iMaxR = extendPathsR(
|
|
2932
|
+
for (let d = 1; d <= dMax; d += 1) {
|
|
2933
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
2934
|
+
if (d < dMin) {
|
|
2935
|
+
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
|
2936
2936
|
} else if (
|
|
2937
2937
|
// If a reverse path overlaps a forward path in the same diagonal,
|
|
2938
2938
|
// return a division of the index intervals at the middle change.
|
|
2939
2939
|
extendOverlappablePathsR(
|
|
2940
|
-
|
|
2940
|
+
d,
|
|
2941
2941
|
aStart,
|
|
2942
2942
|
aEnd,
|
|
2943
2943
|
bStart,
|
|
@@ -2956,11 +2956,11 @@ function requireBuild() {
|
|
|
2956
2956
|
} else {
|
|
2957
2957
|
const dMin = ((nChange || baDeltaLength) + 1) / 2;
|
|
2958
2958
|
const dMax = (aLength + bLength + 1) / 2;
|
|
2959
|
-
let
|
|
2960
|
-
iMaxF = extendPathsF(
|
|
2961
|
-
for (
|
|
2959
|
+
let d = 1;
|
|
2960
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
2961
|
+
for (d += 1; d <= dMax; d += 1) {
|
|
2962
2962
|
iMaxR = extendPathsR(
|
|
2963
|
-
|
|
2963
|
+
d - 1,
|
|
2964
2964
|
aStart,
|
|
2965
2965
|
bStart,
|
|
2966
2966
|
bR,
|
|
@@ -2968,13 +2968,13 @@ function requireBuild() {
|
|
|
2968
2968
|
aIndexesR,
|
|
2969
2969
|
iMaxR
|
|
2970
2970
|
);
|
|
2971
|
-
if (
|
|
2972
|
-
iMaxF = extendPathsF(
|
|
2971
|
+
if (d < dMin) {
|
|
2972
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
2973
2973
|
} else if (
|
|
2974
2974
|
// If a forward path overlaps a reverse path in the same diagonal,
|
|
2975
2975
|
// return a division of the index intervals at the middle change.
|
|
2976
2976
|
extendOverlappablePathsF(
|
|
2977
|
-
|
|
2977
|
+
d,
|
|
2978
2978
|
aStart,
|
|
2979
2979
|
aEnd,
|
|
2980
2980
|
bStart,
|
|
@@ -3589,9 +3589,11 @@ var ChangeBuffer = class {
|
|
|
3589
3589
|
isLineEmpty() {
|
|
3590
3590
|
return this.line.length === 0;
|
|
3591
3591
|
}
|
|
3592
|
+
// Minor input to buffer.
|
|
3592
3593
|
pushDiff(diff2) {
|
|
3593
3594
|
this.line.push(diff2);
|
|
3594
3595
|
}
|
|
3596
|
+
// Main input to buffer.
|
|
3595
3597
|
align(diff2) {
|
|
3596
3598
|
const string2 = diff2[1];
|
|
3597
3599
|
if (string2.includes("\n")) {
|
|
@@ -3609,6 +3611,7 @@ var ChangeBuffer = class {
|
|
|
3609
3611
|
this.pushDiff(diff2);
|
|
3610
3612
|
}
|
|
3611
3613
|
}
|
|
3614
|
+
// Output from buffer.
|
|
3612
3615
|
moveLinesTo(lines) {
|
|
3613
3616
|
if (!this.isLineEmpty()) {
|
|
3614
3617
|
this.pushLine();
|
|
@@ -3642,6 +3645,7 @@ var CommonBuffer = class {
|
|
|
3642
3645
|
this.deleteBuffer.moveLinesTo(this.lines);
|
|
3643
3646
|
this.insertBuffer.moveLinesTo(this.lines);
|
|
3644
3647
|
}
|
|
3648
|
+
// Input to buffer.
|
|
3645
3649
|
align(diff2) {
|
|
3646
3650
|
const op = diff2[0];
|
|
3647
3651
|
const string2 = diff2[1];
|
|
@@ -3668,6 +3672,7 @@ var CommonBuffer = class {
|
|
|
3668
3672
|
this.pushDiffChangeLines(diff2);
|
|
3669
3673
|
}
|
|
3670
3674
|
}
|
|
3675
|
+
// Output from buffer.
|
|
3671
3676
|
getLines() {
|
|
3672
3677
|
this.flushChangeLines();
|
|
3673
3678
|
return this.lines;
|
|
@@ -3943,113 +3948,166 @@ function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
|
|
|
3943
3948
|
return diffs.reduce((reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op ? hasCommonDiff2 ? u.inverse(diff2[1]) : diff2[1] : ""), "");
|
|
3944
3949
|
}
|
|
3945
3950
|
|
|
3946
|
-
// ../../node_modules/.pnpm/tinyspy@
|
|
3947
|
-
function
|
|
3948
|
-
if (!
|
|
3949
|
-
throw new Error(
|
|
3950
|
-
}
|
|
3951
|
-
function
|
|
3952
|
-
return typeof
|
|
3953
|
-
}
|
|
3954
|
-
function
|
|
3955
|
-
return
|
|
3956
|
-
}
|
|
3957
|
-
function
|
|
3958
|
-
Object.defineProperty(
|
|
3959
|
-
}
|
|
3960
|
-
function
|
|
3961
|
-
|
|
3962
|
-
}
|
|
3963
|
-
var
|
|
3964
|
-
var
|
|
3965
|
-
var
|
|
3966
|
-
|
|
3967
|
-
};
|
|
3968
|
-
var
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3951
|
+
// ../../node_modules/.pnpm/tinyspy@4.0.3/node_modules/tinyspy/dist/index.js
|
|
3952
|
+
function assert(condition, message) {
|
|
3953
|
+
if (!condition)
|
|
3954
|
+
throw new Error(message);
|
|
3955
|
+
}
|
|
3956
|
+
function isType(type3, value) {
|
|
3957
|
+
return typeof value === type3;
|
|
3958
|
+
}
|
|
3959
|
+
function isPromise(value) {
|
|
3960
|
+
return value instanceof Promise;
|
|
3961
|
+
}
|
|
3962
|
+
function define(obj, key, descriptor) {
|
|
3963
|
+
Object.defineProperty(obj, key, descriptor);
|
|
3964
|
+
}
|
|
3965
|
+
function defineValue(obj, key, value) {
|
|
3966
|
+
define(obj, key, { value, configurable: true, writable: true });
|
|
3967
|
+
}
|
|
3968
|
+
var SYMBOL_STATE = Symbol.for("tinyspy:spy");
|
|
3969
|
+
var spies = /* @__PURE__ */ new Set();
|
|
3970
|
+
var reset = (state) => {
|
|
3971
|
+
state.called = false, state.callCount = 0, state.calls = [], state.results = [], state.resolves = [], state.next = [];
|
|
3972
|
+
};
|
|
3973
|
+
var defineState = (spy2) => (define(spy2, SYMBOL_STATE, {
|
|
3974
|
+
value: { reset: () => reset(spy2[SYMBOL_STATE]) }
|
|
3975
|
+
}), spy2[SYMBOL_STATE]);
|
|
3976
|
+
var getInternalState = (spy2) => spy2[SYMBOL_STATE] || defineState(spy2);
|
|
3977
|
+
function createInternalSpy(cb) {
|
|
3978
|
+
assert(
|
|
3979
|
+
isType("function", cb) || isType("undefined", cb),
|
|
3973
3980
|
"cannot spy on a non-function value"
|
|
3974
3981
|
);
|
|
3975
|
-
let
|
|
3976
|
-
let
|
|
3977
|
-
|
|
3978
|
-
let
|
|
3979
|
-
if (
|
|
3980
|
-
|
|
3981
|
-
let [
|
|
3982
|
-
if (
|
|
3983
|
-
return
|
|
3984
|
-
throw
|
|
3985
|
-
}
|
|
3986
|
-
let
|
|
3987
|
-
if (
|
|
3982
|
+
let fn2 = function(...args) {
|
|
3983
|
+
let state2 = getInternalState(fn2);
|
|
3984
|
+
state2.called = true, state2.callCount++, state2.calls.push(args);
|
|
3985
|
+
let next = state2.next.shift();
|
|
3986
|
+
if (next) {
|
|
3987
|
+
state2.results.push(next);
|
|
3988
|
+
let [type22, result2] = next;
|
|
3989
|
+
if (type22 === "ok")
|
|
3990
|
+
return result2;
|
|
3991
|
+
throw result2;
|
|
3992
|
+
}
|
|
3993
|
+
let result, type3 = "ok", resultIndex = state2.results.length;
|
|
3994
|
+
if (state2.impl)
|
|
3988
3995
|
try {
|
|
3989
|
-
new.target ?
|
|
3990
|
-
} catch (
|
|
3991
|
-
throw
|
|
3992
|
-
}
|
|
3993
|
-
let
|
|
3994
|
-
return
|
|
3995
|
-
(
|
|
3996
|
-
(
|
|
3997
|
-
),
|
|
3998
|
-
};
|
|
3999
|
-
|
|
4000
|
-
let
|
|
4001
|
-
return
|
|
4002
|
-
}
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
3996
|
+
new.target ? result = Reflect.construct(state2.impl, args, new.target) : result = state2.impl.apply(this, args), type3 = "ok";
|
|
3997
|
+
} catch (err) {
|
|
3998
|
+
throw result = err, type3 = "error", state2.results.push([type3, err]), err;
|
|
3999
|
+
}
|
|
4000
|
+
let resultTuple = [type3, result];
|
|
4001
|
+
return isPromise(result) && result.then(
|
|
4002
|
+
(r2) => state2.resolves[resultIndex] = ["ok", r2],
|
|
4003
|
+
(e) => state2.resolves[resultIndex] = ["error", e]
|
|
4004
|
+
), state2.results.push(resultTuple), result;
|
|
4005
|
+
};
|
|
4006
|
+
defineValue(fn2, "_isMockFunction", true), defineValue(fn2, "length", cb ? cb.length : 0), defineValue(fn2, "name", cb && cb.name || "spy");
|
|
4007
|
+
let state = getInternalState(fn2);
|
|
4008
|
+
return state.reset(), state.impl = cb, fn2;
|
|
4009
|
+
}
|
|
4010
|
+
function isMockFunction(obj) {
|
|
4011
|
+
return !!obj && obj._isMockFunction === true;
|
|
4012
|
+
}
|
|
4013
|
+
var getDescriptor = (obj, method) => {
|
|
4014
|
+
let objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
4015
|
+
if (objDescriptor)
|
|
4016
|
+
return [obj, objDescriptor];
|
|
4017
|
+
let currentProto = Object.getPrototypeOf(obj);
|
|
4018
|
+
for (; currentProto !== null; ) {
|
|
4019
|
+
let descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
4020
|
+
if (descriptor)
|
|
4021
|
+
return [currentProto, descriptor];
|
|
4022
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
var setPototype = (fn2, val) => {
|
|
4026
|
+
val != null && typeof val == "function" && val.prototype != null && Object.setPrototypeOf(fn2.prototype, val.prototype);
|
|
4027
|
+
};
|
|
4028
|
+
function internalSpyOn(obj, methodName, mock) {
|
|
4029
|
+
assert(
|
|
4030
|
+
!isType("undefined", obj),
|
|
4010
4031
|
"spyOn could not find an object to spy upon"
|
|
4011
|
-
),
|
|
4012
|
-
|
|
4032
|
+
), assert(
|
|
4033
|
+
isType("object", obj) || isType("function", obj),
|
|
4013
4034
|
"cannot spyOn on a primitive value"
|
|
4014
4035
|
);
|
|
4015
|
-
let [
|
|
4016
|
-
if (!
|
|
4017
|
-
return [
|
|
4018
|
-
if ("getter" in
|
|
4036
|
+
let [accessName, accessType] = (() => {
|
|
4037
|
+
if (!isType("object", methodName))
|
|
4038
|
+
return [methodName, "value"];
|
|
4039
|
+
if ("getter" in methodName && "setter" in methodName)
|
|
4019
4040
|
throw new Error("cannot spy on both getter and setter");
|
|
4020
|
-
if ("getter" in
|
|
4021
|
-
return [
|
|
4022
|
-
if ("setter" in
|
|
4023
|
-
return [
|
|
4041
|
+
if ("getter" in methodName)
|
|
4042
|
+
return [methodName.getter, "get"];
|
|
4043
|
+
if ("setter" in methodName)
|
|
4044
|
+
return [methodName.setter, "set"];
|
|
4024
4045
|
throw new Error("specify getter or setter to spy on");
|
|
4025
|
-
})(),
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
`${String(
|
|
4046
|
+
})(), [originalDescriptorObject, originalDescriptor] = getDescriptor(obj, accessName) || [];
|
|
4047
|
+
assert(
|
|
4048
|
+
originalDescriptor || accessName in obj,
|
|
4049
|
+
`${String(accessName)} does not exist`
|
|
4029
4050
|
);
|
|
4030
|
-
let
|
|
4031
|
-
|
|
4032
|
-
let
|
|
4033
|
-
|
|
4034
|
-
let
|
|
4035
|
-
let { value
|
|
4051
|
+
let ssr = false;
|
|
4052
|
+
accessType === "value" && originalDescriptor && !originalDescriptor.value && originalDescriptor.get && (accessType = "get", ssr = true, mock = originalDescriptor.get());
|
|
4053
|
+
let original;
|
|
4054
|
+
originalDescriptor ? original = originalDescriptor[accessType] : accessType !== "value" ? original = () => obj[accessName] : original = obj[accessName], original && isSpyFunction(original) && (original = original[SYMBOL_STATE].getOriginal());
|
|
4055
|
+
let reassign = (cb) => {
|
|
4056
|
+
let { value, ...desc } = originalDescriptor || {
|
|
4036
4057
|
configurable: true,
|
|
4037
4058
|
writable: true
|
|
4038
4059
|
};
|
|
4039
|
-
|
|
4040
|
-
},
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
let
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
),
|
|
4060
|
+
accessType !== "value" && delete desc.writable, desc[accessType] = cb, define(obj, accessName, desc);
|
|
4061
|
+
}, restore = () => {
|
|
4062
|
+
originalDescriptorObject !== obj ? Reflect.deleteProperty(obj, accessName) : originalDescriptor && !original ? define(obj, accessName, originalDescriptor) : reassign(original);
|
|
4063
|
+
};
|
|
4064
|
+
mock || (mock = original);
|
|
4065
|
+
let spy2 = wrap(createInternalSpy(mock), mock);
|
|
4066
|
+
accessType === "value" && setPototype(spy2, original);
|
|
4067
|
+
let state = spy2[SYMBOL_STATE];
|
|
4068
|
+
return defineValue(state, "restore", restore), defineValue(state, "getOriginal", () => ssr ? original() : original), defineValue(state, "willCall", (newCb) => (state.impl = newCb, spy2)), reassign(
|
|
4069
|
+
ssr ? () => (setPototype(spy2, mock), spy2) : spy2
|
|
4070
|
+
), spies.add(spy2), spy2;
|
|
4071
|
+
}
|
|
4072
|
+
var ignoreProperties = /* @__PURE__ */ new Set([
|
|
4073
|
+
"length",
|
|
4074
|
+
"name",
|
|
4075
|
+
"prototype"
|
|
4076
|
+
]);
|
|
4077
|
+
function getAllProperties(original) {
|
|
4078
|
+
let properties = /* @__PURE__ */ new Set(), descriptors2 = {};
|
|
4079
|
+
for (; original && original !== Object.prototype && original !== Function.prototype; ) {
|
|
4080
|
+
let ownProperties = [
|
|
4081
|
+
...Object.getOwnPropertyNames(original),
|
|
4082
|
+
...Object.getOwnPropertySymbols(original)
|
|
4083
|
+
];
|
|
4084
|
+
for (let prop of ownProperties)
|
|
4085
|
+
descriptors2[prop] || ignoreProperties.has(prop) || (properties.add(prop), descriptors2[prop] = Object.getOwnPropertyDescriptor(original, prop));
|
|
4086
|
+
original = Object.getPrototypeOf(original);
|
|
4087
|
+
}
|
|
4088
|
+
return {
|
|
4089
|
+
properties,
|
|
4090
|
+
descriptors: descriptors2
|
|
4091
|
+
};
|
|
4092
|
+
}
|
|
4093
|
+
function wrap(mock, original) {
|
|
4094
|
+
if (!original || // the original is already a spy, so it has all the properties
|
|
4095
|
+
SYMBOL_STATE in original)
|
|
4096
|
+
return mock;
|
|
4097
|
+
let { properties, descriptors: descriptors2 } = getAllProperties(original);
|
|
4098
|
+
for (let key of properties) {
|
|
4099
|
+
let descriptor = descriptors2[key];
|
|
4100
|
+
getDescriptor(mock, key) || define(mock, key, descriptor);
|
|
4101
|
+
}
|
|
4102
|
+
return mock;
|
|
4103
|
+
}
|
|
4104
|
+
function isSpyFunction(obj) {
|
|
4105
|
+
return isMockFunction(obj) && "getOriginal" in obj[SYMBOL_STATE];
|
|
4048
4106
|
}
|
|
4049
4107
|
|
|
4050
|
-
// ../../node_modules/.pnpm/@vitest+spy@3.
|
|
4108
|
+
// ../../node_modules/.pnpm/@vitest+spy@3.2.2/node_modules/@vitest/spy/dist/index.js
|
|
4051
4109
|
var mocks = /* @__PURE__ */ new Set();
|
|
4052
|
-
function
|
|
4110
|
+
function isMockFunction2(fn2) {
|
|
4053
4111
|
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
4054
4112
|
}
|
|
4055
4113
|
function spyOn(obj, method, accessType) {
|
|
@@ -4058,17 +4116,29 @@ function spyOn(obj, method, accessType) {
|
|
|
4058
4116
|
set: "setter"
|
|
4059
4117
|
};
|
|
4060
4118
|
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
4061
|
-
|
|
4062
|
-
|
|
4119
|
+
let state;
|
|
4120
|
+
const descriptor = getDescriptor2(obj, method);
|
|
4121
|
+
const fn2 = descriptor && descriptor[accessType || "value"];
|
|
4122
|
+
if (isMockFunction2(fn2)) {
|
|
4123
|
+
state = fn2.mock._state();
|
|
4124
|
+
}
|
|
4125
|
+
const stub = internalSpyOn(obj, objMethod);
|
|
4126
|
+
const spy = enhanceSpy(stub);
|
|
4127
|
+
if (state) {
|
|
4128
|
+
spy.mock._state(state);
|
|
4129
|
+
}
|
|
4130
|
+
return spy;
|
|
4063
4131
|
}
|
|
4064
4132
|
var callOrder = 0;
|
|
4065
4133
|
function enhanceSpy(spy) {
|
|
4066
4134
|
const stub = spy;
|
|
4067
4135
|
let implementation;
|
|
4136
|
+
let onceImplementations = [];
|
|
4137
|
+
let implementationChangedTemporarily = false;
|
|
4068
4138
|
let instances = [];
|
|
4069
4139
|
let contexts = [];
|
|
4070
4140
|
let invocations = [];
|
|
4071
|
-
const state =
|
|
4141
|
+
const state = getInternalState(spy);
|
|
4072
4142
|
const mockContext = {
|
|
4073
4143
|
get calls() {
|
|
4074
4144
|
return state.calls;
|
|
@@ -4102,10 +4172,20 @@ function enhanceSpy(spy) {
|
|
|
4102
4172
|
},
|
|
4103
4173
|
get lastCall() {
|
|
4104
4174
|
return state.calls[state.calls.length - 1];
|
|
4175
|
+
},
|
|
4176
|
+
_state(state2) {
|
|
4177
|
+
if (state2) {
|
|
4178
|
+
implementation = state2.implementation;
|
|
4179
|
+
onceImplementations = state2.onceImplementations;
|
|
4180
|
+
implementationChangedTemporarily = state2.implementationChangedTemporarily;
|
|
4181
|
+
}
|
|
4182
|
+
return {
|
|
4183
|
+
implementation,
|
|
4184
|
+
onceImplementations,
|
|
4185
|
+
implementationChangedTemporarily
|
|
4186
|
+
};
|
|
4105
4187
|
}
|
|
4106
4188
|
};
|
|
4107
|
-
let onceImplementations = [];
|
|
4108
|
-
let implementationChangedTemporarily = false;
|
|
4109
4189
|
function mockCall(...args) {
|
|
4110
4190
|
instances.push(this);
|
|
4111
4191
|
contexts.push(this);
|
|
@@ -4138,6 +4218,9 @@ function enhanceSpy(spy) {
|
|
|
4138
4218
|
state.restore();
|
|
4139
4219
|
return stub;
|
|
4140
4220
|
};
|
|
4221
|
+
if (Symbol.dispose) {
|
|
4222
|
+
stub[Symbol.dispose] = () => stub.mockRestore();
|
|
4223
|
+
}
|
|
4141
4224
|
stub.getMockImplementation = () => implementationChangedTemporarily ? implementation : onceImplementations.at(0) || implementation;
|
|
4142
4225
|
stub.mockImplementation = (fn2) => {
|
|
4143
4226
|
implementation = fn2;
|
|
@@ -4153,18 +4236,18 @@ function enhanceSpy(spy) {
|
|
|
4153
4236
|
implementation = fn2;
|
|
4154
4237
|
state.willCall(mockCall);
|
|
4155
4238
|
implementationChangedTemporarily = true;
|
|
4156
|
-
const
|
|
4239
|
+
const reset2 = () => {
|
|
4157
4240
|
implementation = originalImplementation;
|
|
4158
4241
|
implementationChangedTemporarily = false;
|
|
4159
4242
|
};
|
|
4160
4243
|
const result = cb();
|
|
4161
|
-
if (result
|
|
4244
|
+
if (typeof result === "object" && result && typeof result.then === "function") {
|
|
4162
4245
|
return result.then(() => {
|
|
4163
|
-
|
|
4246
|
+
reset2();
|
|
4164
4247
|
return stub;
|
|
4165
4248
|
});
|
|
4166
4249
|
}
|
|
4167
|
-
|
|
4250
|
+
reset2();
|
|
4168
4251
|
return stub;
|
|
4169
4252
|
}
|
|
4170
4253
|
stub.withImplementation = withImplementation;
|
|
@@ -4183,15 +4266,29 @@ function enhanceSpy(spy) {
|
|
|
4183
4266
|
return stub;
|
|
4184
4267
|
}
|
|
4185
4268
|
function fn(implementation) {
|
|
4186
|
-
const enhancedSpy = enhanceSpy(
|
|
4269
|
+
const enhancedSpy = enhanceSpy(internalSpyOn({ spy: implementation || function() {
|
|
4187
4270
|
} }, "spy"));
|
|
4188
4271
|
if (implementation) {
|
|
4189
4272
|
enhancedSpy.mockImplementation(implementation);
|
|
4190
4273
|
}
|
|
4191
4274
|
return enhancedSpy;
|
|
4192
4275
|
}
|
|
4276
|
+
function getDescriptor2(obj, method) {
|
|
4277
|
+
const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
4278
|
+
if (objDescriptor) {
|
|
4279
|
+
return objDescriptor;
|
|
4280
|
+
}
|
|
4281
|
+
let currentProto = Object.getPrototypeOf(obj);
|
|
4282
|
+
while (currentProto !== null) {
|
|
4283
|
+
const descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
4284
|
+
if (descriptor) {
|
|
4285
|
+
return descriptor;
|
|
4286
|
+
}
|
|
4287
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4193
4290
|
|
|
4194
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.
|
|
4291
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.2.2/node_modules/@vitest/utils/dist/error.js
|
|
4195
4292
|
var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
4196
4293
|
var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
4197
4294
|
function isImmutable(v) {
|
|
@@ -4211,6 +4308,24 @@ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
4211
4308
|
if (!val || typeof val === "string") {
|
|
4212
4309
|
return val;
|
|
4213
4310
|
}
|
|
4311
|
+
if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
|
|
4312
|
+
const jsonValue = val.toJSON();
|
|
4313
|
+
if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
|
|
4314
|
+
if (typeof val.message === "string") {
|
|
4315
|
+
safe(() => jsonValue.message ?? (jsonValue.message = val.message));
|
|
4316
|
+
}
|
|
4317
|
+
if (typeof val.stack === "string") {
|
|
4318
|
+
safe(() => jsonValue.stack ?? (jsonValue.stack = val.stack));
|
|
4319
|
+
}
|
|
4320
|
+
if (typeof val.name === "string") {
|
|
4321
|
+
safe(() => jsonValue.name ?? (jsonValue.name = val.name));
|
|
4322
|
+
}
|
|
4323
|
+
if (val.cause != null) {
|
|
4324
|
+
safe(() => jsonValue.cause ?? (jsonValue.cause = serializeValue(val.cause, seen)));
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
return serializeValue(jsonValue, seen);
|
|
4328
|
+
}
|
|
4214
4329
|
if (typeof val === "function") {
|
|
4215
4330
|
return `Function<${val.name || "anonymous"}>`;
|
|
4216
4331
|
}
|
|
@@ -4270,6 +4385,12 @@ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
4270
4385
|
return clone2;
|
|
4271
4386
|
}
|
|
4272
4387
|
}
|
|
4388
|
+
function safe(fn2) {
|
|
4389
|
+
try {
|
|
4390
|
+
return fn2();
|
|
4391
|
+
} catch {
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4273
4394
|
function normalizeErrorMessage(message) {
|
|
4274
4395
|
return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
|
|
4275
4396
|
}
|
|
@@ -4278,22 +4399,16 @@ function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
4278
4399
|
return { message: String(_err) };
|
|
4279
4400
|
}
|
|
4280
4401
|
const err = _err;
|
|
4281
|
-
if (err.stack) {
|
|
4282
|
-
err.stackStr = String(err.stack);
|
|
4283
|
-
}
|
|
4284
|
-
if (err.name) {
|
|
4285
|
-
err.nameStr = String(err.name);
|
|
4286
|
-
}
|
|
4287
4402
|
if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) {
|
|
4288
4403
|
err.diff = printDiffOrStringify(err.actual, err.expected, {
|
|
4289
4404
|
...diffOptions,
|
|
4290
4405
|
...err.diffOptions
|
|
4291
4406
|
});
|
|
4292
4407
|
}
|
|
4293
|
-
if (typeof err.expected !== "string") {
|
|
4408
|
+
if ("expected" in err && typeof err.expected !== "string") {
|
|
4294
4409
|
err.expected = stringify(err.expected, 10);
|
|
4295
4410
|
}
|
|
4296
|
-
if (typeof err.actual !== "string") {
|
|
4411
|
+
if ("actual" in err && typeof err.actual !== "string") {
|
|
4297
4412
|
err.actual = stringify(err.actual, 10);
|
|
4298
4413
|
}
|
|
4299
4414
|
try {
|
|
@@ -4323,7 +4438,7 @@ chunkCVPOREIE_cjs.__export(chai_exports, {
|
|
|
4323
4438
|
Assertion: () => Assertion,
|
|
4324
4439
|
AssertionError: () => AssertionError,
|
|
4325
4440
|
Should: () => Should,
|
|
4326
|
-
assert: () =>
|
|
4441
|
+
assert: () => assert2,
|
|
4327
4442
|
config: () => config,
|
|
4328
4443
|
expect: () => expect,
|
|
4329
4444
|
should: () => should,
|
|
@@ -7109,7 +7224,7 @@ function closeTo(expected, delta, msg) {
|
|
|
7109
7224
|
ssfi
|
|
7110
7225
|
);
|
|
7111
7226
|
new Assertion(expected, flagMsg, ssfi, true).is.numeric;
|
|
7112
|
-
const abs = /* @__PURE__ */ __name((
|
|
7227
|
+
const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs");
|
|
7113
7228
|
const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
|
|
7114
7229
|
this.assert(
|
|
7115
7230
|
strip(abs(obj - expected)) <= delta,
|
|
@@ -7521,12 +7636,12 @@ function loadShould() {
|
|
|
7521
7636
|
__name(loadShould, "loadShould");
|
|
7522
7637
|
var should = loadShould;
|
|
7523
7638
|
var Should = loadShould;
|
|
7524
|
-
function
|
|
7525
|
-
var test22 = new Assertion(null, null,
|
|
7639
|
+
function assert2(express, errmsg) {
|
|
7640
|
+
var test22 = new Assertion(null, null, assert2, true);
|
|
7526
7641
|
test22.assert(express, errmsg, "[ negation message unavailable ]");
|
|
7527
7642
|
}
|
|
7528
|
-
__name(
|
|
7529
|
-
|
|
7643
|
+
__name(assert2, "assert");
|
|
7644
|
+
assert2.fail = function(actual, expected, message, operator) {
|
|
7530
7645
|
if (arguments.length < 2) {
|
|
7531
7646
|
message = actual;
|
|
7532
7647
|
actual = void 0;
|
|
@@ -7539,17 +7654,17 @@ assert.fail = function(actual, expected, message, operator) {
|
|
|
7539
7654
|
expected,
|
|
7540
7655
|
operator
|
|
7541
7656
|
},
|
|
7542
|
-
|
|
7657
|
+
assert2.fail
|
|
7543
7658
|
);
|
|
7544
7659
|
};
|
|
7545
|
-
|
|
7546
|
-
new Assertion(val, msg,
|
|
7660
|
+
assert2.isOk = function(val, msg) {
|
|
7661
|
+
new Assertion(val, msg, assert2.isOk, true).is.ok;
|
|
7547
7662
|
};
|
|
7548
|
-
|
|
7549
|
-
new Assertion(val, msg,
|
|
7663
|
+
assert2.isNotOk = function(val, msg) {
|
|
7664
|
+
new Assertion(val, msg, assert2.isNotOk, true).is.not.ok;
|
|
7550
7665
|
};
|
|
7551
|
-
|
|
7552
|
-
var test22 = new Assertion(act, msg,
|
|
7666
|
+
assert2.equal = function(act, exp, msg) {
|
|
7667
|
+
var test22 = new Assertion(act, msg, assert2.equal, true);
|
|
7553
7668
|
test22.assert(
|
|
7554
7669
|
exp == flag(test22, "object"),
|
|
7555
7670
|
"expected #{this} to equal #{exp}",
|
|
@@ -7559,8 +7674,8 @@ assert.equal = function(act, exp, msg) {
|
|
|
7559
7674
|
true
|
|
7560
7675
|
);
|
|
7561
7676
|
};
|
|
7562
|
-
|
|
7563
|
-
var test22 = new Assertion(act, msg,
|
|
7677
|
+
assert2.notEqual = function(act, exp, msg) {
|
|
7678
|
+
var test22 = new Assertion(act, msg, assert2.notEqual, true);
|
|
7564
7679
|
test22.assert(
|
|
7565
7680
|
exp != flag(test22, "object"),
|
|
7566
7681
|
"expected #{this} to not equal #{exp}",
|
|
@@ -7570,370 +7685,370 @@ assert.notEqual = function(act, exp, msg) {
|
|
|
7570
7685
|
true
|
|
7571
7686
|
);
|
|
7572
7687
|
};
|
|
7573
|
-
|
|
7574
|
-
new Assertion(act, msg,
|
|
7688
|
+
assert2.strictEqual = function(act, exp, msg) {
|
|
7689
|
+
new Assertion(act, msg, assert2.strictEqual, true).to.equal(exp);
|
|
7575
7690
|
};
|
|
7576
|
-
|
|
7577
|
-
new Assertion(act, msg,
|
|
7691
|
+
assert2.notStrictEqual = function(act, exp, msg) {
|
|
7692
|
+
new Assertion(act, msg, assert2.notStrictEqual, true).to.not.equal(exp);
|
|
7578
7693
|
};
|
|
7579
|
-
|
|
7580
|
-
new Assertion(act, msg,
|
|
7694
|
+
assert2.deepEqual = assert2.deepStrictEqual = function(act, exp, msg) {
|
|
7695
|
+
new Assertion(act, msg, assert2.deepEqual, true).to.eql(exp);
|
|
7581
7696
|
};
|
|
7582
|
-
|
|
7583
|
-
new Assertion(act, msg,
|
|
7697
|
+
assert2.notDeepEqual = function(act, exp, msg) {
|
|
7698
|
+
new Assertion(act, msg, assert2.notDeepEqual, true).to.not.eql(exp);
|
|
7584
7699
|
};
|
|
7585
|
-
|
|
7586
|
-
new Assertion(val, msg,
|
|
7700
|
+
assert2.isAbove = function(val, abv, msg) {
|
|
7701
|
+
new Assertion(val, msg, assert2.isAbove, true).to.be.above(abv);
|
|
7587
7702
|
};
|
|
7588
|
-
|
|
7589
|
-
new Assertion(val, msg,
|
|
7703
|
+
assert2.isAtLeast = function(val, atlst, msg) {
|
|
7704
|
+
new Assertion(val, msg, assert2.isAtLeast, true).to.be.least(atlst);
|
|
7590
7705
|
};
|
|
7591
|
-
|
|
7592
|
-
new Assertion(val, msg,
|
|
7706
|
+
assert2.isBelow = function(val, blw, msg) {
|
|
7707
|
+
new Assertion(val, msg, assert2.isBelow, true).to.be.below(blw);
|
|
7593
7708
|
};
|
|
7594
|
-
|
|
7595
|
-
new Assertion(val, msg,
|
|
7709
|
+
assert2.isAtMost = function(val, atmst, msg) {
|
|
7710
|
+
new Assertion(val, msg, assert2.isAtMost, true).to.be.most(atmst);
|
|
7596
7711
|
};
|
|
7597
|
-
|
|
7598
|
-
new Assertion(val, msg,
|
|
7712
|
+
assert2.isTrue = function(val, msg) {
|
|
7713
|
+
new Assertion(val, msg, assert2.isTrue, true).is["true"];
|
|
7599
7714
|
};
|
|
7600
|
-
|
|
7601
|
-
new Assertion(val, msg,
|
|
7715
|
+
assert2.isNotTrue = function(val, msg) {
|
|
7716
|
+
new Assertion(val, msg, assert2.isNotTrue, true).to.not.equal(true);
|
|
7602
7717
|
};
|
|
7603
|
-
|
|
7604
|
-
new Assertion(val, msg,
|
|
7718
|
+
assert2.isFalse = function(val, msg) {
|
|
7719
|
+
new Assertion(val, msg, assert2.isFalse, true).is["false"];
|
|
7605
7720
|
};
|
|
7606
|
-
|
|
7607
|
-
new Assertion(val, msg,
|
|
7721
|
+
assert2.isNotFalse = function(val, msg) {
|
|
7722
|
+
new Assertion(val, msg, assert2.isNotFalse, true).to.not.equal(false);
|
|
7608
7723
|
};
|
|
7609
|
-
|
|
7610
|
-
new Assertion(val, msg,
|
|
7724
|
+
assert2.isNull = function(val, msg) {
|
|
7725
|
+
new Assertion(val, msg, assert2.isNull, true).to.equal(null);
|
|
7611
7726
|
};
|
|
7612
|
-
|
|
7613
|
-
new Assertion(val, msg,
|
|
7727
|
+
assert2.isNotNull = function(val, msg) {
|
|
7728
|
+
new Assertion(val, msg, assert2.isNotNull, true).to.not.equal(null);
|
|
7614
7729
|
};
|
|
7615
|
-
|
|
7616
|
-
new Assertion(val, msg,
|
|
7730
|
+
assert2.isNaN = function(val, msg) {
|
|
7731
|
+
new Assertion(val, msg, assert2.isNaN, true).to.be.NaN;
|
|
7617
7732
|
};
|
|
7618
|
-
|
|
7619
|
-
new Assertion(value, message,
|
|
7733
|
+
assert2.isNotNaN = function(value, message) {
|
|
7734
|
+
new Assertion(value, message, assert2.isNotNaN, true).not.to.be.NaN;
|
|
7620
7735
|
};
|
|
7621
|
-
|
|
7622
|
-
new Assertion(val, msg,
|
|
7736
|
+
assert2.exists = function(val, msg) {
|
|
7737
|
+
new Assertion(val, msg, assert2.exists, true).to.exist;
|
|
7623
7738
|
};
|
|
7624
|
-
|
|
7625
|
-
new Assertion(val, msg,
|
|
7739
|
+
assert2.notExists = function(val, msg) {
|
|
7740
|
+
new Assertion(val, msg, assert2.notExists, true).to.not.exist;
|
|
7626
7741
|
};
|
|
7627
|
-
|
|
7628
|
-
new Assertion(val, msg,
|
|
7742
|
+
assert2.isUndefined = function(val, msg) {
|
|
7743
|
+
new Assertion(val, msg, assert2.isUndefined, true).to.equal(void 0);
|
|
7629
7744
|
};
|
|
7630
|
-
|
|
7631
|
-
new Assertion(val, msg,
|
|
7745
|
+
assert2.isDefined = function(val, msg) {
|
|
7746
|
+
new Assertion(val, msg, assert2.isDefined, true).to.not.equal(void 0);
|
|
7632
7747
|
};
|
|
7633
|
-
|
|
7634
|
-
new Assertion(value, message,
|
|
7748
|
+
assert2.isCallable = function(value, message) {
|
|
7749
|
+
new Assertion(value, message, assert2.isCallable, true).is.callable;
|
|
7635
7750
|
};
|
|
7636
|
-
|
|
7637
|
-
new Assertion(value, message,
|
|
7751
|
+
assert2.isNotCallable = function(value, message) {
|
|
7752
|
+
new Assertion(value, message, assert2.isNotCallable, true).is.not.callable;
|
|
7638
7753
|
};
|
|
7639
|
-
|
|
7640
|
-
new Assertion(val, msg,
|
|
7754
|
+
assert2.isObject = function(val, msg) {
|
|
7755
|
+
new Assertion(val, msg, assert2.isObject, true).to.be.a("object");
|
|
7641
7756
|
};
|
|
7642
|
-
|
|
7643
|
-
new Assertion(val, msg,
|
|
7757
|
+
assert2.isNotObject = function(val, msg) {
|
|
7758
|
+
new Assertion(val, msg, assert2.isNotObject, true).to.not.be.a("object");
|
|
7644
7759
|
};
|
|
7645
|
-
|
|
7646
|
-
new Assertion(val, msg,
|
|
7760
|
+
assert2.isArray = function(val, msg) {
|
|
7761
|
+
new Assertion(val, msg, assert2.isArray, true).to.be.an("array");
|
|
7647
7762
|
};
|
|
7648
|
-
|
|
7649
|
-
new Assertion(val, msg,
|
|
7763
|
+
assert2.isNotArray = function(val, msg) {
|
|
7764
|
+
new Assertion(val, msg, assert2.isNotArray, true).to.not.be.an("array");
|
|
7650
7765
|
};
|
|
7651
|
-
|
|
7652
|
-
new Assertion(val, msg,
|
|
7766
|
+
assert2.isString = function(val, msg) {
|
|
7767
|
+
new Assertion(val, msg, assert2.isString, true).to.be.a("string");
|
|
7653
7768
|
};
|
|
7654
|
-
|
|
7655
|
-
new Assertion(val, msg,
|
|
7769
|
+
assert2.isNotString = function(val, msg) {
|
|
7770
|
+
new Assertion(val, msg, assert2.isNotString, true).to.not.be.a("string");
|
|
7656
7771
|
};
|
|
7657
|
-
|
|
7658
|
-
new Assertion(val, msg,
|
|
7772
|
+
assert2.isNumber = function(val, msg) {
|
|
7773
|
+
new Assertion(val, msg, assert2.isNumber, true).to.be.a("number");
|
|
7659
7774
|
};
|
|
7660
|
-
|
|
7661
|
-
new Assertion(val, msg,
|
|
7775
|
+
assert2.isNotNumber = function(val, msg) {
|
|
7776
|
+
new Assertion(val, msg, assert2.isNotNumber, true).to.not.be.a("number");
|
|
7662
7777
|
};
|
|
7663
|
-
|
|
7664
|
-
new Assertion(val, msg,
|
|
7778
|
+
assert2.isNumeric = function(val, msg) {
|
|
7779
|
+
new Assertion(val, msg, assert2.isNumeric, true).is.numeric;
|
|
7665
7780
|
};
|
|
7666
|
-
|
|
7667
|
-
new Assertion(val, msg,
|
|
7781
|
+
assert2.isNotNumeric = function(val, msg) {
|
|
7782
|
+
new Assertion(val, msg, assert2.isNotNumeric, true).is.not.numeric;
|
|
7668
7783
|
};
|
|
7669
|
-
|
|
7670
|
-
new Assertion(val, msg,
|
|
7784
|
+
assert2.isFinite = function(val, msg) {
|
|
7785
|
+
new Assertion(val, msg, assert2.isFinite, true).to.be.finite;
|
|
7671
7786
|
};
|
|
7672
|
-
|
|
7673
|
-
new Assertion(val, msg,
|
|
7787
|
+
assert2.isBoolean = function(val, msg) {
|
|
7788
|
+
new Assertion(val, msg, assert2.isBoolean, true).to.be.a("boolean");
|
|
7674
7789
|
};
|
|
7675
|
-
|
|
7676
|
-
new Assertion(val, msg,
|
|
7790
|
+
assert2.isNotBoolean = function(val, msg) {
|
|
7791
|
+
new Assertion(val, msg, assert2.isNotBoolean, true).to.not.be.a("boolean");
|
|
7677
7792
|
};
|
|
7678
|
-
|
|
7679
|
-
new Assertion(val, msg,
|
|
7793
|
+
assert2.typeOf = function(val, type3, msg) {
|
|
7794
|
+
new Assertion(val, msg, assert2.typeOf, true).to.be.a(type3);
|
|
7680
7795
|
};
|
|
7681
|
-
|
|
7682
|
-
new Assertion(value, message,
|
|
7796
|
+
assert2.notTypeOf = function(value, type3, message) {
|
|
7797
|
+
new Assertion(value, message, assert2.notTypeOf, true).to.not.be.a(type3);
|
|
7683
7798
|
};
|
|
7684
|
-
|
|
7685
|
-
new Assertion(val, msg,
|
|
7799
|
+
assert2.instanceOf = function(val, type3, msg) {
|
|
7800
|
+
new Assertion(val, msg, assert2.instanceOf, true).to.be.instanceOf(type3);
|
|
7686
7801
|
};
|
|
7687
|
-
|
|
7688
|
-
new Assertion(val, msg,
|
|
7802
|
+
assert2.notInstanceOf = function(val, type3, msg) {
|
|
7803
|
+
new Assertion(val, msg, assert2.notInstanceOf, true).to.not.be.instanceOf(
|
|
7689
7804
|
type3
|
|
7690
7805
|
);
|
|
7691
7806
|
};
|
|
7692
|
-
|
|
7693
|
-
new Assertion(exp, msg,
|
|
7807
|
+
assert2.include = function(exp, inc, msg) {
|
|
7808
|
+
new Assertion(exp, msg, assert2.include, true).include(inc);
|
|
7694
7809
|
};
|
|
7695
|
-
|
|
7696
|
-
new Assertion(exp, msg,
|
|
7810
|
+
assert2.notInclude = function(exp, inc, msg) {
|
|
7811
|
+
new Assertion(exp, msg, assert2.notInclude, true).not.include(inc);
|
|
7697
7812
|
};
|
|
7698
|
-
|
|
7699
|
-
new Assertion(exp, msg,
|
|
7813
|
+
assert2.deepInclude = function(exp, inc, msg) {
|
|
7814
|
+
new Assertion(exp, msg, assert2.deepInclude, true).deep.include(inc);
|
|
7700
7815
|
};
|
|
7701
|
-
|
|
7702
|
-
new Assertion(exp, msg,
|
|
7816
|
+
assert2.notDeepInclude = function(exp, inc, msg) {
|
|
7817
|
+
new Assertion(exp, msg, assert2.notDeepInclude, true).not.deep.include(inc);
|
|
7703
7818
|
};
|
|
7704
|
-
|
|
7705
|
-
new Assertion(exp, msg,
|
|
7819
|
+
assert2.nestedInclude = function(exp, inc, msg) {
|
|
7820
|
+
new Assertion(exp, msg, assert2.nestedInclude, true).nested.include(inc);
|
|
7706
7821
|
};
|
|
7707
|
-
|
|
7708
|
-
new Assertion(exp, msg,
|
|
7822
|
+
assert2.notNestedInclude = function(exp, inc, msg) {
|
|
7823
|
+
new Assertion(exp, msg, assert2.notNestedInclude, true).not.nested.include(
|
|
7709
7824
|
inc
|
|
7710
7825
|
);
|
|
7711
7826
|
};
|
|
7712
|
-
|
|
7713
|
-
new Assertion(exp, msg,
|
|
7827
|
+
assert2.deepNestedInclude = function(exp, inc, msg) {
|
|
7828
|
+
new Assertion(exp, msg, assert2.deepNestedInclude, true).deep.nested.include(
|
|
7714
7829
|
inc
|
|
7715
7830
|
);
|
|
7716
7831
|
};
|
|
7717
|
-
|
|
7832
|
+
assert2.notDeepNestedInclude = function(exp, inc, msg) {
|
|
7718
7833
|
new Assertion(
|
|
7719
7834
|
exp,
|
|
7720
7835
|
msg,
|
|
7721
|
-
|
|
7836
|
+
assert2.notDeepNestedInclude,
|
|
7722
7837
|
true
|
|
7723
7838
|
).not.deep.nested.include(inc);
|
|
7724
7839
|
};
|
|
7725
|
-
|
|
7726
|
-
new Assertion(exp, msg,
|
|
7840
|
+
assert2.ownInclude = function(exp, inc, msg) {
|
|
7841
|
+
new Assertion(exp, msg, assert2.ownInclude, true).own.include(inc);
|
|
7727
7842
|
};
|
|
7728
|
-
|
|
7729
|
-
new Assertion(exp, msg,
|
|
7843
|
+
assert2.notOwnInclude = function(exp, inc, msg) {
|
|
7844
|
+
new Assertion(exp, msg, assert2.notOwnInclude, true).not.own.include(inc);
|
|
7730
7845
|
};
|
|
7731
|
-
|
|
7732
|
-
new Assertion(exp, msg,
|
|
7846
|
+
assert2.deepOwnInclude = function(exp, inc, msg) {
|
|
7847
|
+
new Assertion(exp, msg, assert2.deepOwnInclude, true).deep.own.include(inc);
|
|
7733
7848
|
};
|
|
7734
|
-
|
|
7735
|
-
new Assertion(exp, msg,
|
|
7849
|
+
assert2.notDeepOwnInclude = function(exp, inc, msg) {
|
|
7850
|
+
new Assertion(exp, msg, assert2.notDeepOwnInclude, true).not.deep.own.include(
|
|
7736
7851
|
inc
|
|
7737
7852
|
);
|
|
7738
7853
|
};
|
|
7739
|
-
|
|
7740
|
-
new Assertion(exp, msg,
|
|
7854
|
+
assert2.match = function(exp, re, msg) {
|
|
7855
|
+
new Assertion(exp, msg, assert2.match, true).to.match(re);
|
|
7741
7856
|
};
|
|
7742
|
-
|
|
7743
|
-
new Assertion(exp, msg,
|
|
7857
|
+
assert2.notMatch = function(exp, re, msg) {
|
|
7858
|
+
new Assertion(exp, msg, assert2.notMatch, true).to.not.match(re);
|
|
7744
7859
|
};
|
|
7745
|
-
|
|
7746
|
-
new Assertion(obj, msg,
|
|
7860
|
+
assert2.property = function(obj, prop, msg) {
|
|
7861
|
+
new Assertion(obj, msg, assert2.property, true).to.have.property(prop);
|
|
7747
7862
|
};
|
|
7748
|
-
|
|
7749
|
-
new Assertion(obj, msg,
|
|
7863
|
+
assert2.notProperty = function(obj, prop, msg) {
|
|
7864
|
+
new Assertion(obj, msg, assert2.notProperty, true).to.not.have.property(prop);
|
|
7750
7865
|
};
|
|
7751
|
-
|
|
7752
|
-
new Assertion(obj, msg,
|
|
7866
|
+
assert2.propertyVal = function(obj, prop, val, msg) {
|
|
7867
|
+
new Assertion(obj, msg, assert2.propertyVal, true).to.have.property(prop, val);
|
|
7753
7868
|
};
|
|
7754
|
-
|
|
7755
|
-
new Assertion(obj, msg,
|
|
7869
|
+
assert2.notPropertyVal = function(obj, prop, val, msg) {
|
|
7870
|
+
new Assertion(obj, msg, assert2.notPropertyVal, true).to.not.have.property(
|
|
7756
7871
|
prop,
|
|
7757
7872
|
val
|
|
7758
7873
|
);
|
|
7759
7874
|
};
|
|
7760
|
-
|
|
7761
|
-
new Assertion(obj, msg,
|
|
7875
|
+
assert2.deepPropertyVal = function(obj, prop, val, msg) {
|
|
7876
|
+
new Assertion(obj, msg, assert2.deepPropertyVal, true).to.have.deep.property(
|
|
7762
7877
|
prop,
|
|
7763
7878
|
val
|
|
7764
7879
|
);
|
|
7765
7880
|
};
|
|
7766
|
-
|
|
7881
|
+
assert2.notDeepPropertyVal = function(obj, prop, val, msg) {
|
|
7767
7882
|
new Assertion(
|
|
7768
7883
|
obj,
|
|
7769
7884
|
msg,
|
|
7770
|
-
|
|
7885
|
+
assert2.notDeepPropertyVal,
|
|
7771
7886
|
true
|
|
7772
7887
|
).to.not.have.deep.property(prop, val);
|
|
7773
7888
|
};
|
|
7774
|
-
|
|
7775
|
-
new Assertion(obj, msg,
|
|
7889
|
+
assert2.ownProperty = function(obj, prop, msg) {
|
|
7890
|
+
new Assertion(obj, msg, assert2.ownProperty, true).to.have.own.property(prop);
|
|
7776
7891
|
};
|
|
7777
|
-
|
|
7778
|
-
new Assertion(obj, msg,
|
|
7892
|
+
assert2.notOwnProperty = function(obj, prop, msg) {
|
|
7893
|
+
new Assertion(obj, msg, assert2.notOwnProperty, true).to.not.have.own.property(
|
|
7779
7894
|
prop
|
|
7780
7895
|
);
|
|
7781
7896
|
};
|
|
7782
|
-
|
|
7783
|
-
new Assertion(obj, msg,
|
|
7897
|
+
assert2.ownPropertyVal = function(obj, prop, value, msg) {
|
|
7898
|
+
new Assertion(obj, msg, assert2.ownPropertyVal, true).to.have.own.property(
|
|
7784
7899
|
prop,
|
|
7785
7900
|
value
|
|
7786
7901
|
);
|
|
7787
7902
|
};
|
|
7788
|
-
|
|
7903
|
+
assert2.notOwnPropertyVal = function(obj, prop, value, msg) {
|
|
7789
7904
|
new Assertion(
|
|
7790
7905
|
obj,
|
|
7791
7906
|
msg,
|
|
7792
|
-
|
|
7907
|
+
assert2.notOwnPropertyVal,
|
|
7793
7908
|
true
|
|
7794
7909
|
).to.not.have.own.property(prop, value);
|
|
7795
7910
|
};
|
|
7796
|
-
|
|
7911
|
+
assert2.deepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
7797
7912
|
new Assertion(
|
|
7798
7913
|
obj,
|
|
7799
7914
|
msg,
|
|
7800
|
-
|
|
7915
|
+
assert2.deepOwnPropertyVal,
|
|
7801
7916
|
true
|
|
7802
7917
|
).to.have.deep.own.property(prop, value);
|
|
7803
7918
|
};
|
|
7804
|
-
|
|
7919
|
+
assert2.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
7805
7920
|
new Assertion(
|
|
7806
7921
|
obj,
|
|
7807
7922
|
msg,
|
|
7808
|
-
|
|
7923
|
+
assert2.notDeepOwnPropertyVal,
|
|
7809
7924
|
true
|
|
7810
7925
|
).to.not.have.deep.own.property(prop, value);
|
|
7811
7926
|
};
|
|
7812
|
-
|
|
7813
|
-
new Assertion(obj, msg,
|
|
7927
|
+
assert2.nestedProperty = function(obj, prop, msg) {
|
|
7928
|
+
new Assertion(obj, msg, assert2.nestedProperty, true).to.have.nested.property(
|
|
7814
7929
|
prop
|
|
7815
7930
|
);
|
|
7816
7931
|
};
|
|
7817
|
-
|
|
7932
|
+
assert2.notNestedProperty = function(obj, prop, msg) {
|
|
7818
7933
|
new Assertion(
|
|
7819
7934
|
obj,
|
|
7820
7935
|
msg,
|
|
7821
|
-
|
|
7936
|
+
assert2.notNestedProperty,
|
|
7822
7937
|
true
|
|
7823
7938
|
).to.not.have.nested.property(prop);
|
|
7824
7939
|
};
|
|
7825
|
-
|
|
7940
|
+
assert2.nestedPropertyVal = function(obj, prop, val, msg) {
|
|
7826
7941
|
new Assertion(
|
|
7827
7942
|
obj,
|
|
7828
7943
|
msg,
|
|
7829
|
-
|
|
7944
|
+
assert2.nestedPropertyVal,
|
|
7830
7945
|
true
|
|
7831
7946
|
).to.have.nested.property(prop, val);
|
|
7832
7947
|
};
|
|
7833
|
-
|
|
7948
|
+
assert2.notNestedPropertyVal = function(obj, prop, val, msg) {
|
|
7834
7949
|
new Assertion(
|
|
7835
7950
|
obj,
|
|
7836
7951
|
msg,
|
|
7837
|
-
|
|
7952
|
+
assert2.notNestedPropertyVal,
|
|
7838
7953
|
true
|
|
7839
7954
|
).to.not.have.nested.property(prop, val);
|
|
7840
7955
|
};
|
|
7841
|
-
|
|
7956
|
+
assert2.deepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
7842
7957
|
new Assertion(
|
|
7843
7958
|
obj,
|
|
7844
7959
|
msg,
|
|
7845
|
-
|
|
7960
|
+
assert2.deepNestedPropertyVal,
|
|
7846
7961
|
true
|
|
7847
7962
|
).to.have.deep.nested.property(prop, val);
|
|
7848
7963
|
};
|
|
7849
|
-
|
|
7964
|
+
assert2.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
7850
7965
|
new Assertion(
|
|
7851
7966
|
obj,
|
|
7852
7967
|
msg,
|
|
7853
|
-
|
|
7968
|
+
assert2.notDeepNestedPropertyVal,
|
|
7854
7969
|
true
|
|
7855
7970
|
).to.not.have.deep.nested.property(prop, val);
|
|
7856
7971
|
};
|
|
7857
|
-
|
|
7858
|
-
new Assertion(exp, msg,
|
|
7972
|
+
assert2.lengthOf = function(exp, len, msg) {
|
|
7973
|
+
new Assertion(exp, msg, assert2.lengthOf, true).to.have.lengthOf(len);
|
|
7859
7974
|
};
|
|
7860
|
-
|
|
7861
|
-
new Assertion(obj, msg,
|
|
7975
|
+
assert2.hasAnyKeys = function(obj, keys2, msg) {
|
|
7976
|
+
new Assertion(obj, msg, assert2.hasAnyKeys, true).to.have.any.keys(keys2);
|
|
7862
7977
|
};
|
|
7863
|
-
|
|
7864
|
-
new Assertion(obj, msg,
|
|
7978
|
+
assert2.hasAllKeys = function(obj, keys2, msg) {
|
|
7979
|
+
new Assertion(obj, msg, assert2.hasAllKeys, true).to.have.all.keys(keys2);
|
|
7865
7980
|
};
|
|
7866
|
-
|
|
7867
|
-
new Assertion(obj, msg,
|
|
7981
|
+
assert2.containsAllKeys = function(obj, keys2, msg) {
|
|
7982
|
+
new Assertion(obj, msg, assert2.containsAllKeys, true).to.contain.all.keys(
|
|
7868
7983
|
keys2
|
|
7869
7984
|
);
|
|
7870
7985
|
};
|
|
7871
|
-
|
|
7872
|
-
new Assertion(obj, msg,
|
|
7986
|
+
assert2.doesNotHaveAnyKeys = function(obj, keys2, msg) {
|
|
7987
|
+
new Assertion(obj, msg, assert2.doesNotHaveAnyKeys, true).to.not.have.any.keys(
|
|
7873
7988
|
keys2
|
|
7874
7989
|
);
|
|
7875
7990
|
};
|
|
7876
|
-
|
|
7877
|
-
new Assertion(obj, msg,
|
|
7991
|
+
assert2.doesNotHaveAllKeys = function(obj, keys2, msg) {
|
|
7992
|
+
new Assertion(obj, msg, assert2.doesNotHaveAllKeys, true).to.not.have.all.keys(
|
|
7878
7993
|
keys2
|
|
7879
7994
|
);
|
|
7880
7995
|
};
|
|
7881
|
-
|
|
7882
|
-
new Assertion(obj, msg,
|
|
7996
|
+
assert2.hasAnyDeepKeys = function(obj, keys2, msg) {
|
|
7997
|
+
new Assertion(obj, msg, assert2.hasAnyDeepKeys, true).to.have.any.deep.keys(
|
|
7883
7998
|
keys2
|
|
7884
7999
|
);
|
|
7885
8000
|
};
|
|
7886
|
-
|
|
7887
|
-
new Assertion(obj, msg,
|
|
8001
|
+
assert2.hasAllDeepKeys = function(obj, keys2, msg) {
|
|
8002
|
+
new Assertion(obj, msg, assert2.hasAllDeepKeys, true).to.have.all.deep.keys(
|
|
7888
8003
|
keys2
|
|
7889
8004
|
);
|
|
7890
8005
|
};
|
|
7891
|
-
|
|
8006
|
+
assert2.containsAllDeepKeys = function(obj, keys2, msg) {
|
|
7892
8007
|
new Assertion(
|
|
7893
8008
|
obj,
|
|
7894
8009
|
msg,
|
|
7895
|
-
|
|
8010
|
+
assert2.containsAllDeepKeys,
|
|
7896
8011
|
true
|
|
7897
8012
|
).to.contain.all.deep.keys(keys2);
|
|
7898
8013
|
};
|
|
7899
|
-
|
|
8014
|
+
assert2.doesNotHaveAnyDeepKeys = function(obj, keys2, msg) {
|
|
7900
8015
|
new Assertion(
|
|
7901
8016
|
obj,
|
|
7902
8017
|
msg,
|
|
7903
|
-
|
|
8018
|
+
assert2.doesNotHaveAnyDeepKeys,
|
|
7904
8019
|
true
|
|
7905
8020
|
).to.not.have.any.deep.keys(keys2);
|
|
7906
8021
|
};
|
|
7907
|
-
|
|
8022
|
+
assert2.doesNotHaveAllDeepKeys = function(obj, keys2, msg) {
|
|
7908
8023
|
new Assertion(
|
|
7909
8024
|
obj,
|
|
7910
8025
|
msg,
|
|
7911
|
-
|
|
8026
|
+
assert2.doesNotHaveAllDeepKeys,
|
|
7912
8027
|
true
|
|
7913
8028
|
).to.not.have.all.deep.keys(keys2);
|
|
7914
8029
|
};
|
|
7915
|
-
|
|
8030
|
+
assert2.throws = function(fn2, errorLike, errMsgMatcher, msg) {
|
|
7916
8031
|
if ("string" === typeof errorLike || errorLike instanceof RegExp) {
|
|
7917
8032
|
errMsgMatcher = errorLike;
|
|
7918
8033
|
errorLike = null;
|
|
7919
8034
|
}
|
|
7920
|
-
var assertErr = new Assertion(fn2, msg,
|
|
8035
|
+
var assertErr = new Assertion(fn2, msg, assert2.throws, true).to.throw(
|
|
7921
8036
|
errorLike,
|
|
7922
8037
|
errMsgMatcher
|
|
7923
8038
|
);
|
|
7924
8039
|
return flag(assertErr, "object");
|
|
7925
8040
|
};
|
|
7926
|
-
|
|
8041
|
+
assert2.doesNotThrow = function(fn2, errorLike, errMsgMatcher, message) {
|
|
7927
8042
|
if ("string" === typeof errorLike || errorLike instanceof RegExp) {
|
|
7928
8043
|
errMsgMatcher = errorLike;
|
|
7929
8044
|
errorLike = null;
|
|
7930
8045
|
}
|
|
7931
|
-
new Assertion(fn2, message,
|
|
8046
|
+
new Assertion(fn2, message, assert2.doesNotThrow, true).to.not.throw(
|
|
7932
8047
|
errorLike,
|
|
7933
8048
|
errMsgMatcher
|
|
7934
8049
|
);
|
|
7935
8050
|
};
|
|
7936
|
-
|
|
8051
|
+
assert2.operator = function(val, operator, val2, msg) {
|
|
7937
8052
|
var ok;
|
|
7938
8053
|
switch (operator) {
|
|
7939
8054
|
case "==":
|
|
@@ -7965,162 +8080,162 @@ assert.operator = function(val, operator, val2, msg) {
|
|
|
7965
8080
|
throw new AssertionError(
|
|
7966
8081
|
msg + 'Invalid operator "' + operator + '"',
|
|
7967
8082
|
void 0,
|
|
7968
|
-
|
|
8083
|
+
assert2.operator
|
|
7969
8084
|
);
|
|
7970
8085
|
}
|
|
7971
|
-
var test22 = new Assertion(ok, msg,
|
|
8086
|
+
var test22 = new Assertion(ok, msg, assert2.operator, true);
|
|
7972
8087
|
test22.assert(
|
|
7973
8088
|
true === flag(test22, "object"),
|
|
7974
8089
|
"expected " + inspect22(val) + " to be " + operator + " " + inspect22(val2),
|
|
7975
8090
|
"expected " + inspect22(val) + " to not be " + operator + " " + inspect22(val2)
|
|
7976
8091
|
);
|
|
7977
8092
|
};
|
|
7978
|
-
|
|
7979
|
-
new Assertion(act, msg,
|
|
8093
|
+
assert2.closeTo = function(act, exp, delta, msg) {
|
|
8094
|
+
new Assertion(act, msg, assert2.closeTo, true).to.be.closeTo(exp, delta);
|
|
7980
8095
|
};
|
|
7981
|
-
|
|
7982
|
-
new Assertion(act, msg,
|
|
8096
|
+
assert2.approximately = function(act, exp, delta, msg) {
|
|
8097
|
+
new Assertion(act, msg, assert2.approximately, true).to.be.approximately(
|
|
7983
8098
|
exp,
|
|
7984
8099
|
delta
|
|
7985
8100
|
);
|
|
7986
8101
|
};
|
|
7987
|
-
|
|
7988
|
-
new Assertion(set1, msg,
|
|
8102
|
+
assert2.sameMembers = function(set1, set22, msg) {
|
|
8103
|
+
new Assertion(set1, msg, assert2.sameMembers, true).to.have.same.members(set22);
|
|
7989
8104
|
};
|
|
7990
|
-
|
|
8105
|
+
assert2.notSameMembers = function(set1, set22, msg) {
|
|
7991
8106
|
new Assertion(
|
|
7992
8107
|
set1,
|
|
7993
8108
|
msg,
|
|
7994
|
-
|
|
8109
|
+
assert2.notSameMembers,
|
|
7995
8110
|
true
|
|
7996
8111
|
).to.not.have.same.members(set22);
|
|
7997
8112
|
};
|
|
7998
|
-
|
|
8113
|
+
assert2.sameDeepMembers = function(set1, set22, msg) {
|
|
7999
8114
|
new Assertion(
|
|
8000
8115
|
set1,
|
|
8001
8116
|
msg,
|
|
8002
|
-
|
|
8117
|
+
assert2.sameDeepMembers,
|
|
8003
8118
|
true
|
|
8004
8119
|
).to.have.same.deep.members(set22);
|
|
8005
8120
|
};
|
|
8006
|
-
|
|
8121
|
+
assert2.notSameDeepMembers = function(set1, set22, msg) {
|
|
8007
8122
|
new Assertion(
|
|
8008
8123
|
set1,
|
|
8009
8124
|
msg,
|
|
8010
|
-
|
|
8125
|
+
assert2.notSameDeepMembers,
|
|
8011
8126
|
true
|
|
8012
8127
|
).to.not.have.same.deep.members(set22);
|
|
8013
8128
|
};
|
|
8014
|
-
|
|
8129
|
+
assert2.sameOrderedMembers = function(set1, set22, msg) {
|
|
8015
8130
|
new Assertion(
|
|
8016
8131
|
set1,
|
|
8017
8132
|
msg,
|
|
8018
|
-
|
|
8133
|
+
assert2.sameOrderedMembers,
|
|
8019
8134
|
true
|
|
8020
8135
|
).to.have.same.ordered.members(set22);
|
|
8021
8136
|
};
|
|
8022
|
-
|
|
8137
|
+
assert2.notSameOrderedMembers = function(set1, set22, msg) {
|
|
8023
8138
|
new Assertion(
|
|
8024
8139
|
set1,
|
|
8025
8140
|
msg,
|
|
8026
|
-
|
|
8141
|
+
assert2.notSameOrderedMembers,
|
|
8027
8142
|
true
|
|
8028
8143
|
).to.not.have.same.ordered.members(set22);
|
|
8029
8144
|
};
|
|
8030
|
-
|
|
8145
|
+
assert2.sameDeepOrderedMembers = function(set1, set22, msg) {
|
|
8031
8146
|
new Assertion(
|
|
8032
8147
|
set1,
|
|
8033
8148
|
msg,
|
|
8034
|
-
|
|
8149
|
+
assert2.sameDeepOrderedMembers,
|
|
8035
8150
|
true
|
|
8036
8151
|
).to.have.same.deep.ordered.members(set22);
|
|
8037
8152
|
};
|
|
8038
|
-
|
|
8153
|
+
assert2.notSameDeepOrderedMembers = function(set1, set22, msg) {
|
|
8039
8154
|
new Assertion(
|
|
8040
8155
|
set1,
|
|
8041
8156
|
msg,
|
|
8042
|
-
|
|
8157
|
+
assert2.notSameDeepOrderedMembers,
|
|
8043
8158
|
true
|
|
8044
8159
|
).to.not.have.same.deep.ordered.members(set22);
|
|
8045
8160
|
};
|
|
8046
|
-
|
|
8047
|
-
new Assertion(superset, msg,
|
|
8161
|
+
assert2.includeMembers = function(superset, subset, msg) {
|
|
8162
|
+
new Assertion(superset, msg, assert2.includeMembers, true).to.include.members(
|
|
8048
8163
|
subset
|
|
8049
8164
|
);
|
|
8050
8165
|
};
|
|
8051
|
-
|
|
8166
|
+
assert2.notIncludeMembers = function(superset, subset, msg) {
|
|
8052
8167
|
new Assertion(
|
|
8053
8168
|
superset,
|
|
8054
8169
|
msg,
|
|
8055
|
-
|
|
8170
|
+
assert2.notIncludeMembers,
|
|
8056
8171
|
true
|
|
8057
8172
|
).to.not.include.members(subset);
|
|
8058
8173
|
};
|
|
8059
|
-
|
|
8174
|
+
assert2.includeDeepMembers = function(superset, subset, msg) {
|
|
8060
8175
|
new Assertion(
|
|
8061
8176
|
superset,
|
|
8062
8177
|
msg,
|
|
8063
|
-
|
|
8178
|
+
assert2.includeDeepMembers,
|
|
8064
8179
|
true
|
|
8065
8180
|
).to.include.deep.members(subset);
|
|
8066
8181
|
};
|
|
8067
|
-
|
|
8182
|
+
assert2.notIncludeDeepMembers = function(superset, subset, msg) {
|
|
8068
8183
|
new Assertion(
|
|
8069
8184
|
superset,
|
|
8070
8185
|
msg,
|
|
8071
|
-
|
|
8186
|
+
assert2.notIncludeDeepMembers,
|
|
8072
8187
|
true
|
|
8073
8188
|
).to.not.include.deep.members(subset);
|
|
8074
8189
|
};
|
|
8075
|
-
|
|
8190
|
+
assert2.includeOrderedMembers = function(superset, subset, msg) {
|
|
8076
8191
|
new Assertion(
|
|
8077
8192
|
superset,
|
|
8078
8193
|
msg,
|
|
8079
|
-
|
|
8194
|
+
assert2.includeOrderedMembers,
|
|
8080
8195
|
true
|
|
8081
8196
|
).to.include.ordered.members(subset);
|
|
8082
8197
|
};
|
|
8083
|
-
|
|
8198
|
+
assert2.notIncludeOrderedMembers = function(superset, subset, msg) {
|
|
8084
8199
|
new Assertion(
|
|
8085
8200
|
superset,
|
|
8086
8201
|
msg,
|
|
8087
|
-
|
|
8202
|
+
assert2.notIncludeOrderedMembers,
|
|
8088
8203
|
true
|
|
8089
8204
|
).to.not.include.ordered.members(subset);
|
|
8090
8205
|
};
|
|
8091
|
-
|
|
8206
|
+
assert2.includeDeepOrderedMembers = function(superset, subset, msg) {
|
|
8092
8207
|
new Assertion(
|
|
8093
8208
|
superset,
|
|
8094
8209
|
msg,
|
|
8095
|
-
|
|
8210
|
+
assert2.includeDeepOrderedMembers,
|
|
8096
8211
|
true
|
|
8097
8212
|
).to.include.deep.ordered.members(subset);
|
|
8098
8213
|
};
|
|
8099
|
-
|
|
8214
|
+
assert2.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
|
|
8100
8215
|
new Assertion(
|
|
8101
8216
|
superset,
|
|
8102
8217
|
msg,
|
|
8103
|
-
|
|
8218
|
+
assert2.notIncludeDeepOrderedMembers,
|
|
8104
8219
|
true
|
|
8105
8220
|
).to.not.include.deep.ordered.members(subset);
|
|
8106
8221
|
};
|
|
8107
|
-
|
|
8108
|
-
new Assertion(inList, msg,
|
|
8222
|
+
assert2.oneOf = function(inList, list, msg) {
|
|
8223
|
+
new Assertion(inList, msg, assert2.oneOf, true).to.be.oneOf(list);
|
|
8109
8224
|
};
|
|
8110
|
-
|
|
8225
|
+
assert2.isIterable = function(obj, msg) {
|
|
8111
8226
|
if (obj == void 0 || !obj[Symbol.iterator]) {
|
|
8112
8227
|
msg = msg ? `${msg} expected ${inspect22(obj)} to be an iterable` : `expected ${inspect22(obj)} to be an iterable`;
|
|
8113
|
-
throw new AssertionError(msg, void 0,
|
|
8228
|
+
throw new AssertionError(msg, void 0, assert2.isIterable);
|
|
8114
8229
|
}
|
|
8115
8230
|
};
|
|
8116
|
-
|
|
8231
|
+
assert2.changes = function(fn2, obj, prop, msg) {
|
|
8117
8232
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8118
8233
|
msg = prop;
|
|
8119
8234
|
prop = null;
|
|
8120
8235
|
}
|
|
8121
|
-
new Assertion(fn2, msg,
|
|
8236
|
+
new Assertion(fn2, msg, assert2.changes, true).to.change(obj, prop);
|
|
8122
8237
|
};
|
|
8123
|
-
|
|
8238
|
+
assert2.changesBy = function(fn2, obj, prop, delta, msg) {
|
|
8124
8239
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8125
8240
|
var tmpMsg = delta;
|
|
8126
8241
|
delta = prop;
|
|
@@ -8129,19 +8244,19 @@ assert.changesBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8129
8244
|
delta = prop;
|
|
8130
8245
|
prop = null;
|
|
8131
8246
|
}
|
|
8132
|
-
new Assertion(fn2, msg,
|
|
8247
|
+
new Assertion(fn2, msg, assert2.changesBy, true).to.change(obj, prop).by(delta);
|
|
8133
8248
|
};
|
|
8134
|
-
|
|
8249
|
+
assert2.doesNotChange = function(fn2, obj, prop, msg) {
|
|
8135
8250
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8136
8251
|
msg = prop;
|
|
8137
8252
|
prop = null;
|
|
8138
8253
|
}
|
|
8139
|
-
return new Assertion(fn2, msg,
|
|
8254
|
+
return new Assertion(fn2, msg, assert2.doesNotChange, true).to.not.change(
|
|
8140
8255
|
obj,
|
|
8141
8256
|
prop
|
|
8142
8257
|
);
|
|
8143
8258
|
};
|
|
8144
|
-
|
|
8259
|
+
assert2.changesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
8145
8260
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8146
8261
|
var tmpMsg = delta;
|
|
8147
8262
|
delta = prop;
|
|
@@ -8150,16 +8265,16 @@ assert.changesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8150
8265
|
delta = prop;
|
|
8151
8266
|
prop = null;
|
|
8152
8267
|
}
|
|
8153
|
-
new Assertion(fn2, msg,
|
|
8268
|
+
new Assertion(fn2, msg, assert2.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
|
|
8154
8269
|
};
|
|
8155
|
-
|
|
8270
|
+
assert2.increases = function(fn2, obj, prop, msg) {
|
|
8156
8271
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8157
8272
|
msg = prop;
|
|
8158
8273
|
prop = null;
|
|
8159
8274
|
}
|
|
8160
|
-
return new Assertion(fn2, msg,
|
|
8275
|
+
return new Assertion(fn2, msg, assert2.increases, true).to.increase(obj, prop);
|
|
8161
8276
|
};
|
|
8162
|
-
|
|
8277
|
+
assert2.increasesBy = function(fn2, obj, prop, delta, msg) {
|
|
8163
8278
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8164
8279
|
var tmpMsg = delta;
|
|
8165
8280
|
delta = prop;
|
|
@@ -8168,19 +8283,19 @@ assert.increasesBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8168
8283
|
delta = prop;
|
|
8169
8284
|
prop = null;
|
|
8170
8285
|
}
|
|
8171
|
-
new Assertion(fn2, msg,
|
|
8286
|
+
new Assertion(fn2, msg, assert2.increasesBy, true).to.increase(obj, prop).by(delta);
|
|
8172
8287
|
};
|
|
8173
|
-
|
|
8288
|
+
assert2.doesNotIncrease = function(fn2, obj, prop, msg) {
|
|
8174
8289
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8175
8290
|
msg = prop;
|
|
8176
8291
|
prop = null;
|
|
8177
8292
|
}
|
|
8178
|
-
return new Assertion(fn2, msg,
|
|
8293
|
+
return new Assertion(fn2, msg, assert2.doesNotIncrease, true).to.not.increase(
|
|
8179
8294
|
obj,
|
|
8180
8295
|
prop
|
|
8181
8296
|
);
|
|
8182
8297
|
};
|
|
8183
|
-
|
|
8298
|
+
assert2.increasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
8184
8299
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8185
8300
|
var tmpMsg = delta;
|
|
8186
8301
|
delta = prop;
|
|
@@ -8189,16 +8304,16 @@ assert.increasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8189
8304
|
delta = prop;
|
|
8190
8305
|
prop = null;
|
|
8191
8306
|
}
|
|
8192
|
-
new Assertion(fn2, msg,
|
|
8307
|
+
new Assertion(fn2, msg, assert2.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
|
|
8193
8308
|
};
|
|
8194
|
-
|
|
8309
|
+
assert2.decreases = function(fn2, obj, prop, msg) {
|
|
8195
8310
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8196
8311
|
msg = prop;
|
|
8197
8312
|
prop = null;
|
|
8198
8313
|
}
|
|
8199
|
-
return new Assertion(fn2, msg,
|
|
8314
|
+
return new Assertion(fn2, msg, assert2.decreases, true).to.decrease(obj, prop);
|
|
8200
8315
|
};
|
|
8201
|
-
|
|
8316
|
+
assert2.decreasesBy = function(fn2, obj, prop, delta, msg) {
|
|
8202
8317
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8203
8318
|
var tmpMsg = delta;
|
|
8204
8319
|
delta = prop;
|
|
@@ -8207,19 +8322,19 @@ assert.decreasesBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8207
8322
|
delta = prop;
|
|
8208
8323
|
prop = null;
|
|
8209
8324
|
}
|
|
8210
|
-
new Assertion(fn2, msg,
|
|
8325
|
+
new Assertion(fn2, msg, assert2.decreasesBy, true).to.decrease(obj, prop).by(delta);
|
|
8211
8326
|
};
|
|
8212
|
-
|
|
8327
|
+
assert2.doesNotDecrease = function(fn2, obj, prop, msg) {
|
|
8213
8328
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
8214
8329
|
msg = prop;
|
|
8215
8330
|
prop = null;
|
|
8216
8331
|
}
|
|
8217
|
-
return new Assertion(fn2, msg,
|
|
8332
|
+
return new Assertion(fn2, msg, assert2.doesNotDecrease, true).to.not.decrease(
|
|
8218
8333
|
obj,
|
|
8219
8334
|
prop
|
|
8220
8335
|
);
|
|
8221
8336
|
};
|
|
8222
|
-
|
|
8337
|
+
assert2.doesNotDecreaseBy = function(fn2, obj, prop, delta, msg) {
|
|
8223
8338
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8224
8339
|
var tmpMsg = delta;
|
|
8225
8340
|
delta = prop;
|
|
@@ -8228,9 +8343,9 @@ assert.doesNotDecreaseBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8228
8343
|
delta = prop;
|
|
8229
8344
|
prop = null;
|
|
8230
8345
|
}
|
|
8231
|
-
return new Assertion(fn2, msg,
|
|
8346
|
+
return new Assertion(fn2, msg, assert2.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
|
|
8232
8347
|
};
|
|
8233
|
-
|
|
8348
|
+
assert2.decreasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
8234
8349
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8235
8350
|
var tmpMsg = delta;
|
|
8236
8351
|
delta = prop;
|
|
@@ -8239,41 +8354,41 @@ assert.decreasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
|
8239
8354
|
delta = prop;
|
|
8240
8355
|
prop = null;
|
|
8241
8356
|
}
|
|
8242
|
-
new Assertion(fn2, msg,
|
|
8357
|
+
new Assertion(fn2, msg, assert2.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
|
|
8243
8358
|
};
|
|
8244
|
-
|
|
8359
|
+
assert2.ifError = function(val) {
|
|
8245
8360
|
if (val) {
|
|
8246
8361
|
throw val;
|
|
8247
8362
|
}
|
|
8248
8363
|
};
|
|
8249
|
-
|
|
8250
|
-
new Assertion(obj, msg,
|
|
8364
|
+
assert2.isExtensible = function(obj, msg) {
|
|
8365
|
+
new Assertion(obj, msg, assert2.isExtensible, true).to.be.extensible;
|
|
8251
8366
|
};
|
|
8252
|
-
|
|
8253
|
-
new Assertion(obj, msg,
|
|
8367
|
+
assert2.isNotExtensible = function(obj, msg) {
|
|
8368
|
+
new Assertion(obj, msg, assert2.isNotExtensible, true).to.not.be.extensible;
|
|
8254
8369
|
};
|
|
8255
|
-
|
|
8256
|
-
new Assertion(obj, msg,
|
|
8370
|
+
assert2.isSealed = function(obj, msg) {
|
|
8371
|
+
new Assertion(obj, msg, assert2.isSealed, true).to.be.sealed;
|
|
8257
8372
|
};
|
|
8258
|
-
|
|
8259
|
-
new Assertion(obj, msg,
|
|
8373
|
+
assert2.isNotSealed = function(obj, msg) {
|
|
8374
|
+
new Assertion(obj, msg, assert2.isNotSealed, true).to.not.be.sealed;
|
|
8260
8375
|
};
|
|
8261
|
-
|
|
8262
|
-
new Assertion(obj, msg,
|
|
8376
|
+
assert2.isFrozen = function(obj, msg) {
|
|
8377
|
+
new Assertion(obj, msg, assert2.isFrozen, true).to.be.frozen;
|
|
8263
8378
|
};
|
|
8264
|
-
|
|
8265
|
-
new Assertion(obj, msg,
|
|
8379
|
+
assert2.isNotFrozen = function(obj, msg) {
|
|
8380
|
+
new Assertion(obj, msg, assert2.isNotFrozen, true).to.not.be.frozen;
|
|
8266
8381
|
};
|
|
8267
|
-
|
|
8268
|
-
new Assertion(val, msg,
|
|
8382
|
+
assert2.isEmpty = function(val, msg) {
|
|
8383
|
+
new Assertion(val, msg, assert2.isEmpty, true).to.be.empty;
|
|
8269
8384
|
};
|
|
8270
|
-
|
|
8271
|
-
new Assertion(val, msg,
|
|
8385
|
+
assert2.isNotEmpty = function(val, msg) {
|
|
8386
|
+
new Assertion(val, msg, assert2.isNotEmpty, true).to.not.be.empty;
|
|
8272
8387
|
};
|
|
8273
|
-
|
|
8388
|
+
assert2.containsSubset = function(val, exp, msg) {
|
|
8274
8389
|
new Assertion(val, msg).to.containSubset(exp);
|
|
8275
8390
|
};
|
|
8276
|
-
|
|
8391
|
+
assert2.doesNotContainSubset = function(val, exp, msg) {
|
|
8277
8392
|
new Assertion(val, msg).to.not.containSubset(exp);
|
|
8278
8393
|
};
|
|
8279
8394
|
var aliases = [
|
|
@@ -8294,7 +8409,7 @@ var aliases = [
|
|
|
8294
8409
|
["containsSubset", "containSubset"]
|
|
8295
8410
|
];
|
|
8296
8411
|
for (const [name, as] of aliases) {
|
|
8297
|
-
|
|
8412
|
+
assert2[as] = assert2[name];
|
|
8298
8413
|
}
|
|
8299
8414
|
var used = [];
|
|
8300
8415
|
function use(fn2) {
|
|
@@ -8304,7 +8419,7 @@ function use(fn2) {
|
|
|
8304
8419
|
util: utils_exports,
|
|
8305
8420
|
config,
|
|
8306
8421
|
expect,
|
|
8307
|
-
assert,
|
|
8422
|
+
assert: assert2,
|
|
8308
8423
|
Assertion,
|
|
8309
8424
|
...should_exports
|
|
8310
8425
|
};
|
|
@@ -8316,7 +8431,7 @@ function use(fn2) {
|
|
|
8316
8431
|
}
|
|
8317
8432
|
__name(use, "use");
|
|
8318
8433
|
|
|
8319
|
-
// ../../node_modules/.pnpm/@vitest+expect@3.
|
|
8434
|
+
// ../../node_modules/.pnpm/@vitest+expect@3.2.2/node_modules/@vitest/expect/dist/index.js
|
|
8320
8435
|
var MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
8321
8436
|
var JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
8322
8437
|
var GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
@@ -8514,6 +8629,16 @@ function eq(a3, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
8514
8629
|
}
|
|
8515
8630
|
case "[object RegExp]":
|
|
8516
8631
|
return a3.source === b.source && a3.flags === b.flags;
|
|
8632
|
+
case "[object Temporal.Instant]":
|
|
8633
|
+
case "[object Temporal.ZonedDateTime]":
|
|
8634
|
+
case "[object Temporal.PlainDateTime]":
|
|
8635
|
+
case "[object Temporal.PlainDate]":
|
|
8636
|
+
case "[object Temporal.PlainTime]":
|
|
8637
|
+
case "[object Temporal.PlainYearMonth]":
|
|
8638
|
+
case "[object Temporal.PlainMonthDay]":
|
|
8639
|
+
return a3.equals(b);
|
|
8640
|
+
case "[object Temporal.Duration]":
|
|
8641
|
+
return a3.toString() === b.toString();
|
|
8517
8642
|
}
|
|
8518
8643
|
if (typeof a3 !== "object" || typeof b !== "object") {
|
|
8519
8644
|
return false;
|
|
@@ -8702,7 +8827,7 @@ function iterableEquality(a3, b, customTesters = [], aStack = [], bStack = []) {
|
|
|
8702
8827
|
if (!isImmutableList(a3) && !isImmutableOrderedKeyed(a3) && !isImmutableOrderedSet(a3) && !isImmutableRecord(a3)) {
|
|
8703
8828
|
const aEntries = Object.entries(a3);
|
|
8704
8829
|
const bEntries = Object.entries(b);
|
|
8705
|
-
if (!equals(aEntries, bEntries)) {
|
|
8830
|
+
if (!equals(aEntries, bEntries, filteredCustomTesters)) {
|
|
8706
8831
|
return false;
|
|
8707
8832
|
}
|
|
8708
8833
|
}
|
|
@@ -8879,6 +9004,7 @@ function setState(state, expect2) {
|
|
|
8879
9004
|
map2.set(expect2, results);
|
|
8880
9005
|
}
|
|
8881
9006
|
var AsymmetricMatcher3 = class {
|
|
9007
|
+
// should have "jest" to be compatible with its ecosystem
|
|
8882
9008
|
$$typeof = Symbol.for("jest.asymmetricMatcher");
|
|
8883
9009
|
constructor(sample, inverse = false) {
|
|
8884
9010
|
this.sample = sample;
|
|
@@ -9233,8 +9359,8 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
9233
9359
|
"throw",
|
|
9234
9360
|
"throws",
|
|
9235
9361
|
"Throw"
|
|
9236
|
-
].forEach((
|
|
9237
|
-
utils.overwriteMethod(chai2.Assertion.prototype,
|
|
9362
|
+
].forEach((m2) => {
|
|
9363
|
+
utils.overwriteMethod(chai2.Assertion.prototype, m2, (_super) => {
|
|
9238
9364
|
return function(...args) {
|
|
9239
9365
|
const promise = utils.flag(this, "promise");
|
|
9240
9366
|
const object2 = utils.flag(this, "object");
|
|
@@ -9459,7 +9585,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
9459
9585
|
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);
|
|
9460
9586
|
});
|
|
9461
9587
|
function assertIsMock(assertion) {
|
|
9462
|
-
if (!
|
|
9588
|
+
if (!isMockFunction2(assertion._obj)) {
|
|
9463
9589
|
throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
|
|
9464
9590
|
}
|
|
9465
9591
|
}
|
|
@@ -9561,14 +9687,14 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
9561
9687
|
}
|
|
9562
9688
|
def(["toHaveBeenCalledBefore"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
9563
9689
|
const expectSpy = getSpy(this);
|
|
9564
|
-
if (!
|
|
9690
|
+
if (!isMockFunction2(resultSpy)) {
|
|
9565
9691
|
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
9566
9692
|
}
|
|
9567
9693
|
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);
|
|
9568
9694
|
});
|
|
9569
9695
|
def(["toHaveBeenCalledAfter"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
9570
9696
|
const expectSpy = getSpy(this);
|
|
9571
|
-
if (!
|
|
9697
|
+
if (!isMockFunction2(resultSpy)) {
|
|
9572
9698
|
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
9573
9699
|
}
|
|
9574
9700
|
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);
|
|
@@ -9697,14 +9823,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
9697
9823
|
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
9698
9824
|
const result = results[results.length - 1];
|
|
9699
9825
|
const spyName = spy.getMockName();
|
|
9700
|
-
this.assert(
|
|
9701
|
-
condition(spy, value),
|
|
9702
|
-
`expected last "${spyName}" call to ${action} #{exp}`,
|
|
9703
|
-
`expected last "${spyName}" call to not ${action} #{exp}`,
|
|
9704
|
-
value,
|
|
9705
|
-
// for jest compat
|
|
9706
|
-
result === null || result === void 0 ? void 0 : result.value
|
|
9707
|
-
);
|
|
9826
|
+
this.assert(condition(spy, value), `expected last "${spyName}" call to ${action} #{exp}`, `expected last "${spyName}" call to not ${action} #{exp}`, value, result === null || result === void 0 ? void 0 : result.value);
|
|
9708
9827
|
});
|
|
9709
9828
|
});
|
|
9710
9829
|
[{
|
|
@@ -9810,14 +9929,14 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
9810
9929
|
};
|
|
9811
9930
|
function ordinalOf(i) {
|
|
9812
9931
|
const j = i % 10;
|
|
9813
|
-
const
|
|
9814
|
-
if (j === 1 &&
|
|
9932
|
+
const k = i % 100;
|
|
9933
|
+
if (j === 1 && k !== 11) {
|
|
9815
9934
|
return `${i}st`;
|
|
9816
9935
|
}
|
|
9817
|
-
if (j === 2 &&
|
|
9936
|
+
if (j === 2 && k !== 12) {
|
|
9818
9937
|
return `${i}nd`;
|
|
9819
9938
|
}
|
|
9820
|
-
if (j === 3 &&
|
|
9939
|
+
if (j === 3 && k !== 13) {
|
|
9821
9940
|
return `${i}rd`;
|
|
9822
9941
|
}
|
|
9823
9942
|
return `${i}th`;
|
|
@@ -10281,53 +10400,7 @@ var isAbsolute2 = function(p3) {
|
|
|
10281
10400
|
return _IS_ABSOLUTE_RE2.test(p3);
|
|
10282
10401
|
};
|
|
10283
10402
|
|
|
10284
|
-
// ../../node_modules/.pnpm/@vitest+runner@3.
|
|
10285
|
-
function createChainable(keys2, fn2) {
|
|
10286
|
-
function create(context) {
|
|
10287
|
-
const chain2 = function(...args) {
|
|
10288
|
-
return fn2.apply(context, args);
|
|
10289
|
-
};
|
|
10290
|
-
Object.assign(chain2, fn2);
|
|
10291
|
-
chain2.withContext = () => chain2.bind(context);
|
|
10292
|
-
chain2.setContext = (key, value) => {
|
|
10293
|
-
context[key] = value;
|
|
10294
|
-
};
|
|
10295
|
-
chain2.mergeContext = (ctx) => {
|
|
10296
|
-
Object.assign(context, ctx);
|
|
10297
|
-
};
|
|
10298
|
-
for (const key of keys2) {
|
|
10299
|
-
Object.defineProperty(chain2, key, { get() {
|
|
10300
|
-
return create({
|
|
10301
|
-
...context,
|
|
10302
|
-
[key]: true
|
|
10303
|
-
});
|
|
10304
|
-
} });
|
|
10305
|
-
}
|
|
10306
|
-
return chain2;
|
|
10307
|
-
}
|
|
10308
|
-
const chain = create({});
|
|
10309
|
-
chain.fn = fn2;
|
|
10310
|
-
return chain;
|
|
10311
|
-
}
|
|
10312
|
-
function getNames(task) {
|
|
10313
|
-
const names = [task.name];
|
|
10314
|
-
let current = task;
|
|
10315
|
-
while (current === null || current === void 0 ? void 0 : current.suite) {
|
|
10316
|
-
current = current.suite;
|
|
10317
|
-
if (current === null || current === void 0 ? void 0 : current.name) {
|
|
10318
|
-
names.unshift(current.name);
|
|
10319
|
-
}
|
|
10320
|
-
}
|
|
10321
|
-
if (current !== task.file) {
|
|
10322
|
-
names.unshift(task.file.name);
|
|
10323
|
-
}
|
|
10324
|
-
return names;
|
|
10325
|
-
}
|
|
10326
|
-
function getTestName(task, separator = " > ") {
|
|
10327
|
-
return getNames(task).slice(1).join(separator);
|
|
10328
|
-
}
|
|
10329
|
-
|
|
10330
|
-
// ../../node_modules/.pnpm/@vitest+runner@3.1.2/node_modules/@vitest/runner/dist/index.js
|
|
10403
|
+
// ../../node_modules/.pnpm/@vitest+runner@3.2.2/node_modules/@vitest/runner/dist/chunk-hooks.js
|
|
10331
10404
|
var PendingError = class extends Error {
|
|
10332
10405
|
code = "VITEST_PENDING";
|
|
10333
10406
|
taskId;
|
|
@@ -10373,14 +10446,23 @@ function mergeScopedFixtures(testFixtures, scopedFixtures) {
|
|
|
10373
10446
|
}
|
|
10374
10447
|
return Object.values(newFixtures);
|
|
10375
10448
|
}
|
|
10376
|
-
function mergeContextFixtures(fixtures, context,
|
|
10377
|
-
const fixtureOptionKeys = [
|
|
10449
|
+
function mergeContextFixtures(fixtures, context, runner2) {
|
|
10450
|
+
const fixtureOptionKeys = [
|
|
10451
|
+
"auto",
|
|
10452
|
+
"injected",
|
|
10453
|
+
"scope"
|
|
10454
|
+
];
|
|
10378
10455
|
const fixtureArray = Object.entries(fixtures).map(([prop, value]) => {
|
|
10379
10456
|
const fixtureItem = { value };
|
|
10380
10457
|
if (Array.isArray(value) && value.length >= 2 && isObject(value[1]) && Object.keys(value[1]).some((key) => fixtureOptionKeys.includes(key))) {
|
|
10458
|
+
var _runner$injectValue;
|
|
10381
10459
|
Object.assign(fixtureItem, value[1]);
|
|
10382
10460
|
const userValue = value[0];
|
|
10383
|
-
fixtureItem.value = fixtureItem.injected ?
|
|
10461
|
+
fixtureItem.value = fixtureItem.injected ? ((_runner$injectValue = runner2.injectValue) === null || _runner$injectValue === void 0 ? void 0 : _runner$injectValue.call(runner2, prop)) ?? userValue : userValue;
|
|
10462
|
+
}
|
|
10463
|
+
fixtureItem.scope = fixtureItem.scope || "test";
|
|
10464
|
+
if (fixtureItem.scope === "worker" && !runner2.getWorkerContext) {
|
|
10465
|
+
fixtureItem.scope = "file";
|
|
10384
10466
|
}
|
|
10385
10467
|
fixtureItem.prop = prop;
|
|
10386
10468
|
fixtureItem.isFn = typeof fixtureItem.value === "function";
|
|
@@ -10397,13 +10479,28 @@ function mergeContextFixtures(fixtures, context, inject2) {
|
|
|
10397
10479
|
if (usedProps.length) {
|
|
10398
10480
|
fixture.deps = context.fixtures.filter(({ prop }) => prop !== fixture.prop && usedProps.includes(prop));
|
|
10399
10481
|
}
|
|
10482
|
+
if (fixture.scope !== "test") {
|
|
10483
|
+
var _fixture$deps2;
|
|
10484
|
+
(_fixture$deps2 = fixture.deps) === null || _fixture$deps2 === void 0 ? void 0 : _fixture$deps2.forEach((dep) => {
|
|
10485
|
+
if (!dep.isFn) {
|
|
10486
|
+
return;
|
|
10487
|
+
}
|
|
10488
|
+
if (fixture.scope === "worker" && dep.scope === "worker") {
|
|
10489
|
+
return;
|
|
10490
|
+
}
|
|
10491
|
+
if (fixture.scope === "file" && dep.scope !== "test") {
|
|
10492
|
+
return;
|
|
10493
|
+
}
|
|
10494
|
+
throw new SyntaxError(`cannot use the ${dep.scope} fixture "${dep.prop}" inside the ${fixture.scope} fixture "${fixture.prop}"`);
|
|
10495
|
+
});
|
|
10496
|
+
}
|
|
10400
10497
|
}
|
|
10401
10498
|
});
|
|
10402
10499
|
return context;
|
|
10403
10500
|
}
|
|
10404
10501
|
var fixtureValueMaps = /* @__PURE__ */ new Map();
|
|
10405
10502
|
var cleanupFnArrayMap = /* @__PURE__ */ new Map();
|
|
10406
|
-
function withFixtures(fn2, testContext) {
|
|
10503
|
+
function withFixtures(runner2, fn2, testContext) {
|
|
10407
10504
|
return (hookContext) => {
|
|
10408
10505
|
const context = hookContext || testContext;
|
|
10409
10506
|
if (!context) {
|
|
@@ -10436,17 +10533,63 @@ function withFixtures(fn2, testContext) {
|
|
|
10436
10533
|
if (fixtureValueMap.has(fixture)) {
|
|
10437
10534
|
continue;
|
|
10438
10535
|
}
|
|
10439
|
-
const resolvedValue =
|
|
10536
|
+
const resolvedValue = await resolveFixtureValue(runner2, fixture, context, cleanupFnArray);
|
|
10440
10537
|
context[fixture.prop] = resolvedValue;
|
|
10441
10538
|
fixtureValueMap.set(fixture, resolvedValue);
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10539
|
+
if (fixture.scope === "test") {
|
|
10540
|
+
cleanupFnArray.unshift(() => {
|
|
10541
|
+
fixtureValueMap.delete(fixture);
|
|
10542
|
+
});
|
|
10543
|
+
}
|
|
10445
10544
|
}
|
|
10446
10545
|
}
|
|
10447
10546
|
return resolveFixtures().then(() => fn2(context));
|
|
10448
10547
|
};
|
|
10449
10548
|
}
|
|
10549
|
+
var globalFixturePromise = /* @__PURE__ */ new WeakMap();
|
|
10550
|
+
function resolveFixtureValue(runner2, fixture, context, cleanupFnArray) {
|
|
10551
|
+
var _runner$getWorkerCont;
|
|
10552
|
+
const fileContext = getFileContext(context.task.file);
|
|
10553
|
+
const workerContext = (_runner$getWorkerCont = runner2.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner2);
|
|
10554
|
+
if (!fixture.isFn) {
|
|
10555
|
+
var _fixture$prop;
|
|
10556
|
+
fileContext[_fixture$prop = fixture.prop] ?? (fileContext[_fixture$prop] = fixture.value);
|
|
10557
|
+
if (workerContext) {
|
|
10558
|
+
var _fixture$prop2;
|
|
10559
|
+
workerContext[_fixture$prop2 = fixture.prop] ?? (workerContext[_fixture$prop2] = fixture.value);
|
|
10560
|
+
}
|
|
10561
|
+
return fixture.value;
|
|
10562
|
+
}
|
|
10563
|
+
if (fixture.scope === "test") {
|
|
10564
|
+
return resolveFixtureFunction(fixture.value, context, cleanupFnArray);
|
|
10565
|
+
}
|
|
10566
|
+
if (globalFixturePromise.has(fixture)) {
|
|
10567
|
+
return globalFixturePromise.get(fixture);
|
|
10568
|
+
}
|
|
10569
|
+
let fixtureContext;
|
|
10570
|
+
if (fixture.scope === "worker") {
|
|
10571
|
+
if (!workerContext) {
|
|
10572
|
+
throw new TypeError("[@vitest/runner] The worker context is not available in the current test runner. Please, provide the `getWorkerContext` method when initiating the runner.");
|
|
10573
|
+
}
|
|
10574
|
+
fixtureContext = workerContext;
|
|
10575
|
+
} else {
|
|
10576
|
+
fixtureContext = fileContext;
|
|
10577
|
+
}
|
|
10578
|
+
if (fixture.prop in fixtureContext) {
|
|
10579
|
+
return fixtureContext[fixture.prop];
|
|
10580
|
+
}
|
|
10581
|
+
if (!cleanupFnArrayMap.has(fixtureContext)) {
|
|
10582
|
+
cleanupFnArrayMap.set(fixtureContext, []);
|
|
10583
|
+
}
|
|
10584
|
+
const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
|
|
10585
|
+
const promise = resolveFixtureFunction(fixture.value, fixtureContext, cleanupFnFileArray).then((value) => {
|
|
10586
|
+
fixtureContext[fixture.prop] = value;
|
|
10587
|
+
globalFixturePromise.delete(fixture);
|
|
10588
|
+
return value;
|
|
10589
|
+
});
|
|
10590
|
+
globalFixturePromise.set(fixture, promise);
|
|
10591
|
+
return promise;
|
|
10592
|
+
}
|
|
10450
10593
|
async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) {
|
|
10451
10594
|
const useFnArgPromise = createDefer();
|
|
10452
10595
|
let isUseFnArgResolved = false;
|
|
@@ -10478,7 +10621,7 @@ function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtur
|
|
|
10478
10621
|
return;
|
|
10479
10622
|
}
|
|
10480
10623
|
if (depSet.has(fixture)) {
|
|
10481
|
-
throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((
|
|
10624
|
+
throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((d) => d.prop).join(" <- ")}`);
|
|
10482
10625
|
}
|
|
10483
10626
|
depSet.add(fixture);
|
|
10484
10627
|
resolveDeps(fixture.deps, depSet, pendingFixtures);
|
|
@@ -10489,8 +10632,8 @@ function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtur
|
|
|
10489
10632
|
}
|
|
10490
10633
|
function getUsedProps(fn2) {
|
|
10491
10634
|
let fnString = fn2.toString();
|
|
10492
|
-
if (/__async\(this, (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
|
|
10493
|
-
fnString = fnString.split(
|
|
10635
|
+
if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
|
|
10636
|
+
fnString = fnString.split(/__async\((?:this|null),/)[1];
|
|
10494
10637
|
}
|
|
10495
10638
|
const match = fnString.match(/[^(]*\(([^)]*)/);
|
|
10496
10639
|
if (!match) {
|
|
@@ -10547,6 +10690,33 @@ var _test;
|
|
|
10547
10690
|
function getCurrentTest() {
|
|
10548
10691
|
return _test;
|
|
10549
10692
|
}
|
|
10693
|
+
function createChainable(keys2, fn2) {
|
|
10694
|
+
function create(context) {
|
|
10695
|
+
const chain2 = function(...args) {
|
|
10696
|
+
return fn2.apply(context, args);
|
|
10697
|
+
};
|
|
10698
|
+
Object.assign(chain2, fn2);
|
|
10699
|
+
chain2.withContext = () => chain2.bind(context);
|
|
10700
|
+
chain2.setContext = (key, value) => {
|
|
10701
|
+
context[key] = value;
|
|
10702
|
+
};
|
|
10703
|
+
chain2.mergeContext = (ctx) => {
|
|
10704
|
+
Object.assign(context, ctx);
|
|
10705
|
+
};
|
|
10706
|
+
for (const key of keys2) {
|
|
10707
|
+
Object.defineProperty(chain2, key, { get() {
|
|
10708
|
+
return create({
|
|
10709
|
+
...context,
|
|
10710
|
+
[key]: true
|
|
10711
|
+
});
|
|
10712
|
+
} });
|
|
10713
|
+
}
|
|
10714
|
+
return chain2;
|
|
10715
|
+
}
|
|
10716
|
+
const chain = create({});
|
|
10717
|
+
chain.fn = fn2;
|
|
10718
|
+
return chain;
|
|
10719
|
+
}
|
|
10550
10720
|
var suite = createSuite();
|
|
10551
10721
|
var test3 = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
10552
10722
|
getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
|
|
@@ -10556,7 +10726,7 @@ var it = test3;
|
|
|
10556
10726
|
var runner;
|
|
10557
10727
|
var defaultSuite;
|
|
10558
10728
|
var currentTestFilepath;
|
|
10559
|
-
function
|
|
10729
|
+
function assert3(condition, message) {
|
|
10560
10730
|
if (!condition) {
|
|
10561
10731
|
throw new Error(`Vitest failed to find ${message}. This is a bug in Vitest. Please, open an issue with reproduction.`);
|
|
10562
10732
|
}
|
|
@@ -10565,12 +10735,12 @@ function getTestFilepath() {
|
|
|
10565
10735
|
return currentTestFilepath;
|
|
10566
10736
|
}
|
|
10567
10737
|
function getRunner() {
|
|
10568
|
-
|
|
10738
|
+
assert3(runner, "the runner");
|
|
10569
10739
|
return runner;
|
|
10570
10740
|
}
|
|
10571
10741
|
function getCurrentSuite() {
|
|
10572
10742
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
10573
|
-
|
|
10743
|
+
assert3(currentSuite, "the current suite");
|
|
10574
10744
|
return currentSuite;
|
|
10575
10745
|
}
|
|
10576
10746
|
function createSuiteHooks() {
|
|
@@ -10630,7 +10800,8 @@ function createSuiteCollector(name, factory = () => {
|
|
|
10630
10800
|
retry: options.retry ?? runner.config.retry,
|
|
10631
10801
|
repeats: options.repeats,
|
|
10632
10802
|
mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
|
|
10633
|
-
meta: options.meta ?? /* @__PURE__ */ Object.create(null)
|
|
10803
|
+
meta: options.meta ?? /* @__PURE__ */ Object.create(null),
|
|
10804
|
+
annotations: []
|
|
10634
10805
|
};
|
|
10635
10806
|
const handler = options.handler;
|
|
10636
10807
|
if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) {
|
|
@@ -10648,11 +10819,11 @@ function createSuiteCollector(name, factory = () => {
|
|
|
10648
10819
|
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
10649
10820
|
Error.stackTraceLimit = limit;
|
|
10650
10821
|
if (handler) {
|
|
10651
|
-
setFn(task2, withTimeout(withAwaitAsyncAssertions(withFixtures(handler, context), task2), timeout, false, stackTraceError));
|
|
10822
|
+
setFn(task2, withTimeout(withAwaitAsyncAssertions(withFixtures(runner, handler, context), task2), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
|
|
10652
10823
|
}
|
|
10653
10824
|
if (runner.config.includeTaskLocation) {
|
|
10654
10825
|
const error = stackTraceError.stack;
|
|
10655
|
-
const stack = findTestFileStackTrace(error
|
|
10826
|
+
const stack = findTestFileStackTrace(error);
|
|
10656
10827
|
if (stack) {
|
|
10657
10828
|
task2.location = stack;
|
|
10658
10829
|
}
|
|
@@ -10691,10 +10862,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
10691
10862
|
return collectorFixtures;
|
|
10692
10863
|
},
|
|
10693
10864
|
scoped(fixtures) {
|
|
10694
|
-
const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures },
|
|
10695
|
-
var _getRunner$injectValu, _getRunner;
|
|
10696
|
-
return (_getRunner$injectValu = (_getRunner = getRunner()).injectValue) === null || _getRunner$injectValu === void 0 ? void 0 : _getRunner$injectValu.call(_getRunner, key);
|
|
10697
|
-
});
|
|
10865
|
+
const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures }, runner);
|
|
10698
10866
|
if (parsed.fixtures) {
|
|
10699
10867
|
collectorFixtures = parsed.fixtures;
|
|
10700
10868
|
}
|
|
@@ -10892,10 +11060,7 @@ function createTaskCollector(fn2, context) {
|
|
|
10892
11060
|
collector.scoped(fixtures);
|
|
10893
11061
|
};
|
|
10894
11062
|
taskFn.extend = function(fixtures) {
|
|
10895
|
-
const _context = mergeContextFixtures(fixtures, context || {},
|
|
10896
|
-
var _getRunner$injectValu2, _getRunner2;
|
|
10897
|
-
return (_getRunner$injectValu2 = (_getRunner2 = getRunner()).injectValue) === null || _getRunner$injectValu2 === void 0 ? void 0 : _getRunner$injectValu2.call(_getRunner2, key);
|
|
10898
|
-
});
|
|
11063
|
+
const _context = mergeContextFixtures(fixtures, context || {}, runner);
|
|
10899
11064
|
return createTest(function fn3(name, optionsOrFn, optionsOrTest) {
|
|
10900
11065
|
const collector = getCurrentSuite();
|
|
10901
11066
|
const scopedFixtures = collector.fixtures();
|
|
@@ -10967,19 +11132,66 @@ function formatTemplateString(cases, args) {
|
|
|
10967
11132
|
}
|
|
10968
11133
|
return res;
|
|
10969
11134
|
}
|
|
10970
|
-
function findTestFileStackTrace(error
|
|
11135
|
+
function findTestFileStackTrace(error) {
|
|
11136
|
+
const testFilePath = getTestFilepath();
|
|
10971
11137
|
const lines = error.split("\n").slice(1);
|
|
10972
11138
|
for (const line of lines) {
|
|
10973
11139
|
const stack = parseSingleStack(line);
|
|
10974
|
-
if (stack && stack.file ===
|
|
11140
|
+
if (stack && stack.file === testFilePath) {
|
|
10975
11141
|
return {
|
|
10976
11142
|
line: stack.line,
|
|
10977
|
-
column:
|
|
11143
|
+
column: stack.column
|
|
10978
11144
|
};
|
|
10979
11145
|
}
|
|
10980
11146
|
}
|
|
10981
11147
|
}
|
|
10982
|
-
|
|
11148
|
+
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
11149
|
+
function getNames(task) {
|
|
11150
|
+
const names = [task.name];
|
|
11151
|
+
let current = task;
|
|
11152
|
+
while (current === null || current === void 0 ? void 0 : current.suite) {
|
|
11153
|
+
current = current.suite;
|
|
11154
|
+
if (current === null || current === void 0 ? void 0 : current.name) {
|
|
11155
|
+
names.unshift(current.name);
|
|
11156
|
+
}
|
|
11157
|
+
}
|
|
11158
|
+
if (current !== task.file) {
|
|
11159
|
+
names.unshift(task.file.name);
|
|
11160
|
+
}
|
|
11161
|
+
return names;
|
|
11162
|
+
}
|
|
11163
|
+
function getTestName(task, separator = " > ") {
|
|
11164
|
+
return getNames(task).slice(1).join(separator);
|
|
11165
|
+
}
|
|
11166
|
+
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
11167
|
+
var packs = /* @__PURE__ */ new Map();
|
|
11168
|
+
var eventsPacks = [];
|
|
11169
|
+
var pendingTasksUpdates = [];
|
|
11170
|
+
function sendTasksUpdate(runner2) {
|
|
11171
|
+
if (packs.size) {
|
|
11172
|
+
var _runner$onTaskUpdate;
|
|
11173
|
+
const taskPacks = Array.from(packs).map(([id, task]) => {
|
|
11174
|
+
return [
|
|
11175
|
+
id,
|
|
11176
|
+
task[0],
|
|
11177
|
+
task[1]
|
|
11178
|
+
];
|
|
11179
|
+
});
|
|
11180
|
+
const p3 = (_runner$onTaskUpdate = runner2.onTaskUpdate) === null || _runner$onTaskUpdate === void 0 ? void 0 : _runner$onTaskUpdate.call(runner2, taskPacks, eventsPacks);
|
|
11181
|
+
if (p3) {
|
|
11182
|
+
pendingTasksUpdates.push(p3);
|
|
11183
|
+
p3.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p3), 1), () => {
|
|
11184
|
+
});
|
|
11185
|
+
}
|
|
11186
|
+
eventsPacks.length = 0;
|
|
11187
|
+
packs.clear();
|
|
11188
|
+
}
|
|
11189
|
+
}
|
|
11190
|
+
async function finishSendTasksUpdate(runner2) {
|
|
11191
|
+
sendTasksUpdate(runner2);
|
|
11192
|
+
await Promise.all(pendingTasksUpdates);
|
|
11193
|
+
}
|
|
11194
|
+
var now = Date.now;
|
|
10983
11195
|
var collectorContext = {
|
|
10984
11196
|
currentSuite: null
|
|
10985
11197
|
};
|
|
@@ -10993,13 +11205,13 @@ async function runWithSuite(suite2, fn2) {
|
|
|
10993
11205
|
await fn2();
|
|
10994
11206
|
collectorContext.currentSuite = prev;
|
|
10995
11207
|
}
|
|
10996
|
-
function withTimeout(fn2, timeout, isHook = false, stackTraceError) {
|
|
11208
|
+
function withTimeout(fn2, timeout, isHook = false, stackTraceError, onTimeout) {
|
|
10997
11209
|
if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) {
|
|
10998
11210
|
return fn2;
|
|
10999
11211
|
}
|
|
11000
11212
|
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
11001
11213
|
return function runWithTimeout(...args) {
|
|
11002
|
-
const startTime = now
|
|
11214
|
+
const startTime = now();
|
|
11003
11215
|
const runner2 = getRunner();
|
|
11004
11216
|
runner2._currentTaskStartTime = startTime;
|
|
11005
11217
|
runner2._currentTaskTimeout = timeout;
|
|
@@ -11011,13 +11223,15 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError) {
|
|
|
11011
11223
|
}, timeout);
|
|
11012
11224
|
(_timer$unref = timer.unref) === null || _timer$unref === void 0 ? void 0 : _timer$unref.call(timer);
|
|
11013
11225
|
function rejectTimeoutError() {
|
|
11014
|
-
|
|
11226
|
+
const error = makeTimeoutError(isHook, timeout, stackTraceError);
|
|
11227
|
+
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(args, error);
|
|
11228
|
+
reject_(error);
|
|
11015
11229
|
}
|
|
11016
11230
|
function resolve4(result) {
|
|
11017
11231
|
runner2._currentTaskStartTime = void 0;
|
|
11018
11232
|
runner2._currentTaskTimeout = void 0;
|
|
11019
11233
|
clearTimeout(timer);
|
|
11020
|
-
if (now
|
|
11234
|
+
if (now() - startTime >= timeout) {
|
|
11021
11235
|
rejectTimeoutError();
|
|
11022
11236
|
return;
|
|
11023
11237
|
}
|
|
@@ -11042,11 +11256,27 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError) {
|
|
|
11042
11256
|
});
|
|
11043
11257
|
};
|
|
11044
11258
|
}
|
|
11259
|
+
var abortControllers = /* @__PURE__ */ new WeakMap();
|
|
11260
|
+
function abortIfTimeout([context], error) {
|
|
11261
|
+
if (context) {
|
|
11262
|
+
abortContextSignal(context, error);
|
|
11263
|
+
}
|
|
11264
|
+
}
|
|
11265
|
+
function abortContextSignal(context, error) {
|
|
11266
|
+
const abortController = abortControllers.get(context);
|
|
11267
|
+
abortController === null || abortController === void 0 ? void 0 : abortController.abort(error);
|
|
11268
|
+
}
|
|
11045
11269
|
function createTestContext(test5, runner2) {
|
|
11046
11270
|
var _runner$extendTaskCon;
|
|
11047
11271
|
const context = function() {
|
|
11048
11272
|
throw new Error("done() callback is deprecated, use promise instead");
|
|
11049
11273
|
};
|
|
11274
|
+
let abortController = abortControllers.get(context);
|
|
11275
|
+
if (!abortController) {
|
|
11276
|
+
abortController = new AbortController();
|
|
11277
|
+
abortControllers.set(context, abortController);
|
|
11278
|
+
}
|
|
11279
|
+
context.signal = abortController.signal;
|
|
11050
11280
|
context.task = test5;
|
|
11051
11281
|
context.skip = (condition, note) => {
|
|
11052
11282
|
if (condition === false) {
|
|
@@ -11056,13 +11286,63 @@ function createTestContext(test5, runner2) {
|
|
|
11056
11286
|
test5.result.pending = true;
|
|
11057
11287
|
throw new PendingError("test is skipped; abort execution", test5, typeof condition === "string" ? condition : note);
|
|
11058
11288
|
};
|
|
11289
|
+
async function annotate(message, location, type3, attachment) {
|
|
11290
|
+
const annotation = {
|
|
11291
|
+
message,
|
|
11292
|
+
type: type3 || "notice"
|
|
11293
|
+
};
|
|
11294
|
+
if (attachment) {
|
|
11295
|
+
if (!attachment.body && !attachment.path) {
|
|
11296
|
+
throw new TypeError(`Test attachment requires body or path to be set. Both are missing.`);
|
|
11297
|
+
}
|
|
11298
|
+
if (attachment.body && attachment.path) {
|
|
11299
|
+
throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
|
|
11300
|
+
}
|
|
11301
|
+
annotation.attachment = attachment;
|
|
11302
|
+
if (attachment.body instanceof Uint8Array) {
|
|
11303
|
+
attachment.body = encodeUint8Array(attachment.body);
|
|
11304
|
+
}
|
|
11305
|
+
}
|
|
11306
|
+
if (location) {
|
|
11307
|
+
annotation.location = location;
|
|
11308
|
+
}
|
|
11309
|
+
if (!runner2.onTestAnnotate) {
|
|
11310
|
+
throw new Error(`Test runner doesn't support test annotations.`);
|
|
11311
|
+
}
|
|
11312
|
+
await finishSendTasksUpdate(runner2);
|
|
11313
|
+
const resolvedAnnotation = await runner2.onTestAnnotate(test5, annotation);
|
|
11314
|
+
test5.annotations.push(resolvedAnnotation);
|
|
11315
|
+
return resolvedAnnotation;
|
|
11316
|
+
}
|
|
11317
|
+
context.annotate = (message, type3, attachment) => {
|
|
11318
|
+
if (test5.result && test5.result.state !== "run") {
|
|
11319
|
+
throw new Error(`Cannot annotate tests outside of the test run. The test "${test5.name}" finished running with the "${test5.result.state}" state already.`);
|
|
11320
|
+
}
|
|
11321
|
+
let location;
|
|
11322
|
+
const stack = new Error("STACK_TRACE").stack;
|
|
11323
|
+
const index2 = stack.includes("STACK_TRACE") ? 2 : 1;
|
|
11324
|
+
const stackLine = stack.split("\n")[index2];
|
|
11325
|
+
const parsed = parseSingleStack(stackLine);
|
|
11326
|
+
if (parsed) {
|
|
11327
|
+
location = {
|
|
11328
|
+
file: parsed.file,
|
|
11329
|
+
line: parsed.line,
|
|
11330
|
+
column: parsed.column
|
|
11331
|
+
};
|
|
11332
|
+
}
|
|
11333
|
+
if (typeof type3 === "object") {
|
|
11334
|
+
return recordAsyncAnnotation(test5, annotate(message, location, void 0, type3));
|
|
11335
|
+
} else {
|
|
11336
|
+
return recordAsyncAnnotation(test5, annotate(message, location, type3, attachment));
|
|
11337
|
+
}
|
|
11338
|
+
};
|
|
11059
11339
|
context.onTestFailed = (handler, timeout) => {
|
|
11060
11340
|
test5.onFailed || (test5.onFailed = []);
|
|
11061
|
-
test5.onFailed.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR")));
|
|
11341
|
+
test5.onFailed.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
11062
11342
|
};
|
|
11063
11343
|
context.onTestFinished = (handler, timeout) => {
|
|
11064
11344
|
test5.onFinished || (test5.onFinished = []);
|
|
11065
|
-
test5.onFinished.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR")));
|
|
11345
|
+
test5.onFinished.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
11066
11346
|
};
|
|
11067
11347
|
return ((_runner$extendTaskCon = runner2.extendTaskContext) === null || _runner$extendTaskCon === void 0 ? void 0 : _runner$extendTaskCon.call(runner2, context)) || context;
|
|
11068
11348
|
}
|
|
@@ -11075,6 +11355,71 @@ If this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as t
|
|
|
11075
11355
|
}
|
|
11076
11356
|
return error;
|
|
11077
11357
|
}
|
|
11358
|
+
var fileContexts = /* @__PURE__ */ new WeakMap();
|
|
11359
|
+
function getFileContext(file) {
|
|
11360
|
+
const context = fileContexts.get(file);
|
|
11361
|
+
if (!context) {
|
|
11362
|
+
throw new Error(`Cannot find file context for ${file.name}`);
|
|
11363
|
+
}
|
|
11364
|
+
return context;
|
|
11365
|
+
}
|
|
11366
|
+
var table = [];
|
|
11367
|
+
for (let i = 65; i < 91; i++) {
|
|
11368
|
+
table.push(String.fromCharCode(i));
|
|
11369
|
+
}
|
|
11370
|
+
for (let i = 97; i < 123; i++) {
|
|
11371
|
+
table.push(String.fromCharCode(i));
|
|
11372
|
+
}
|
|
11373
|
+
for (let i = 0; i < 10; i++) {
|
|
11374
|
+
table.push(i.toString(10));
|
|
11375
|
+
}
|
|
11376
|
+
function encodeUint8Array(bytes) {
|
|
11377
|
+
let base64 = "";
|
|
11378
|
+
const len = bytes.byteLength;
|
|
11379
|
+
for (let i = 0; i < len; i += 3) {
|
|
11380
|
+
if (len === i + 1) {
|
|
11381
|
+
const a3 = (bytes[i] & 252) >> 2;
|
|
11382
|
+
const b = (bytes[i] & 3) << 4;
|
|
11383
|
+
base64 += table[a3];
|
|
11384
|
+
base64 += table[b];
|
|
11385
|
+
base64 += "==";
|
|
11386
|
+
} else if (len === i + 2) {
|
|
11387
|
+
const a3 = (bytes[i] & 252) >> 2;
|
|
11388
|
+
const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
|
|
11389
|
+
const c = (bytes[i + 1] & 15) << 2;
|
|
11390
|
+
base64 += table[a3];
|
|
11391
|
+
base64 += table[b];
|
|
11392
|
+
base64 += table[c];
|
|
11393
|
+
base64 += "=";
|
|
11394
|
+
} else {
|
|
11395
|
+
const a3 = (bytes[i] & 252) >> 2;
|
|
11396
|
+
const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
|
|
11397
|
+
const c = (bytes[i + 1] & 15) << 2 | (bytes[i + 2] & 192) >> 6;
|
|
11398
|
+
const d = bytes[i + 2] & 63;
|
|
11399
|
+
base64 += table[a3];
|
|
11400
|
+
base64 += table[b];
|
|
11401
|
+
base64 += table[c];
|
|
11402
|
+
base64 += table[d];
|
|
11403
|
+
}
|
|
11404
|
+
}
|
|
11405
|
+
return base64;
|
|
11406
|
+
}
|
|
11407
|
+
function recordAsyncAnnotation(test5, promise) {
|
|
11408
|
+
promise = promise.finally(() => {
|
|
11409
|
+
if (!test5.promises) {
|
|
11410
|
+
return;
|
|
11411
|
+
}
|
|
11412
|
+
const index2 = test5.promises.indexOf(promise);
|
|
11413
|
+
if (index2 !== -1) {
|
|
11414
|
+
test5.promises.splice(index2, 1);
|
|
11415
|
+
}
|
|
11416
|
+
});
|
|
11417
|
+
if (!test5.promises) {
|
|
11418
|
+
test5.promises = [];
|
|
11419
|
+
}
|
|
11420
|
+
test5.promises.push(promise);
|
|
11421
|
+
return promise;
|
|
11422
|
+
}
|
|
11078
11423
|
function getDefaultHookTimeout() {
|
|
11079
11424
|
return getRunner().config.hookTimeout;
|
|
11080
11425
|
}
|
|
@@ -11095,14 +11440,16 @@ function afterAll(fn2, timeout) {
|
|
|
11095
11440
|
function beforeEach(fn2, timeout = getDefaultHookTimeout()) {
|
|
11096
11441
|
assertTypes(fn2, '"beforeEach" callback', ["function"]);
|
|
11097
11442
|
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
11098
|
-
|
|
11443
|
+
const runner2 = getRunner();
|
|
11444
|
+
return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(withFixtures(runner2, fn2), timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
|
|
11099
11445
|
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
11100
11446
|
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
11101
11447
|
}));
|
|
11102
11448
|
}
|
|
11103
11449
|
function afterEach(fn2, timeout) {
|
|
11104
11450
|
assertTypes(fn2, '"afterEach" callback', ["function"]);
|
|
11105
|
-
|
|
11451
|
+
const runner2 = getRunner();
|
|
11452
|
+
return getCurrentSuite().on("afterEach", withTimeout(withFixtures(runner2, fn2), timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
11106
11453
|
}
|
|
11107
11454
|
var onTestFailed = createTestHook("onTestFailed");
|
|
11108
11455
|
var onTestFinished = createTestHook("onTestFinished");
|
|
@@ -11114,10 +11461,8 @@ function createTestHook(name, handler) {
|
|
|
11114
11461
|
}
|
|
11115
11462
|
};
|
|
11116
11463
|
}
|
|
11117
|
-
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
11118
|
-
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
11119
11464
|
|
|
11120
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
11465
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js
|
|
11121
11466
|
var NAME_WORKER_STATE = "__vitest_worker__";
|
|
11122
11467
|
function getWorkerState() {
|
|
11123
11468
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -11143,9 +11488,7 @@ function resetModules(modules, resetMocks = false) {
|
|
|
11143
11488
|
...!resetMocks ? [/^mock:/] : []
|
|
11144
11489
|
];
|
|
11145
11490
|
modules.forEach((mod, path) => {
|
|
11146
|
-
if (skipPaths.some((re) => re.test(path)))
|
|
11147
|
-
return;
|
|
11148
|
-
}
|
|
11491
|
+
if (skipPaths.some((re) => re.test(path))) return;
|
|
11149
11492
|
modules.invalidateModule(mod);
|
|
11150
11493
|
});
|
|
11151
11494
|
}
|
|
@@ -11159,27 +11502,21 @@ async function waitForImportsToResolve() {
|
|
|
11159
11502
|
const promises = [];
|
|
11160
11503
|
let resolvingCount = 0;
|
|
11161
11504
|
for (const mod of state.moduleCache.values()) {
|
|
11162
|
-
if (mod.promise && !mod.evaluated)
|
|
11163
|
-
|
|
11164
|
-
}
|
|
11165
|
-
if (mod.resolving) {
|
|
11166
|
-
resolvingCount++;
|
|
11167
|
-
}
|
|
11168
|
-
}
|
|
11169
|
-
if (!promises.length && !resolvingCount) {
|
|
11170
|
-
return;
|
|
11505
|
+
if (mod.promise && !mod.evaluated) promises.push(mod.promise);
|
|
11506
|
+
if (mod.resolving) resolvingCount++;
|
|
11171
11507
|
}
|
|
11508
|
+
if (!promises.length && !resolvingCount) return;
|
|
11172
11509
|
await Promise.allSettled(promises);
|
|
11173
11510
|
await waitForImportsToResolve();
|
|
11174
11511
|
}
|
|
11175
11512
|
|
|
11176
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
11513
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
|
|
11177
11514
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
11178
|
-
function getDefaultExportFromCjs3(
|
|
11179
|
-
return
|
|
11515
|
+
function getDefaultExportFromCjs3(x) {
|
|
11516
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
11180
11517
|
}
|
|
11181
11518
|
|
|
11182
|
-
// ../../node_modules/.pnpm/@vitest+snapshot@3.
|
|
11519
|
+
// ../../node_modules/.pnpm/@vitest+snapshot@3.2.2/node_modules/@vitest/snapshot/dist/index.js
|
|
11183
11520
|
var comma2 = ",".charCodeAt(0);
|
|
11184
11521
|
var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
11185
11522
|
var intToChar2 = new Uint8Array(64);
|
|
@@ -11806,6 +12143,9 @@ function parseStacktrace(stack, options = {}) {
|
|
|
11806
12143
|
const fileUrl = stack2.file.startsWith("file://") ? stack2.file : `file://${stack2.file}`;
|
|
11807
12144
|
const sourceRootUrl = map2.sourceRoot ? new URL(map2.sourceRoot, fileUrl) : fileUrl;
|
|
11808
12145
|
file = new URL(source, sourceRootUrl).pathname;
|
|
12146
|
+
if (file.match(/\/\w:\//)) {
|
|
12147
|
+
file = file.slice(1);
|
|
12148
|
+
}
|
|
11809
12149
|
}
|
|
11810
12150
|
if (shouldFilter(ignoreStackEntries, file)) {
|
|
11811
12151
|
return null;
|
|
@@ -11837,8 +12177,8 @@ function parseErrorStacktrace(e, options = {}) {
|
|
|
11837
12177
|
if (e.stacks) {
|
|
11838
12178
|
return e.stacks;
|
|
11839
12179
|
}
|
|
11840
|
-
const stackStr = e.stack ||
|
|
11841
|
-
let stackFrames = parseStacktrace(stackStr, options);
|
|
12180
|
+
const stackStr = e.stack || "";
|
|
12181
|
+
let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : [];
|
|
11842
12182
|
if (!stackFrames.length) {
|
|
11843
12183
|
const e_ = e;
|
|
11844
12184
|
if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) {
|
|
@@ -11849,7 +12189,7 @@ function parseErrorStacktrace(e, options = {}) {
|
|
|
11849
12189
|
}
|
|
11850
12190
|
}
|
|
11851
12191
|
if (options.frameFilter) {
|
|
11852
|
-
stackFrames = stackFrames.filter((
|
|
12192
|
+
stackFrames = stackFrames.filter((f3) => options.frameFilter(e, f3) !== false);
|
|
11853
12193
|
}
|
|
11854
12194
|
e.stacks = stackFrames;
|
|
11855
12195
|
return stackFrames;
|
|
@@ -11863,8 +12203,8 @@ try {
|
|
|
11863
12203
|
chunkCVPOREIE_cjs.__require("util");
|
|
11864
12204
|
} catch (noNodeInspect) {
|
|
11865
12205
|
}
|
|
11866
|
-
function getDefaultExportFromCjs4(
|
|
11867
|
-
return
|
|
12206
|
+
function getDefaultExportFromCjs4(x) {
|
|
12207
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
11868
12208
|
}
|
|
11869
12209
|
var reservedWords2 = {
|
|
11870
12210
|
keyword: [
|
|
@@ -11918,7 +12258,7 @@ var reservedWords2 = {
|
|
|
11918
12258
|
};
|
|
11919
12259
|
new Set(reservedWords2.keyword);
|
|
11920
12260
|
new Set(reservedWords2.strict);
|
|
11921
|
-
var
|
|
12261
|
+
var f2 = {
|
|
11922
12262
|
reset: [0, 0],
|
|
11923
12263
|
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
11924
12264
|
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
@@ -11961,39 +12301,39 @@ var f3 = {
|
|
|
11961
12301
|
bgCyanBright: [106, 49],
|
|
11962
12302
|
bgWhiteBright: [107, 49]
|
|
11963
12303
|
};
|
|
11964
|
-
var h2 = Object.entries(
|
|
12304
|
+
var h2 = Object.entries(f2);
|
|
11965
12305
|
function a2(n) {
|
|
11966
12306
|
return String(n);
|
|
11967
12307
|
}
|
|
11968
12308
|
a2.open = "";
|
|
11969
12309
|
a2.close = "";
|
|
11970
|
-
function
|
|
12310
|
+
function C2(n = false) {
|
|
11971
12311
|
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
11972
12312
|
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
11973
12313
|
}
|
|
11974
12314
|
function p2(n = false) {
|
|
11975
|
-
let e =
|
|
11976
|
-
let
|
|
12315
|
+
let e = C2(n), i = (r2, t, c, o) => {
|
|
12316
|
+
let l = "", s2 = 0;
|
|
11977
12317
|
do
|
|
11978
|
-
|
|
12318
|
+
l += r2.substring(s2, o) + c, s2 = o + t.length, o = r2.indexOf(t, s2);
|
|
11979
12319
|
while (~o);
|
|
11980
|
-
return
|
|
12320
|
+
return l + r2.substring(s2);
|
|
11981
12321
|
}, g = (r2, t, c = r2) => {
|
|
11982
|
-
let o = (
|
|
11983
|
-
let s2 = String(
|
|
12322
|
+
let o = (l) => {
|
|
12323
|
+
let s2 = String(l), b = s2.indexOf(t, r2.length);
|
|
11984
12324
|
return ~b ? r2 + i(s2, t, c, b) + t : r2 + s2 + t;
|
|
11985
12325
|
};
|
|
11986
12326
|
return o.open = r2, o.close = t, o;
|
|
11987
|
-
},
|
|
12327
|
+
}, u2 = {
|
|
11988
12328
|
isColorSupported: e
|
|
11989
|
-
},
|
|
12329
|
+
}, d = (r2) => `\x1B[${r2}m`;
|
|
11990
12330
|
for (let [r2, t] of h2)
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
12331
|
+
u2[r2] = e ? g(
|
|
12332
|
+
d(t[0]),
|
|
12333
|
+
d(t[1]),
|
|
11994
12334
|
t[2]
|
|
11995
12335
|
) : a2;
|
|
11996
|
-
return
|
|
12336
|
+
return u2;
|
|
11997
12337
|
}
|
|
11998
12338
|
p2();
|
|
11999
12339
|
var lineSplitRE = /\r?\n/;
|
|
@@ -12364,6 +12704,11 @@ var CounterMap = class extends DefaultMap {
|
|
|
12364
12704
|
constructor() {
|
|
12365
12705
|
super(() => 0);
|
|
12366
12706
|
}
|
|
12707
|
+
// compat for jest-image-snapshot https://github.com/vitest-dev/vitest/issues/7322
|
|
12708
|
+
// `valueOf` and `Snapshot.added` setter allows
|
|
12709
|
+
// snapshotState.added = snapshotState.added + 1
|
|
12710
|
+
// to function as
|
|
12711
|
+
// snapshotState.added.total_ = snapshotState.added.total() + 1
|
|
12367
12712
|
_total;
|
|
12368
12713
|
valueOf() {
|
|
12369
12714
|
return this._total = this.total();
|
|
@@ -12379,14 +12724,14 @@ var CounterMap = class extends DefaultMap {
|
|
|
12379
12724
|
return this._total;
|
|
12380
12725
|
}
|
|
12381
12726
|
let total = 0;
|
|
12382
|
-
for (const
|
|
12383
|
-
total +=
|
|
12727
|
+
for (const x of this.values()) {
|
|
12728
|
+
total += x;
|
|
12384
12729
|
}
|
|
12385
12730
|
return total;
|
|
12386
12731
|
}
|
|
12387
12732
|
};
|
|
12388
|
-
function isSameStackPosition(
|
|
12389
|
-
return
|
|
12733
|
+
function isSameStackPosition(x, y) {
|
|
12734
|
+
return x.file === y.file && x.column === y.column && x.line === y.line;
|
|
12390
12735
|
}
|
|
12391
12736
|
var SnapshotState = class _SnapshotState {
|
|
12392
12737
|
_counters = new CounterMap();
|
|
@@ -12403,6 +12748,8 @@ var SnapshotState = class _SnapshotState {
|
|
|
12403
12748
|
_environment;
|
|
12404
12749
|
_fileExists;
|
|
12405
12750
|
expand;
|
|
12751
|
+
// getter/setter for jest-image-snapshot compat
|
|
12752
|
+
// https://github.com/vitest-dev/vitest/issues/7322
|
|
12406
12753
|
_added = new CounterMap();
|
|
12407
12754
|
_matched = new CounterMap();
|
|
12408
12755
|
_unmatched = new CounterMap();
|
|
@@ -12797,31 +13144,28 @@ var SnapshotClient = class {
|
|
|
12797
13144
|
}
|
|
12798
13145
|
};
|
|
12799
13146
|
|
|
12800
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
13147
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js
|
|
12801
13148
|
var RealDate = Date;
|
|
12802
13149
|
var now2 = null;
|
|
12803
13150
|
var MockDate = class _MockDate extends RealDate {
|
|
12804
|
-
constructor(
|
|
13151
|
+
constructor(y, m2, d, h3, M, s2, ms) {
|
|
12805
13152
|
super();
|
|
12806
13153
|
let date;
|
|
12807
13154
|
switch (arguments.length) {
|
|
12808
13155
|
case 0:
|
|
12809
|
-
if (now2 !== null)
|
|
12810
|
-
|
|
12811
|
-
} else {
|
|
12812
|
-
date = new RealDate();
|
|
12813
|
-
}
|
|
13156
|
+
if (now2 !== null) date = new RealDate(now2.valueOf());
|
|
13157
|
+
else date = new RealDate();
|
|
12814
13158
|
break;
|
|
12815
13159
|
case 1:
|
|
12816
|
-
date = new RealDate(
|
|
13160
|
+
date = new RealDate(y);
|
|
12817
13161
|
break;
|
|
12818
13162
|
default:
|
|
12819
|
-
|
|
13163
|
+
d = typeof d === "undefined" ? 1 : d;
|
|
12820
13164
|
h3 = h3 || 0;
|
|
12821
13165
|
M = M || 0;
|
|
12822
13166
|
s2 = s2 || 0;
|
|
12823
13167
|
ms = ms || 0;
|
|
12824
|
-
date = new RealDate(
|
|
13168
|
+
date = new RealDate(y, m2, d, h3, M, s2, ms);
|
|
12825
13169
|
break;
|
|
12826
13170
|
}
|
|
12827
13171
|
Object.setPrototypeOf(date, _MockDate.prototype);
|
|
@@ -12840,9 +13184,7 @@ MockDate.toString = function() {
|
|
|
12840
13184
|
};
|
|
12841
13185
|
function mockDate(date) {
|
|
12842
13186
|
const dateObj = new RealDate(date.valueOf());
|
|
12843
|
-
if (Number.isNaN(dateObj.getTime())) {
|
|
12844
|
-
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
12845
|
-
}
|
|
13187
|
+
if (Number.isNaN(dateObj.getTime())) throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
12846
13188
|
globalThis.Date = MockDate;
|
|
12847
13189
|
now2 = dateObj.valueOf();
|
|
12848
13190
|
}
|
|
@@ -12850,7 +13192,7 @@ function resetDate() {
|
|
|
12850
13192
|
globalThis.Date = RealDate;
|
|
12851
13193
|
}
|
|
12852
13194
|
|
|
12853
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
13195
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js
|
|
12854
13196
|
var unsupported = [
|
|
12855
13197
|
"matchSnapshot",
|
|
12856
13198
|
"toMatchSnapshot",
|
|
@@ -12871,20 +13213,12 @@ function createExpectPoll(expect2) {
|
|
|
12871
13213
|
const assertion = expect2(null, message).withContext({ poll: true });
|
|
12872
13214
|
fn2 = fn2.bind(assertion);
|
|
12873
13215
|
const test5 = utils_exports.flag(assertion, "vitest-test");
|
|
12874
|
-
if (!test5)
|
|
12875
|
-
throw new Error("expect.poll() must be called inside a test");
|
|
12876
|
-
}
|
|
13216
|
+
if (!test5) throw new Error("expect.poll() must be called inside a test");
|
|
12877
13217
|
const proxy = new Proxy(assertion, { get(target, key, receiver) {
|
|
12878
13218
|
const assertionFunction = Reflect.get(target, key, receiver);
|
|
12879
|
-
if (typeof assertionFunction !== "function")
|
|
12880
|
-
|
|
12881
|
-
}
|
|
12882
|
-
if (key === "assert") {
|
|
12883
|
-
return assertionFunction;
|
|
12884
|
-
}
|
|
12885
|
-
if (typeof key === "string" && unsupported.includes(key)) {
|
|
12886
|
-
throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
|
|
12887
|
-
}
|
|
13219
|
+
if (typeof assertionFunction !== "function") return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
13220
|
+
if (key === "assert") return assertionFunction;
|
|
13221
|
+
if (typeof key === "string" && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
|
|
12888
13222
|
return function(...args) {
|
|
12889
13223
|
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
12890
13224
|
const promise = () => new Promise((resolve4, reject) => {
|
|
@@ -12902,9 +13236,7 @@ function createExpectPoll(expect2) {
|
|
|
12902
13236
|
clearTimeout(timeoutId);
|
|
12903
13237
|
} catch (err) {
|
|
12904
13238
|
lastError = err;
|
|
12905
|
-
if (!utils_exports.flag(assertion, "_isLastPollAttempt"))
|
|
12906
|
-
intervalId = setTimeout(check, interval);
|
|
12907
|
-
}
|
|
13239
|
+
if (!utils_exports.flag(assertion, "_isLastPollAttempt")) intervalId = setTimeout(check, interval);
|
|
12908
13240
|
}
|
|
12909
13241
|
};
|
|
12910
13242
|
timeoutId = setTimeout(() => {
|
|
@@ -12951,9 +13283,7 @@ await ${assertionString}
|
|
|
12951
13283
|
};
|
|
12952
13284
|
}
|
|
12953
13285
|
function copyStackTrace$1(target, source) {
|
|
12954
|
-
if (source.stack !== void 0)
|
|
12955
|
-
target.stack = source.stack.replace(source.message, target.message);
|
|
12956
|
-
}
|
|
13286
|
+
if (source.stack !== void 0) target.stack = source.stack.replace(source.message, target.message);
|
|
12957
13287
|
return target;
|
|
12958
13288
|
}
|
|
12959
13289
|
function commonjsRequire(path) {
|
|
@@ -13053,17 +13383,11 @@ function recordAsyncExpect2(_test2, promise, assertion, error) {
|
|
|
13053
13383
|
const test5 = _test2;
|
|
13054
13384
|
if (test5 && promise instanceof Promise) {
|
|
13055
13385
|
promise = promise.finally(() => {
|
|
13056
|
-
if (!test5.promises)
|
|
13057
|
-
return;
|
|
13058
|
-
}
|
|
13386
|
+
if (!test5.promises) return;
|
|
13059
13387
|
const index2 = test5.promises.indexOf(promise);
|
|
13060
|
-
if (index2 !== -1)
|
|
13061
|
-
test5.promises.splice(index2, 1);
|
|
13062
|
-
}
|
|
13388
|
+
if (index2 !== -1) test5.promises.splice(index2, 1);
|
|
13063
13389
|
});
|
|
13064
|
-
if (!test5.promises)
|
|
13065
|
-
test5.promises = [];
|
|
13066
|
-
}
|
|
13390
|
+
if (!test5.promises) test5.promises = [];
|
|
13067
13391
|
test5.promises.push(promise);
|
|
13068
13392
|
let resolved = false;
|
|
13069
13393
|
test5.onFinished ??= [];
|
|
@@ -13097,18 +13421,14 @@ function recordAsyncExpect2(_test2, promise, assertion, error) {
|
|
|
13097
13421
|
}
|
|
13098
13422
|
var _client;
|
|
13099
13423
|
function getSnapshotClient() {
|
|
13100
|
-
if (!_client) {
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
} });
|
|
13104
|
-
}
|
|
13424
|
+
if (!_client) _client = new SnapshotClient({ isEqual: (received, expected) => {
|
|
13425
|
+
return equals(received, expected, [iterableEquality, subsetEquality]);
|
|
13426
|
+
} });
|
|
13105
13427
|
return _client;
|
|
13106
13428
|
}
|
|
13107
13429
|
function getError(expected, promise) {
|
|
13108
13430
|
if (typeof expected !== "function") {
|
|
13109
|
-
if (!promise) {
|
|
13110
|
-
throw new Error(`expected must be a function, received ${typeof expected}`);
|
|
13111
|
-
}
|
|
13431
|
+
if (!promise) throw new Error(`expected must be a function, received ${typeof expected}`);
|
|
13112
13432
|
return expected;
|
|
13113
13433
|
}
|
|
13114
13434
|
try {
|
|
@@ -13128,41 +13448,33 @@ function getTestNames(test5) {
|
|
|
13128
13448
|
var SnapshotPlugin = (chai2, utils) => {
|
|
13129
13449
|
function getTest(assertionName, obj) {
|
|
13130
13450
|
const test5 = utils.flag(obj, "vitest-test");
|
|
13131
|
-
if (!test5) {
|
|
13132
|
-
throw new Error(`'${assertionName}' cannot be used without test context`);
|
|
13133
|
-
}
|
|
13451
|
+
if (!test5) throw new Error(`'${assertionName}' cannot be used without test context`);
|
|
13134
13452
|
return test5;
|
|
13135
13453
|
}
|
|
13136
|
-
for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
|
|
13137
|
-
utils.
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
properties,
|
|
13155
|
-
errorMessage,
|
|
13156
|
-
...getTestNames(test5)
|
|
13157
|
-
});
|
|
13454
|
+
for (const key of ["matchSnapshot", "toMatchSnapshot"]) utils.addMethod(chai2.Assertion.prototype, key, function(properties, message) {
|
|
13455
|
+
utils.flag(this, "_name", key);
|
|
13456
|
+
const isNot = utils.flag(this, "negate");
|
|
13457
|
+
if (isNot) throw new Error(`${key} cannot be used with "not"`);
|
|
13458
|
+
const expected = utils.flag(this, "object");
|
|
13459
|
+
const test5 = getTest(key, this);
|
|
13460
|
+
if (typeof properties === "string" && typeof message === "undefined") {
|
|
13461
|
+
message = properties;
|
|
13462
|
+
properties = void 0;
|
|
13463
|
+
}
|
|
13464
|
+
const errorMessage = utils.flag(this, "message");
|
|
13465
|
+
getSnapshotClient().assert({
|
|
13466
|
+
received: expected,
|
|
13467
|
+
message,
|
|
13468
|
+
isInline: false,
|
|
13469
|
+
properties,
|
|
13470
|
+
errorMessage,
|
|
13471
|
+
...getTestNames(test5)
|
|
13158
13472
|
});
|
|
13159
|
-
}
|
|
13473
|
+
});
|
|
13160
13474
|
utils.addMethod(chai2.Assertion.prototype, "toMatchFileSnapshot", function(file, message) {
|
|
13161
13475
|
utils.flag(this, "_name", "toMatchFileSnapshot");
|
|
13162
13476
|
const isNot = utils.flag(this, "negate");
|
|
13163
|
-
if (isNot)
|
|
13164
|
-
throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
13165
|
-
}
|
|
13477
|
+
if (isNot) throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
13166
13478
|
const error = new Error("resolves");
|
|
13167
13479
|
const expected = utils.flag(this, "object");
|
|
13168
13480
|
const test5 = getTest("toMatchFileSnapshot", this);
|
|
@@ -13180,14 +13492,10 @@ var SnapshotPlugin = (chai2, utils) => {
|
|
|
13180
13492
|
utils.addMethod(chai2.Assertion.prototype, "toMatchInlineSnapshot", function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
13181
13493
|
utils.flag(this, "_name", "toMatchInlineSnapshot");
|
|
13182
13494
|
const isNot = utils.flag(this, "negate");
|
|
13183
|
-
if (isNot)
|
|
13184
|
-
throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
13185
|
-
}
|
|
13495
|
+
if (isNot) throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
13186
13496
|
const test5 = getTest("toMatchInlineSnapshot", this);
|
|
13187
13497
|
const isInsideEach = test5.each || test5.suite?.each;
|
|
13188
|
-
if (isInsideEach)
|
|
13189
|
-
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13190
|
-
}
|
|
13498
|
+
if (isInsideEach) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13191
13499
|
const expected = utils.flag(this, "object");
|
|
13192
13500
|
const error = utils.flag(this, "error");
|
|
13193
13501
|
if (typeof properties === "string") {
|
|
@@ -13195,9 +13503,7 @@ var SnapshotPlugin = (chai2, utils) => {
|
|
|
13195
13503
|
inlineSnapshot = properties;
|
|
13196
13504
|
properties = void 0;
|
|
13197
13505
|
}
|
|
13198
|
-
if (inlineSnapshot)
|
|
13199
|
-
inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
13200
|
-
}
|
|
13506
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
13201
13507
|
const errorMessage = utils.flag(this, "message");
|
|
13202
13508
|
getSnapshotClient().assert({
|
|
13203
13509
|
received: expected,
|
|
@@ -13213,9 +13519,7 @@ var SnapshotPlugin = (chai2, utils) => {
|
|
|
13213
13519
|
utils.addMethod(chai2.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
|
|
13214
13520
|
utils.flag(this, "_name", "toThrowErrorMatchingSnapshot");
|
|
13215
13521
|
const isNot = utils.flag(this, "negate");
|
|
13216
|
-
if (isNot)
|
|
13217
|
-
throw new Error('toThrowErrorMatchingSnapshot cannot be used with "not"');
|
|
13218
|
-
}
|
|
13522
|
+
if (isNot) throw new Error('toThrowErrorMatchingSnapshot cannot be used with "not"');
|
|
13219
13523
|
const expected = utils.flag(this, "object");
|
|
13220
13524
|
const test5 = getTest("toThrowErrorMatchingSnapshot", this);
|
|
13221
13525
|
const promise = utils.flag(this, "promise");
|
|
@@ -13229,21 +13533,15 @@ var SnapshotPlugin = (chai2, utils) => {
|
|
|
13229
13533
|
});
|
|
13230
13534
|
utils.addMethod(chai2.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
13231
13535
|
const isNot = utils.flag(this, "negate");
|
|
13232
|
-
if (isNot)
|
|
13233
|
-
throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
13234
|
-
}
|
|
13536
|
+
if (isNot) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
13235
13537
|
const test5 = getTest("toThrowErrorMatchingInlineSnapshot", this);
|
|
13236
13538
|
const isInsideEach = test5.each || test5.suite?.each;
|
|
13237
|
-
if (isInsideEach)
|
|
13238
|
-
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13239
|
-
}
|
|
13539
|
+
if (isInsideEach) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13240
13540
|
const expected = utils.flag(this, "object");
|
|
13241
13541
|
const error = utils.flag(this, "error");
|
|
13242
13542
|
const promise = utils.flag(this, "promise");
|
|
13243
13543
|
const errorMessage = utils.flag(this, "message");
|
|
13244
|
-
if (inlineSnapshot)
|
|
13245
|
-
inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
13246
|
-
}
|
|
13544
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
13247
13545
|
getSnapshotClient().assert({
|
|
13248
13546
|
received: getError(expected, promise),
|
|
13249
13547
|
message,
|
|
@@ -13265,13 +13563,11 @@ function createExpect(test5) {
|
|
|
13265
13563
|
const expect2 = (value, message) => {
|
|
13266
13564
|
const { assertionCalls } = getState(expect2);
|
|
13267
13565
|
setState({ assertionCalls: assertionCalls + 1 }, expect2);
|
|
13268
|
-
const
|
|
13566
|
+
const assert4 = expect(value, message);
|
|
13269
13567
|
const _test2 = test5 || getCurrentTest();
|
|
13270
|
-
if (_test2)
|
|
13271
|
-
return
|
|
13272
|
-
|
|
13273
|
-
return assert3;
|
|
13274
|
-
}
|
|
13568
|
+
if (_test2)
|
|
13569
|
+
return assert4.withTest(_test2);
|
|
13570
|
+
else return assert4;
|
|
13275
13571
|
};
|
|
13276
13572
|
Object.assign(expect2, expect);
|
|
13277
13573
|
Object.assign(expect2, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
@@ -13298,13 +13594,11 @@ function createExpect(test5) {
|
|
|
13298
13594
|
};
|
|
13299
13595
|
expect2.poll = createExpectPoll(expect2);
|
|
13300
13596
|
expect2.unreachable = (message) => {
|
|
13301
|
-
|
|
13597
|
+
assert2.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
|
|
13302
13598
|
};
|
|
13303
13599
|
function assertions(expected) {
|
|
13304
13600
|
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect2.getState().assertionCalls}`);
|
|
13305
|
-
if (Error.captureStackTrace)
|
|
13306
|
-
Error.captureStackTrace(errorGen(), assertions);
|
|
13307
|
-
}
|
|
13601
|
+
if (Error.captureStackTrace) Error.captureStackTrace(errorGen(), assertions);
|
|
13308
13602
|
expect2.setState({
|
|
13309
13603
|
expectedAssertionsNumber: expected,
|
|
13310
13604
|
expectedAssertionsNumberErrorGen: errorGen
|
|
@@ -13312,9 +13606,7 @@ function createExpect(test5) {
|
|
|
13312
13606
|
}
|
|
13313
13607
|
function hasAssertions() {
|
|
13314
13608
|
const error = new Error("expected any number of assertion, but got none");
|
|
13315
|
-
if (Error.captureStackTrace)
|
|
13316
|
-
Error.captureStackTrace(error, hasAssertions);
|
|
13317
|
-
}
|
|
13609
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, hasAssertions);
|
|
13318
13610
|
expect2.setState({
|
|
13319
13611
|
isExpectingAssertions: true,
|
|
13320
13612
|
isExpectingAssertionsError: error
|
|
@@ -13421,10 +13713,10 @@ function requireCalledInOrder() {
|
|
|
13421
13713
|
}
|
|
13422
13714
|
return callMap[spy.id] < spy.callCount;
|
|
13423
13715
|
}
|
|
13424
|
-
function checkAdjacentCalls(callMap, spy, index2,
|
|
13716
|
+
function checkAdjacentCalls(callMap, spy, index2, spies2) {
|
|
13425
13717
|
var calledBeforeNext = true;
|
|
13426
|
-
if (index2 !==
|
|
13427
|
-
calledBeforeNext = spy.calledBefore(
|
|
13718
|
+
if (index2 !== spies2.length - 1) {
|
|
13719
|
+
calledBeforeNext = spy.calledBefore(spies2[index2 + 1]);
|
|
13428
13720
|
}
|
|
13429
13721
|
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
|
|
13430
13722
|
callMap[spy.id] += 1;
|
|
@@ -13432,9 +13724,9 @@ function requireCalledInOrder() {
|
|
|
13432
13724
|
}
|
|
13433
13725
|
return false;
|
|
13434
13726
|
}
|
|
13435
|
-
function calledInOrder(
|
|
13727
|
+
function calledInOrder(spies2) {
|
|
13436
13728
|
var callMap = {};
|
|
13437
|
-
var _spies = arguments.length > 1 ? arguments :
|
|
13729
|
+
var _spies = arguments.length > 1 ? arguments : spies2;
|
|
13438
13730
|
return every2(_spies, checkAdjacentCalls.bind(null, callMap));
|
|
13439
13731
|
}
|
|
13440
13732
|
calledInOrder_1 = calledInOrder;
|
|
@@ -13538,8 +13830,8 @@ function requireOrderByFirstCall() {
|
|
|
13538
13830
|
var bId = bCall && bCall.callId || -1;
|
|
13539
13831
|
return aId < bId ? -1 : 1;
|
|
13540
13832
|
}
|
|
13541
|
-
function orderByFirstCall(
|
|
13542
|
-
return sort2(slice(
|
|
13833
|
+
function orderByFirstCall(spies2) {
|
|
13834
|
+
return sort2(slice(spies2), comparator);
|
|
13543
13835
|
}
|
|
13544
13836
|
orderByFirstCall_1 = orderByFirstCall;
|
|
13545
13837
|
return orderByFirstCall_1;
|
|
@@ -13866,11 +14158,11 @@ function requireFakeTimersSrc() {
|
|
|
13866
14158
|
return 0;
|
|
13867
14159
|
}
|
|
13868
14160
|
const strings = str.split(":");
|
|
13869
|
-
const
|
|
13870
|
-
let i =
|
|
14161
|
+
const l = strings.length;
|
|
14162
|
+
let i = l;
|
|
13871
14163
|
let ms = 0;
|
|
13872
14164
|
let parsed;
|
|
13873
|
-
if (
|
|
14165
|
+
if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
|
|
13874
14166
|
throw new Error(
|
|
13875
14167
|
"tick only understands numbers, 'm:s' and 'h:m:s'. Each part must be two digits"
|
|
13876
14168
|
);
|
|
@@ -13880,7 +14172,7 @@ function requireFakeTimersSrc() {
|
|
|
13880
14172
|
if (parsed >= 60) {
|
|
13881
14173
|
throw new Error(`Invalid time ${str}`);
|
|
13882
14174
|
}
|
|
13883
|
-
ms += parsed * Math.pow(60,
|
|
14175
|
+
ms += parsed * Math.pow(60, l - i - 1);
|
|
13884
14176
|
}
|
|
13885
14177
|
return ms * 1e3;
|
|
13886
14178
|
}
|
|
@@ -14252,10 +14544,10 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
14252
14544
|
}
|
|
14253
14545
|
}
|
|
14254
14546
|
function uninstall(clock, config2) {
|
|
14255
|
-
let method, i,
|
|
14547
|
+
let method, i, l;
|
|
14256
14548
|
const installedHrTime = "_hrtime";
|
|
14257
14549
|
const installedNextTick = "_nextTick";
|
|
14258
|
-
for (i = 0,
|
|
14550
|
+
for (i = 0, l = clock.methods.length; i < l; i++) {
|
|
14259
14551
|
method = clock.methods[i];
|
|
14260
14552
|
if (method === "hrtime" && _global.process) {
|
|
14261
14553
|
_global.process.hrtime = clock[installedHrTime];
|
|
@@ -14798,7 +15090,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
14798
15090
|
});
|
|
14799
15091
|
};
|
|
14800
15092
|
}
|
|
14801
|
-
clock.reset = function
|
|
15093
|
+
clock.reset = function reset2() {
|
|
14802
15094
|
nanos = 0;
|
|
14803
15095
|
clock.timers = {};
|
|
14804
15096
|
clock.jobs = [];
|
|
@@ -14869,7 +15161,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
14869
15161
|
`non-existent timers and/or objects cannot be faked: '${timer}'`
|
|
14870
15162
|
);
|
|
14871
15163
|
}
|
|
14872
|
-
let i,
|
|
15164
|
+
let i, l;
|
|
14873
15165
|
const clock = createClock(config2.now, config2.loopLimit);
|
|
14874
15166
|
clock.shouldClearNativeTimers = config2.shouldClearNativeTimers;
|
|
14875
15167
|
clock.uninstall = function() {
|
|
@@ -14920,7 +15212,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
14920
15212
|
if (_global === globalObject && timersPromisesModule) {
|
|
14921
15213
|
clock.timersPromisesModuleMethods = [];
|
|
14922
15214
|
}
|
|
14923
|
-
for (i = 0,
|
|
15215
|
+
for (i = 0, l = clock.methods.length; i < l; i++) {
|
|
14924
15216
|
const nameOfMethodToReplace = clock.methods[i];
|
|
14925
15217
|
if (!isPresent[nameOfMethodToReplace]) {
|
|
14926
15218
|
handleMissingTimer(nameOfMethodToReplace);
|
|
@@ -15154,6 +15446,12 @@ var fakeTimersSrcExports = requireFakeTimersSrc();
|
|
|
15154
15446
|
var FakeTimers = class {
|
|
15155
15447
|
_global;
|
|
15156
15448
|
_clock;
|
|
15449
|
+
// | _fakingTime | _fakingDate |
|
|
15450
|
+
// +-------------+-------------+
|
|
15451
|
+
// | false | falsy | initial
|
|
15452
|
+
// | false | truthy | vi.setSystemTime called first (for mocking only Date without fake timers)
|
|
15453
|
+
// | true | falsy | vi.useFakeTimers called first
|
|
15454
|
+
// | true | truthy | unreachable
|
|
15157
15455
|
_fakingTime;
|
|
15158
15456
|
_fakingDate;
|
|
15159
15457
|
_fakeTimers;
|
|
@@ -15167,74 +15465,49 @@ var FakeTimers = class {
|
|
|
15167
15465
|
this._global = global3;
|
|
15168
15466
|
}
|
|
15169
15467
|
clearAllTimers() {
|
|
15170
|
-
if (this._fakingTime)
|
|
15171
|
-
this._clock.reset();
|
|
15172
|
-
}
|
|
15468
|
+
if (this._fakingTime) this._clock.reset();
|
|
15173
15469
|
}
|
|
15174
15470
|
dispose() {
|
|
15175
15471
|
this.useRealTimers();
|
|
15176
15472
|
}
|
|
15177
15473
|
runAllTimers() {
|
|
15178
|
-
if (this._checkFakeTimers())
|
|
15179
|
-
this._clock.runAll();
|
|
15180
|
-
}
|
|
15474
|
+
if (this._checkFakeTimers()) this._clock.runAll();
|
|
15181
15475
|
}
|
|
15182
15476
|
async runAllTimersAsync() {
|
|
15183
|
-
if (this._checkFakeTimers())
|
|
15184
|
-
await this._clock.runAllAsync();
|
|
15185
|
-
}
|
|
15477
|
+
if (this._checkFakeTimers()) await this._clock.runAllAsync();
|
|
15186
15478
|
}
|
|
15187
15479
|
runOnlyPendingTimers() {
|
|
15188
|
-
if (this._checkFakeTimers())
|
|
15189
|
-
this._clock.runToLast();
|
|
15190
|
-
}
|
|
15480
|
+
if (this._checkFakeTimers()) this._clock.runToLast();
|
|
15191
15481
|
}
|
|
15192
15482
|
async runOnlyPendingTimersAsync() {
|
|
15193
|
-
if (this._checkFakeTimers())
|
|
15194
|
-
await this._clock.runToLastAsync();
|
|
15195
|
-
}
|
|
15483
|
+
if (this._checkFakeTimers()) await this._clock.runToLastAsync();
|
|
15196
15484
|
}
|
|
15197
15485
|
advanceTimersToNextTimer(steps = 1) {
|
|
15198
|
-
if (this._checkFakeTimers()) {
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
if (this._clock.countTimers() === 0) {
|
|
15203
|
-
break;
|
|
15204
|
-
}
|
|
15205
|
-
}
|
|
15486
|
+
if (this._checkFakeTimers()) for (let i = steps; i > 0; i--) {
|
|
15487
|
+
this._clock.next();
|
|
15488
|
+
this._clock.tick(0);
|
|
15489
|
+
if (this._clock.countTimers() === 0) break;
|
|
15206
15490
|
}
|
|
15207
15491
|
}
|
|
15208
15492
|
async advanceTimersToNextTimerAsync(steps = 1) {
|
|
15209
|
-
if (this._checkFakeTimers()) {
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
if (this._clock.countTimers() === 0) {
|
|
15214
|
-
break;
|
|
15215
|
-
}
|
|
15216
|
-
}
|
|
15493
|
+
if (this._checkFakeTimers()) for (let i = steps; i > 0; i--) {
|
|
15494
|
+
await this._clock.nextAsync();
|
|
15495
|
+
this._clock.tick(0);
|
|
15496
|
+
if (this._clock.countTimers() === 0) break;
|
|
15217
15497
|
}
|
|
15218
15498
|
}
|
|
15219
15499
|
advanceTimersByTime(msToRun) {
|
|
15220
|
-
if (this._checkFakeTimers())
|
|
15221
|
-
this._clock.tick(msToRun);
|
|
15222
|
-
}
|
|
15500
|
+
if (this._checkFakeTimers()) this._clock.tick(msToRun);
|
|
15223
15501
|
}
|
|
15224
15502
|
async advanceTimersByTimeAsync(msToRun) {
|
|
15225
|
-
if (this._checkFakeTimers())
|
|
15226
|
-
await this._clock.tickAsync(msToRun);
|
|
15227
|
-
}
|
|
15503
|
+
if (this._checkFakeTimers()) await this._clock.tickAsync(msToRun);
|
|
15228
15504
|
}
|
|
15229
15505
|
advanceTimersToNextFrame() {
|
|
15230
|
-
if (this._checkFakeTimers())
|
|
15231
|
-
this._clock.runToFrame();
|
|
15232
|
-
}
|
|
15506
|
+
if (this._checkFakeTimers()) this._clock.runToFrame();
|
|
15233
15507
|
}
|
|
15234
15508
|
runAllTicks() {
|
|
15235
|
-
if (this._checkFakeTimers())
|
|
15509
|
+
if (this._checkFakeTimers())
|
|
15236
15510
|
this._clock.runMicrotasks();
|
|
15237
|
-
}
|
|
15238
15511
|
}
|
|
15239
15512
|
useRealTimers() {
|
|
15240
15513
|
if (this._fakingDate) {
|
|
@@ -15247,14 +15520,10 @@ var FakeTimers = class {
|
|
|
15247
15520
|
}
|
|
15248
15521
|
}
|
|
15249
15522
|
useFakeTimers() {
|
|
15250
|
-
if (this._fakingDate)
|
|
15251
|
-
throw new Error('"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.');
|
|
15252
|
-
}
|
|
15523
|
+
if (this._fakingDate) throw new Error('"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.');
|
|
15253
15524
|
if (!this._fakingTime) {
|
|
15254
15525
|
const toFake = Object.keys(this._fakeTimers.timers).filter((timer) => timer !== "nextTick" && timer !== "queueMicrotask");
|
|
15255
|
-
if (this._userConfig?.toFake?.includes("nextTick") && isChildProcess())
|
|
15256
|
-
throw new Error("process.nextTick cannot be mocked inside child_process");
|
|
15257
|
-
}
|
|
15526
|
+
if (this._userConfig?.toFake?.includes("nextTick") && isChildProcess()) throw new Error("process.nextTick cannot be mocked inside child_process");
|
|
15258
15527
|
this._clock = this._fakeTimers.install({
|
|
15259
15528
|
now: Date.now(),
|
|
15260
15529
|
...this._userConfig,
|
|
@@ -15273,9 +15542,8 @@ var FakeTimers = class {
|
|
|
15273
15542
|
}
|
|
15274
15543
|
setSystemTime(now3) {
|
|
15275
15544
|
const date = typeof now3 === "undefined" || now3 instanceof Date ? now3 : new Date(now3);
|
|
15276
|
-
if (this._fakingTime)
|
|
15277
|
-
|
|
15278
|
-
} else {
|
|
15545
|
+
if (this._fakingTime) this._clock.setSystemTime(date);
|
|
15546
|
+
else {
|
|
15279
15547
|
this._fakingDate = date ?? new Date(this.getRealSystemTime());
|
|
15280
15548
|
mockDate(this._fakingDate);
|
|
15281
15549
|
}
|
|
@@ -15287,9 +15555,7 @@ var FakeTimers = class {
|
|
|
15287
15555
|
return this._now();
|
|
15288
15556
|
}
|
|
15289
15557
|
getTimerCount() {
|
|
15290
|
-
if (this._checkFakeTimers())
|
|
15291
|
-
return this._clock.countTimers();
|
|
15292
|
-
}
|
|
15558
|
+
if (this._checkFakeTimers()) return this._clock.countTimers();
|
|
15293
15559
|
return 0;
|
|
15294
15560
|
}
|
|
15295
15561
|
configure(config2) {
|
|
@@ -15299,16 +15565,12 @@ var FakeTimers = class {
|
|
|
15299
15565
|
return this._fakingTime;
|
|
15300
15566
|
}
|
|
15301
15567
|
_checkFakeTimers() {
|
|
15302
|
-
if (!this._fakingTime)
|
|
15303
|
-
throw new Error('Timers are not mocked. Try calling "vi.useFakeTimers()" first.');
|
|
15304
|
-
}
|
|
15568
|
+
if (!this._fakingTime) throw new Error('Timers are not mocked. Try calling "vi.useFakeTimers()" first.');
|
|
15305
15569
|
return this._fakingTime;
|
|
15306
15570
|
}
|
|
15307
15571
|
};
|
|
15308
15572
|
function copyStackTrace(target, source) {
|
|
15309
|
-
if (source.stack !== void 0)
|
|
15310
|
-
target.stack = source.stack.replace(source.message, target.message);
|
|
15311
|
-
}
|
|
15573
|
+
if (source.stack !== void 0) target.stack = source.stack.replace(source.message, target.message);
|
|
15312
15574
|
return target;
|
|
15313
15575
|
}
|
|
15314
15576
|
function waitFor(callback, options = {}) {
|
|
@@ -15321,31 +15583,19 @@ function waitFor(callback, options = {}) {
|
|
|
15321
15583
|
let timeoutId;
|
|
15322
15584
|
let intervalId;
|
|
15323
15585
|
const onResolve = (result) => {
|
|
15324
|
-
if (timeoutId)
|
|
15325
|
-
|
|
15326
|
-
}
|
|
15327
|
-
if (intervalId) {
|
|
15328
|
-
clearInterval(intervalId);
|
|
15329
|
-
}
|
|
15586
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
15587
|
+
if (intervalId) clearInterval(intervalId);
|
|
15330
15588
|
resolve4(result);
|
|
15331
15589
|
};
|
|
15332
15590
|
const handleTimeout = () => {
|
|
15333
|
-
if (intervalId)
|
|
15334
|
-
clearInterval(intervalId);
|
|
15335
|
-
}
|
|
15591
|
+
if (intervalId) clearInterval(intervalId);
|
|
15336
15592
|
let error = lastError;
|
|
15337
|
-
if (!error)
|
|
15338
|
-
error = copyStackTrace(new Error("Timed out in waitFor!"), STACK_TRACE_ERROR);
|
|
15339
|
-
}
|
|
15593
|
+
if (!error) error = copyStackTrace(new Error("Timed out in waitFor!"), STACK_TRACE_ERROR);
|
|
15340
15594
|
reject(error);
|
|
15341
15595
|
};
|
|
15342
15596
|
const checkCallback = () => {
|
|
15343
|
-
if (vi.isFakeTimers())
|
|
15344
|
-
|
|
15345
|
-
}
|
|
15346
|
-
if (promiseStatus === "pending") {
|
|
15347
|
-
return;
|
|
15348
|
-
}
|
|
15597
|
+
if (vi.isFakeTimers()) vi.advanceTimersByTime(interval);
|
|
15598
|
+
if (promiseStatus === "pending") return;
|
|
15349
15599
|
try {
|
|
15350
15600
|
const result = callback();
|
|
15351
15601
|
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
@@ -15366,9 +15616,7 @@ function waitFor(callback, options = {}) {
|
|
|
15366
15616
|
lastError = error;
|
|
15367
15617
|
}
|
|
15368
15618
|
};
|
|
15369
|
-
if (checkCallback() === true)
|
|
15370
|
-
return;
|
|
15371
|
-
}
|
|
15619
|
+
if (checkCallback() === true) return;
|
|
15372
15620
|
timeoutId = setTimeout(handleTimeout, timeout);
|
|
15373
15621
|
intervalId = setInterval(checkCallback, interval);
|
|
15374
15622
|
});
|
|
@@ -15382,34 +15630,20 @@ function waitUntil(callback, options = {}) {
|
|
|
15382
15630
|
let timeoutId;
|
|
15383
15631
|
let intervalId;
|
|
15384
15632
|
const onReject = (error) => {
|
|
15385
|
-
if (intervalId)
|
|
15386
|
-
|
|
15387
|
-
}
|
|
15388
|
-
if (!error) {
|
|
15389
|
-
error = copyStackTrace(new Error("Timed out in waitUntil!"), STACK_TRACE_ERROR);
|
|
15390
|
-
}
|
|
15633
|
+
if (intervalId) clearInterval(intervalId);
|
|
15634
|
+
if (!error) error = copyStackTrace(new Error("Timed out in waitUntil!"), STACK_TRACE_ERROR);
|
|
15391
15635
|
reject(error);
|
|
15392
15636
|
};
|
|
15393
15637
|
const onResolve = (result) => {
|
|
15394
|
-
if (!result)
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
if (timeoutId) {
|
|
15398
|
-
clearTimeout(timeoutId);
|
|
15399
|
-
}
|
|
15400
|
-
if (intervalId) {
|
|
15401
|
-
clearInterval(intervalId);
|
|
15402
|
-
}
|
|
15638
|
+
if (!result) return;
|
|
15639
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
15640
|
+
if (intervalId) clearInterval(intervalId);
|
|
15403
15641
|
resolve4(result);
|
|
15404
15642
|
return true;
|
|
15405
15643
|
};
|
|
15406
15644
|
const checkCallback = () => {
|
|
15407
|
-
if (vi.isFakeTimers())
|
|
15408
|
-
|
|
15409
|
-
}
|
|
15410
|
-
if (promiseStatus === "pending") {
|
|
15411
|
-
return;
|
|
15412
|
-
}
|
|
15645
|
+
if (vi.isFakeTimers()) vi.advanceTimersByTime(interval);
|
|
15646
|
+
if (promiseStatus === "pending") return;
|
|
15413
15647
|
try {
|
|
15414
15648
|
const result = callback();
|
|
15415
15649
|
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
@@ -15422,16 +15656,12 @@ function waitUntil(callback, options = {}) {
|
|
|
15422
15656
|
promiseStatus = "rejected";
|
|
15423
15657
|
onReject(rejectedValue);
|
|
15424
15658
|
});
|
|
15425
|
-
} else
|
|
15426
|
-
return onResolve(result);
|
|
15427
|
-
}
|
|
15659
|
+
} else return onResolve(result);
|
|
15428
15660
|
} catch (error) {
|
|
15429
15661
|
onReject(error);
|
|
15430
15662
|
}
|
|
15431
15663
|
};
|
|
15432
|
-
if (checkCallback() === true)
|
|
15433
|
-
return;
|
|
15434
|
-
}
|
|
15664
|
+
if (checkCallback() === true) return;
|
|
15435
15665
|
timeoutId = setTimeout(onReject, timeout);
|
|
15436
15666
|
intervalId = setInterval(checkCallback, interval);
|
|
15437
15667
|
});
|
|
@@ -15454,18 +15684,13 @@ function createVitest() {
|
|
|
15454
15684
|
const utils = {
|
|
15455
15685
|
useFakeTimers(config2) {
|
|
15456
15686
|
if (isChildProcess()) {
|
|
15457
|
-
if (config2?.toFake?.includes("nextTick") || workerState.config?.fakeTimers?.toFake?.includes("nextTick")) {
|
|
15458
|
-
throw new Error('vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.');
|
|
15459
|
-
}
|
|
15460
|
-
}
|
|
15461
|
-
if (config2) {
|
|
15462
|
-
timers().configure({
|
|
15463
|
-
...workerState.config.fakeTimers,
|
|
15464
|
-
...config2
|
|
15465
|
-
});
|
|
15466
|
-
} else {
|
|
15467
|
-
timers().configure(workerState.config.fakeTimers);
|
|
15687
|
+
if (config2?.toFake?.includes("nextTick") || workerState.config?.fakeTimers?.toFake?.includes("nextTick")) throw new Error('vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.');
|
|
15468
15688
|
}
|
|
15689
|
+
if (config2) timers().configure({
|
|
15690
|
+
...workerState.config.fakeTimers,
|
|
15691
|
+
...config2
|
|
15692
|
+
});
|
|
15693
|
+
else timers().configure(workerState.config.fakeTimers);
|
|
15469
15694
|
timers().useFakeTimers();
|
|
15470
15695
|
return utils;
|
|
15471
15696
|
},
|
|
@@ -15542,29 +15767,21 @@ function createVitest() {
|
|
|
15542
15767
|
return factory();
|
|
15543
15768
|
},
|
|
15544
15769
|
mock(path, factory) {
|
|
15545
|
-
if (typeof path !== "string") {
|
|
15546
|
-
throw new TypeError(`vi.mock() expects a string path, but received a ${typeof path}`);
|
|
15547
|
-
}
|
|
15770
|
+
if (typeof path !== "string") throw new TypeError(`vi.mock() expects a string path, but received a ${typeof path}`);
|
|
15548
15771
|
const importer = getImporter("mock");
|
|
15549
15772
|
_mocker().queueMock(path, importer, typeof factory === "function" ? () => factory(() => _mocker().importActual(path, importer, _mocker().getMockContext().callstack)) : factory);
|
|
15550
15773
|
},
|
|
15551
15774
|
unmock(path) {
|
|
15552
|
-
if (typeof path !== "string") {
|
|
15553
|
-
throw new TypeError(`vi.unmock() expects a string path, but received a ${typeof path}`);
|
|
15554
|
-
}
|
|
15775
|
+
if (typeof path !== "string") throw new TypeError(`vi.unmock() expects a string path, but received a ${typeof path}`);
|
|
15555
15776
|
_mocker().queueUnmock(path, getImporter("unmock"));
|
|
15556
15777
|
},
|
|
15557
15778
|
doMock(path, factory) {
|
|
15558
|
-
if (typeof path !== "string") {
|
|
15559
|
-
throw new TypeError(`vi.doMock() expects a string path, but received a ${typeof path}`);
|
|
15560
|
-
}
|
|
15779
|
+
if (typeof path !== "string") throw new TypeError(`vi.doMock() expects a string path, but received a ${typeof path}`);
|
|
15561
15780
|
const importer = getImporter("doMock");
|
|
15562
15781
|
_mocker().queueMock(path, importer, typeof factory === "function" ? () => factory(() => _mocker().importActual(path, importer, _mocker().getMockContext().callstack)) : factory);
|
|
15563
15782
|
},
|
|
15564
15783
|
doUnmock(path) {
|
|
15565
|
-
if (typeof path !== "string") {
|
|
15566
|
-
throw new TypeError(`vi.doUnmock() expects a string path, but received a ${typeof path}`);
|
|
15567
|
-
}
|
|
15784
|
+
if (typeof path !== "string") throw new TypeError(`vi.doUnmock() expects a string path, but received a ${typeof path}`);
|
|
15568
15785
|
_mocker().queueUnmock(path, getImporter("doUnmock"));
|
|
15569
15786
|
},
|
|
15570
15787
|
async importActual(path) {
|
|
@@ -15573,11 +15790,14 @@ function createVitest() {
|
|
|
15573
15790
|
async importMock(path) {
|
|
15574
15791
|
return _mocker().importMock(path, getImporter("importMock"));
|
|
15575
15792
|
},
|
|
15793
|
+
mockObject(value) {
|
|
15794
|
+
return _mocker().mockObject({ value }).value;
|
|
15795
|
+
},
|
|
15576
15796
|
mocked(item, _options = {}) {
|
|
15577
15797
|
return item;
|
|
15578
15798
|
},
|
|
15579
15799
|
isMockFunction(fn2) {
|
|
15580
|
-
return
|
|
15800
|
+
return isMockFunction2(fn2);
|
|
15581
15801
|
},
|
|
15582
15802
|
clearAllMocks() {
|
|
15583
15803
|
[...mocks].reverse().forEach((spy) => spy.mockClear());
|
|
@@ -15592,9 +15812,7 @@ function createVitest() {
|
|
|
15592
15812
|
return utils;
|
|
15593
15813
|
},
|
|
15594
15814
|
stubGlobal(name, value) {
|
|
15595
|
-
if (!_stubsGlobal.has(name))
|
|
15596
|
-
_stubsGlobal.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
|
|
15597
|
-
}
|
|
15815
|
+
if (!_stubsGlobal.has(name)) _stubsGlobal.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
|
|
15598
15816
|
Object.defineProperty(globalThis, name, {
|
|
15599
15817
|
value,
|
|
15600
15818
|
writable: true,
|
|
@@ -15604,36 +15822,24 @@ function createVitest() {
|
|
|
15604
15822
|
return utils;
|
|
15605
15823
|
},
|
|
15606
15824
|
stubEnv(name, value) {
|
|
15607
|
-
if (!_stubsEnv.has(name))
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
process.env[name] = value ? "1" : "";
|
|
15612
|
-
} else if (value === void 0) {
|
|
15613
|
-
delete process.env[name];
|
|
15614
|
-
} else {
|
|
15615
|
-
process.env[name] = String(value);
|
|
15616
|
-
}
|
|
15825
|
+
if (!_stubsEnv.has(name)) _stubsEnv.set(name, process.env[name]);
|
|
15826
|
+
if (_envBooleans.includes(name)) process.env[name] = value ? "1" : "";
|
|
15827
|
+
else if (value === void 0) delete process.env[name];
|
|
15828
|
+
else process.env[name] = String(value);
|
|
15617
15829
|
return utils;
|
|
15618
15830
|
},
|
|
15619
15831
|
unstubAllGlobals() {
|
|
15620
15832
|
_stubsGlobal.forEach((original, name) => {
|
|
15621
|
-
if (!original)
|
|
15622
|
-
|
|
15623
|
-
} else {
|
|
15624
|
-
Object.defineProperty(globalThis, name, original);
|
|
15625
|
-
}
|
|
15833
|
+
if (!original) Reflect.deleteProperty(globalThis, name);
|
|
15834
|
+
else Object.defineProperty(globalThis, name, original);
|
|
15626
15835
|
});
|
|
15627
15836
|
_stubsGlobal.clear();
|
|
15628
15837
|
return utils;
|
|
15629
15838
|
},
|
|
15630
15839
|
unstubAllEnvs() {
|
|
15631
15840
|
_stubsEnv.forEach((original, name) => {
|
|
15632
|
-
if (original === void 0)
|
|
15633
|
-
|
|
15634
|
-
} else {
|
|
15635
|
-
process.env[name] = original;
|
|
15636
|
-
}
|
|
15841
|
+
if (original === void 0) delete process.env[name];
|
|
15842
|
+
else process.env[name] = original;
|
|
15637
15843
|
});
|
|
15638
15844
|
_stubsEnv.clear();
|
|
15639
15845
|
return utils;
|
|
@@ -15646,15 +15852,11 @@ function createVitest() {
|
|
|
15646
15852
|
return waitForImportsToResolve();
|
|
15647
15853
|
},
|
|
15648
15854
|
setConfig(config2) {
|
|
15649
|
-
if (!_config) {
|
|
15650
|
-
_config = { ...workerState.config };
|
|
15651
|
-
}
|
|
15855
|
+
if (!_config) _config = { ...workerState.config };
|
|
15652
15856
|
Object.assign(workerState.config, config2);
|
|
15653
15857
|
},
|
|
15654
15858
|
resetConfig() {
|
|
15655
|
-
if (_config)
|
|
15656
|
-
Object.assign(workerState.config, _config);
|
|
15657
|
-
}
|
|
15859
|
+
if (_config) Object.assign(workerState.config, _config);
|
|
15658
15860
|
}
|
|
15659
15861
|
};
|
|
15660
15862
|
return utils;
|
|
@@ -15676,36 +15878,11 @@ function getImporter(name) {
|
|
|
15676
15878
|
return stack?.file || "";
|
|
15677
15879
|
}
|
|
15678
15880
|
|
|
15679
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
15680
|
-
var filesCount = /* @__PURE__ */ new Map();
|
|
15681
|
-
var cache = /* @__PURE__ */ new Map();
|
|
15682
|
-
function runOnce(fn2, key) {
|
|
15683
|
-
const filepath = getWorkerState().filepath || "__unknown_files__";
|
|
15684
|
-
if (!key) {
|
|
15685
|
-
filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
|
|
15686
|
-
key = String(filesCount.get(filepath));
|
|
15687
|
-
}
|
|
15688
|
-
const id = `${filepath}:${key}`;
|
|
15689
|
-
if (!cache.has(id)) {
|
|
15690
|
-
cache.set(id, fn2());
|
|
15691
|
-
}
|
|
15692
|
-
return cache.get(id);
|
|
15693
|
-
}
|
|
15694
|
-
function isFirstRun() {
|
|
15695
|
-
let firstRun = false;
|
|
15696
|
-
runOnce(() => {
|
|
15697
|
-
firstRun = true;
|
|
15698
|
-
}, "__vitest_first_run__");
|
|
15699
|
-
return firstRun;
|
|
15700
|
-
}
|
|
15701
|
-
|
|
15702
|
-
// ../../node_modules/.pnpm/vitest@3.1.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.32_@vitest+ui_3f295c4d69ef1c15dd9f9eff0f44d011/node_modules/vitest/dist/chunks/benchmark.BoF7jW0Q.js
|
|
15881
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js
|
|
15703
15882
|
var benchFns = /* @__PURE__ */ new WeakMap();
|
|
15704
15883
|
var benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
15705
15884
|
var bench = createBenchmark(function(name, fn2 = noop, options = {}) {
|
|
15706
|
-
if (getWorkerState().config.mode !== "benchmark")
|
|
15707
|
-
throw new Error("`bench()` is only available in benchmark mode.");
|
|
15708
|
-
}
|
|
15885
|
+
if (getWorkerState().config.mode !== "benchmark") throw new Error("`bench()` is only available in benchmark mode.");
|
|
15709
15886
|
const task = getCurrentSuite().task(formatName2(name), {
|
|
15710
15887
|
...this,
|
|
15711
15888
|
meta: { benchmark: true }
|
|
@@ -15727,18 +15904,12 @@ function formatName2(name) {
|
|
|
15727
15904
|
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
15728
15905
|
}
|
|
15729
15906
|
|
|
15730
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
15907
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js
|
|
15731
15908
|
chunkCVPOREIE_cjs.__toESM(require_dist(), 1);
|
|
15732
|
-
function getRunningMode() {
|
|
15733
|
-
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
15734
|
-
}
|
|
15735
|
-
function isWatchMode() {
|
|
15736
|
-
return getRunningMode() === "watch";
|
|
15737
|
-
}
|
|
15738
15909
|
var assertType = function assertType2() {
|
|
15739
15910
|
};
|
|
15740
15911
|
|
|
15741
|
-
// ../../node_modules/.pnpm/vitest@3.
|
|
15912
|
+
// ../../node_modules/.pnpm/vitest@3.2.2_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.19.0_@vitest+ui@_f2f8c5e73aab614bca86ded968276706/node_modules/vitest/dist/index.js
|
|
15742
15913
|
var import_expect_type2 = chunkCVPOREIE_cjs.__toESM(require_dist(), 1);
|
|
15743
15914
|
var export_expectTypeOf = import_expect_type2.expectTypeOf;
|
|
15744
15915
|
/*! Bundled license information:
|
|
@@ -16035,7 +16206,7 @@ chai/chai.js:
|
|
|
16035
16206
|
|
|
16036
16207
|
exports.afterAll = afterAll;
|
|
16037
16208
|
exports.afterEach = afterEach;
|
|
16038
|
-
exports.assert =
|
|
16209
|
+
exports.assert = assert2;
|
|
16039
16210
|
exports.assertType = assertType;
|
|
16040
16211
|
exports.beforeAll = beforeAll;
|
|
16041
16212
|
exports.beforeEach = beforeEach;
|
|
@@ -16045,14 +16216,10 @@ exports.createExpect = createExpect;
|
|
|
16045
16216
|
exports.describe = describe;
|
|
16046
16217
|
exports.expect = globalExpect;
|
|
16047
16218
|
exports.expectTypeOf = export_expectTypeOf;
|
|
16048
|
-
exports.getRunningMode = getRunningMode;
|
|
16049
16219
|
exports.inject = inject;
|
|
16050
|
-
exports.isFirstRun = isFirstRun;
|
|
16051
|
-
exports.isWatchMode = isWatchMode;
|
|
16052
16220
|
exports.it = it;
|
|
16053
16221
|
exports.onTestFailed = onTestFailed;
|
|
16054
16222
|
exports.onTestFinished = onTestFinished;
|
|
16055
|
-
exports.runOnce = runOnce;
|
|
16056
16223
|
exports.should = should;
|
|
16057
16224
|
exports.suite = suite;
|
|
16058
16225
|
exports.test = test3;
|