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