@prisma/get-platform 6.20.0-integration-next.17 → 6.20.0-integration-next.19
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/{chunk-OJINGNLI.js → chunk-3UEKS5W6.js} +70 -129
- package/dist/{chunk-6OBQDQYE.js → chunk-GGL63BNP.js} +7 -7
- package/dist/{chunk-YLRTNN74.js → chunk-M5T7GI2R.js} +5 -14
- package/dist/index.js +8 -8
- package/dist/link.js +2 -2
- package/dist/{magic-string.es-SDTMJBWP.js → magic-string.es-3WRPFX2A.js} +17 -26
- package/dist/test-utils/index.js +6 -6
- package/dist/test-utils/jestContext.js +6 -6
- package/dist/test-utils/vitestContext.js +1163 -1170
- package/package.json +2 -2
|
@@ -35,7 +35,7 @@ __export(vitestContext_exports, {
|
|
|
35
35
|
vitestStdoutContext: () => vitestStdoutContext
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(vitestContext_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_3UEKS5W6 = require("../chunk-3UEKS5W6.js");
|
|
39
39
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
40
40
|
var import_node_path = __toESM(require("node:path"));
|
|
41
41
|
var import_tty = require("tty");
|
|
@@ -504,18 +504,18 @@ var require_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
504
504
|
var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
505
505
|
"../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.js"(exports) {
|
|
506
506
|
"use strict";
|
|
507
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2,
|
|
508
|
-
if (
|
|
509
|
-
var desc = Object.getOwnPropertyDescriptor(m2,
|
|
507
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
508
|
+
if (k2 === void 0) k2 = k;
|
|
509
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
510
510
|
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
511
511
|
desc = { enumerable: true, get: function() {
|
|
512
|
-
return m2[
|
|
512
|
+
return m2[k];
|
|
513
513
|
} };
|
|
514
514
|
}
|
|
515
|
-
Object.defineProperty(o,
|
|
516
|
-
} : function(o, m2,
|
|
517
|
-
if (
|
|
518
|
-
o[
|
|
515
|
+
Object.defineProperty(o, k2, desc);
|
|
516
|
+
} : function(o, m2, k, k2) {
|
|
517
|
+
if (k2 === void 0) k2 = k;
|
|
518
|
+
o[k2] = m2[k];
|
|
519
519
|
});
|
|
520
520
|
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
521
521
|
for (var p3 in m2) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p3)) __createBinding(exports2, m2, p3);
|
|
@@ -579,8 +579,8 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
579
579
|
exports.expectTypeOf = expectTypeOf2;
|
|
580
580
|
}
|
|
581
581
|
});
|
|
582
|
-
var import_fs_jetpack = (0, import_chunk_2ESYSVXG.__toESM)((0,
|
|
583
|
-
var import_tempy = (0, import_chunk_2ESYSVXG.__toESM)((0,
|
|
582
|
+
var import_fs_jetpack = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_3UEKS5W6.require_main)());
|
|
583
|
+
var import_tempy = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_3UEKS5W6.require_tempy)());
|
|
584
584
|
var f = {
|
|
585
585
|
reset: [0, 0],
|
|
586
586
|
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
@@ -636,39 +636,39 @@ function C(n = false) {
|
|
|
636
636
|
}
|
|
637
637
|
function p(n = false) {
|
|
638
638
|
let e = C(n), i = (r2, t, c, o) => {
|
|
639
|
-
let
|
|
639
|
+
let l = "", s2 = 0;
|
|
640
640
|
do
|
|
641
|
-
|
|
641
|
+
l += r2.substring(s2, o) + c, s2 = o + t.length, o = r2.indexOf(t, s2);
|
|
642
642
|
while (~o);
|
|
643
|
-
return
|
|
643
|
+
return l + r2.substring(s2);
|
|
644
644
|
}, g = (r2, t, c = r2) => {
|
|
645
|
-
let o = (
|
|
646
|
-
let s2 = String(
|
|
647
|
-
return ~
|
|
645
|
+
let o = (l) => {
|
|
646
|
+
let s2 = String(l), b = s2.indexOf(t, r2.length);
|
|
647
|
+
return ~b ? r2 + i(s2, t, c, b) + t : r2 + s2 + t;
|
|
648
648
|
};
|
|
649
649
|
return o.open = r2, o.close = t, o;
|
|
650
|
-
},
|
|
650
|
+
}, u2 = {
|
|
651
651
|
isColorSupported: e
|
|
652
652
|
}, d = (r2) => `\x1B[${r2}m`;
|
|
653
653
|
for (let [r2, t] of h)
|
|
654
|
-
|
|
654
|
+
u2[r2] = e ? g(
|
|
655
655
|
d(t[0]),
|
|
656
656
|
d(t[1]),
|
|
657
657
|
t[2]
|
|
658
658
|
) : a;
|
|
659
|
-
return
|
|
659
|
+
return u2;
|
|
660
660
|
}
|
|
661
661
|
var r = process.env.FORCE_TTY !== void 0 || (0, import_tty.isatty)(1);
|
|
662
662
|
var u = p(r);
|
|
663
663
|
function _mergeNamespaces(n, m2) {
|
|
664
664
|
m2.forEach(function(e) {
|
|
665
|
-
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(
|
|
666
|
-
if (
|
|
667
|
-
var d = Object.getOwnPropertyDescriptor(e,
|
|
668
|
-
Object.defineProperty(n,
|
|
665
|
+
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
666
|
+
if (k !== "default" && !(k in n)) {
|
|
667
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
668
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
669
669
|
enumerable: true,
|
|
670
670
|
get: function() {
|
|
671
|
-
return e[
|
|
671
|
+
return e[k];
|
|
672
672
|
}
|
|
673
673
|
});
|
|
674
674
|
}
|
|
@@ -743,7 +743,7 @@ function printIteratorValues(iterator, config2, indentation, depth, refs, printe
|
|
|
743
743
|
function printListItems(list, config2, indentation, depth, refs, printer2) {
|
|
744
744
|
let result = "";
|
|
745
745
|
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
746
|
-
const isDataView = (
|
|
746
|
+
const isDataView = (l) => l instanceof DataView;
|
|
747
747
|
const length = isDataView(list) ? list.byteLength : list.length;
|
|
748
748
|
if (length > 0) {
|
|
749
749
|
result += config2.spacingOuter;
|
|
@@ -1004,8 +1004,8 @@ var plugin$2 = {
|
|
|
1004
1004
|
serialize: serialize$2,
|
|
1005
1005
|
test: test$2
|
|
1006
1006
|
};
|
|
1007
|
-
function getDefaultExportFromCjs(
|
|
1008
|
-
return
|
|
1007
|
+
function getDefaultExportFromCjs(x) {
|
|
1008
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1009
1009
|
}
|
|
1010
1010
|
var reactIs$1 = { exports: {} };
|
|
1011
1011
|
var reactIs_production = {};
|
|
@@ -1217,25 +1217,25 @@ var hasRequiredReactIs_production_min;
|
|
|
1217
1217
|
function requireReactIs_production_min() {
|
|
1218
1218
|
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
1219
1219
|
hasRequiredReactIs_production_min = 1;
|
|
1220
|
-
var
|
|
1221
|
-
|
|
1222
|
-
function
|
|
1220
|
+
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;
|
|
1221
|
+
u2 = Symbol.for("react.module.reference");
|
|
1222
|
+
function v(a3) {
|
|
1223
1223
|
if ("object" === typeof a3 && null !== a3) {
|
|
1224
1224
|
var r2 = a3.$$typeof;
|
|
1225
1225
|
switch (r2) {
|
|
1226
|
-
case
|
|
1226
|
+
case b:
|
|
1227
1227
|
switch (a3 = a3.type, a3) {
|
|
1228
1228
|
case d:
|
|
1229
|
-
case
|
|
1229
|
+
case f3:
|
|
1230
1230
|
case e:
|
|
1231
1231
|
case m2:
|
|
1232
1232
|
case n:
|
|
1233
1233
|
return a3;
|
|
1234
1234
|
default:
|
|
1235
1235
|
switch (a3 = a3 && a3.$$typeof, a3) {
|
|
1236
|
-
case
|
|
1237
|
-
case
|
|
1238
|
-
case
|
|
1236
|
+
case k:
|
|
1237
|
+
case h3:
|
|
1238
|
+
case l:
|
|
1239
1239
|
case q:
|
|
1240
1240
|
case p3:
|
|
1241
1241
|
case g:
|
|
@@ -1249,15 +1249,15 @@ function requireReactIs_production_min() {
|
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
1251
|
}
|
|
1252
|
-
reactIs_production_min.ContextConsumer =
|
|
1252
|
+
reactIs_production_min.ContextConsumer = h3;
|
|
1253
1253
|
reactIs_production_min.ContextProvider = g;
|
|
1254
|
-
reactIs_production_min.Element =
|
|
1255
|
-
reactIs_production_min.ForwardRef =
|
|
1254
|
+
reactIs_production_min.Element = b;
|
|
1255
|
+
reactIs_production_min.ForwardRef = l;
|
|
1256
1256
|
reactIs_production_min.Fragment = d;
|
|
1257
1257
|
reactIs_production_min.Lazy = q;
|
|
1258
1258
|
reactIs_production_min.Memo = p3;
|
|
1259
1259
|
reactIs_production_min.Portal = c;
|
|
1260
|
-
reactIs_production_min.Profiler =
|
|
1260
|
+
reactIs_production_min.Profiler = f3;
|
|
1261
1261
|
reactIs_production_min.StrictMode = e;
|
|
1262
1262
|
reactIs_production_min.Suspense = m2;
|
|
1263
1263
|
reactIs_production_min.SuspenseList = n;
|
|
@@ -1268,45 +1268,45 @@ function requireReactIs_production_min() {
|
|
|
1268
1268
|
return false;
|
|
1269
1269
|
};
|
|
1270
1270
|
reactIs_production_min.isContextConsumer = function(a3) {
|
|
1271
|
-
return
|
|
1271
|
+
return v(a3) === h3;
|
|
1272
1272
|
};
|
|
1273
1273
|
reactIs_production_min.isContextProvider = function(a3) {
|
|
1274
|
-
return
|
|
1274
|
+
return v(a3) === g;
|
|
1275
1275
|
};
|
|
1276
1276
|
reactIs_production_min.isElement = function(a3) {
|
|
1277
|
-
return "object" === typeof a3 && null !== a3 && a3.$$typeof ===
|
|
1277
|
+
return "object" === typeof a3 && null !== a3 && a3.$$typeof === b;
|
|
1278
1278
|
};
|
|
1279
1279
|
reactIs_production_min.isForwardRef = function(a3) {
|
|
1280
|
-
return
|
|
1280
|
+
return v(a3) === l;
|
|
1281
1281
|
};
|
|
1282
1282
|
reactIs_production_min.isFragment = function(a3) {
|
|
1283
|
-
return
|
|
1283
|
+
return v(a3) === d;
|
|
1284
1284
|
};
|
|
1285
1285
|
reactIs_production_min.isLazy = function(a3) {
|
|
1286
|
-
return
|
|
1286
|
+
return v(a3) === q;
|
|
1287
1287
|
};
|
|
1288
1288
|
reactIs_production_min.isMemo = function(a3) {
|
|
1289
|
-
return
|
|
1289
|
+
return v(a3) === p3;
|
|
1290
1290
|
};
|
|
1291
1291
|
reactIs_production_min.isPortal = function(a3) {
|
|
1292
|
-
return
|
|
1292
|
+
return v(a3) === c;
|
|
1293
1293
|
};
|
|
1294
1294
|
reactIs_production_min.isProfiler = function(a3) {
|
|
1295
|
-
return
|
|
1295
|
+
return v(a3) === f3;
|
|
1296
1296
|
};
|
|
1297
1297
|
reactIs_production_min.isStrictMode = function(a3) {
|
|
1298
|
-
return
|
|
1298
|
+
return v(a3) === e;
|
|
1299
1299
|
};
|
|
1300
1300
|
reactIs_production_min.isSuspense = function(a3) {
|
|
1301
|
-
return
|
|
1301
|
+
return v(a3) === m2;
|
|
1302
1302
|
};
|
|
1303
1303
|
reactIs_production_min.isSuspenseList = function(a3) {
|
|
1304
|
-
return
|
|
1304
|
+
return v(a3) === n;
|
|
1305
1305
|
};
|
|
1306
1306
|
reactIs_production_min.isValidElementType = function(a3) {
|
|
1307
|
-
return "string" === typeof a3 || "function" === typeof a3 || a3 === d || a3 ===
|
|
1307
|
+
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;
|
|
1308
1308
|
};
|
|
1309
|
-
reactIs_production_min.typeOf =
|
|
1309
|
+
reactIs_production_min.typeOf = v;
|
|
1310
1310
|
return reactIs_production_min;
|
|
1311
1311
|
}
|
|
1312
1312
|
var reactIs_development = {};
|
|
@@ -1524,7 +1524,7 @@ var reactIsMethods = [
|
|
|
1524
1524
|
"isSuspenseList",
|
|
1525
1525
|
"isValidElementType"
|
|
1526
1526
|
];
|
|
1527
|
-
var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (
|
|
1527
|
+
var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v) => ReactIs18[m2](v) || ReactIs19[m2](v)]));
|
|
1528
1528
|
function getChildren(arg, children = []) {
|
|
1529
1529
|
if (Array.isArray(arg)) {
|
|
1530
1530
|
for (const item of arg) {
|
|
@@ -2193,6 +2193,19 @@ function inspectSymbol(value) {
|
|
|
2193
2193
|
return value.toString();
|
|
2194
2194
|
}
|
|
2195
2195
|
var getPromiseValue = () => "Promise{\u2026}";
|
|
2196
|
+
try {
|
|
2197
|
+
const { getPromiseDetails, kPending, kRejected } = process.binding("util");
|
|
2198
|
+
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
2199
|
+
getPromiseValue = (value, options) => {
|
|
2200
|
+
const [state, innerValue] = getPromiseDetails(value);
|
|
2201
|
+
if (state === kPending) {
|
|
2202
|
+
return "Promise{<pending>}";
|
|
2203
|
+
}
|
|
2204
|
+
return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
} catch (notNode) {
|
|
2208
|
+
}
|
|
2196
2209
|
var promise_default = getPromiseValue;
|
|
2197
2210
|
function inspectObject(object2, options) {
|
|
2198
2211
|
const properties = Object.getOwnPropertyNames(object2);
|
|
@@ -2354,12 +2367,12 @@ var baseTypesMap = {
|
|
|
2354
2367
|
HTMLCollection: inspectNodeCollection,
|
|
2355
2368
|
NodeList: inspectNodeCollection
|
|
2356
2369
|
};
|
|
2357
|
-
var inspectCustom = (value, options, type3
|
|
2370
|
+
var inspectCustom = (value, options, type3) => {
|
|
2358
2371
|
if (chaiInspect in value && typeof value[chaiInspect] === "function") {
|
|
2359
2372
|
return value[chaiInspect](options);
|
|
2360
2373
|
}
|
|
2361
2374
|
if (nodeInspect in value && typeof value[nodeInspect] === "function") {
|
|
2362
|
-
return value[nodeInspect](options.depth, options
|
|
2375
|
+
return value[nodeInspect](options.depth, options);
|
|
2363
2376
|
}
|
|
2364
2377
|
if ("inspect" in value && typeof value.inspect === "function") {
|
|
2365
2378
|
return value.inspect(options.depth, options);
|
|
@@ -2384,7 +2397,7 @@ function inspect(value, opts = {}) {
|
|
|
2384
2397
|
return baseTypesMap[type3](value, options);
|
|
2385
2398
|
}
|
|
2386
2399
|
if (customInspect && value) {
|
|
2387
|
-
const output = inspectCustom(value, options, type3
|
|
2400
|
+
const output = inspectCustom(value, options, type3);
|
|
2388
2401
|
if (output) {
|
|
2389
2402
|
if (typeof output === "string")
|
|
2390
2403
|
return output;
|
|
@@ -2457,14 +2470,14 @@ function format2(...args) {
|
|
|
2457
2470
|
const len = args.length;
|
|
2458
2471
|
let i = 1;
|
|
2459
2472
|
const template = args[0];
|
|
2460
|
-
let str = String(template).replace(formatRegExp, (
|
|
2461
|
-
if (
|
|
2473
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
2474
|
+
if (x === "%%") {
|
|
2462
2475
|
return "%";
|
|
2463
2476
|
}
|
|
2464
2477
|
if (i >= len) {
|
|
2465
|
-
return
|
|
2478
|
+
return x;
|
|
2466
2479
|
}
|
|
2467
|
-
switch (
|
|
2480
|
+
switch (x) {
|
|
2468
2481
|
case "%s": {
|
|
2469
2482
|
const value = args[i++];
|
|
2470
2483
|
if (typeof value === "bigint") {
|
|
@@ -2522,14 +2535,14 @@ function format2(...args) {
|
|
|
2522
2535
|
throw err;
|
|
2523
2536
|
}
|
|
2524
2537
|
default:
|
|
2525
|
-
return
|
|
2538
|
+
return x;
|
|
2526
2539
|
}
|
|
2527
2540
|
});
|
|
2528
|
-
for (let
|
|
2529
|
-
if (
|
|
2530
|
-
str += ` ${
|
|
2541
|
+
for (let x = args[i]; i < len; x = args[++i]) {
|
|
2542
|
+
if (x === null || typeof x !== "object") {
|
|
2543
|
+
str += ` ${x}`;
|
|
2531
2544
|
} else {
|
|
2532
|
-
str += ` ${inspect2(
|
|
2545
|
+
str += ` ${inspect2(x)}`;
|
|
2533
2546
|
}
|
|
2534
2547
|
}
|
|
2535
2548
|
return str;
|
|
@@ -2562,8 +2575,8 @@ function objDisplay(obj, options = {}) {
|
|
|
2562
2575
|
}
|
|
2563
2576
|
return str;
|
|
2564
2577
|
}
|
|
2565
|
-
function getDefaultExportFromCjs2(
|
|
2566
|
-
return
|
|
2578
|
+
function getDefaultExportFromCjs2(x) {
|
|
2579
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2567
2580
|
}
|
|
2568
2581
|
function createSimpleStackTrace(options) {
|
|
2569
2582
|
const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
|
|
@@ -2621,15 +2634,15 @@ function deepClone(val, options = defaultCloneOptions) {
|
|
|
2621
2634
|
return clone(val, seen, options);
|
|
2622
2635
|
}
|
|
2623
2636
|
function clone(val, seen, options = defaultCloneOptions) {
|
|
2624
|
-
let
|
|
2637
|
+
let k, out;
|
|
2625
2638
|
if (seen.has(val)) {
|
|
2626
2639
|
return seen.get(val);
|
|
2627
2640
|
}
|
|
2628
2641
|
if (Array.isArray(val)) {
|
|
2629
|
-
out = Array.from({ length:
|
|
2642
|
+
out = Array.from({ length: k = val.length });
|
|
2630
2643
|
seen.set(val, out);
|
|
2631
|
-
while (
|
|
2632
|
-
out[
|
|
2644
|
+
while (k--) {
|
|
2645
|
+
out[k] = clone(val[k], seen, options);
|
|
2633
2646
|
}
|
|
2634
2647
|
return out;
|
|
2635
2648
|
}
|
|
@@ -2637,28 +2650,28 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
2637
2650
|
out = Object.create(Object.getPrototypeOf(val));
|
|
2638
2651
|
seen.set(val, out);
|
|
2639
2652
|
const props = getOwnProperties(val);
|
|
2640
|
-
for (const
|
|
2641
|
-
const descriptor = Object.getOwnPropertyDescriptor(val,
|
|
2653
|
+
for (const k2 of props) {
|
|
2654
|
+
const descriptor = Object.getOwnPropertyDescriptor(val, k2);
|
|
2642
2655
|
if (!descriptor) {
|
|
2643
2656
|
continue;
|
|
2644
2657
|
}
|
|
2645
|
-
const cloned = clone(val[
|
|
2658
|
+
const cloned = clone(val[k2], seen, options);
|
|
2646
2659
|
if (options.forceWritable) {
|
|
2647
|
-
Object.defineProperty(out,
|
|
2660
|
+
Object.defineProperty(out, k2, {
|
|
2648
2661
|
enumerable: descriptor.enumerable,
|
|
2649
2662
|
configurable: true,
|
|
2650
2663
|
writable: true,
|
|
2651
2664
|
value: cloned
|
|
2652
2665
|
});
|
|
2653
2666
|
} else if ("get" in descriptor) {
|
|
2654
|
-
Object.defineProperty(out,
|
|
2667
|
+
Object.defineProperty(out, k2, {
|
|
2655
2668
|
...descriptor,
|
|
2656
2669
|
get() {
|
|
2657
2670
|
return cloned;
|
|
2658
2671
|
}
|
|
2659
2672
|
});
|
|
2660
2673
|
} else {
|
|
2661
|
-
Object.defineProperty(out,
|
|
2674
|
+
Object.defineProperty(out, k2, {
|
|
2662
2675
|
...descriptor,
|
|
2663
2676
|
value: cloned
|
|
2664
2677
|
});
|
|
@@ -4043,19 +4056,19 @@ function joinAlignedDiffsNoExpand(diffs, options) {
|
|
|
4043
4056
|
let aEnd = 0;
|
|
4044
4057
|
let bEnd = 0;
|
|
4045
4058
|
const pushCommonLine = (line) => {
|
|
4046
|
-
const
|
|
4047
|
-
lines.push(printCommonLine(line,
|
|
4059
|
+
const j = lines.length;
|
|
4060
|
+
lines.push(printCommonLine(line, j === 0 || j === jLast, options));
|
|
4048
4061
|
aEnd += 1;
|
|
4049
4062
|
bEnd += 1;
|
|
4050
4063
|
};
|
|
4051
4064
|
const pushDeleteLine = (line) => {
|
|
4052
|
-
const
|
|
4053
|
-
lines.push(printDeleteLine(line,
|
|
4065
|
+
const j = lines.length;
|
|
4066
|
+
lines.push(printDeleteLine(line, j === 0 || j === jLast, options));
|
|
4054
4067
|
aEnd += 1;
|
|
4055
4068
|
};
|
|
4056
4069
|
const pushInsertLine = (line) => {
|
|
4057
|
-
const
|
|
4058
|
-
lines.push(printInsertLine(line,
|
|
4070
|
+
const j = lines.length;
|
|
4071
|
+
lines.push(printInsertLine(line, j === 0 || j === jLast, options));
|
|
4059
4072
|
bEnd += 1;
|
|
4060
4073
|
};
|
|
4061
4074
|
i = 0;
|
|
@@ -4182,20 +4195,20 @@ function isEmptyString(lines) {
|
|
|
4182
4195
|
}
|
|
4183
4196
|
function countChanges(diffs) {
|
|
4184
4197
|
let a3 = 0;
|
|
4185
|
-
let
|
|
4198
|
+
let b = 0;
|
|
4186
4199
|
diffs.forEach((diff2) => {
|
|
4187
4200
|
switch (diff2[0]) {
|
|
4188
4201
|
case DIFF_DELETE:
|
|
4189
4202
|
a3 += 1;
|
|
4190
4203
|
break;
|
|
4191
4204
|
case DIFF_INSERT:
|
|
4192
|
-
|
|
4205
|
+
b += 1;
|
|
4193
4206
|
break;
|
|
4194
4207
|
}
|
|
4195
4208
|
});
|
|
4196
4209
|
return {
|
|
4197
4210
|
a: a3,
|
|
4198
|
-
b
|
|
4211
|
+
b
|
|
4199
4212
|
};
|
|
4200
4213
|
}
|
|
4201
4214
|
function printAnnotation({ aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator, includeChangeCounts, omitAnnotationLines }, changeCounts) {
|
|
@@ -4217,9 +4230,9 @@ function printAnnotation({ aAnnotation, aColor, aIndicator, bAnnotation, bColor,
|
|
|
4217
4230
|
bRest = `${bAnnotationPadding} ${bIndicator} ${bCountPadding}${bCount}`;
|
|
4218
4231
|
}
|
|
4219
4232
|
const a3 = `${aIndicator} ${aAnnotation}${aRest}`;
|
|
4220
|
-
const
|
|
4233
|
+
const b = `${bIndicator} ${bAnnotation}${bRest}`;
|
|
4221
4234
|
return `${aColor(a3)}
|
|
4222
|
-
${bColor(
|
|
4235
|
+
${bColor(b)}
|
|
4223
4236
|
|
|
4224
4237
|
`;
|
|
4225
4238
|
}
|
|
@@ -4333,25 +4346,25 @@ function getType3(value) {
|
|
|
4333
4346
|
function getNewLineSymbol(string2) {
|
|
4334
4347
|
return string2.includes("\r\n") ? "\r\n" : "\n";
|
|
4335
4348
|
}
|
|
4336
|
-
function diffStrings(a3,
|
|
4349
|
+
function diffStrings(a3, b, options) {
|
|
4337
4350
|
const truncate3 = (options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? false;
|
|
4338
4351
|
const truncateThreshold = Math.max(Math.floor((options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? 0), 0);
|
|
4339
4352
|
let aLength = a3.length;
|
|
4340
|
-
let bLength =
|
|
4353
|
+
let bLength = b.length;
|
|
4341
4354
|
if (truncate3) {
|
|
4342
4355
|
const aMultipleLines = a3.includes("\n");
|
|
4343
|
-
const bMultipleLines =
|
|
4356
|
+
const bMultipleLines = b.includes("\n");
|
|
4344
4357
|
const aNewLineSymbol = getNewLineSymbol(a3);
|
|
4345
|
-
const bNewLineSymbol = getNewLineSymbol(
|
|
4358
|
+
const bNewLineSymbol = getNewLineSymbol(b);
|
|
4346
4359
|
const _a = aMultipleLines ? `${a3.split(aNewLineSymbol, truncateThreshold).join(aNewLineSymbol)}
|
|
4347
4360
|
` : a3;
|
|
4348
|
-
const _b = bMultipleLines ? `${
|
|
4349
|
-
` :
|
|
4361
|
+
const _b = bMultipleLines ? `${b.split(bNewLineSymbol, truncateThreshold).join(bNewLineSymbol)}
|
|
4362
|
+
` : b;
|
|
4350
4363
|
aLength = _a.length;
|
|
4351
4364
|
bLength = _b.length;
|
|
4352
4365
|
}
|
|
4353
|
-
const truncated = aLength !== a3.length || bLength !==
|
|
4354
|
-
const isCommon = (aIndex2, bIndex2) => a3[aIndex2] ===
|
|
4366
|
+
const truncated = aLength !== a3.length || bLength !== b.length;
|
|
4367
|
+
const isCommon = (aIndex2, bIndex2) => a3[aIndex2] === b[bIndex2];
|
|
4355
4368
|
let aIndex = 0;
|
|
4356
4369
|
let bIndex = 0;
|
|
4357
4370
|
const diffs = [];
|
|
@@ -4360,18 +4373,18 @@ function diffStrings(a3, b2, options) {
|
|
|
4360
4373
|
diffs.push(new Diff(DIFF_DELETE, a3.slice(aIndex, aCommon)));
|
|
4361
4374
|
}
|
|
4362
4375
|
if (bIndex !== bCommon) {
|
|
4363
|
-
diffs.push(new Diff(DIFF_INSERT,
|
|
4376
|
+
diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex, bCommon)));
|
|
4364
4377
|
}
|
|
4365
4378
|
aIndex = aCommon + nCommon;
|
|
4366
4379
|
bIndex = bCommon + nCommon;
|
|
4367
|
-
diffs.push(new Diff(DIFF_EQUAL,
|
|
4380
|
+
diffs.push(new Diff(DIFF_EQUAL, b.slice(bCommon, bIndex)));
|
|
4368
4381
|
};
|
|
4369
4382
|
diffSequences(aLength, bLength, isCommon, foundSubsequence);
|
|
4370
4383
|
if (aIndex !== aLength) {
|
|
4371
4384
|
diffs.push(new Diff(DIFF_DELETE, a3.slice(aIndex)));
|
|
4372
4385
|
}
|
|
4373
4386
|
if (bIndex !== bLength) {
|
|
4374
|
-
diffs.push(new Diff(DIFF_INSERT,
|
|
4387
|
+
diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex)));
|
|
4375
4388
|
}
|
|
4376
4389
|
return [diffs, truncated];
|
|
4377
4390
|
}
|
|
@@ -4513,22 +4526,22 @@ function hasCommonDiff(diffs, isMultiline) {
|
|
|
4513
4526
|
}
|
|
4514
4527
|
return diffs.some((diff2) => diff2[0] === DIFF_EQUAL);
|
|
4515
4528
|
}
|
|
4516
|
-
function diffStringsUnified(a3,
|
|
4517
|
-
if (a3 !==
|
|
4518
|
-
const isMultiline = a3.includes("\n") ||
|
|
4529
|
+
function diffStringsUnified(a3, b, options) {
|
|
4530
|
+
if (a3 !== b && a3.length !== 0 && b.length !== 0) {
|
|
4531
|
+
const isMultiline = a3.includes("\n") || b.includes("\n");
|
|
4519
4532
|
const [diffs, truncated] = diffStringsRaw(isMultiline ? `${a3}
|
|
4520
|
-
` : a3, isMultiline ? `${
|
|
4521
|
-
` :
|
|
4533
|
+
` : a3, isMultiline ? `${b}
|
|
4534
|
+
` : b, true, options);
|
|
4522
4535
|
if (hasCommonDiff(diffs, isMultiline)) {
|
|
4523
4536
|
const optionsNormalized = normalizeDiffOptions(options);
|
|
4524
4537
|
const lines = getAlignedDiffs(diffs, optionsNormalized.changeColor);
|
|
4525
4538
|
return printDiffLines(lines, truncated, optionsNormalized);
|
|
4526
4539
|
}
|
|
4527
4540
|
}
|
|
4528
|
-
return diffLinesUnified(a3.split("\n"),
|
|
4541
|
+
return diffLinesUnified(a3.split("\n"), b.split("\n"), options);
|
|
4529
4542
|
}
|
|
4530
|
-
function diffStringsRaw(a3,
|
|
4531
|
-
const [diffs, truncated] = diffStrings(a3,
|
|
4543
|
+
function diffStringsRaw(a3, b, cleanup, options) {
|
|
4544
|
+
const [diffs, truncated] = diffStrings(a3, b, options);
|
|
4532
4545
|
if (cleanup) {
|
|
4533
4546
|
diff_cleanupSemantic(diffs);
|
|
4534
4547
|
}
|
|
@@ -4557,8 +4570,8 @@ var FALLBACK_FORMAT_OPTIONS = {
|
|
|
4557
4570
|
maxDepth: 8,
|
|
4558
4571
|
plugins: PLUGINS2
|
|
4559
4572
|
};
|
|
4560
|
-
function diff(a3,
|
|
4561
|
-
if (Object.is(a3,
|
|
4573
|
+
function diff(a3, b, options) {
|
|
4574
|
+
if (Object.is(a3, b)) {
|
|
4562
4575
|
return "";
|
|
4563
4576
|
}
|
|
4564
4577
|
const aType = getType3(a3);
|
|
@@ -4574,7 +4587,7 @@ function diff(a3, b2, options) {
|
|
|
4574
4587
|
expectedType = a3.getExpectedType();
|
|
4575
4588
|
omitDifference = expectedType === "string";
|
|
4576
4589
|
}
|
|
4577
|
-
if (expectedType !== getType3(
|
|
4590
|
+
if (expectedType !== getType3(b)) {
|
|
4578
4591
|
let truncate4 = function(s2) {
|
|
4579
4592
|
return s2.length <= MAX_LENGTH ? s2 : `${s2.slice(0, MAX_LENGTH)}...`;
|
|
4580
4593
|
};
|
|
@@ -4582,7 +4595,7 @@ function diff(a3, b2, options) {
|
|
|
4582
4595
|
const { aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator } = normalizeDiffOptions(options);
|
|
4583
4596
|
const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
|
|
4584
4597
|
let aDisplay = format(a3, formatOptions);
|
|
4585
|
-
let bDisplay = format(
|
|
4598
|
+
let bDisplay = format(b, formatOptions);
|
|
4586
4599
|
const MAX_LENGTH = 1e5;
|
|
4587
4600
|
aDisplay = truncate4(aDisplay);
|
|
4588
4601
|
bDisplay = truncate4(bDisplay);
|
|
@@ -4599,21 +4612,21 @@ ${bDiff}`;
|
|
|
4599
4612
|
}
|
|
4600
4613
|
switch (aType) {
|
|
4601
4614
|
case "string":
|
|
4602
|
-
return diffLinesUnified(a3.split("\n"),
|
|
4615
|
+
return diffLinesUnified(a3.split("\n"), b.split("\n"), options);
|
|
4603
4616
|
case "boolean":
|
|
4604
4617
|
case "number":
|
|
4605
|
-
return comparePrimitive(a3,
|
|
4618
|
+
return comparePrimitive(a3, b, options);
|
|
4606
4619
|
case "map":
|
|
4607
|
-
return compareObjects(sortMap(a3), sortMap(
|
|
4620
|
+
return compareObjects(sortMap(a3), sortMap(b), options);
|
|
4608
4621
|
case "set":
|
|
4609
|
-
return compareObjects(sortSet(a3), sortSet(
|
|
4622
|
+
return compareObjects(sortSet(a3), sortSet(b), options);
|
|
4610
4623
|
default:
|
|
4611
|
-
return compareObjects(a3,
|
|
4624
|
+
return compareObjects(a3, b, options);
|
|
4612
4625
|
}
|
|
4613
4626
|
}
|
|
4614
|
-
function comparePrimitive(a3,
|
|
4627
|
+
function comparePrimitive(a3, b, options) {
|
|
4615
4628
|
const aFormat = format(a3, FORMAT_OPTIONS);
|
|
4616
|
-
const bFormat = format(
|
|
4629
|
+
const bFormat = format(b, FORMAT_OPTIONS);
|
|
4617
4630
|
return aFormat === bFormat ? "" : diffLinesUnified(aFormat.split("\n"), bFormat.split("\n"), options);
|
|
4618
4631
|
}
|
|
4619
4632
|
function sortMap(map2) {
|
|
@@ -4622,19 +4635,19 @@ function sortMap(map2) {
|
|
|
4622
4635
|
function sortSet(set3) {
|
|
4623
4636
|
return new Set(Array.from(set3.values()).sort());
|
|
4624
4637
|
}
|
|
4625
|
-
function compareObjects(a3,
|
|
4638
|
+
function compareObjects(a3, b, options) {
|
|
4626
4639
|
let difference;
|
|
4627
4640
|
let hasThrown = false;
|
|
4628
4641
|
try {
|
|
4629
4642
|
const formatOptions = getFormatOptions(FORMAT_OPTIONS, options);
|
|
4630
|
-
difference = getObjectsDifference(a3,
|
|
4643
|
+
difference = getObjectsDifference(a3, b, formatOptions, options);
|
|
4631
4644
|
} catch {
|
|
4632
4645
|
hasThrown = true;
|
|
4633
4646
|
}
|
|
4634
4647
|
const noDiffMessage = getCommonMessage(NO_DIFF_MESSAGE, options);
|
|
4635
4648
|
if (difference === void 0 || difference === noDiffMessage) {
|
|
4636
4649
|
const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
|
|
4637
|
-
difference = getObjectsDifference(a3,
|
|
4650
|
+
difference = getObjectsDifference(a3, b, formatOptions, options);
|
|
4638
4651
|
if (difference !== noDiffMessage && !hasThrown) {
|
|
4639
4652
|
difference = `${getCommonMessage(SIMILAR_MESSAGE, options)}
|
|
4640
4653
|
|
|
@@ -4652,18 +4665,18 @@ function getFormatOptions(formatOptions, options) {
|
|
|
4652
4665
|
maxDepth: maxDepth ?? formatOptions.maxDepth
|
|
4653
4666
|
};
|
|
4654
4667
|
}
|
|
4655
|
-
function getObjectsDifference(a3,
|
|
4668
|
+
function getObjectsDifference(a3, b, formatOptions, options) {
|
|
4656
4669
|
const formatOptionsZeroIndent = {
|
|
4657
4670
|
...formatOptions,
|
|
4658
4671
|
indent: 0
|
|
4659
4672
|
};
|
|
4660
4673
|
const aCompare = format(a3, formatOptionsZeroIndent);
|
|
4661
|
-
const bCompare = format(
|
|
4674
|
+
const bCompare = format(b, formatOptionsZeroIndent);
|
|
4662
4675
|
if (aCompare === bCompare) {
|
|
4663
4676
|
return getCommonMessage(NO_DIFF_MESSAGE, options);
|
|
4664
4677
|
} else {
|
|
4665
4678
|
const aDisplay = format(a3, formatOptions);
|
|
4666
|
-
const bDisplay = format(
|
|
4679
|
+
const bDisplay = format(b, formatOptions);
|
|
4667
4680
|
return diffLinesUnified2(aDisplay.split("\n"), bDisplay.split("\n"), aCompare.split("\n"), bCompare.split("\n"), options);
|
|
4668
4681
|
}
|
|
4669
4682
|
}
|
|
@@ -4758,163 +4771,163 @@ function printExpected(value) {
|
|
|
4758
4771
|
function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
|
|
4759
4772
|
return diffs.reduce((reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op ? hasCommonDiff2 ? u.inverse(diff2[1]) : diff2[1] : ""), "");
|
|
4760
4773
|
}
|
|
4761
|
-
function
|
|
4762
|
-
if (!
|
|
4763
|
-
throw new Error(
|
|
4774
|
+
function assert(condition, message) {
|
|
4775
|
+
if (!condition)
|
|
4776
|
+
throw new Error(message);
|
|
4764
4777
|
}
|
|
4765
|
-
function
|
|
4766
|
-
return typeof
|
|
4778
|
+
function isType(type3, value) {
|
|
4779
|
+
return typeof value === type3;
|
|
4767
4780
|
}
|
|
4768
|
-
function
|
|
4769
|
-
return
|
|
4781
|
+
function isPromise(value) {
|
|
4782
|
+
return value instanceof Promise;
|
|
4770
4783
|
}
|
|
4771
|
-
function
|
|
4772
|
-
Object.defineProperty(
|
|
4784
|
+
function define(obj, key, descriptor) {
|
|
4785
|
+
Object.defineProperty(obj, key, descriptor);
|
|
4773
4786
|
}
|
|
4774
|
-
function
|
|
4775
|
-
|
|
4787
|
+
function defineValue(obj, key, value) {
|
|
4788
|
+
define(obj, key, { value, configurable: true, writable: true });
|
|
4776
4789
|
}
|
|
4777
|
-
var
|
|
4778
|
-
var
|
|
4779
|
-
var
|
|
4780
|
-
|
|
4790
|
+
var SYMBOL_STATE = Symbol.for("tinyspy:spy");
|
|
4791
|
+
var spies = /* @__PURE__ */ new Set();
|
|
4792
|
+
var reset = (state) => {
|
|
4793
|
+
state.called = false, state.callCount = 0, state.calls = [], state.results = [], state.resolves = [], state.next = [];
|
|
4781
4794
|
};
|
|
4782
|
-
var
|
|
4783
|
-
value: { reset: () =>
|
|
4784
|
-
}),
|
|
4785
|
-
var
|
|
4786
|
-
function
|
|
4787
|
-
|
|
4788
|
-
|
|
4795
|
+
var defineState = (spy2) => (define(spy2, SYMBOL_STATE, {
|
|
4796
|
+
value: { reset: () => reset(spy2[SYMBOL_STATE]) }
|
|
4797
|
+
}), spy2[SYMBOL_STATE]);
|
|
4798
|
+
var getInternalState = (spy2) => spy2[SYMBOL_STATE] || defineState(spy2);
|
|
4799
|
+
function createInternalSpy(cb) {
|
|
4800
|
+
assert(
|
|
4801
|
+
isType("function", cb) || isType("undefined", cb),
|
|
4789
4802
|
"cannot spy on a non-function value"
|
|
4790
4803
|
);
|
|
4791
|
-
let
|
|
4792
|
-
let
|
|
4793
|
-
|
|
4794
|
-
let
|
|
4795
|
-
if (
|
|
4796
|
-
|
|
4797
|
-
let [
|
|
4798
|
-
if (
|
|
4799
|
-
return
|
|
4800
|
-
throw
|
|
4801
|
-
}
|
|
4802
|
-
let
|
|
4803
|
-
if (
|
|
4804
|
+
let fn2 = function(...args) {
|
|
4805
|
+
let state2 = getInternalState(fn2);
|
|
4806
|
+
state2.called = true, state2.callCount++, state2.calls.push(args);
|
|
4807
|
+
let next = state2.next.shift();
|
|
4808
|
+
if (next) {
|
|
4809
|
+
state2.results.push(next);
|
|
4810
|
+
let [type22, result2] = next;
|
|
4811
|
+
if (type22 === "ok")
|
|
4812
|
+
return result2;
|
|
4813
|
+
throw result2;
|
|
4814
|
+
}
|
|
4815
|
+
let result, type3 = "ok", resultIndex = state2.results.length;
|
|
4816
|
+
if (state2.impl)
|
|
4804
4817
|
try {
|
|
4805
|
-
new.target ?
|
|
4806
|
-
} catch (
|
|
4807
|
-
throw
|
|
4808
|
-
}
|
|
4809
|
-
let
|
|
4810
|
-
return
|
|
4811
|
-
(
|
|
4812
|
-
(
|
|
4813
|
-
),
|
|
4818
|
+
new.target ? result = Reflect.construct(state2.impl, args, new.target) : result = state2.impl.apply(this, args), type3 = "ok";
|
|
4819
|
+
} catch (err) {
|
|
4820
|
+
throw result = err, type3 = "error", state2.results.push([type3, err]), err;
|
|
4821
|
+
}
|
|
4822
|
+
let resultTuple = [type3, result];
|
|
4823
|
+
return isPromise(result) && result.then(
|
|
4824
|
+
(r2) => state2.resolves[resultIndex] = ["ok", r2],
|
|
4825
|
+
(e) => state2.resolves[resultIndex] = ["error", e]
|
|
4826
|
+
), state2.results.push(resultTuple), result;
|
|
4814
4827
|
};
|
|
4815
|
-
|
|
4816
|
-
let
|
|
4817
|
-
return
|
|
4818
|
-
}
|
|
4819
|
-
function
|
|
4820
|
-
return !!
|
|
4821
|
-
}
|
|
4822
|
-
var
|
|
4823
|
-
let
|
|
4824
|
-
if (
|
|
4825
|
-
return [
|
|
4826
|
-
let
|
|
4827
|
-
for (;
|
|
4828
|
-
let
|
|
4829
|
-
if (
|
|
4830
|
-
return [
|
|
4831
|
-
|
|
4828
|
+
defineValue(fn2, "_isMockFunction", true), defineValue(fn2, "length", cb ? cb.length : 0), defineValue(fn2, "name", cb && cb.name || "spy");
|
|
4829
|
+
let state = getInternalState(fn2);
|
|
4830
|
+
return state.reset(), state.impl = cb, fn2;
|
|
4831
|
+
}
|
|
4832
|
+
function isMockFunction(obj) {
|
|
4833
|
+
return !!obj && obj._isMockFunction === true;
|
|
4834
|
+
}
|
|
4835
|
+
var getDescriptor = (obj, method) => {
|
|
4836
|
+
let objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
4837
|
+
if (objDescriptor)
|
|
4838
|
+
return [obj, objDescriptor];
|
|
4839
|
+
let currentProto = Object.getPrototypeOf(obj);
|
|
4840
|
+
for (; currentProto !== null; ) {
|
|
4841
|
+
let descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
4842
|
+
if (descriptor)
|
|
4843
|
+
return [currentProto, descriptor];
|
|
4844
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
4832
4845
|
}
|
|
4833
4846
|
};
|
|
4834
|
-
var
|
|
4835
|
-
|
|
4847
|
+
var setPototype = (fn2, val) => {
|
|
4848
|
+
val != null && typeof val == "function" && val.prototype != null && Object.setPrototypeOf(fn2.prototype, val.prototype);
|
|
4836
4849
|
};
|
|
4837
|
-
function
|
|
4838
|
-
|
|
4839
|
-
!
|
|
4850
|
+
function internalSpyOn(obj, methodName, mock) {
|
|
4851
|
+
assert(
|
|
4852
|
+
!isType("undefined", obj),
|
|
4840
4853
|
"spyOn could not find an object to spy upon"
|
|
4841
|
-
),
|
|
4842
|
-
|
|
4854
|
+
), assert(
|
|
4855
|
+
isType("object", obj) || isType("function", obj),
|
|
4843
4856
|
"cannot spyOn on a primitive value"
|
|
4844
4857
|
);
|
|
4845
|
-
let [
|
|
4846
|
-
if (!
|
|
4847
|
-
return [
|
|
4848
|
-
if ("getter" in
|
|
4858
|
+
let [accessName, accessType] = (() => {
|
|
4859
|
+
if (!isType("object", methodName))
|
|
4860
|
+
return [methodName, "value"];
|
|
4861
|
+
if ("getter" in methodName && "setter" in methodName)
|
|
4849
4862
|
throw new Error("cannot spy on both getter and setter");
|
|
4850
|
-
if ("getter" in
|
|
4851
|
-
return [
|
|
4852
|
-
if ("setter" in
|
|
4853
|
-
return [
|
|
4863
|
+
if ("getter" in methodName)
|
|
4864
|
+
return [methodName.getter, "get"];
|
|
4865
|
+
if ("setter" in methodName)
|
|
4866
|
+
return [methodName.setter, "set"];
|
|
4854
4867
|
throw new Error("specify getter or setter to spy on");
|
|
4855
|
-
})(), [
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
`${String(
|
|
4868
|
+
})(), [originalDescriptorObject, originalDescriptor] = getDescriptor(obj, accessName) || [];
|
|
4869
|
+
assert(
|
|
4870
|
+
originalDescriptor || accessName in obj,
|
|
4871
|
+
`${String(accessName)} does not exist`
|
|
4859
4872
|
);
|
|
4860
|
-
let
|
|
4861
|
-
|
|
4862
|
-
let
|
|
4863
|
-
|
|
4864
|
-
let
|
|
4865
|
-
let { value
|
|
4873
|
+
let ssr = false;
|
|
4874
|
+
accessType === "value" && originalDescriptor && !originalDescriptor.value && originalDescriptor.get && (accessType = "get", ssr = true, mock = originalDescriptor.get());
|
|
4875
|
+
let original;
|
|
4876
|
+
originalDescriptor ? original = originalDescriptor[accessType] : accessType !== "value" ? original = () => obj[accessName] : original = obj[accessName], original && isSpyFunction(original) && (original = original[SYMBOL_STATE].getOriginal());
|
|
4877
|
+
let reassign = (cb) => {
|
|
4878
|
+
let { value, ...desc } = originalDescriptor || {
|
|
4866
4879
|
configurable: true,
|
|
4867
4880
|
writable: true
|
|
4868
4881
|
};
|
|
4869
|
-
|
|
4870
|
-
},
|
|
4871
|
-
|
|
4882
|
+
accessType !== "value" && delete desc.writable, desc[accessType] = cb, define(obj, accessName, desc);
|
|
4883
|
+
}, restore = () => {
|
|
4884
|
+
originalDescriptorObject !== obj ? Reflect.deleteProperty(obj, accessName) : originalDescriptor && !original ? define(obj, accessName, originalDescriptor) : reassign(original);
|
|
4872
4885
|
};
|
|
4873
|
-
|
|
4874
|
-
let
|
|
4875
|
-
|
|
4876
|
-
let
|
|
4877
|
-
return
|
|
4878
|
-
|
|
4879
|
-
),
|
|
4880
|
-
}
|
|
4881
|
-
var
|
|
4886
|
+
mock || (mock = original);
|
|
4887
|
+
let spy2 = wrap(createInternalSpy(mock), mock);
|
|
4888
|
+
accessType === "value" && setPototype(spy2, original);
|
|
4889
|
+
let state = spy2[SYMBOL_STATE];
|
|
4890
|
+
return defineValue(state, "restore", restore), defineValue(state, "getOriginal", () => ssr ? original() : original), defineValue(state, "willCall", (newCb) => (state.impl = newCb, spy2)), reassign(
|
|
4891
|
+
ssr ? () => (setPototype(spy2, mock), spy2) : spy2
|
|
4892
|
+
), spies.add(spy2), spy2;
|
|
4893
|
+
}
|
|
4894
|
+
var ignoreProperties = /* @__PURE__ */ new Set([
|
|
4882
4895
|
"length",
|
|
4883
4896
|
"name",
|
|
4884
4897
|
"prototype"
|
|
4885
4898
|
]);
|
|
4886
|
-
function
|
|
4887
|
-
let
|
|
4888
|
-
for (;
|
|
4889
|
-
let
|
|
4890
|
-
...Object.getOwnPropertyNames(
|
|
4891
|
-
...Object.getOwnPropertySymbols(
|
|
4899
|
+
function getAllProperties(original) {
|
|
4900
|
+
let properties = /* @__PURE__ */ new Set(), descriptors2 = {};
|
|
4901
|
+
for (; original && original !== Object.prototype && original !== Function.prototype; ) {
|
|
4902
|
+
let ownProperties = [
|
|
4903
|
+
...Object.getOwnPropertyNames(original),
|
|
4904
|
+
...Object.getOwnPropertySymbols(original)
|
|
4892
4905
|
];
|
|
4893
|
-
for (let
|
|
4894
|
-
|
|
4895
|
-
|
|
4906
|
+
for (let prop of ownProperties)
|
|
4907
|
+
descriptors2[prop] || ignoreProperties.has(prop) || (properties.add(prop), descriptors2[prop] = Object.getOwnPropertyDescriptor(original, prop));
|
|
4908
|
+
original = Object.getPrototypeOf(original);
|
|
4896
4909
|
}
|
|
4897
4910
|
return {
|
|
4898
|
-
properties
|
|
4899
|
-
descriptors:
|
|
4911
|
+
properties,
|
|
4912
|
+
descriptors: descriptors2
|
|
4900
4913
|
};
|
|
4901
4914
|
}
|
|
4902
|
-
function
|
|
4903
|
-
if (!
|
|
4904
|
-
|
|
4905
|
-
return
|
|
4906
|
-
let { properties
|
|
4907
|
-
for (let
|
|
4908
|
-
let
|
|
4909
|
-
|
|
4915
|
+
function wrap(mock, original) {
|
|
4916
|
+
if (!original || // the original is already a spy, so it has all the properties
|
|
4917
|
+
SYMBOL_STATE in original)
|
|
4918
|
+
return mock;
|
|
4919
|
+
let { properties, descriptors: descriptors2 } = getAllProperties(original);
|
|
4920
|
+
for (let key of properties) {
|
|
4921
|
+
let descriptor = descriptors2[key];
|
|
4922
|
+
getDescriptor(mock, key) || define(mock, key, descriptor);
|
|
4910
4923
|
}
|
|
4911
|
-
return
|
|
4924
|
+
return mock;
|
|
4912
4925
|
}
|
|
4913
|
-
function
|
|
4914
|
-
return
|
|
4926
|
+
function isSpyFunction(obj) {
|
|
4927
|
+
return isMockFunction(obj) && "getOriginal" in obj[SYMBOL_STATE];
|
|
4915
4928
|
}
|
|
4916
4929
|
var mocks = /* @__PURE__ */ new Set();
|
|
4917
|
-
function
|
|
4930
|
+
function isMockFunction2(fn2) {
|
|
4918
4931
|
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
4919
4932
|
}
|
|
4920
4933
|
function spyOn(obj, method, accessType) {
|
|
@@ -4924,13 +4937,13 @@ function spyOn(obj, method, accessType) {
|
|
|
4924
4937
|
};
|
|
4925
4938
|
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
4926
4939
|
let state;
|
|
4927
|
-
const descriptor =
|
|
4940
|
+
const descriptor = getDescriptor2(obj, method);
|
|
4928
4941
|
const fn2 = descriptor && descriptor[accessType || "value"];
|
|
4929
|
-
if (
|
|
4942
|
+
if (isMockFunction2(fn2)) {
|
|
4930
4943
|
state = fn2.mock._state();
|
|
4931
4944
|
}
|
|
4932
4945
|
try {
|
|
4933
|
-
const stub =
|
|
4946
|
+
const stub = internalSpyOn(obj, objMethod);
|
|
4934
4947
|
const spy = enhanceSpy(stub);
|
|
4935
4948
|
if (state) {
|
|
4936
4949
|
spy.mock._state(state);
|
|
@@ -4952,7 +4965,7 @@ function enhanceSpy(spy) {
|
|
|
4952
4965
|
let instances = [];
|
|
4953
4966
|
let contexts = [];
|
|
4954
4967
|
let invocations = [];
|
|
4955
|
-
const state =
|
|
4968
|
+
const state = getInternalState(spy);
|
|
4956
4969
|
const mockContext = {
|
|
4957
4970
|
get calls() {
|
|
4958
4971
|
return state.calls;
|
|
@@ -5050,18 +5063,18 @@ function enhanceSpy(spy) {
|
|
|
5050
5063
|
implementation = fn2;
|
|
5051
5064
|
state.willCall(mockCall);
|
|
5052
5065
|
implementationChangedTemporarily = true;
|
|
5053
|
-
const
|
|
5066
|
+
const reset2 = () => {
|
|
5054
5067
|
implementation = originalImplementation;
|
|
5055
5068
|
implementationChangedTemporarily = false;
|
|
5056
5069
|
};
|
|
5057
5070
|
const result = cb();
|
|
5058
5071
|
if (typeof result === "object" && result && typeof result.then === "function") {
|
|
5059
5072
|
return result.then(() => {
|
|
5060
|
-
|
|
5073
|
+
reset2();
|
|
5061
5074
|
return stub;
|
|
5062
5075
|
});
|
|
5063
5076
|
}
|
|
5064
|
-
|
|
5077
|
+
reset2();
|
|
5065
5078
|
return stub;
|
|
5066
5079
|
}
|
|
5067
5080
|
stub.withImplementation = withImplementation;
|
|
@@ -5080,14 +5093,14 @@ function enhanceSpy(spy) {
|
|
|
5080
5093
|
return stub;
|
|
5081
5094
|
}
|
|
5082
5095
|
function fn(implementation) {
|
|
5083
|
-
const enhancedSpy = enhanceSpy(
|
|
5096
|
+
const enhancedSpy = enhanceSpy(internalSpyOn({ spy: implementation || function() {
|
|
5084
5097
|
} }, "spy"));
|
|
5085
5098
|
if (implementation) {
|
|
5086
5099
|
enhancedSpy.mockImplementation(implementation);
|
|
5087
5100
|
}
|
|
5088
5101
|
return enhancedSpy;
|
|
5089
5102
|
}
|
|
5090
|
-
function
|
|
5103
|
+
function getDescriptor2(obj, method) {
|
|
5091
5104
|
const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
5092
5105
|
if (objDescriptor) {
|
|
5093
5106
|
return objDescriptor;
|
|
@@ -5103,8 +5116,8 @@ function getDescriptor(obj, method) {
|
|
|
5103
5116
|
}
|
|
5104
5117
|
var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
5105
5118
|
var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
5106
|
-
function isImmutable(
|
|
5107
|
-
return
|
|
5119
|
+
function isImmutable(v) {
|
|
5120
|
+
return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
|
|
5108
5121
|
}
|
|
5109
5122
|
var OBJECT_PROTO = Object.getPrototypeOf({});
|
|
5110
5123
|
function getUnserializableMessage(err) {
|
|
@@ -5250,11 +5263,19 @@ Inner error message: ${err === null || err === void 0 ? void 0 : err.message}`))
|
|
|
5250
5263
|
}
|
|
5251
5264
|
}
|
|
5252
5265
|
var __defProp2 = Object.defineProperty;
|
|
5266
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
5253
5267
|
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
5268
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
5269
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5270
|
+
};
|
|
5254
5271
|
var __export2 = (target, all) => {
|
|
5255
5272
|
for (var name in all)
|
|
5256
5273
|
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
5257
5274
|
};
|
|
5275
|
+
var require_util = __commonJS2({
|
|
5276
|
+
"(disabled):util"() {
|
|
5277
|
+
}
|
|
5278
|
+
});
|
|
5258
5279
|
var utils_exports = {};
|
|
5259
5280
|
__export2(utils_exports, {
|
|
5260
5281
|
addChainableMethod: () => addChainableMethod,
|
|
@@ -5352,7 +5373,7 @@ function getMessage(errorLike) {
|
|
|
5352
5373
|
}
|
|
5353
5374
|
__name(getMessage, "getMessage");
|
|
5354
5375
|
function flag(obj, key, value) {
|
|
5355
|
-
|
|
5376
|
+
var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
|
|
5356
5377
|
if (arguments.length === 3) {
|
|
5357
5378
|
flags[key] = value;
|
|
5358
5379
|
} else {
|
|
@@ -5361,7 +5382,7 @@ function flag(obj, key, value) {
|
|
|
5361
5382
|
}
|
|
5362
5383
|
__name(flag, "flag");
|
|
5363
5384
|
function test2(obj, args) {
|
|
5364
|
-
|
|
5385
|
+
var negate = flag(obj, "negate"), expr = args[0];
|
|
5365
5386
|
return negate ? !expr : expr;
|
|
5366
5387
|
}
|
|
5367
5388
|
__name(test2, "test");
|
|
@@ -5415,20 +5436,20 @@ var AssertionError = class _AssertionError extends Error {
|
|
|
5415
5436
|
}
|
|
5416
5437
|
};
|
|
5417
5438
|
function expectTypes(obj, types) {
|
|
5418
|
-
|
|
5419
|
-
|
|
5439
|
+
var flagMsg = flag(obj, "message");
|
|
5440
|
+
var ssfi = flag(obj, "ssfi");
|
|
5420
5441
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
5421
5442
|
obj = flag(obj, "object");
|
|
5422
5443
|
types = types.map(function(t) {
|
|
5423
5444
|
return t.toLowerCase();
|
|
5424
5445
|
});
|
|
5425
5446
|
types.sort();
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5447
|
+
var str = types.map(function(t, index2) {
|
|
5448
|
+
var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
|
|
5449
|
+
var or = types.length > 1 && index2 === types.length - 1 ? "or " : "";
|
|
5429
5450
|
return or + art + " " + t;
|
|
5430
5451
|
}).join(", ");
|
|
5431
|
-
|
|
5452
|
+
var objType = type(obj).toLowerCase();
|
|
5432
5453
|
if (!types.some(function(expected) {
|
|
5433
5454
|
return objType === expected;
|
|
5434
5455
|
})) {
|
|
@@ -5686,8 +5707,10 @@ function mapToEntries2(map2) {
|
|
|
5686
5707
|
}
|
|
5687
5708
|
__name(mapToEntries2, "mapToEntries");
|
|
5688
5709
|
function inspectMap2(map2, options) {
|
|
5689
|
-
|
|
5710
|
+
const size = map2.size - 1;
|
|
5711
|
+
if (size <= 0) {
|
|
5690
5712
|
return "Map{}";
|
|
5713
|
+
}
|
|
5691
5714
|
options.truncate -= 7;
|
|
5692
5715
|
return `Map{ ${inspectList2(mapToEntries2(map2), options, inspectMapEntry2)} }`;
|
|
5693
5716
|
}
|
|
@@ -5769,6 +5792,19 @@ function inspectSymbol2(value) {
|
|
|
5769
5792
|
}
|
|
5770
5793
|
__name(inspectSymbol2, "inspectSymbol");
|
|
5771
5794
|
var getPromiseValue2 = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue");
|
|
5795
|
+
try {
|
|
5796
|
+
const { getPromiseDetails, kPending, kRejected } = process.binding("util");
|
|
5797
|
+
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
5798
|
+
getPromiseValue2 = /* @__PURE__ */ __name((value, options) => {
|
|
5799
|
+
const [state, innerValue] = getPromiseDetails(value);
|
|
5800
|
+
if (state === kPending) {
|
|
5801
|
+
return "Promise{<pending>}";
|
|
5802
|
+
}
|
|
5803
|
+
return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
|
|
5804
|
+
}, "getPromiseValue");
|
|
5805
|
+
}
|
|
5806
|
+
} catch (notNode) {
|
|
5807
|
+
}
|
|
5772
5808
|
var promise_default2 = getPromiseValue2;
|
|
5773
5809
|
function inspectObject3(object2, options) {
|
|
5774
5810
|
const properties = Object.getOwnPropertyNames(object2);
|
|
@@ -5855,21 +5891,10 @@ function inspectAttribute2([key, value], options) {
|
|
|
5855
5891
|
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
5856
5892
|
}
|
|
5857
5893
|
__name(inspectAttribute2, "inspectAttribute");
|
|
5858
|
-
function
|
|
5859
|
-
return inspectList2(collection, options,
|
|
5860
|
-
}
|
|
5861
|
-
__name(inspectNodeCollection2, "inspectNodeCollection");
|
|
5862
|
-
function inspectNode2(node, options) {
|
|
5863
|
-
switch (node.nodeType) {
|
|
5864
|
-
case 1:
|
|
5865
|
-
return inspectHTML2(node, options);
|
|
5866
|
-
case 3:
|
|
5867
|
-
return options.inspect(node.data, options);
|
|
5868
|
-
default:
|
|
5869
|
-
return options.inspect(node, options);
|
|
5870
|
-
}
|
|
5894
|
+
function inspectHTMLCollection(collection, options) {
|
|
5895
|
+
return inspectList2(collection, options, inspectHTML2, "\n");
|
|
5871
5896
|
}
|
|
5872
|
-
__name(
|
|
5897
|
+
__name(inspectHTMLCollection, "inspectHTMLCollection");
|
|
5873
5898
|
function inspectHTML2(element, options) {
|
|
5874
5899
|
const properties = element.getAttributeNames();
|
|
5875
5900
|
const name = element.tagName.toLowerCase();
|
|
@@ -5884,7 +5909,7 @@ function inspectHTML2(element, options) {
|
|
|
5884
5909
|
}
|
|
5885
5910
|
options.truncate -= propertyContents.length;
|
|
5886
5911
|
const truncate22 = options.truncate;
|
|
5887
|
-
let children =
|
|
5912
|
+
let children = inspectHTMLCollection(element.children, options);
|
|
5888
5913
|
if (children && children.length > truncate22) {
|
|
5889
5914
|
children = `${truncator2}(${element.children.length})`;
|
|
5890
5915
|
}
|
|
@@ -5893,14 +5918,20 @@ function inspectHTML2(element, options) {
|
|
|
5893
5918
|
__name(inspectHTML2, "inspectHTML");
|
|
5894
5919
|
var symbolsSupported2 = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
5895
5920
|
var chaiInspect2 = symbolsSupported2 ? Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
5896
|
-
var nodeInspect2 =
|
|
5921
|
+
var nodeInspect2 = false;
|
|
5922
|
+
try {
|
|
5923
|
+
const nodeUtil = require_util();
|
|
5924
|
+
nodeInspect2 = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
|
5925
|
+
} catch (noNodeInspect) {
|
|
5926
|
+
nodeInspect2 = false;
|
|
5927
|
+
}
|
|
5897
5928
|
var constructorMap2 = /* @__PURE__ */ new WeakMap();
|
|
5898
5929
|
var stringTagMap2 = {};
|
|
5899
5930
|
var baseTypesMap2 = {
|
|
5900
|
-
undefined:
|
|
5901
|
-
null:
|
|
5902
|
-
boolean:
|
|
5903
|
-
Boolean:
|
|
5931
|
+
undefined: (value, options) => options.stylize("undefined", "undefined"),
|
|
5932
|
+
null: (value, options) => options.stylize("null", "null"),
|
|
5933
|
+
boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
5934
|
+
Boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
5904
5935
|
number: inspectNumber2,
|
|
5905
5936
|
Number: inspectNumber2,
|
|
5906
5937
|
bigint: inspectBigInt2,
|
|
@@ -5919,8 +5950,8 @@ var baseTypesMap2 = {
|
|
|
5919
5950
|
RegExp: inspectRegExp2,
|
|
5920
5951
|
Promise: promise_default2,
|
|
5921
5952
|
// WeakSet, WeakMap are totally opaque to us
|
|
5922
|
-
WeakSet:
|
|
5923
|
-
WeakMap:
|
|
5953
|
+
WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
|
|
5954
|
+
WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
|
|
5924
5955
|
Arguments: inspectArguments2,
|
|
5925
5956
|
Int8Array: inspectTypedArray2,
|
|
5926
5957
|
Uint8Array: inspectTypedArray2,
|
|
@@ -5931,18 +5962,18 @@ var baseTypesMap2 = {
|
|
|
5931
5962
|
Uint32Array: inspectTypedArray2,
|
|
5932
5963
|
Float32Array: inspectTypedArray2,
|
|
5933
5964
|
Float64Array: inspectTypedArray2,
|
|
5934
|
-
Generator:
|
|
5935
|
-
DataView:
|
|
5936
|
-
ArrayBuffer:
|
|
5965
|
+
Generator: () => "",
|
|
5966
|
+
DataView: () => "",
|
|
5967
|
+
ArrayBuffer: () => "",
|
|
5937
5968
|
Error: inspectObject22,
|
|
5938
|
-
HTMLCollection:
|
|
5939
|
-
NodeList:
|
|
5969
|
+
HTMLCollection: inspectHTMLCollection,
|
|
5970
|
+
NodeList: inspectHTMLCollection
|
|
5940
5971
|
};
|
|
5941
5972
|
var inspectCustom2 = /* @__PURE__ */ __name((value, options, type3) => {
|
|
5942
5973
|
if (chaiInspect2 in value && typeof value[chaiInspect2] === "function") {
|
|
5943
5974
|
return value[chaiInspect2](options);
|
|
5944
5975
|
}
|
|
5945
|
-
if (nodeInspect2 in value && typeof value[nodeInspect2] === "function") {
|
|
5976
|
+
if (nodeInspect2 && nodeInspect2 in value && typeof value[nodeInspect2] === "function") {
|
|
5946
5977
|
return value[nodeInspect2](options.depth, options);
|
|
5947
5978
|
}
|
|
5948
5979
|
if ("inspect" in value && typeof value.inspect === "function") {
|
|
@@ -6102,7 +6133,7 @@ var config = {
|
|
|
6102
6133
|
deepEqual: null
|
|
6103
6134
|
};
|
|
6104
6135
|
function inspect22(obj, showHidden, depth, colors) {
|
|
6105
|
-
|
|
6136
|
+
var options = {
|
|
6106
6137
|
colors,
|
|
6107
6138
|
depth: typeof depth === "undefined" ? 2 : depth,
|
|
6108
6139
|
showHidden,
|
|
@@ -6112,14 +6143,14 @@ function inspect22(obj, showHidden, depth, colors) {
|
|
|
6112
6143
|
}
|
|
6113
6144
|
__name(inspect22, "inspect");
|
|
6114
6145
|
function objDisplay2(obj) {
|
|
6115
|
-
|
|
6146
|
+
var str = inspect22(obj), type3 = Object.prototype.toString.call(obj);
|
|
6116
6147
|
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
6117
6148
|
if (type3 === "[object Function]") {
|
|
6118
6149
|
return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
|
|
6119
6150
|
} else if (type3 === "[object Array]") {
|
|
6120
6151
|
return "[ Array(" + obj.length + ") ]";
|
|
6121
6152
|
} else if (type3 === "[object Object]") {
|
|
6122
|
-
|
|
6153
|
+
var keys2 = Object.keys(obj), kstr = keys2.length > 2 ? keys2.splice(0, 2).join(", ") + ", ..." : keys2.join(", ");
|
|
6123
6154
|
return "{ Object (" + kstr + ") }";
|
|
6124
6155
|
} else {
|
|
6125
6156
|
return str;
|
|
@@ -6130,13 +6161,9 @@ function objDisplay2(obj) {
|
|
|
6130
6161
|
}
|
|
6131
6162
|
__name(objDisplay2, "objDisplay");
|
|
6132
6163
|
function getMessage2(obj, args) {
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
let actual = getActual(obj, args);
|
|
6137
|
-
let msg = negate ? args[2] : args[1];
|
|
6138
|
-
let flagMsg = flag(obj, "message");
|
|
6139
|
-
if (typeof msg === "function") msg = msg();
|
|
6164
|
+
var negate = flag(obj, "negate"), val = flag(obj, "object"), expected = args[3], actual = getActual(obj, args), msg = negate ? args[2] : args[1], flagMsg = flag(obj, "message");
|
|
6165
|
+
if (typeof msg === "function")
|
|
6166
|
+
msg = msg();
|
|
6140
6167
|
msg = msg || "";
|
|
6141
6168
|
msg = msg.replace(/#\{this\}/g, function() {
|
|
6142
6169
|
return objDisplay2(val);
|
|
@@ -6149,12 +6176,12 @@ function getMessage2(obj, args) {
|
|
|
6149
6176
|
}
|
|
6150
6177
|
__name(getMessage2, "getMessage");
|
|
6151
6178
|
function transferFlags(assertion, object2, includeAll) {
|
|
6152
|
-
|
|
6179
|
+
var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
|
|
6153
6180
|
if (!object2.__flags) {
|
|
6154
6181
|
object2.__flags = /* @__PURE__ */ Object.create(null);
|
|
6155
6182
|
}
|
|
6156
6183
|
includeAll = arguments.length === 3 ? includeAll : true;
|
|
6157
|
-
for (
|
|
6184
|
+
for (var flag3 in flags) {
|
|
6158
6185
|
if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
|
|
6159
6186
|
object2.__flags[flag3] = flags[flag3];
|
|
6160
6187
|
}
|
|
@@ -6542,183 +6569,96 @@ function getPathInfo(obj, path2) {
|
|
|
6542
6569
|
return info;
|
|
6543
6570
|
}
|
|
6544
6571
|
__name(getPathInfo, "getPathInfo");
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
* - `object`: This flag contains the target of the assertion. For example, in
|
|
6557
|
-
* the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
|
|
6558
|
-
* contain `numKittens` so that the `equal` assertion can reference it when
|
|
6559
|
-
* needed.
|
|
6560
|
-
*
|
|
6561
|
-
* - `message`: This flag contains an optional custom error message to be
|
|
6562
|
-
* prepended to the error message that's generated by the assertion when it
|
|
6563
|
-
* fails.
|
|
6564
|
-
*
|
|
6565
|
-
* - `ssfi`: This flag stands for "start stack function indicator". It
|
|
6566
|
-
* contains a function reference that serves as the starting point for
|
|
6567
|
-
* removing frames from the stack trace of the error that's created by the
|
|
6568
|
-
* assertion when it fails. The goal is to provide a cleaner stack trace to
|
|
6569
|
-
* end users by removing Chai's internal functions. Note that it only works
|
|
6570
|
-
* in environments that support `Error.captureStackTrace`, and only when
|
|
6571
|
-
* `Chai.config.includeStack` hasn't been set to `false`.
|
|
6572
|
-
*
|
|
6573
|
-
* - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
|
|
6574
|
-
* should retain its current value, even as assertions are chained off of
|
|
6575
|
-
* this object. This is usually set to `true` when creating a new assertion
|
|
6576
|
-
* from within another assertion. It's also temporarily set to `true` before
|
|
6577
|
-
* an overwritten assertion gets called by the overwriting assertion.
|
|
6578
|
-
*
|
|
6579
|
-
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
|
|
6580
|
-
*
|
|
6581
|
-
* @param {unknown} obj target of the assertion
|
|
6582
|
-
* @param {string} [msg] (optional) custom error message
|
|
6583
|
-
* @param {Function} [ssfi] (optional) starting point for removing stack frames
|
|
6584
|
-
* @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked
|
|
6585
|
-
*/
|
|
6586
|
-
constructor(obj, msg, ssfi, lockSsfi) {
|
|
6587
|
-
flag(this, "ssfi", ssfi || _Assertion);
|
|
6588
|
-
flag(this, "lockSsfi", lockSsfi);
|
|
6589
|
-
flag(this, "object", obj);
|
|
6590
|
-
flag(this, "message", msg);
|
|
6591
|
-
flag(this, "eql", config.deepEqual || deep_eql_default);
|
|
6592
|
-
return proxify(this);
|
|
6593
|
-
}
|
|
6594
|
-
/** @returns {boolean} */
|
|
6595
|
-
static get includeStack() {
|
|
6572
|
+
function Assertion(obj, msg, ssfi, lockSsfi) {
|
|
6573
|
+
flag(this, "ssfi", ssfi || Assertion);
|
|
6574
|
+
flag(this, "lockSsfi", lockSsfi);
|
|
6575
|
+
flag(this, "object", obj);
|
|
6576
|
+
flag(this, "message", msg);
|
|
6577
|
+
flag(this, "eql", config.deepEqual || deep_eql_default);
|
|
6578
|
+
return proxify(this);
|
|
6579
|
+
}
|
|
6580
|
+
__name(Assertion, "Assertion");
|
|
6581
|
+
Object.defineProperty(Assertion, "includeStack", {
|
|
6582
|
+
get: function() {
|
|
6596
6583
|
console.warn(
|
|
6597
6584
|
"Assertion.includeStack is deprecated, use chai.config.includeStack instead."
|
|
6598
6585
|
);
|
|
6599
6586
|
return config.includeStack;
|
|
6600
|
-
}
|
|
6601
|
-
|
|
6602
|
-
static set includeStack(value) {
|
|
6587
|
+
},
|
|
6588
|
+
set: function(value) {
|
|
6603
6589
|
console.warn(
|
|
6604
6590
|
"Assertion.includeStack is deprecated, use chai.config.includeStack instead."
|
|
6605
6591
|
);
|
|
6606
6592
|
config.includeStack = value;
|
|
6607
6593
|
}
|
|
6608
|
-
|
|
6609
|
-
|
|
6594
|
+
});
|
|
6595
|
+
Object.defineProperty(Assertion, "showDiff", {
|
|
6596
|
+
get: function() {
|
|
6610
6597
|
console.warn(
|
|
6611
6598
|
"Assertion.showDiff is deprecated, use chai.config.showDiff instead."
|
|
6612
6599
|
);
|
|
6613
6600
|
return config.showDiff;
|
|
6614
|
-
}
|
|
6615
|
-
|
|
6616
|
-
static set showDiff(value) {
|
|
6601
|
+
},
|
|
6602
|
+
set: function(value) {
|
|
6617
6603
|
console.warn(
|
|
6618
6604
|
"Assertion.showDiff is deprecated, use chai.config.showDiff instead."
|
|
6619
6605
|
);
|
|
6620
6606
|
config.showDiff = value;
|
|
6621
6607
|
}
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
* @param {Function} fn
|
|
6661
|
-
* @param {Function} chainingBehavior
|
|
6662
|
-
*/
|
|
6663
|
-
static overwriteChainableMethod(name, fn2, chainingBehavior) {
|
|
6664
|
-
overwriteChainableMethod(this.prototype, name, fn2, chainingBehavior);
|
|
6665
|
-
}
|
|
6666
|
-
/**
|
|
6667
|
-
* ### .assert(expression, message, negateMessage, expected, actual, showDiff)
|
|
6668
|
-
*
|
|
6669
|
-
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
|
6670
|
-
*
|
|
6671
|
-
* @name assert
|
|
6672
|
-
* @param {unknown} _expr to be tested
|
|
6673
|
-
* @param {string | Function} msg or function that returns message to display if expression fails
|
|
6674
|
-
* @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails
|
|
6675
|
-
* @param {unknown} expected value (remember to check for negation)
|
|
6676
|
-
* @param {unknown} _actual (optional) will default to `this.obj`
|
|
6677
|
-
* @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
|
|
6678
|
-
* @returns {void}
|
|
6679
|
-
*/
|
|
6680
|
-
assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
|
|
6681
|
-
const ok = test2(this, arguments);
|
|
6682
|
-
if (false !== showDiff) showDiff = true;
|
|
6683
|
-
if (void 0 === expected && void 0 === _actual) showDiff = false;
|
|
6684
|
-
if (true !== config.showDiff) showDiff = false;
|
|
6685
|
-
if (!ok) {
|
|
6686
|
-
msg = getMessage2(this, arguments);
|
|
6687
|
-
const actual = getActual(this, arguments);
|
|
6688
|
-
const assertionErrorObjectProperties = {
|
|
6689
|
-
actual,
|
|
6690
|
-
expected,
|
|
6691
|
-
showDiff
|
|
6692
|
-
};
|
|
6693
|
-
const operator = getOperator(this, arguments);
|
|
6694
|
-
if (operator) {
|
|
6695
|
-
assertionErrorObjectProperties.operator = operator;
|
|
6696
|
-
}
|
|
6697
|
-
throw new AssertionError(
|
|
6698
|
-
msg,
|
|
6699
|
-
assertionErrorObjectProperties,
|
|
6700
|
-
// @ts-expect-error Not sure what to do about these types yet
|
|
6701
|
-
config.includeStack ? this.assert : flag(this, "ssfi")
|
|
6702
|
-
);
|
|
6608
|
+
});
|
|
6609
|
+
Assertion.addProperty = function(name, fn2) {
|
|
6610
|
+
addProperty(this.prototype, name, fn2);
|
|
6611
|
+
};
|
|
6612
|
+
Assertion.addMethod = function(name, fn2) {
|
|
6613
|
+
addMethod(this.prototype, name, fn2);
|
|
6614
|
+
};
|
|
6615
|
+
Assertion.addChainableMethod = function(name, fn2, chainingBehavior) {
|
|
6616
|
+
addChainableMethod(this.prototype, name, fn2, chainingBehavior);
|
|
6617
|
+
};
|
|
6618
|
+
Assertion.overwriteProperty = function(name, fn2) {
|
|
6619
|
+
overwriteProperty(this.prototype, name, fn2);
|
|
6620
|
+
};
|
|
6621
|
+
Assertion.overwriteMethod = function(name, fn2) {
|
|
6622
|
+
overwriteMethod(this.prototype, name, fn2);
|
|
6623
|
+
};
|
|
6624
|
+
Assertion.overwriteChainableMethod = function(name, fn2, chainingBehavior) {
|
|
6625
|
+
overwriteChainableMethod(this.prototype, name, fn2, chainingBehavior);
|
|
6626
|
+
};
|
|
6627
|
+
Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) {
|
|
6628
|
+
var ok = test2(this, arguments);
|
|
6629
|
+
if (false !== showDiff)
|
|
6630
|
+
showDiff = true;
|
|
6631
|
+
if (void 0 === expected && void 0 === _actual)
|
|
6632
|
+
showDiff = false;
|
|
6633
|
+
if (true !== config.showDiff)
|
|
6634
|
+
showDiff = false;
|
|
6635
|
+
if (!ok) {
|
|
6636
|
+
msg = getMessage2(this, arguments);
|
|
6637
|
+
var actual = getActual(this, arguments);
|
|
6638
|
+
var assertionErrorObjectProperties = {
|
|
6639
|
+
actual,
|
|
6640
|
+
expected,
|
|
6641
|
+
showDiff
|
|
6642
|
+
};
|
|
6643
|
+
var operator = getOperator(this, arguments);
|
|
6644
|
+
if (operator) {
|
|
6645
|
+
assertionErrorObjectProperties.operator = operator;
|
|
6703
6646
|
}
|
|
6647
|
+
throw new AssertionError(
|
|
6648
|
+
msg,
|
|
6649
|
+
assertionErrorObjectProperties,
|
|
6650
|
+
config.includeStack ? this.assert : flag(this, "ssfi")
|
|
6651
|
+
);
|
|
6704
6652
|
}
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
* @returns {unknown}
|
|
6709
|
-
*/
|
|
6710
|
-
get _obj() {
|
|
6653
|
+
};
|
|
6654
|
+
Object.defineProperty(Assertion.prototype, "_obj", {
|
|
6655
|
+
get: function() {
|
|
6711
6656
|
return flag(this, "object");
|
|
6712
|
-
}
|
|
6713
|
-
|
|
6714
|
-
* Quick reference to stored `actual` value for plugin developers.
|
|
6715
|
-
*
|
|
6716
|
-
* @param {unknown} val
|
|
6717
|
-
*/
|
|
6718
|
-
set _obj(val) {
|
|
6657
|
+
},
|
|
6658
|
+
set: function(val) {
|
|
6719
6659
|
flag(this, "object", val);
|
|
6720
6660
|
}
|
|
6721
|
-
};
|
|
6661
|
+
});
|
|
6722
6662
|
function isProxyEnabled() {
|
|
6723
6663
|
return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
|
|
6724
6664
|
}
|
|
@@ -6731,9 +6671,10 @@ function addProperty(ctx, name, getter) {
|
|
|
6731
6671
|
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
6732
6672
|
flag(this, "ssfi", propertyGetter);
|
|
6733
6673
|
}
|
|
6734
|
-
|
|
6735
|
-
if (result !== void 0)
|
|
6736
|
-
|
|
6674
|
+
var result = getter.call(this);
|
|
6675
|
+
if (result !== void 0)
|
|
6676
|
+
return result;
|
|
6677
|
+
var newAssertion = new Assertion();
|
|
6737
6678
|
transferFlags(this, newAssertion);
|
|
6738
6679
|
return newAssertion;
|
|
6739
6680
|
}, "propertyGetter"),
|
|
@@ -6744,9 +6685,10 @@ __name(addProperty, "addProperty");
|
|
|
6744
6685
|
var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
|
|
6745
6686
|
}, "length");
|
|
6746
6687
|
function addLengthGuard(fn2, assertionName, isChainable) {
|
|
6747
|
-
if (!fnLengthDesc.configurable)
|
|
6688
|
+
if (!fnLengthDesc.configurable)
|
|
6689
|
+
return fn2;
|
|
6748
6690
|
Object.defineProperty(fn2, "length", {
|
|
6749
|
-
get:
|
|
6691
|
+
get: function() {
|
|
6750
6692
|
if (isChainable) {
|
|
6751
6693
|
throw Error(
|
|
6752
6694
|
"Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.'
|
|
@@ -6755,20 +6697,20 @@ function addLengthGuard(fn2, assertionName, isChainable) {
|
|
|
6755
6697
|
throw Error(
|
|
6756
6698
|
"Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".'
|
|
6757
6699
|
);
|
|
6758
|
-
}
|
|
6700
|
+
}
|
|
6759
6701
|
});
|
|
6760
6702
|
return fn2;
|
|
6761
6703
|
}
|
|
6762
6704
|
__name(addLengthGuard, "addLengthGuard");
|
|
6763
6705
|
function getProperties(object2) {
|
|
6764
|
-
|
|
6706
|
+
var result = Object.getOwnPropertyNames(object2);
|
|
6765
6707
|
function addProperty2(property) {
|
|
6766
6708
|
if (result.indexOf(property) === -1) {
|
|
6767
6709
|
result.push(property);
|
|
6768
6710
|
}
|
|
6769
6711
|
}
|
|
6770
6712
|
__name(addProperty2, "addProperty");
|
|
6771
|
-
|
|
6713
|
+
var proto = Object.getPrototypeOf(object2);
|
|
6772
6714
|
while (proto !== null) {
|
|
6773
6715
|
Object.getOwnPropertyNames(proto).forEach(addProperty2);
|
|
6774
6716
|
proto = Object.getPrototypeOf(proto);
|
|
@@ -6778,7 +6720,8 @@ function getProperties(object2) {
|
|
|
6778
6720
|
__name(getProperties, "getProperties");
|
|
6779
6721
|
var builtins = ["__flags", "__methods", "_obj", "assert"];
|
|
6780
6722
|
function proxify(obj, nonChainableMethodName) {
|
|
6781
|
-
if (!isProxyEnabled())
|
|
6723
|
+
if (!isProxyEnabled())
|
|
6724
|
+
return obj;
|
|
6782
6725
|
return new Proxy(obj, {
|
|
6783
6726
|
get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
|
|
6784
6727
|
if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
|
|
@@ -6787,15 +6730,15 @@ function proxify(obj, nonChainableMethodName) {
|
|
|
6787
6730
|
"Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".'
|
|
6788
6731
|
);
|
|
6789
6732
|
}
|
|
6790
|
-
|
|
6791
|
-
|
|
6733
|
+
var suggestion = null;
|
|
6734
|
+
var suggestionDistance = 4;
|
|
6792
6735
|
getProperties(target).forEach(function(prop) {
|
|
6793
6736
|
if (
|
|
6794
6737
|
// we actually mean to check `Object.prototype` here
|
|
6795
6738
|
// eslint-disable-next-line no-prototype-builtins
|
|
6796
6739
|
!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1
|
|
6797
6740
|
) {
|
|
6798
|
-
|
|
6741
|
+
var dist = stringDistanceCapped(property, prop, suggestionDistance);
|
|
6799
6742
|
if (dist < suggestionDistance) {
|
|
6800
6743
|
suggestion = prop;
|
|
6801
6744
|
suggestionDistance = dist;
|
|
@@ -6822,25 +6765,25 @@ function stringDistanceCapped(strA, strB, cap) {
|
|
|
6822
6765
|
if (Math.abs(strA.length - strB.length) >= cap) {
|
|
6823
6766
|
return cap;
|
|
6824
6767
|
}
|
|
6825
|
-
|
|
6768
|
+
var memo = [];
|
|
6826
6769
|
for (let i = 0; i <= strA.length; i++) {
|
|
6827
6770
|
memo[i] = Array(strB.length + 1).fill(0);
|
|
6828
6771
|
memo[i][0] = i;
|
|
6829
6772
|
}
|
|
6830
|
-
for (let
|
|
6831
|
-
memo[0][
|
|
6773
|
+
for (let j = 0; j < strB.length; j++) {
|
|
6774
|
+
memo[0][j] = j;
|
|
6832
6775
|
}
|
|
6833
6776
|
for (let i = 1; i <= strA.length; i++) {
|
|
6834
|
-
|
|
6835
|
-
for (let
|
|
6836
|
-
if (Math.abs(i -
|
|
6837
|
-
memo[i][
|
|
6777
|
+
var ch = strA.charCodeAt(i - 1);
|
|
6778
|
+
for (let j = 1; j <= strB.length; j++) {
|
|
6779
|
+
if (Math.abs(i - j) >= cap) {
|
|
6780
|
+
memo[i][j] = cap;
|
|
6838
6781
|
continue;
|
|
6839
6782
|
}
|
|
6840
|
-
memo[i][
|
|
6841
|
-
memo[i - 1][
|
|
6842
|
-
memo[i][
|
|
6843
|
-
memo[i - 1][
|
|
6783
|
+
memo[i][j] = Math.min(
|
|
6784
|
+
memo[i - 1][j] + 1,
|
|
6785
|
+
memo[i][j - 1] + 1,
|
|
6786
|
+
memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1)
|
|
6844
6787
|
);
|
|
6845
6788
|
}
|
|
6846
6789
|
}
|
|
@@ -6848,13 +6791,14 @@ function stringDistanceCapped(strA, strB, cap) {
|
|
|
6848
6791
|
}
|
|
6849
6792
|
__name(stringDistanceCapped, "stringDistanceCapped");
|
|
6850
6793
|
function addMethod(ctx, name, method) {
|
|
6851
|
-
|
|
6794
|
+
var methodWrapper = /* @__PURE__ */ __name(function() {
|
|
6852
6795
|
if (!flag(this, "lockSsfi")) {
|
|
6853
6796
|
flag(this, "ssfi", methodWrapper);
|
|
6854
6797
|
}
|
|
6855
|
-
|
|
6856
|
-
if (result !== void 0)
|
|
6857
|
-
|
|
6798
|
+
var result = method.apply(this, arguments);
|
|
6799
|
+
if (result !== void 0)
|
|
6800
|
+
return result;
|
|
6801
|
+
var newAssertion = new Assertion();
|
|
6858
6802
|
transferFlags(this, newAssertion);
|
|
6859
6803
|
return newAssertion;
|
|
6860
6804
|
}, "methodWrapper");
|
|
@@ -6863,22 +6807,23 @@ function addMethod(ctx, name, method) {
|
|
|
6863
6807
|
}
|
|
6864
6808
|
__name(addMethod, "addMethod");
|
|
6865
6809
|
function overwriteProperty(ctx, name, getter) {
|
|
6866
|
-
|
|
6810
|
+
var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
|
|
6867
6811
|
}, "_super");
|
|
6868
|
-
if (_get && "function" === typeof _get.get)
|
|
6812
|
+
if (_get && "function" === typeof _get.get)
|
|
6813
|
+
_super = _get.get;
|
|
6869
6814
|
Object.defineProperty(ctx, name, {
|
|
6870
6815
|
get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
|
|
6871
6816
|
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
6872
6817
|
flag(this, "ssfi", overwritingPropertyGetter);
|
|
6873
6818
|
}
|
|
6874
|
-
|
|
6819
|
+
var origLockSsfi = flag(this, "lockSsfi");
|
|
6875
6820
|
flag(this, "lockSsfi", true);
|
|
6876
|
-
|
|
6821
|
+
var result = getter(_super).call(this);
|
|
6877
6822
|
flag(this, "lockSsfi", origLockSsfi);
|
|
6878
6823
|
if (result !== void 0) {
|
|
6879
6824
|
return result;
|
|
6880
6825
|
}
|
|
6881
|
-
|
|
6826
|
+
var newAssertion = new Assertion();
|
|
6882
6827
|
transferFlags(this, newAssertion);
|
|
6883
6828
|
return newAssertion;
|
|
6884
6829
|
}, "overwritingPropertyGetter"),
|
|
@@ -6887,22 +6832,23 @@ function overwriteProperty(ctx, name, getter) {
|
|
|
6887
6832
|
}
|
|
6888
6833
|
__name(overwriteProperty, "overwriteProperty");
|
|
6889
6834
|
function overwriteMethod(ctx, name, method) {
|
|
6890
|
-
|
|
6835
|
+
var _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
|
|
6891
6836
|
throw new Error(name + " is not a function");
|
|
6892
6837
|
}, "_super");
|
|
6893
|
-
if (_method && "function" === typeof _method)
|
|
6894
|
-
|
|
6838
|
+
if (_method && "function" === typeof _method)
|
|
6839
|
+
_super = _method;
|
|
6840
|
+
var overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
6895
6841
|
if (!flag(this, "lockSsfi")) {
|
|
6896
6842
|
flag(this, "ssfi", overwritingMethodWrapper);
|
|
6897
6843
|
}
|
|
6898
|
-
|
|
6844
|
+
var origLockSsfi = flag(this, "lockSsfi");
|
|
6899
6845
|
flag(this, "lockSsfi", true);
|
|
6900
|
-
|
|
6846
|
+
var result = method(_super).apply(this, arguments);
|
|
6901
6847
|
flag(this, "lockSsfi", origLockSsfi);
|
|
6902
6848
|
if (result !== void 0) {
|
|
6903
6849
|
return result;
|
|
6904
6850
|
}
|
|
6905
|
-
|
|
6851
|
+
var newAssertion = new Assertion();
|
|
6906
6852
|
transferFlags(this, newAssertion);
|
|
6907
6853
|
return newAssertion;
|
|
6908
6854
|
}, "overwritingMethodWrapper");
|
|
@@ -6914,8 +6860,9 @@ var canSetPrototype = typeof Object.setPrototypeOf === "function";
|
|
|
6914
6860
|
var testFn = /* @__PURE__ */ __name(function() {
|
|
6915
6861
|
}, "testFn");
|
|
6916
6862
|
var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
|
6917
|
-
|
|
6918
|
-
if (typeof propDesc !== "object")
|
|
6863
|
+
var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
|
6864
|
+
if (typeof propDesc !== "object")
|
|
6865
|
+
return true;
|
|
6919
6866
|
return !propDesc.configurable;
|
|
6920
6867
|
});
|
|
6921
6868
|
var call = Function.prototype.call;
|
|
@@ -6925,7 +6872,7 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6925
6872
|
chainingBehavior = /* @__PURE__ */ __name(function() {
|
|
6926
6873
|
}, "chainingBehavior");
|
|
6927
6874
|
}
|
|
6928
|
-
|
|
6875
|
+
var chainableBehavior = {
|
|
6929
6876
|
method,
|
|
6930
6877
|
chainingBehavior
|
|
6931
6878
|
};
|
|
@@ -6936,31 +6883,31 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6936
6883
|
Object.defineProperty(ctx, name, {
|
|
6937
6884
|
get: /* @__PURE__ */ __name(function chainableMethodGetter() {
|
|
6938
6885
|
chainableBehavior.chainingBehavior.call(this);
|
|
6939
|
-
|
|
6886
|
+
var chainableMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
6940
6887
|
if (!flag(this, "lockSsfi")) {
|
|
6941
6888
|
flag(this, "ssfi", chainableMethodWrapper);
|
|
6942
6889
|
}
|
|
6943
|
-
|
|
6890
|
+
var result = chainableBehavior.method.apply(this, arguments);
|
|
6944
6891
|
if (result !== void 0) {
|
|
6945
6892
|
return result;
|
|
6946
6893
|
}
|
|
6947
|
-
|
|
6894
|
+
var newAssertion = new Assertion();
|
|
6948
6895
|
transferFlags(this, newAssertion);
|
|
6949
6896
|
return newAssertion;
|
|
6950
6897
|
}, "chainableMethodWrapper");
|
|
6951
6898
|
addLengthGuard(chainableMethodWrapper, name, true);
|
|
6952
6899
|
if (canSetPrototype) {
|
|
6953
|
-
|
|
6900
|
+
var prototype = Object.create(this);
|
|
6954
6901
|
prototype.call = call;
|
|
6955
6902
|
prototype.apply = apply;
|
|
6956
6903
|
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
|
6957
6904
|
} else {
|
|
6958
|
-
|
|
6905
|
+
var asserterNames = Object.getOwnPropertyNames(ctx);
|
|
6959
6906
|
asserterNames.forEach(function(asserterName) {
|
|
6960
6907
|
if (excludeNames.indexOf(asserterName) !== -1) {
|
|
6961
6908
|
return;
|
|
6962
6909
|
}
|
|
6963
|
-
|
|
6910
|
+
var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
|
6964
6911
|
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
6965
6912
|
});
|
|
6966
6913
|
}
|
|
@@ -6972,35 +6919,36 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6972
6919
|
}
|
|
6973
6920
|
__name(addChainableMethod, "addChainableMethod");
|
|
6974
6921
|
function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
|
6975
|
-
|
|
6976
|
-
|
|
6922
|
+
var chainableBehavior = ctx.__methods[name];
|
|
6923
|
+
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
|
6977
6924
|
chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
|
|
6978
|
-
|
|
6925
|
+
var result = chainingBehavior(_chainingBehavior).call(this);
|
|
6979
6926
|
if (result !== void 0) {
|
|
6980
6927
|
return result;
|
|
6981
6928
|
}
|
|
6982
|
-
|
|
6929
|
+
var newAssertion = new Assertion();
|
|
6983
6930
|
transferFlags(this, newAssertion);
|
|
6984
6931
|
return newAssertion;
|
|
6985
6932
|
}, "overwritingChainableMethodGetter");
|
|
6986
|
-
|
|
6933
|
+
var _method = chainableBehavior.method;
|
|
6987
6934
|
chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
|
|
6988
|
-
|
|
6935
|
+
var result = method(_method).apply(this, arguments);
|
|
6989
6936
|
if (result !== void 0) {
|
|
6990
6937
|
return result;
|
|
6991
6938
|
}
|
|
6992
|
-
|
|
6939
|
+
var newAssertion = new Assertion();
|
|
6993
6940
|
transferFlags(this, newAssertion);
|
|
6994
6941
|
return newAssertion;
|
|
6995
6942
|
}, "overwritingChainableMethodWrapper");
|
|
6996
6943
|
}
|
|
6997
6944
|
__name(overwriteChainableMethod, "overwriteChainableMethod");
|
|
6998
|
-
function compareByInspect(a3,
|
|
6999
|
-
return inspect22(a3) < inspect22(
|
|
6945
|
+
function compareByInspect(a3, b) {
|
|
6946
|
+
return inspect22(a3) < inspect22(b) ? -1 : 1;
|
|
7000
6947
|
}
|
|
7001
6948
|
__name(compareByInspect, "compareByInspect");
|
|
7002
6949
|
function getOwnEnumerablePropertySymbols(obj) {
|
|
7003
|
-
if (typeof Object.getOwnPropertySymbols !== "function")
|
|
6950
|
+
if (typeof Object.getOwnPropertySymbols !== "function")
|
|
6951
|
+
return [];
|
|
7004
6952
|
return Object.getOwnPropertySymbols(obj).filter(function(sym) {
|
|
7005
6953
|
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
|
7006
6954
|
});
|
|
@@ -7012,20 +6960,21 @@ function getOwnEnumerableProperties(obj) {
|
|
|
7012
6960
|
__name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
|
|
7013
6961
|
var isNaN22 = Number.isNaN;
|
|
7014
6962
|
function isObjectType(obj) {
|
|
7015
|
-
|
|
7016
|
-
|
|
6963
|
+
var objectType = type(obj);
|
|
6964
|
+
var objectTypes = ["Array", "Object", "Function"];
|
|
7017
6965
|
return objectTypes.indexOf(objectType) !== -1;
|
|
7018
6966
|
}
|
|
7019
6967
|
__name(isObjectType, "isObjectType");
|
|
7020
6968
|
function getOperator(obj, args) {
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
6969
|
+
var operator = flag(obj, "operator");
|
|
6970
|
+
var negate = flag(obj, "negate");
|
|
6971
|
+
var expected = args[3];
|
|
6972
|
+
var msg = negate ? args[2] : args[1];
|
|
7025
6973
|
if (operator) {
|
|
7026
6974
|
return operator;
|
|
7027
6975
|
}
|
|
7028
|
-
if (typeof msg === "function")
|
|
6976
|
+
if (typeof msg === "function")
|
|
6977
|
+
msg = msg();
|
|
7029
6978
|
msg = msg || "";
|
|
7030
6979
|
if (!msg) {
|
|
7031
6980
|
return void 0;
|
|
@@ -7033,7 +6982,7 @@ function getOperator(obj, args) {
|
|
|
7033
6982
|
if (/\shave\s/.test(msg)) {
|
|
7034
6983
|
return void 0;
|
|
7035
6984
|
}
|
|
7036
|
-
|
|
6985
|
+
var isObject3 = isObjectType(expected);
|
|
7037
6986
|
if (/\snot\s/.test(msg)) {
|
|
7038
6987
|
return isObject3 ? "notDeepStrictEqual" : "notStrictEqual";
|
|
7039
6988
|
}
|
|
@@ -7109,9 +7058,10 @@ var functionTypes = {
|
|
|
7109
7058
|
asyncgeneratorfunction: ["asyncgeneratorfunction"]
|
|
7110
7059
|
};
|
|
7111
7060
|
function an(type3, msg) {
|
|
7112
|
-
if (msg)
|
|
7061
|
+
if (msg)
|
|
7062
|
+
flag2(this, "message", msg);
|
|
7113
7063
|
type3 = type3.toLowerCase();
|
|
7114
|
-
|
|
7064
|
+
var obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
|
|
7115
7065
|
const detectedType = type(obj).toLowerCase();
|
|
7116
7066
|
if (functionTypes["function"].includes(type3)) {
|
|
7117
7067
|
this.assert(
|
|
@@ -7130,8 +7080,8 @@ function an(type3, msg) {
|
|
|
7130
7080
|
__name(an, "an");
|
|
7131
7081
|
Assertion.addChainableMethod("an", an);
|
|
7132
7082
|
Assertion.addChainableMethod("a", an);
|
|
7133
|
-
function SameValueZero(a3,
|
|
7134
|
-
return isNaN22(a3) && isNaN22(
|
|
7083
|
+
function SameValueZero(a3, b) {
|
|
7084
|
+
return isNaN22(a3) && isNaN22(b) || a3 === b;
|
|
7135
7085
|
}
|
|
7136
7086
|
__name(SameValueZero, "SameValueZero");
|
|
7137
7087
|
function includeChainingBehavior() {
|
|
@@ -7139,10 +7089,11 @@ function includeChainingBehavior() {
|
|
|
7139
7089
|
}
|
|
7140
7090
|
__name(includeChainingBehavior, "includeChainingBehavior");
|
|
7141
7091
|
function include(val, msg) {
|
|
7142
|
-
if (msg)
|
|
7143
|
-
|
|
7092
|
+
if (msg)
|
|
7093
|
+
flag2(this, "message", msg);
|
|
7094
|
+
var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
|
|
7144
7095
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7145
|
-
|
|
7096
|
+
var included = false;
|
|
7146
7097
|
switch (objType) {
|
|
7147
7098
|
case "string":
|
|
7148
7099
|
included = obj.indexOf(val) !== -1;
|
|
@@ -7180,7 +7131,7 @@ function include(val, msg) {
|
|
|
7180
7131
|
included = obj.indexOf(val) !== -1;
|
|
7181
7132
|
}
|
|
7182
7133
|
break;
|
|
7183
|
-
default:
|
|
7134
|
+
default:
|
|
7184
7135
|
if (val !== Object(val)) {
|
|
7185
7136
|
throw new AssertionError(
|
|
7186
7137
|
flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(),
|
|
@@ -7188,11 +7139,9 @@ function include(val, msg) {
|
|
|
7188
7139
|
ssfi
|
|
7189
7140
|
);
|
|
7190
7141
|
}
|
|
7191
|
-
|
|
7192
|
-
let firstErr = null;
|
|
7193
|
-
let numErrs = 0;
|
|
7142
|
+
var props = Object.keys(val), firstErr = null, numErrs = 0;
|
|
7194
7143
|
props.forEach(function(prop) {
|
|
7195
|
-
|
|
7144
|
+
var propAssertion = new Assertion(obj);
|
|
7196
7145
|
transferFlags(this, propAssertion, true);
|
|
7197
7146
|
flag2(propAssertion, "lockSsfi", true);
|
|
7198
7147
|
if (!negate || props.length === 1) {
|
|
@@ -7205,7 +7154,8 @@ function include(val, msg) {
|
|
|
7205
7154
|
if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
|
|
7206
7155
|
throw err;
|
|
7207
7156
|
}
|
|
7208
|
-
if (firstErr === null)
|
|
7157
|
+
if (firstErr === null)
|
|
7158
|
+
firstErr = err;
|
|
7209
7159
|
numErrs++;
|
|
7210
7160
|
}
|
|
7211
7161
|
}, this);
|
|
@@ -7213,7 +7163,6 @@ function include(val, msg) {
|
|
|
7213
7163
|
throw firstErr;
|
|
7214
7164
|
}
|
|
7215
7165
|
return;
|
|
7216
|
-
}
|
|
7217
7166
|
}
|
|
7218
7167
|
this.assert(
|
|
7219
7168
|
included,
|
|
@@ -7297,7 +7246,7 @@ Assertion.addProperty("NaN", function() {
|
|
|
7297
7246
|
);
|
|
7298
7247
|
});
|
|
7299
7248
|
function assertExist() {
|
|
7300
|
-
|
|
7249
|
+
var val = flag2(this, "object");
|
|
7301
7250
|
this.assert(
|
|
7302
7251
|
val !== null && val !== void 0,
|
|
7303
7252
|
"expected #{this} to exist",
|
|
@@ -7308,7 +7257,7 @@ __name(assertExist, "assertExist");
|
|
|
7308
7257
|
Assertion.addProperty("exist", assertExist);
|
|
7309
7258
|
Assertion.addProperty("exists", assertExist);
|
|
7310
7259
|
Assertion.addProperty("empty", function() {
|
|
7311
|
-
|
|
7260
|
+
var val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
|
|
7312
7261
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7313
7262
|
switch (type(val).toLowerCase()) {
|
|
7314
7263
|
case "array":
|
|
@@ -7326,10 +7275,9 @@ Assertion.addProperty("empty", function() {
|
|
|
7326
7275
|
void 0,
|
|
7327
7276
|
ssfi
|
|
7328
7277
|
);
|
|
7329
|
-
case "function":
|
|
7330
|
-
|
|
7278
|
+
case "function":
|
|
7279
|
+
var msg = flagMsg + ".empty was passed a function " + getName(val);
|
|
7331
7280
|
throw new AssertionError(msg.trim(), void 0, ssfi);
|
|
7332
|
-
}
|
|
7333
7281
|
default:
|
|
7334
7282
|
if (val !== Object(val)) {
|
|
7335
7283
|
throw new AssertionError(
|
|
@@ -7347,7 +7295,7 @@ Assertion.addProperty("empty", function() {
|
|
|
7347
7295
|
);
|
|
7348
7296
|
});
|
|
7349
7297
|
function checkArguments() {
|
|
7350
|
-
|
|
7298
|
+
var obj = flag2(this, "object"), type3 = type(obj);
|
|
7351
7299
|
this.assert(
|
|
7352
7300
|
"Arguments" === type3,
|
|
7353
7301
|
"expected #{this} to be arguments but got " + type3,
|
|
@@ -7358,10 +7306,11 @@ __name(checkArguments, "checkArguments");
|
|
|
7358
7306
|
Assertion.addProperty("arguments", checkArguments);
|
|
7359
7307
|
Assertion.addProperty("Arguments", checkArguments);
|
|
7360
7308
|
function assertEqual(val, msg) {
|
|
7361
|
-
if (msg)
|
|
7362
|
-
|
|
7309
|
+
if (msg)
|
|
7310
|
+
flag2(this, "message", msg);
|
|
7311
|
+
var obj = flag2(this, "object");
|
|
7363
7312
|
if (flag2(this, "deep")) {
|
|
7364
|
-
|
|
7313
|
+
var prevLockSsfi = flag2(this, "lockSsfi");
|
|
7365
7314
|
flag2(this, "lockSsfi", true);
|
|
7366
7315
|
this.eql(val);
|
|
7367
7316
|
flag2(this, "lockSsfi", prevLockSsfi);
|
|
@@ -7381,8 +7330,9 @@ Assertion.addMethod("equal", assertEqual);
|
|
|
7381
7330
|
Assertion.addMethod("equals", assertEqual);
|
|
7382
7331
|
Assertion.addMethod("eq", assertEqual);
|
|
7383
7332
|
function assertEql(obj, msg) {
|
|
7384
|
-
if (msg)
|
|
7385
|
-
|
|
7333
|
+
if (msg)
|
|
7334
|
+
flag2(this, "message", msg);
|
|
7335
|
+
var eql = flag2(this, "eql");
|
|
7386
7336
|
this.assert(
|
|
7387
7337
|
eql(obj, flag2(this, "object")),
|
|
7388
7338
|
"expected #{this} to deeply equal #{exp}",
|
|
@@ -7396,8 +7346,9 @@ __name(assertEql, "assertEql");
|
|
|
7396
7346
|
Assertion.addMethod("eql", assertEql);
|
|
7397
7347
|
Assertion.addMethod("eqls", assertEql);
|
|
7398
7348
|
function assertAbove(n, msg) {
|
|
7399
|
-
if (msg)
|
|
7400
|
-
|
|
7349
|
+
if (msg)
|
|
7350
|
+
flag2(this, "message", msg);
|
|
7351
|
+
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
|
|
7401
7352
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7402
7353
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7403
7354
|
}
|
|
@@ -7414,7 +7365,7 @@ function assertAbove(n, msg) {
|
|
|
7414
7365
|
ssfi
|
|
7415
7366
|
);
|
|
7416
7367
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7417
|
-
|
|
7368
|
+
var printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7418
7369
|
throw new AssertionError(
|
|
7419
7370
|
msgPrefix + "expected " + printObj + " to be a number or a date",
|
|
7420
7371
|
void 0,
|
|
@@ -7422,7 +7373,7 @@ function assertAbove(n, msg) {
|
|
|
7422
7373
|
);
|
|
7423
7374
|
}
|
|
7424
7375
|
if (doLength) {
|
|
7425
|
-
|
|
7376
|
+
var descriptor = "length", itemsCount;
|
|
7426
7377
|
if (objType === "map" || objType === "set") {
|
|
7427
7378
|
descriptor = "size";
|
|
7428
7379
|
itemsCount = obj.size;
|
|
@@ -7450,8 +7401,9 @@ Assertion.addMethod("above", assertAbove);
|
|
|
7450
7401
|
Assertion.addMethod("gt", assertAbove);
|
|
7451
7402
|
Assertion.addMethod("greaterThan", assertAbove);
|
|
7452
7403
|
function assertLeast(n, msg) {
|
|
7453
|
-
if (msg)
|
|
7454
|
-
|
|
7404
|
+
if (msg)
|
|
7405
|
+
flag2(this, "message", msg);
|
|
7406
|
+
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7455
7407
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7456
7408
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7457
7409
|
}
|
|
@@ -7460,7 +7412,7 @@ function assertLeast(n, msg) {
|
|
|
7460
7412
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7461
7413
|
errorMessage = msgPrefix + "the argument to least must be a number";
|
|
7462
7414
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7463
|
-
|
|
7415
|
+
var printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7464
7416
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7465
7417
|
} else {
|
|
7466
7418
|
shouldThrow = false;
|
|
@@ -7469,7 +7421,7 @@ function assertLeast(n, msg) {
|
|
|
7469
7421
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7470
7422
|
}
|
|
7471
7423
|
if (doLength) {
|
|
7472
|
-
|
|
7424
|
+
var descriptor = "length", itemsCount;
|
|
7473
7425
|
if (objType === "map" || objType === "set") {
|
|
7474
7426
|
descriptor = "size";
|
|
7475
7427
|
itemsCount = obj.size;
|
|
@@ -7497,8 +7449,9 @@ Assertion.addMethod("least", assertLeast);
|
|
|
7497
7449
|
Assertion.addMethod("gte", assertLeast);
|
|
7498
7450
|
Assertion.addMethod("greaterThanOrEqual", assertLeast);
|
|
7499
7451
|
function assertBelow(n, msg) {
|
|
7500
|
-
if (msg)
|
|
7501
|
-
|
|
7452
|
+
if (msg)
|
|
7453
|
+
flag2(this, "message", msg);
|
|
7454
|
+
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7502
7455
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7503
7456
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7504
7457
|
}
|
|
@@ -7507,7 +7460,7 @@ function assertBelow(n, msg) {
|
|
|
7507
7460
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7508
7461
|
errorMessage = msgPrefix + "the argument to below must be a number";
|
|
7509
7462
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7510
|
-
|
|
7463
|
+
var printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7511
7464
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7512
7465
|
} else {
|
|
7513
7466
|
shouldThrow = false;
|
|
@@ -7516,7 +7469,7 @@ function assertBelow(n, msg) {
|
|
|
7516
7469
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7517
7470
|
}
|
|
7518
7471
|
if (doLength) {
|
|
7519
|
-
|
|
7472
|
+
var descriptor = "length", itemsCount;
|
|
7520
7473
|
if (objType === "map" || objType === "set") {
|
|
7521
7474
|
descriptor = "size";
|
|
7522
7475
|
itemsCount = obj.size;
|
|
@@ -7544,8 +7497,9 @@ Assertion.addMethod("below", assertBelow);
|
|
|
7544
7497
|
Assertion.addMethod("lt", assertBelow);
|
|
7545
7498
|
Assertion.addMethod("lessThan", assertBelow);
|
|
7546
7499
|
function assertMost(n, msg) {
|
|
7547
|
-
if (msg)
|
|
7548
|
-
|
|
7500
|
+
if (msg)
|
|
7501
|
+
flag2(this, "message", msg);
|
|
7502
|
+
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7549
7503
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7550
7504
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7551
7505
|
}
|
|
@@ -7554,7 +7508,7 @@ function assertMost(n, msg) {
|
|
|
7554
7508
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7555
7509
|
errorMessage = msgPrefix + "the argument to most must be a number";
|
|
7556
7510
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7557
|
-
|
|
7511
|
+
var printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7558
7512
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7559
7513
|
} else {
|
|
7560
7514
|
shouldThrow = false;
|
|
@@ -7563,7 +7517,7 @@ function assertMost(n, msg) {
|
|
|
7563
7517
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7564
7518
|
}
|
|
7565
7519
|
if (doLength) {
|
|
7566
|
-
|
|
7520
|
+
var descriptor = "length", itemsCount;
|
|
7567
7521
|
if (objType === "map" || objType === "set") {
|
|
7568
7522
|
descriptor = "size";
|
|
7569
7523
|
itemsCount = obj.size;
|
|
@@ -7591,8 +7545,9 @@ Assertion.addMethod("most", assertMost);
|
|
|
7591
7545
|
Assertion.addMethod("lte", assertMost);
|
|
7592
7546
|
Assertion.addMethod("lessThanOrEqual", assertMost);
|
|
7593
7547
|
Assertion.addMethod("within", function(start, finish, msg) {
|
|
7594
|
-
if (msg)
|
|
7595
|
-
|
|
7548
|
+
if (msg)
|
|
7549
|
+
flag2(this, "message", msg);
|
|
7550
|
+
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
|
|
7596
7551
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7597
7552
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7598
7553
|
}
|
|
@@ -7601,7 +7556,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7601
7556
|
} else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
|
|
7602
7557
|
errorMessage = msgPrefix + "the arguments to within must be numbers";
|
|
7603
7558
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7604
|
-
|
|
7559
|
+
var printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7605
7560
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7606
7561
|
} else {
|
|
7607
7562
|
shouldThrow = false;
|
|
@@ -7610,7 +7565,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7610
7565
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7611
7566
|
}
|
|
7612
7567
|
if (doLength) {
|
|
7613
|
-
|
|
7568
|
+
var descriptor = "length", itemsCount;
|
|
7614
7569
|
if (objType === "map" || objType === "set") {
|
|
7615
7570
|
descriptor = "size";
|
|
7616
7571
|
itemsCount = obj.size;
|
|
@@ -7631,13 +7586,13 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7631
7586
|
}
|
|
7632
7587
|
});
|
|
7633
7588
|
function assertInstanceOf(constructor, msg) {
|
|
7634
|
-
if (msg)
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7589
|
+
if (msg)
|
|
7590
|
+
flag2(this, "message", msg);
|
|
7591
|
+
var target = flag2(this, "object");
|
|
7592
|
+
var ssfi = flag2(this, "ssfi");
|
|
7593
|
+
var flagMsg = flag2(this, "message");
|
|
7639
7594
|
try {
|
|
7640
|
-
isInstanceOf = target instanceof constructor;
|
|
7595
|
+
var isInstanceOf = target instanceof constructor;
|
|
7641
7596
|
} catch (err) {
|
|
7642
7597
|
if (err instanceof TypeError) {
|
|
7643
7598
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
@@ -7649,7 +7604,7 @@ function assertInstanceOf(constructor, msg) {
|
|
|
7649
7604
|
}
|
|
7650
7605
|
throw err;
|
|
7651
7606
|
}
|
|
7652
|
-
|
|
7607
|
+
var name = getName(constructor);
|
|
7653
7608
|
if (name == null) {
|
|
7654
7609
|
name = "an unnamed constructor";
|
|
7655
7610
|
}
|
|
@@ -7663,8 +7618,9 @@ __name(assertInstanceOf, "assertInstanceOf");
|
|
|
7663
7618
|
Assertion.addMethod("instanceof", assertInstanceOf);
|
|
7664
7619
|
Assertion.addMethod("instanceOf", assertInstanceOf);
|
|
7665
7620
|
function assertProperty(name, val, msg) {
|
|
7666
|
-
if (msg)
|
|
7667
|
-
|
|
7621
|
+
if (msg)
|
|
7622
|
+
flag2(this, "message", msg);
|
|
7623
|
+
var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
|
|
7668
7624
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7669
7625
|
if (isNested) {
|
|
7670
7626
|
if (nameType !== "string") {
|
|
@@ -7697,16 +7653,22 @@ function assertProperty(name, val, msg) {
|
|
|
7697
7653
|
ssfi
|
|
7698
7654
|
);
|
|
7699
7655
|
}
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
if (isDeep)
|
|
7703
|
-
|
|
7704
|
-
if (
|
|
7656
|
+
var isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
7657
|
+
var descriptor = "";
|
|
7658
|
+
if (isDeep)
|
|
7659
|
+
descriptor += "deep ";
|
|
7660
|
+
if (isOwn)
|
|
7661
|
+
descriptor += "own ";
|
|
7662
|
+
if (isNested)
|
|
7663
|
+
descriptor += "nested ";
|
|
7705
7664
|
descriptor += "property ";
|
|
7706
|
-
|
|
7707
|
-
if (isOwn)
|
|
7708
|
-
|
|
7709
|
-
else
|
|
7665
|
+
var hasProperty2;
|
|
7666
|
+
if (isOwn)
|
|
7667
|
+
hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
|
|
7668
|
+
else if (isNested)
|
|
7669
|
+
hasProperty2 = pathInfo.exists;
|
|
7670
|
+
else
|
|
7671
|
+
hasProperty2 = hasProperty(obj, name);
|
|
7710
7672
|
if (!negate || arguments.length === 1) {
|
|
7711
7673
|
this.assert(
|
|
7712
7674
|
hasProperty2,
|
|
@@ -7739,10 +7701,11 @@ function assertOwnPropertyDescriptor(name, descriptor, msg) {
|
|
|
7739
7701
|
msg = descriptor;
|
|
7740
7702
|
descriptor = null;
|
|
7741
7703
|
}
|
|
7742
|
-
if (msg)
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7704
|
+
if (msg)
|
|
7705
|
+
flag2(this, "message", msg);
|
|
7706
|
+
var obj = flag2(this, "object");
|
|
7707
|
+
var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
|
|
7708
|
+
var eql = flag2(this, "eql");
|
|
7746
7709
|
if (actualDescriptor && descriptor) {
|
|
7747
7710
|
this.assert(
|
|
7748
7711
|
eql(descriptor, actualDescriptor),
|
|
@@ -7769,8 +7732,9 @@ function assertLengthChain() {
|
|
|
7769
7732
|
}
|
|
7770
7733
|
__name(assertLengthChain, "assertLengthChain");
|
|
7771
7734
|
function assertLength(n, msg) {
|
|
7772
|
-
if (msg)
|
|
7773
|
-
|
|
7735
|
+
if (msg)
|
|
7736
|
+
flag2(this, "message", msg);
|
|
7737
|
+
var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
|
|
7774
7738
|
switch (objType) {
|
|
7775
7739
|
case "map":
|
|
7776
7740
|
case "set":
|
|
@@ -7793,8 +7757,9 @@ __name(assertLength, "assertLength");
|
|
|
7793
7757
|
Assertion.addChainableMethod("length", assertLength, assertLengthChain);
|
|
7794
7758
|
Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
|
|
7795
7759
|
function assertMatch(re, msg) {
|
|
7796
|
-
if (msg)
|
|
7797
|
-
|
|
7760
|
+
if (msg)
|
|
7761
|
+
flag2(this, "message", msg);
|
|
7762
|
+
var obj = flag2(this, "object");
|
|
7798
7763
|
this.assert(
|
|
7799
7764
|
re.exec(obj),
|
|
7800
7765
|
"expected #{this} to match " + re,
|
|
@@ -7805,8 +7770,9 @@ __name(assertMatch, "assertMatch");
|
|
|
7805
7770
|
Assertion.addMethod("match", assertMatch);
|
|
7806
7771
|
Assertion.addMethod("matches", assertMatch);
|
|
7807
7772
|
Assertion.addMethod("string", function(str, msg) {
|
|
7808
|
-
if (msg)
|
|
7809
|
-
|
|
7773
|
+
if (msg)
|
|
7774
|
+
flag2(this, "message", msg);
|
|
7775
|
+
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7810
7776
|
new Assertion(obj, flagMsg, ssfi, true).is.a("string");
|
|
7811
7777
|
this.assert(
|
|
7812
7778
|
~obj.indexOf(str),
|
|
@@ -7815,9 +7781,9 @@ Assertion.addMethod("string", function(str, msg) {
|
|
|
7815
7781
|
);
|
|
7816
7782
|
});
|
|
7817
7783
|
function assertKeys(keys2) {
|
|
7818
|
-
|
|
7784
|
+
var obj = flag2(this, "object"), objType = type(obj), keysType = type(keys2), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
|
|
7819
7785
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7820
|
-
|
|
7786
|
+
var mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
|
|
7821
7787
|
if (objType === "Map" || objType === "Set") {
|
|
7822
7788
|
deepStr = isDeep ? "deeply " : "";
|
|
7823
7789
|
actual = [];
|
|
@@ -7851,7 +7817,7 @@ function assertKeys(keys2) {
|
|
|
7851
7817
|
if (!keys2.length) {
|
|
7852
7818
|
throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
|
|
7853
7819
|
}
|
|
7854
|
-
|
|
7820
|
+
var len = keys2.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys2, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
7855
7821
|
if (!any && !all) {
|
|
7856
7822
|
all = true;
|
|
7857
7823
|
}
|
|
@@ -7876,7 +7842,7 @@ function assertKeys(keys2) {
|
|
|
7876
7842
|
keys2 = keys2.map(function(key) {
|
|
7877
7843
|
return inspect22(key);
|
|
7878
7844
|
});
|
|
7879
|
-
|
|
7845
|
+
var last = keys2.pop();
|
|
7880
7846
|
if (all) {
|
|
7881
7847
|
str = keys2.join(", ") + ", and " + last;
|
|
7882
7848
|
}
|
|
@@ -7901,8 +7867,9 @@ __name(assertKeys, "assertKeys");
|
|
|
7901
7867
|
Assertion.addMethod("keys", assertKeys);
|
|
7902
7868
|
Assertion.addMethod("key", assertKeys);
|
|
7903
7869
|
function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
7904
|
-
if (msg)
|
|
7905
|
-
|
|
7870
|
+
if (msg)
|
|
7871
|
+
flag2(this, "message", msg);
|
|
7872
|
+
var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
|
|
7906
7873
|
new Assertion(obj, flagMsg, ssfi, true).is.a("function");
|
|
7907
7874
|
if (isRegExp2(errorLike) || typeof errorLike === "string") {
|
|
7908
7875
|
errMsgMatcher = errorLike;
|
|
@@ -7916,12 +7883,12 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7916
7883
|
errorWasThrown = true;
|
|
7917
7884
|
caughtErr = err;
|
|
7918
7885
|
}
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7886
|
+
var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
|
|
7887
|
+
var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
|
|
7888
|
+
var errorLikeFail = false;
|
|
7889
|
+
var errMsgMatcherFail = false;
|
|
7923
7890
|
if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
|
|
7924
|
-
|
|
7891
|
+
var errorLikeString = "an error";
|
|
7925
7892
|
if (errorLike instanceof Error) {
|
|
7926
7893
|
errorLikeString = "#{exp}";
|
|
7927
7894
|
} else if (errorLike) {
|
|
@@ -7948,7 +7915,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7948
7915
|
}
|
|
7949
7916
|
if (errorLike && caughtErr) {
|
|
7950
7917
|
if (errorLike instanceof Error) {
|
|
7951
|
-
|
|
7918
|
+
var isCompatibleInstance = check_error_exports.compatibleInstance(
|
|
7952
7919
|
caughtErr,
|
|
7953
7920
|
errorLike
|
|
7954
7921
|
);
|
|
@@ -7966,7 +7933,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7966
7933
|
}
|
|
7967
7934
|
}
|
|
7968
7935
|
}
|
|
7969
|
-
|
|
7936
|
+
var isCompatibleConstructor = check_error_exports.compatibleConstructor(
|
|
7970
7937
|
caughtErr,
|
|
7971
7938
|
errorLike
|
|
7972
7939
|
);
|
|
@@ -7985,11 +7952,11 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7985
7952
|
}
|
|
7986
7953
|
}
|
|
7987
7954
|
if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
|
|
7988
|
-
|
|
7955
|
+
var placeholder = "including";
|
|
7989
7956
|
if (isRegExp2(errMsgMatcher)) {
|
|
7990
7957
|
placeholder = "matching";
|
|
7991
7958
|
}
|
|
7992
|
-
|
|
7959
|
+
var isCompatibleMessage = check_error_exports.compatibleMessage(
|
|
7993
7960
|
caughtErr,
|
|
7994
7961
|
errMsgMatcher
|
|
7995
7962
|
);
|
|
@@ -8023,8 +7990,9 @@ Assertion.addMethod("throw", assertThrows);
|
|
|
8023
7990
|
Assertion.addMethod("throws", assertThrows);
|
|
8024
7991
|
Assertion.addMethod("Throw", assertThrows);
|
|
8025
7992
|
function respondTo(method, msg) {
|
|
8026
|
-
if (msg)
|
|
8027
|
-
|
|
7993
|
+
if (msg)
|
|
7994
|
+
flag2(this, "message", msg);
|
|
7995
|
+
var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
|
|
8028
7996
|
this.assert(
|
|
8029
7997
|
"function" === typeof context,
|
|
8030
7998
|
"expected #{this} to respond to " + inspect22(method),
|
|
@@ -8038,9 +8006,10 @@ Assertion.addProperty("itself", function() {
|
|
|
8038
8006
|
flag2(this, "itself", true);
|
|
8039
8007
|
});
|
|
8040
8008
|
function satisfy(matcher, msg) {
|
|
8041
|
-
if (msg)
|
|
8042
|
-
|
|
8043
|
-
|
|
8009
|
+
if (msg)
|
|
8010
|
+
flag2(this, "message", msg);
|
|
8011
|
+
var obj = flag2(this, "object");
|
|
8012
|
+
var result = matcher(obj);
|
|
8044
8013
|
this.assert(
|
|
8045
8014
|
result,
|
|
8046
8015
|
"expected #{this} to satisfy " + objDisplay2(matcher),
|
|
@@ -8053,28 +8022,27 @@ __name(satisfy, "satisfy");
|
|
|
8053
8022
|
Assertion.addMethod("satisfy", satisfy);
|
|
8054
8023
|
Assertion.addMethod("satisfies", satisfy);
|
|
8055
8024
|
function closeTo(expected, delta, msg) {
|
|
8056
|
-
if (msg)
|
|
8057
|
-
|
|
8025
|
+
if (msg)
|
|
8026
|
+
flag2(this, "message", msg);
|
|
8027
|
+
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8058
8028
|
new Assertion(obj, flagMsg, ssfi, true).is.numeric;
|
|
8059
8029
|
let message = "A `delta` value is required for `closeTo`";
|
|
8060
|
-
if (delta == void 0)
|
|
8030
|
+
if (delta == void 0)
|
|
8061
8031
|
throw new AssertionError(
|
|
8062
8032
|
flagMsg ? `${flagMsg}: ${message}` : message,
|
|
8063
8033
|
void 0,
|
|
8064
8034
|
ssfi
|
|
8065
8035
|
);
|
|
8066
|
-
}
|
|
8067
8036
|
new Assertion(delta, flagMsg, ssfi, true).is.numeric;
|
|
8068
8037
|
message = "A `expected` value is required for `closeTo`";
|
|
8069
|
-
if (expected == void 0)
|
|
8038
|
+
if (expected == void 0)
|
|
8070
8039
|
throw new AssertionError(
|
|
8071
8040
|
flagMsg ? `${flagMsg}: ${message}` : message,
|
|
8072
8041
|
void 0,
|
|
8073
8042
|
ssfi
|
|
8074
8043
|
);
|
|
8075
|
-
}
|
|
8076
8044
|
new Assertion(expected, flagMsg, ssfi, true).is.numeric;
|
|
8077
|
-
const abs = /* @__PURE__ */ __name((
|
|
8045
|
+
const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs");
|
|
8078
8046
|
const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
|
|
8079
8047
|
this.assert(
|
|
8080
8048
|
strip(abs(obj - expected)) <= delta,
|
|
@@ -8089,33 +8057,40 @@ function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
|
|
|
8089
8057
|
let superset = Array.from(_superset);
|
|
8090
8058
|
let subset = Array.from(_subset);
|
|
8091
8059
|
if (!contains) {
|
|
8092
|
-
if (subset.length !== superset.length)
|
|
8060
|
+
if (subset.length !== superset.length)
|
|
8061
|
+
return false;
|
|
8093
8062
|
superset = superset.slice();
|
|
8094
8063
|
}
|
|
8095
8064
|
return subset.every(function(elem, idx) {
|
|
8096
|
-
if (ordered)
|
|
8065
|
+
if (ordered)
|
|
8066
|
+
return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
|
|
8097
8067
|
if (!cmp) {
|
|
8098
|
-
|
|
8099
|
-
if (matchIdx === -1)
|
|
8100
|
-
|
|
8068
|
+
var matchIdx = superset.indexOf(elem);
|
|
8069
|
+
if (matchIdx === -1)
|
|
8070
|
+
return false;
|
|
8071
|
+
if (!contains)
|
|
8072
|
+
superset.splice(matchIdx, 1);
|
|
8101
8073
|
return true;
|
|
8102
8074
|
}
|
|
8103
|
-
return superset.some(function(elem2,
|
|
8104
|
-
if (!cmp(elem, elem2))
|
|
8105
|
-
|
|
8075
|
+
return superset.some(function(elem2, matchIdx2) {
|
|
8076
|
+
if (!cmp(elem, elem2))
|
|
8077
|
+
return false;
|
|
8078
|
+
if (!contains)
|
|
8079
|
+
superset.splice(matchIdx2, 1);
|
|
8106
8080
|
return true;
|
|
8107
8081
|
});
|
|
8108
8082
|
});
|
|
8109
8083
|
}
|
|
8110
8084
|
__name(isSubsetOf, "isSubsetOf");
|
|
8111
8085
|
Assertion.addMethod("members", function(subset, msg) {
|
|
8112
|
-
if (msg)
|
|
8113
|
-
|
|
8086
|
+
if (msg)
|
|
8087
|
+
flag2(this, "message", msg);
|
|
8088
|
+
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8114
8089
|
new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
|
|
8115
8090
|
new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8091
|
+
var contains = flag2(this, "contains");
|
|
8092
|
+
var ordered = flag2(this, "ordered");
|
|
8093
|
+
var subject, failMsg, failNegateMsg;
|
|
8119
8094
|
if (contains) {
|
|
8120
8095
|
subject = ordered ? "an ordered superset" : "a superset";
|
|
8121
8096
|
failMsg = "expected #{this} to be " + subject + " of #{exp}";
|
|
@@ -8125,7 +8100,7 @@ Assertion.addMethod("members", function(subset, msg) {
|
|
|
8125
8100
|
failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
|
|
8126
8101
|
failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
|
|
8127
8102
|
}
|
|
8128
|
-
|
|
8103
|
+
var cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0;
|
|
8129
8104
|
this.assert(
|
|
8130
8105
|
isSubsetOf(subset, obj, cmp, contains, ordered),
|
|
8131
8106
|
failMsg,
|
|
@@ -8136,8 +8111,9 @@ Assertion.addMethod("members", function(subset, msg) {
|
|
|
8136
8111
|
);
|
|
8137
8112
|
});
|
|
8138
8113
|
Assertion.addProperty("iterable", function(msg) {
|
|
8139
|
-
if (msg)
|
|
8140
|
-
|
|
8114
|
+
if (msg)
|
|
8115
|
+
flag2(this, "message", msg);
|
|
8116
|
+
var obj = flag2(this, "object");
|
|
8141
8117
|
this.assert(
|
|
8142
8118
|
obj != void 0 && obj[Symbol.iterator],
|
|
8143
8119
|
"expected #{this} to be an iterable",
|
|
@@ -8146,8 +8122,9 @@ Assertion.addProperty("iterable", function(msg) {
|
|
|
8146
8122
|
);
|
|
8147
8123
|
});
|
|
8148
8124
|
function oneOf(list, msg) {
|
|
8149
|
-
if (msg)
|
|
8150
|
-
|
|
8125
|
+
if (msg)
|
|
8126
|
+
flag2(this, "message", msg);
|
|
8127
|
+
var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
|
|
8151
8128
|
new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
|
|
8152
8129
|
if (contains) {
|
|
8153
8130
|
this.assert(
|
|
@@ -8184,10 +8161,11 @@ function oneOf(list, msg) {
|
|
|
8184
8161
|
__name(oneOf, "oneOf");
|
|
8185
8162
|
Assertion.addMethod("oneOf", oneOf);
|
|
8186
8163
|
function assertChanges(subject, prop, msg) {
|
|
8187
|
-
if (msg)
|
|
8188
|
-
|
|
8164
|
+
if (msg)
|
|
8165
|
+
flag2(this, "message", msg);
|
|
8166
|
+
var fn2 = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8189
8167
|
new Assertion(fn2, flagMsg, ssfi, true).is.a("function");
|
|
8190
|
-
|
|
8168
|
+
var initial;
|
|
8191
8169
|
if (!prop) {
|
|
8192
8170
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8193
8171
|
initial = subject();
|
|
@@ -8196,8 +8174,8 @@ function assertChanges(subject, prop, msg) {
|
|
|
8196
8174
|
initial = subject[prop];
|
|
8197
8175
|
}
|
|
8198
8176
|
fn2();
|
|
8199
|
-
|
|
8200
|
-
|
|
8177
|
+
var final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
8178
|
+
var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8201
8179
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8202
8180
|
flag2(this, "initialDeltaValue", initial);
|
|
8203
8181
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8213,10 +8191,11 @@ __name(assertChanges, "assertChanges");
|
|
|
8213
8191
|
Assertion.addMethod("change", assertChanges);
|
|
8214
8192
|
Assertion.addMethod("changes", assertChanges);
|
|
8215
8193
|
function assertIncreases(subject, prop, msg) {
|
|
8216
|
-
if (msg)
|
|
8217
|
-
|
|
8194
|
+
if (msg)
|
|
8195
|
+
flag2(this, "message", msg);
|
|
8196
|
+
var fn2 = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8218
8197
|
new Assertion(fn2, flagMsg, ssfi, true).is.a("function");
|
|
8219
|
-
|
|
8198
|
+
var initial;
|
|
8220
8199
|
if (!prop) {
|
|
8221
8200
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8222
8201
|
initial = subject();
|
|
@@ -8226,8 +8205,8 @@ function assertIncreases(subject, prop, msg) {
|
|
|
8226
8205
|
}
|
|
8227
8206
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
8228
8207
|
fn2();
|
|
8229
|
-
|
|
8230
|
-
|
|
8208
|
+
var final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
8209
|
+
var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8231
8210
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8232
8211
|
flag2(this, "initialDeltaValue", initial);
|
|
8233
8212
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8243,10 +8222,11 @@ __name(assertIncreases, "assertIncreases");
|
|
|
8243
8222
|
Assertion.addMethod("increase", assertIncreases);
|
|
8244
8223
|
Assertion.addMethod("increases", assertIncreases);
|
|
8245
8224
|
function assertDecreases(subject, prop, msg) {
|
|
8246
|
-
if (msg)
|
|
8247
|
-
|
|
8225
|
+
if (msg)
|
|
8226
|
+
flag2(this, "message", msg);
|
|
8227
|
+
var fn2 = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8248
8228
|
new Assertion(fn2, flagMsg, ssfi, true).is.a("function");
|
|
8249
|
-
|
|
8229
|
+
var initial;
|
|
8250
8230
|
if (!prop) {
|
|
8251
8231
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8252
8232
|
initial = subject();
|
|
@@ -8256,8 +8236,8 @@ function assertDecreases(subject, prop, msg) {
|
|
|
8256
8236
|
}
|
|
8257
8237
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
8258
8238
|
fn2();
|
|
8259
|
-
|
|
8260
|
-
|
|
8239
|
+
var final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
8240
|
+
var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8261
8241
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8262
8242
|
flag2(this, "initialDeltaValue", initial);
|
|
8263
8243
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8273,13 +8253,14 @@ __name(assertDecreases, "assertDecreases");
|
|
|
8273
8253
|
Assertion.addMethod("decrease", assertDecreases);
|
|
8274
8254
|
Assertion.addMethod("decreases", assertDecreases);
|
|
8275
8255
|
function assertDelta(delta, msg) {
|
|
8276
|
-
if (msg)
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8256
|
+
if (msg)
|
|
8257
|
+
flag2(this, "message", msg);
|
|
8258
|
+
var msgObj = flag2(this, "deltaMsgObj");
|
|
8259
|
+
var initial = flag2(this, "initialDeltaValue");
|
|
8260
|
+
var final = flag2(this, "finalDeltaValue");
|
|
8261
|
+
var behavior = flag2(this, "deltaBehavior");
|
|
8262
|
+
var realDelta = flag2(this, "realDelta");
|
|
8263
|
+
var expression;
|
|
8283
8264
|
if (behavior === "change") {
|
|
8284
8265
|
expression = Math.abs(final - initial) === Math.abs(delta);
|
|
8285
8266
|
} else {
|
|
@@ -8294,8 +8275,8 @@ function assertDelta(delta, msg) {
|
|
|
8294
8275
|
__name(assertDelta, "assertDelta");
|
|
8295
8276
|
Assertion.addMethod("by", assertDelta);
|
|
8296
8277
|
Assertion.addProperty("extensible", function() {
|
|
8297
|
-
|
|
8298
|
-
|
|
8278
|
+
var obj = flag2(this, "object");
|
|
8279
|
+
var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
|
|
8299
8280
|
this.assert(
|
|
8300
8281
|
isExtensible,
|
|
8301
8282
|
"expected #{this} to be extensible",
|
|
@@ -8303,8 +8284,8 @@ Assertion.addProperty("extensible", function() {
|
|
|
8303
8284
|
);
|
|
8304
8285
|
});
|
|
8305
8286
|
Assertion.addProperty("sealed", function() {
|
|
8306
|
-
|
|
8307
|
-
|
|
8287
|
+
var obj = flag2(this, "object");
|
|
8288
|
+
var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
|
|
8308
8289
|
this.assert(
|
|
8309
8290
|
isSealed,
|
|
8310
8291
|
"expected #{this} to be sealed",
|
|
@@ -8312,8 +8293,8 @@ Assertion.addProperty("sealed", function() {
|
|
|
8312
8293
|
);
|
|
8313
8294
|
});
|
|
8314
8295
|
Assertion.addProperty("frozen", function() {
|
|
8315
|
-
|
|
8316
|
-
|
|
8296
|
+
var obj = flag2(this, "object");
|
|
8297
|
+
var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
|
|
8317
8298
|
this.assert(
|
|
8318
8299
|
isFrozen,
|
|
8319
8300
|
"expected #{this} to be frozen",
|
|
@@ -8321,7 +8302,7 @@ Assertion.addProperty("frozen", function() {
|
|
|
8321
8302
|
);
|
|
8322
8303
|
});
|
|
8323
8304
|
Assertion.addProperty("finite", function(_msg) {
|
|
8324
|
-
|
|
8305
|
+
var obj = flag2(this, "object");
|
|
8325
8306
|
this.assert(
|
|
8326
8307
|
typeof obj === "number" && isFinite(obj),
|
|
8327
8308
|
"expected #{this} to be a finite number",
|
|
@@ -8359,8 +8340,8 @@ function compareSubset(expected, actual) {
|
|
|
8359
8340
|
}
|
|
8360
8341
|
}
|
|
8361
8342
|
return Object.keys(expected).every(function(key) {
|
|
8362
|
-
|
|
8363
|
-
|
|
8343
|
+
var expectedValue = expected[key];
|
|
8344
|
+
var actualValue = actual[key];
|
|
8364
8345
|
if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
|
|
8365
8346
|
return compareSubset(expectedValue, actualValue);
|
|
8366
8347
|
}
|
|
@@ -8430,7 +8411,7 @@ function loadShould() {
|
|
|
8430
8411
|
get: shouldGetter,
|
|
8431
8412
|
configurable: true
|
|
8432
8413
|
});
|
|
8433
|
-
|
|
8414
|
+
var should2 = {};
|
|
8434
8415
|
should2.fail = function(actual, expected, message, operator) {
|
|
8435
8416
|
if (arguments.length < 2) {
|
|
8436
8417
|
message = actual;
|
|
@@ -8473,12 +8454,12 @@ function loadShould() {
|
|
|
8473
8454
|
__name(loadShould, "loadShould");
|
|
8474
8455
|
var should = loadShould;
|
|
8475
8456
|
var Should = loadShould;
|
|
8476
|
-
function
|
|
8477
|
-
|
|
8457
|
+
function assert2(express, errmsg) {
|
|
8458
|
+
var test22 = new Assertion(null, null, assert2, true);
|
|
8478
8459
|
test22.assert(express, errmsg, "[ negation message unavailable ]");
|
|
8479
8460
|
}
|
|
8480
|
-
__name(
|
|
8481
|
-
|
|
8461
|
+
__name(assert2, "assert");
|
|
8462
|
+
assert2.fail = function(actual, expected, message, operator) {
|
|
8482
8463
|
if (arguments.length < 2) {
|
|
8483
8464
|
message = actual;
|
|
8484
8465
|
actual = void 0;
|
|
@@ -8491,17 +8472,17 @@ assert.fail = function(actual, expected, message, operator) {
|
|
|
8491
8472
|
expected,
|
|
8492
8473
|
operator
|
|
8493
8474
|
},
|
|
8494
|
-
|
|
8475
|
+
assert2.fail
|
|
8495
8476
|
);
|
|
8496
8477
|
};
|
|
8497
|
-
|
|
8498
|
-
new Assertion(val, msg,
|
|
8478
|
+
assert2.isOk = function(val, msg) {
|
|
8479
|
+
new Assertion(val, msg, assert2.isOk, true).is.ok;
|
|
8499
8480
|
};
|
|
8500
|
-
|
|
8501
|
-
new Assertion(val, msg,
|
|
8481
|
+
assert2.isNotOk = function(val, msg) {
|
|
8482
|
+
new Assertion(val, msg, assert2.isNotOk, true).is.not.ok;
|
|
8502
8483
|
};
|
|
8503
|
-
|
|
8504
|
-
|
|
8484
|
+
assert2.equal = function(act, exp, msg) {
|
|
8485
|
+
var test22 = new Assertion(act, msg, assert2.equal, true);
|
|
8505
8486
|
test22.assert(
|
|
8506
8487
|
exp == flag(test22, "object"),
|
|
8507
8488
|
"expected #{this} to equal #{exp}",
|
|
@@ -8511,8 +8492,8 @@ assert.equal = function(act, exp, msg) {
|
|
|
8511
8492
|
true
|
|
8512
8493
|
);
|
|
8513
8494
|
};
|
|
8514
|
-
|
|
8515
|
-
|
|
8495
|
+
assert2.notEqual = function(act, exp, msg) {
|
|
8496
|
+
var test22 = new Assertion(act, msg, assert2.notEqual, true);
|
|
8516
8497
|
test22.assert(
|
|
8517
8498
|
exp != flag(test22, "object"),
|
|
8518
8499
|
"expected #{this} to not equal #{exp}",
|
|
@@ -8522,371 +8503,371 @@ assert.notEqual = function(act, exp, msg) {
|
|
|
8522
8503
|
true
|
|
8523
8504
|
);
|
|
8524
8505
|
};
|
|
8525
|
-
|
|
8526
|
-
new Assertion(act, msg,
|
|
8506
|
+
assert2.strictEqual = function(act, exp, msg) {
|
|
8507
|
+
new Assertion(act, msg, assert2.strictEqual, true).to.equal(exp);
|
|
8527
8508
|
};
|
|
8528
|
-
|
|
8529
|
-
new Assertion(act, msg,
|
|
8509
|
+
assert2.notStrictEqual = function(act, exp, msg) {
|
|
8510
|
+
new Assertion(act, msg, assert2.notStrictEqual, true).to.not.equal(exp);
|
|
8530
8511
|
};
|
|
8531
|
-
|
|
8532
|
-
new Assertion(act, msg,
|
|
8512
|
+
assert2.deepEqual = assert2.deepStrictEqual = function(act, exp, msg) {
|
|
8513
|
+
new Assertion(act, msg, assert2.deepEqual, true).to.eql(exp);
|
|
8533
8514
|
};
|
|
8534
|
-
|
|
8535
|
-
new Assertion(act, msg,
|
|
8515
|
+
assert2.notDeepEqual = function(act, exp, msg) {
|
|
8516
|
+
new Assertion(act, msg, assert2.notDeepEqual, true).to.not.eql(exp);
|
|
8536
8517
|
};
|
|
8537
|
-
|
|
8538
|
-
new Assertion(val, msg,
|
|
8518
|
+
assert2.isAbove = function(val, abv, msg) {
|
|
8519
|
+
new Assertion(val, msg, assert2.isAbove, true).to.be.above(abv);
|
|
8539
8520
|
};
|
|
8540
|
-
|
|
8541
|
-
new Assertion(val, msg,
|
|
8521
|
+
assert2.isAtLeast = function(val, atlst, msg) {
|
|
8522
|
+
new Assertion(val, msg, assert2.isAtLeast, true).to.be.least(atlst);
|
|
8542
8523
|
};
|
|
8543
|
-
|
|
8544
|
-
new Assertion(val, msg,
|
|
8524
|
+
assert2.isBelow = function(val, blw, msg) {
|
|
8525
|
+
new Assertion(val, msg, assert2.isBelow, true).to.be.below(blw);
|
|
8545
8526
|
};
|
|
8546
|
-
|
|
8547
|
-
new Assertion(val, msg,
|
|
8527
|
+
assert2.isAtMost = function(val, atmst, msg) {
|
|
8528
|
+
new Assertion(val, msg, assert2.isAtMost, true).to.be.most(atmst);
|
|
8548
8529
|
};
|
|
8549
|
-
|
|
8550
|
-
new Assertion(val, msg,
|
|
8530
|
+
assert2.isTrue = function(val, msg) {
|
|
8531
|
+
new Assertion(val, msg, assert2.isTrue, true).is["true"];
|
|
8551
8532
|
};
|
|
8552
|
-
|
|
8553
|
-
new Assertion(val, msg,
|
|
8533
|
+
assert2.isNotTrue = function(val, msg) {
|
|
8534
|
+
new Assertion(val, msg, assert2.isNotTrue, true).to.not.equal(true);
|
|
8554
8535
|
};
|
|
8555
|
-
|
|
8556
|
-
new Assertion(val, msg,
|
|
8536
|
+
assert2.isFalse = function(val, msg) {
|
|
8537
|
+
new Assertion(val, msg, assert2.isFalse, true).is["false"];
|
|
8557
8538
|
};
|
|
8558
|
-
|
|
8559
|
-
new Assertion(val, msg,
|
|
8539
|
+
assert2.isNotFalse = function(val, msg) {
|
|
8540
|
+
new Assertion(val, msg, assert2.isNotFalse, true).to.not.equal(false);
|
|
8560
8541
|
};
|
|
8561
|
-
|
|
8562
|
-
new Assertion(val, msg,
|
|
8542
|
+
assert2.isNull = function(val, msg) {
|
|
8543
|
+
new Assertion(val, msg, assert2.isNull, true).to.equal(null);
|
|
8563
8544
|
};
|
|
8564
|
-
|
|
8565
|
-
new Assertion(val, msg,
|
|
8545
|
+
assert2.isNotNull = function(val, msg) {
|
|
8546
|
+
new Assertion(val, msg, assert2.isNotNull, true).to.not.equal(null);
|
|
8566
8547
|
};
|
|
8567
|
-
|
|
8568
|
-
new Assertion(val, msg,
|
|
8548
|
+
assert2.isNaN = function(val, msg) {
|
|
8549
|
+
new Assertion(val, msg, assert2.isNaN, true).to.be.NaN;
|
|
8569
8550
|
};
|
|
8570
|
-
|
|
8571
|
-
new Assertion(value, message,
|
|
8551
|
+
assert2.isNotNaN = function(value, message) {
|
|
8552
|
+
new Assertion(value, message, assert2.isNotNaN, true).not.to.be.NaN;
|
|
8572
8553
|
};
|
|
8573
|
-
|
|
8574
|
-
new Assertion(val, msg,
|
|
8554
|
+
assert2.exists = function(val, msg) {
|
|
8555
|
+
new Assertion(val, msg, assert2.exists, true).to.exist;
|
|
8575
8556
|
};
|
|
8576
|
-
|
|
8577
|
-
new Assertion(val, msg,
|
|
8557
|
+
assert2.notExists = function(val, msg) {
|
|
8558
|
+
new Assertion(val, msg, assert2.notExists, true).to.not.exist;
|
|
8578
8559
|
};
|
|
8579
|
-
|
|
8580
|
-
new Assertion(val, msg,
|
|
8560
|
+
assert2.isUndefined = function(val, msg) {
|
|
8561
|
+
new Assertion(val, msg, assert2.isUndefined, true).to.equal(void 0);
|
|
8581
8562
|
};
|
|
8582
|
-
|
|
8583
|
-
new Assertion(val, msg,
|
|
8563
|
+
assert2.isDefined = function(val, msg) {
|
|
8564
|
+
new Assertion(val, msg, assert2.isDefined, true).to.not.equal(void 0);
|
|
8584
8565
|
};
|
|
8585
|
-
|
|
8586
|
-
new Assertion(value, message,
|
|
8566
|
+
assert2.isCallable = function(value, message) {
|
|
8567
|
+
new Assertion(value, message, assert2.isCallable, true).is.callable;
|
|
8587
8568
|
};
|
|
8588
|
-
|
|
8589
|
-
new Assertion(value, message,
|
|
8569
|
+
assert2.isNotCallable = function(value, message) {
|
|
8570
|
+
new Assertion(value, message, assert2.isNotCallable, true).is.not.callable;
|
|
8590
8571
|
};
|
|
8591
|
-
|
|
8592
|
-
new Assertion(val, msg,
|
|
8572
|
+
assert2.isObject = function(val, msg) {
|
|
8573
|
+
new Assertion(val, msg, assert2.isObject, true).to.be.a("object");
|
|
8593
8574
|
};
|
|
8594
|
-
|
|
8595
|
-
new Assertion(val, msg,
|
|
8575
|
+
assert2.isNotObject = function(val, msg) {
|
|
8576
|
+
new Assertion(val, msg, assert2.isNotObject, true).to.not.be.a("object");
|
|
8596
8577
|
};
|
|
8597
|
-
|
|
8598
|
-
new Assertion(val, msg,
|
|
8578
|
+
assert2.isArray = function(val, msg) {
|
|
8579
|
+
new Assertion(val, msg, assert2.isArray, true).to.be.an("array");
|
|
8599
8580
|
};
|
|
8600
|
-
|
|
8601
|
-
new Assertion(val, msg,
|
|
8581
|
+
assert2.isNotArray = function(val, msg) {
|
|
8582
|
+
new Assertion(val, msg, assert2.isNotArray, true).to.not.be.an("array");
|
|
8602
8583
|
};
|
|
8603
|
-
|
|
8604
|
-
new Assertion(val, msg,
|
|
8584
|
+
assert2.isString = function(val, msg) {
|
|
8585
|
+
new Assertion(val, msg, assert2.isString, true).to.be.a("string");
|
|
8605
8586
|
};
|
|
8606
|
-
|
|
8607
|
-
new Assertion(val, msg,
|
|
8587
|
+
assert2.isNotString = function(val, msg) {
|
|
8588
|
+
new Assertion(val, msg, assert2.isNotString, true).to.not.be.a("string");
|
|
8608
8589
|
};
|
|
8609
|
-
|
|
8610
|
-
new Assertion(val, msg,
|
|
8590
|
+
assert2.isNumber = function(val, msg) {
|
|
8591
|
+
new Assertion(val, msg, assert2.isNumber, true).to.be.a("number");
|
|
8611
8592
|
};
|
|
8612
|
-
|
|
8613
|
-
new Assertion(val, msg,
|
|
8593
|
+
assert2.isNotNumber = function(val, msg) {
|
|
8594
|
+
new Assertion(val, msg, assert2.isNotNumber, true).to.not.be.a("number");
|
|
8614
8595
|
};
|
|
8615
|
-
|
|
8616
|
-
new Assertion(val, msg,
|
|
8596
|
+
assert2.isNumeric = function(val, msg) {
|
|
8597
|
+
new Assertion(val, msg, assert2.isNumeric, true).is.numeric;
|
|
8617
8598
|
};
|
|
8618
|
-
|
|
8619
|
-
new Assertion(val, msg,
|
|
8599
|
+
assert2.isNotNumeric = function(val, msg) {
|
|
8600
|
+
new Assertion(val, msg, assert2.isNotNumeric, true).is.not.numeric;
|
|
8620
8601
|
};
|
|
8621
|
-
|
|
8622
|
-
new Assertion(val, msg,
|
|
8602
|
+
assert2.isFinite = function(val, msg) {
|
|
8603
|
+
new Assertion(val, msg, assert2.isFinite, true).to.be.finite;
|
|
8623
8604
|
};
|
|
8624
|
-
|
|
8625
|
-
new Assertion(val, msg,
|
|
8605
|
+
assert2.isBoolean = function(val, msg) {
|
|
8606
|
+
new Assertion(val, msg, assert2.isBoolean, true).to.be.a("boolean");
|
|
8626
8607
|
};
|
|
8627
|
-
|
|
8628
|
-
new Assertion(val, msg,
|
|
8608
|
+
assert2.isNotBoolean = function(val, msg) {
|
|
8609
|
+
new Assertion(val, msg, assert2.isNotBoolean, true).to.not.be.a("boolean");
|
|
8629
8610
|
};
|
|
8630
|
-
|
|
8631
|
-
new Assertion(val, msg,
|
|
8611
|
+
assert2.typeOf = function(val, type3, msg) {
|
|
8612
|
+
new Assertion(val, msg, assert2.typeOf, true).to.be.a(type3);
|
|
8632
8613
|
};
|
|
8633
|
-
|
|
8634
|
-
new Assertion(value, message,
|
|
8614
|
+
assert2.notTypeOf = function(value, type3, message) {
|
|
8615
|
+
new Assertion(value, message, assert2.notTypeOf, true).to.not.be.a(type3);
|
|
8635
8616
|
};
|
|
8636
|
-
|
|
8637
|
-
new Assertion(val, msg,
|
|
8617
|
+
assert2.instanceOf = function(val, type3, msg) {
|
|
8618
|
+
new Assertion(val, msg, assert2.instanceOf, true).to.be.instanceOf(type3);
|
|
8638
8619
|
};
|
|
8639
|
-
|
|
8640
|
-
new Assertion(val, msg,
|
|
8620
|
+
assert2.notInstanceOf = function(val, type3, msg) {
|
|
8621
|
+
new Assertion(val, msg, assert2.notInstanceOf, true).to.not.be.instanceOf(
|
|
8641
8622
|
type3
|
|
8642
8623
|
);
|
|
8643
8624
|
};
|
|
8644
|
-
|
|
8645
|
-
new Assertion(exp, msg,
|
|
8625
|
+
assert2.include = function(exp, inc, msg) {
|
|
8626
|
+
new Assertion(exp, msg, assert2.include, true).include(inc);
|
|
8646
8627
|
};
|
|
8647
|
-
|
|
8648
|
-
new Assertion(exp, msg,
|
|
8628
|
+
assert2.notInclude = function(exp, inc, msg) {
|
|
8629
|
+
new Assertion(exp, msg, assert2.notInclude, true).not.include(inc);
|
|
8649
8630
|
};
|
|
8650
|
-
|
|
8651
|
-
new Assertion(exp, msg,
|
|
8631
|
+
assert2.deepInclude = function(exp, inc, msg) {
|
|
8632
|
+
new Assertion(exp, msg, assert2.deepInclude, true).deep.include(inc);
|
|
8652
8633
|
};
|
|
8653
|
-
|
|
8654
|
-
new Assertion(exp, msg,
|
|
8634
|
+
assert2.notDeepInclude = function(exp, inc, msg) {
|
|
8635
|
+
new Assertion(exp, msg, assert2.notDeepInclude, true).not.deep.include(inc);
|
|
8655
8636
|
};
|
|
8656
|
-
|
|
8657
|
-
new Assertion(exp, msg,
|
|
8637
|
+
assert2.nestedInclude = function(exp, inc, msg) {
|
|
8638
|
+
new Assertion(exp, msg, assert2.nestedInclude, true).nested.include(inc);
|
|
8658
8639
|
};
|
|
8659
|
-
|
|
8660
|
-
new Assertion(exp, msg,
|
|
8640
|
+
assert2.notNestedInclude = function(exp, inc, msg) {
|
|
8641
|
+
new Assertion(exp, msg, assert2.notNestedInclude, true).not.nested.include(
|
|
8661
8642
|
inc
|
|
8662
8643
|
);
|
|
8663
8644
|
};
|
|
8664
|
-
|
|
8665
|
-
new Assertion(exp, msg,
|
|
8645
|
+
assert2.deepNestedInclude = function(exp, inc, msg) {
|
|
8646
|
+
new Assertion(exp, msg, assert2.deepNestedInclude, true).deep.nested.include(
|
|
8666
8647
|
inc
|
|
8667
8648
|
);
|
|
8668
8649
|
};
|
|
8669
|
-
|
|
8650
|
+
assert2.notDeepNestedInclude = function(exp, inc, msg) {
|
|
8670
8651
|
new Assertion(
|
|
8671
8652
|
exp,
|
|
8672
8653
|
msg,
|
|
8673
|
-
|
|
8654
|
+
assert2.notDeepNestedInclude,
|
|
8674
8655
|
true
|
|
8675
8656
|
).not.deep.nested.include(inc);
|
|
8676
8657
|
};
|
|
8677
|
-
|
|
8678
|
-
new Assertion(exp, msg,
|
|
8658
|
+
assert2.ownInclude = function(exp, inc, msg) {
|
|
8659
|
+
new Assertion(exp, msg, assert2.ownInclude, true).own.include(inc);
|
|
8679
8660
|
};
|
|
8680
|
-
|
|
8681
|
-
new Assertion(exp, msg,
|
|
8661
|
+
assert2.notOwnInclude = function(exp, inc, msg) {
|
|
8662
|
+
new Assertion(exp, msg, assert2.notOwnInclude, true).not.own.include(inc);
|
|
8682
8663
|
};
|
|
8683
|
-
|
|
8684
|
-
new Assertion(exp, msg,
|
|
8664
|
+
assert2.deepOwnInclude = function(exp, inc, msg) {
|
|
8665
|
+
new Assertion(exp, msg, assert2.deepOwnInclude, true).deep.own.include(inc);
|
|
8685
8666
|
};
|
|
8686
|
-
|
|
8687
|
-
new Assertion(exp, msg,
|
|
8667
|
+
assert2.notDeepOwnInclude = function(exp, inc, msg) {
|
|
8668
|
+
new Assertion(exp, msg, assert2.notDeepOwnInclude, true).not.deep.own.include(
|
|
8688
8669
|
inc
|
|
8689
8670
|
);
|
|
8690
8671
|
};
|
|
8691
|
-
|
|
8692
|
-
new Assertion(exp, msg,
|
|
8672
|
+
assert2.match = function(exp, re, msg) {
|
|
8673
|
+
new Assertion(exp, msg, assert2.match, true).to.match(re);
|
|
8693
8674
|
};
|
|
8694
|
-
|
|
8695
|
-
new Assertion(exp, msg,
|
|
8675
|
+
assert2.notMatch = function(exp, re, msg) {
|
|
8676
|
+
new Assertion(exp, msg, assert2.notMatch, true).to.not.match(re);
|
|
8696
8677
|
};
|
|
8697
|
-
|
|
8698
|
-
new Assertion(obj, msg,
|
|
8678
|
+
assert2.property = function(obj, prop, msg) {
|
|
8679
|
+
new Assertion(obj, msg, assert2.property, true).to.have.property(prop);
|
|
8699
8680
|
};
|
|
8700
|
-
|
|
8701
|
-
new Assertion(obj, msg,
|
|
8681
|
+
assert2.notProperty = function(obj, prop, msg) {
|
|
8682
|
+
new Assertion(obj, msg, assert2.notProperty, true).to.not.have.property(prop);
|
|
8702
8683
|
};
|
|
8703
|
-
|
|
8704
|
-
new Assertion(obj, msg,
|
|
8684
|
+
assert2.propertyVal = function(obj, prop, val, msg) {
|
|
8685
|
+
new Assertion(obj, msg, assert2.propertyVal, true).to.have.property(prop, val);
|
|
8705
8686
|
};
|
|
8706
|
-
|
|
8707
|
-
new Assertion(obj, msg,
|
|
8687
|
+
assert2.notPropertyVal = function(obj, prop, val, msg) {
|
|
8688
|
+
new Assertion(obj, msg, assert2.notPropertyVal, true).to.not.have.property(
|
|
8708
8689
|
prop,
|
|
8709
8690
|
val
|
|
8710
8691
|
);
|
|
8711
8692
|
};
|
|
8712
|
-
|
|
8713
|
-
new Assertion(obj, msg,
|
|
8693
|
+
assert2.deepPropertyVal = function(obj, prop, val, msg) {
|
|
8694
|
+
new Assertion(obj, msg, assert2.deepPropertyVal, true).to.have.deep.property(
|
|
8714
8695
|
prop,
|
|
8715
8696
|
val
|
|
8716
8697
|
);
|
|
8717
8698
|
};
|
|
8718
|
-
|
|
8699
|
+
assert2.notDeepPropertyVal = function(obj, prop, val, msg) {
|
|
8719
8700
|
new Assertion(
|
|
8720
8701
|
obj,
|
|
8721
8702
|
msg,
|
|
8722
|
-
|
|
8703
|
+
assert2.notDeepPropertyVal,
|
|
8723
8704
|
true
|
|
8724
8705
|
).to.not.have.deep.property(prop, val);
|
|
8725
8706
|
};
|
|
8726
|
-
|
|
8727
|
-
new Assertion(obj, msg,
|
|
8707
|
+
assert2.ownProperty = function(obj, prop, msg) {
|
|
8708
|
+
new Assertion(obj, msg, assert2.ownProperty, true).to.have.own.property(prop);
|
|
8728
8709
|
};
|
|
8729
|
-
|
|
8730
|
-
new Assertion(obj, msg,
|
|
8710
|
+
assert2.notOwnProperty = function(obj, prop, msg) {
|
|
8711
|
+
new Assertion(obj, msg, assert2.notOwnProperty, true).to.not.have.own.property(
|
|
8731
8712
|
prop
|
|
8732
8713
|
);
|
|
8733
8714
|
};
|
|
8734
|
-
|
|
8735
|
-
new Assertion(obj, msg,
|
|
8715
|
+
assert2.ownPropertyVal = function(obj, prop, value, msg) {
|
|
8716
|
+
new Assertion(obj, msg, assert2.ownPropertyVal, true).to.have.own.property(
|
|
8736
8717
|
prop,
|
|
8737
8718
|
value
|
|
8738
8719
|
);
|
|
8739
8720
|
};
|
|
8740
|
-
|
|
8721
|
+
assert2.notOwnPropertyVal = function(obj, prop, value, msg) {
|
|
8741
8722
|
new Assertion(
|
|
8742
8723
|
obj,
|
|
8743
8724
|
msg,
|
|
8744
|
-
|
|
8725
|
+
assert2.notOwnPropertyVal,
|
|
8745
8726
|
true
|
|
8746
8727
|
).to.not.have.own.property(prop, value);
|
|
8747
8728
|
};
|
|
8748
|
-
|
|
8729
|
+
assert2.deepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
8749
8730
|
new Assertion(
|
|
8750
8731
|
obj,
|
|
8751
8732
|
msg,
|
|
8752
|
-
|
|
8733
|
+
assert2.deepOwnPropertyVal,
|
|
8753
8734
|
true
|
|
8754
8735
|
).to.have.deep.own.property(prop, value);
|
|
8755
8736
|
};
|
|
8756
|
-
|
|
8737
|
+
assert2.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
8757
8738
|
new Assertion(
|
|
8758
8739
|
obj,
|
|
8759
8740
|
msg,
|
|
8760
|
-
|
|
8741
|
+
assert2.notDeepOwnPropertyVal,
|
|
8761
8742
|
true
|
|
8762
8743
|
).to.not.have.deep.own.property(prop, value);
|
|
8763
8744
|
};
|
|
8764
|
-
|
|
8765
|
-
new Assertion(obj, msg,
|
|
8745
|
+
assert2.nestedProperty = function(obj, prop, msg) {
|
|
8746
|
+
new Assertion(obj, msg, assert2.nestedProperty, true).to.have.nested.property(
|
|
8766
8747
|
prop
|
|
8767
8748
|
);
|
|
8768
8749
|
};
|
|
8769
|
-
|
|
8750
|
+
assert2.notNestedProperty = function(obj, prop, msg) {
|
|
8770
8751
|
new Assertion(
|
|
8771
8752
|
obj,
|
|
8772
8753
|
msg,
|
|
8773
|
-
|
|
8754
|
+
assert2.notNestedProperty,
|
|
8774
8755
|
true
|
|
8775
8756
|
).to.not.have.nested.property(prop);
|
|
8776
8757
|
};
|
|
8777
|
-
|
|
8758
|
+
assert2.nestedPropertyVal = function(obj, prop, val, msg) {
|
|
8778
8759
|
new Assertion(
|
|
8779
8760
|
obj,
|
|
8780
8761
|
msg,
|
|
8781
|
-
|
|
8762
|
+
assert2.nestedPropertyVal,
|
|
8782
8763
|
true
|
|
8783
8764
|
).to.have.nested.property(prop, val);
|
|
8784
8765
|
};
|
|
8785
|
-
|
|
8766
|
+
assert2.notNestedPropertyVal = function(obj, prop, val, msg) {
|
|
8786
8767
|
new Assertion(
|
|
8787
8768
|
obj,
|
|
8788
8769
|
msg,
|
|
8789
|
-
|
|
8770
|
+
assert2.notNestedPropertyVal,
|
|
8790
8771
|
true
|
|
8791
8772
|
).to.not.have.nested.property(prop, val);
|
|
8792
8773
|
};
|
|
8793
|
-
|
|
8774
|
+
assert2.deepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
8794
8775
|
new Assertion(
|
|
8795
8776
|
obj,
|
|
8796
8777
|
msg,
|
|
8797
|
-
|
|
8778
|
+
assert2.deepNestedPropertyVal,
|
|
8798
8779
|
true
|
|
8799
8780
|
).to.have.deep.nested.property(prop, val);
|
|
8800
8781
|
};
|
|
8801
|
-
|
|
8782
|
+
assert2.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
8802
8783
|
new Assertion(
|
|
8803
8784
|
obj,
|
|
8804
8785
|
msg,
|
|
8805
|
-
|
|
8786
|
+
assert2.notDeepNestedPropertyVal,
|
|
8806
8787
|
true
|
|
8807
8788
|
).to.not.have.deep.nested.property(prop, val);
|
|
8808
8789
|
};
|
|
8809
|
-
|
|
8810
|
-
new Assertion(exp, msg,
|
|
8790
|
+
assert2.lengthOf = function(exp, len, msg) {
|
|
8791
|
+
new Assertion(exp, msg, assert2.lengthOf, true).to.have.lengthOf(len);
|
|
8811
8792
|
};
|
|
8812
|
-
|
|
8813
|
-
new Assertion(obj, msg,
|
|
8793
|
+
assert2.hasAnyKeys = function(obj, keys2, msg) {
|
|
8794
|
+
new Assertion(obj, msg, assert2.hasAnyKeys, true).to.have.any.keys(keys2);
|
|
8814
8795
|
};
|
|
8815
|
-
|
|
8816
|
-
new Assertion(obj, msg,
|
|
8796
|
+
assert2.hasAllKeys = function(obj, keys2, msg) {
|
|
8797
|
+
new Assertion(obj, msg, assert2.hasAllKeys, true).to.have.all.keys(keys2);
|
|
8817
8798
|
};
|
|
8818
|
-
|
|
8819
|
-
new Assertion(obj, msg,
|
|
8799
|
+
assert2.containsAllKeys = function(obj, keys2, msg) {
|
|
8800
|
+
new Assertion(obj, msg, assert2.containsAllKeys, true).to.contain.all.keys(
|
|
8820
8801
|
keys2
|
|
8821
8802
|
);
|
|
8822
8803
|
};
|
|
8823
|
-
|
|
8824
|
-
new Assertion(obj, msg,
|
|
8804
|
+
assert2.doesNotHaveAnyKeys = function(obj, keys2, msg) {
|
|
8805
|
+
new Assertion(obj, msg, assert2.doesNotHaveAnyKeys, true).to.not.have.any.keys(
|
|
8825
8806
|
keys2
|
|
8826
8807
|
);
|
|
8827
8808
|
};
|
|
8828
|
-
|
|
8829
|
-
new Assertion(obj, msg,
|
|
8809
|
+
assert2.doesNotHaveAllKeys = function(obj, keys2, msg) {
|
|
8810
|
+
new Assertion(obj, msg, assert2.doesNotHaveAllKeys, true).to.not.have.all.keys(
|
|
8830
8811
|
keys2
|
|
8831
8812
|
);
|
|
8832
8813
|
};
|
|
8833
|
-
|
|
8834
|
-
new Assertion(obj, msg,
|
|
8814
|
+
assert2.hasAnyDeepKeys = function(obj, keys2, msg) {
|
|
8815
|
+
new Assertion(obj, msg, assert2.hasAnyDeepKeys, true).to.have.any.deep.keys(
|
|
8835
8816
|
keys2
|
|
8836
8817
|
);
|
|
8837
8818
|
};
|
|
8838
|
-
|
|
8839
|
-
new Assertion(obj, msg,
|
|
8819
|
+
assert2.hasAllDeepKeys = function(obj, keys2, msg) {
|
|
8820
|
+
new Assertion(obj, msg, assert2.hasAllDeepKeys, true).to.have.all.deep.keys(
|
|
8840
8821
|
keys2
|
|
8841
8822
|
);
|
|
8842
8823
|
};
|
|
8843
|
-
|
|
8824
|
+
assert2.containsAllDeepKeys = function(obj, keys2, msg) {
|
|
8844
8825
|
new Assertion(
|
|
8845
8826
|
obj,
|
|
8846
8827
|
msg,
|
|
8847
|
-
|
|
8828
|
+
assert2.containsAllDeepKeys,
|
|
8848
8829
|
true
|
|
8849
8830
|
).to.contain.all.deep.keys(keys2);
|
|
8850
8831
|
};
|
|
8851
|
-
|
|
8832
|
+
assert2.doesNotHaveAnyDeepKeys = function(obj, keys2, msg) {
|
|
8852
8833
|
new Assertion(
|
|
8853
8834
|
obj,
|
|
8854
8835
|
msg,
|
|
8855
|
-
|
|
8836
|
+
assert2.doesNotHaveAnyDeepKeys,
|
|
8856
8837
|
true
|
|
8857
8838
|
).to.not.have.any.deep.keys(keys2);
|
|
8858
8839
|
};
|
|
8859
|
-
|
|
8840
|
+
assert2.doesNotHaveAllDeepKeys = function(obj, keys2, msg) {
|
|
8860
8841
|
new Assertion(
|
|
8861
8842
|
obj,
|
|
8862
8843
|
msg,
|
|
8863
|
-
|
|
8844
|
+
assert2.doesNotHaveAllDeepKeys,
|
|
8864
8845
|
true
|
|
8865
8846
|
).to.not.have.all.deep.keys(keys2);
|
|
8866
8847
|
};
|
|
8867
|
-
|
|
8848
|
+
assert2.throws = function(fn2, errorLike, errMsgMatcher, msg) {
|
|
8868
8849
|
if ("string" === typeof errorLike || errorLike instanceof RegExp) {
|
|
8869
8850
|
errMsgMatcher = errorLike;
|
|
8870
8851
|
errorLike = null;
|
|
8871
8852
|
}
|
|
8872
|
-
|
|
8853
|
+
var assertErr = new Assertion(fn2, msg, assert2.throws, true).to.throw(
|
|
8873
8854
|
errorLike,
|
|
8874
8855
|
errMsgMatcher
|
|
8875
8856
|
);
|
|
8876
8857
|
return flag(assertErr, "object");
|
|
8877
8858
|
};
|
|
8878
|
-
|
|
8859
|
+
assert2.doesNotThrow = function(fn2, errorLike, errMsgMatcher, message) {
|
|
8879
8860
|
if ("string" === typeof errorLike || errorLike instanceof RegExp) {
|
|
8880
8861
|
errMsgMatcher = errorLike;
|
|
8881
8862
|
errorLike = null;
|
|
8882
8863
|
}
|
|
8883
|
-
new Assertion(fn2, message,
|
|
8864
|
+
new Assertion(fn2, message, assert2.doesNotThrow, true).to.not.throw(
|
|
8884
8865
|
errorLike,
|
|
8885
8866
|
errMsgMatcher
|
|
8886
8867
|
);
|
|
8887
8868
|
};
|
|
8888
|
-
|
|
8889
|
-
|
|
8869
|
+
assert2.operator = function(val, operator, val2, msg) {
|
|
8870
|
+
var ok;
|
|
8890
8871
|
switch (operator) {
|
|
8891
8872
|
case "==":
|
|
8892
8873
|
ok = val == val2;
|
|
@@ -8917,315 +8898,315 @@ assert.operator = function(val, operator, val2, msg) {
|
|
|
8917
8898
|
throw new AssertionError(
|
|
8918
8899
|
msg + 'Invalid operator "' + operator + '"',
|
|
8919
8900
|
void 0,
|
|
8920
|
-
|
|
8901
|
+
assert2.operator
|
|
8921
8902
|
);
|
|
8922
8903
|
}
|
|
8923
|
-
|
|
8904
|
+
var test22 = new Assertion(ok, msg, assert2.operator, true);
|
|
8924
8905
|
test22.assert(
|
|
8925
8906
|
true === flag(test22, "object"),
|
|
8926
8907
|
"expected " + inspect22(val) + " to be " + operator + " " + inspect22(val2),
|
|
8927
8908
|
"expected " + inspect22(val) + " to not be " + operator + " " + inspect22(val2)
|
|
8928
8909
|
);
|
|
8929
8910
|
};
|
|
8930
|
-
|
|
8931
|
-
new Assertion(act, msg,
|
|
8911
|
+
assert2.closeTo = function(act, exp, delta, msg) {
|
|
8912
|
+
new Assertion(act, msg, assert2.closeTo, true).to.be.closeTo(exp, delta);
|
|
8932
8913
|
};
|
|
8933
|
-
|
|
8934
|
-
new Assertion(act, msg,
|
|
8914
|
+
assert2.approximately = function(act, exp, delta, msg) {
|
|
8915
|
+
new Assertion(act, msg, assert2.approximately, true).to.be.approximately(
|
|
8935
8916
|
exp,
|
|
8936
8917
|
delta
|
|
8937
8918
|
);
|
|
8938
8919
|
};
|
|
8939
|
-
|
|
8940
|
-
new Assertion(set1, msg,
|
|
8920
|
+
assert2.sameMembers = function(set1, set22, msg) {
|
|
8921
|
+
new Assertion(set1, msg, assert2.sameMembers, true).to.have.same.members(set22);
|
|
8941
8922
|
};
|
|
8942
|
-
|
|
8923
|
+
assert2.notSameMembers = function(set1, set22, msg) {
|
|
8943
8924
|
new Assertion(
|
|
8944
8925
|
set1,
|
|
8945
8926
|
msg,
|
|
8946
|
-
|
|
8927
|
+
assert2.notSameMembers,
|
|
8947
8928
|
true
|
|
8948
8929
|
).to.not.have.same.members(set22);
|
|
8949
8930
|
};
|
|
8950
|
-
|
|
8931
|
+
assert2.sameDeepMembers = function(set1, set22, msg) {
|
|
8951
8932
|
new Assertion(
|
|
8952
8933
|
set1,
|
|
8953
8934
|
msg,
|
|
8954
|
-
|
|
8935
|
+
assert2.sameDeepMembers,
|
|
8955
8936
|
true
|
|
8956
8937
|
).to.have.same.deep.members(set22);
|
|
8957
8938
|
};
|
|
8958
|
-
|
|
8939
|
+
assert2.notSameDeepMembers = function(set1, set22, msg) {
|
|
8959
8940
|
new Assertion(
|
|
8960
8941
|
set1,
|
|
8961
8942
|
msg,
|
|
8962
|
-
|
|
8943
|
+
assert2.notSameDeepMembers,
|
|
8963
8944
|
true
|
|
8964
8945
|
).to.not.have.same.deep.members(set22);
|
|
8965
8946
|
};
|
|
8966
|
-
|
|
8947
|
+
assert2.sameOrderedMembers = function(set1, set22, msg) {
|
|
8967
8948
|
new Assertion(
|
|
8968
8949
|
set1,
|
|
8969
8950
|
msg,
|
|
8970
|
-
|
|
8951
|
+
assert2.sameOrderedMembers,
|
|
8971
8952
|
true
|
|
8972
8953
|
).to.have.same.ordered.members(set22);
|
|
8973
8954
|
};
|
|
8974
|
-
|
|
8955
|
+
assert2.notSameOrderedMembers = function(set1, set22, msg) {
|
|
8975
8956
|
new Assertion(
|
|
8976
8957
|
set1,
|
|
8977
8958
|
msg,
|
|
8978
|
-
|
|
8959
|
+
assert2.notSameOrderedMembers,
|
|
8979
8960
|
true
|
|
8980
8961
|
).to.not.have.same.ordered.members(set22);
|
|
8981
8962
|
};
|
|
8982
|
-
|
|
8963
|
+
assert2.sameDeepOrderedMembers = function(set1, set22, msg) {
|
|
8983
8964
|
new Assertion(
|
|
8984
8965
|
set1,
|
|
8985
8966
|
msg,
|
|
8986
|
-
|
|
8967
|
+
assert2.sameDeepOrderedMembers,
|
|
8987
8968
|
true
|
|
8988
8969
|
).to.have.same.deep.ordered.members(set22);
|
|
8989
8970
|
};
|
|
8990
|
-
|
|
8971
|
+
assert2.notSameDeepOrderedMembers = function(set1, set22, msg) {
|
|
8991
8972
|
new Assertion(
|
|
8992
8973
|
set1,
|
|
8993
8974
|
msg,
|
|
8994
|
-
|
|
8975
|
+
assert2.notSameDeepOrderedMembers,
|
|
8995
8976
|
true
|
|
8996
8977
|
).to.not.have.same.deep.ordered.members(set22);
|
|
8997
8978
|
};
|
|
8998
|
-
|
|
8999
|
-
new Assertion(superset, msg,
|
|
8979
|
+
assert2.includeMembers = function(superset, subset, msg) {
|
|
8980
|
+
new Assertion(superset, msg, assert2.includeMembers, true).to.include.members(
|
|
9000
8981
|
subset
|
|
9001
8982
|
);
|
|
9002
8983
|
};
|
|
9003
|
-
|
|
8984
|
+
assert2.notIncludeMembers = function(superset, subset, msg) {
|
|
9004
8985
|
new Assertion(
|
|
9005
8986
|
superset,
|
|
9006
8987
|
msg,
|
|
9007
|
-
|
|
8988
|
+
assert2.notIncludeMembers,
|
|
9008
8989
|
true
|
|
9009
8990
|
).to.not.include.members(subset);
|
|
9010
8991
|
};
|
|
9011
|
-
|
|
8992
|
+
assert2.includeDeepMembers = function(superset, subset, msg) {
|
|
9012
8993
|
new Assertion(
|
|
9013
8994
|
superset,
|
|
9014
8995
|
msg,
|
|
9015
|
-
|
|
8996
|
+
assert2.includeDeepMembers,
|
|
9016
8997
|
true
|
|
9017
8998
|
).to.include.deep.members(subset);
|
|
9018
8999
|
};
|
|
9019
|
-
|
|
9000
|
+
assert2.notIncludeDeepMembers = function(superset, subset, msg) {
|
|
9020
9001
|
new Assertion(
|
|
9021
9002
|
superset,
|
|
9022
9003
|
msg,
|
|
9023
|
-
|
|
9004
|
+
assert2.notIncludeDeepMembers,
|
|
9024
9005
|
true
|
|
9025
9006
|
).to.not.include.deep.members(subset);
|
|
9026
9007
|
};
|
|
9027
|
-
|
|
9008
|
+
assert2.includeOrderedMembers = function(superset, subset, msg) {
|
|
9028
9009
|
new Assertion(
|
|
9029
9010
|
superset,
|
|
9030
9011
|
msg,
|
|
9031
|
-
|
|
9012
|
+
assert2.includeOrderedMembers,
|
|
9032
9013
|
true
|
|
9033
9014
|
).to.include.ordered.members(subset);
|
|
9034
9015
|
};
|
|
9035
|
-
|
|
9016
|
+
assert2.notIncludeOrderedMembers = function(superset, subset, msg) {
|
|
9036
9017
|
new Assertion(
|
|
9037
9018
|
superset,
|
|
9038
9019
|
msg,
|
|
9039
|
-
|
|
9020
|
+
assert2.notIncludeOrderedMembers,
|
|
9040
9021
|
true
|
|
9041
9022
|
).to.not.include.ordered.members(subset);
|
|
9042
9023
|
};
|
|
9043
|
-
|
|
9024
|
+
assert2.includeDeepOrderedMembers = function(superset, subset, msg) {
|
|
9044
9025
|
new Assertion(
|
|
9045
9026
|
superset,
|
|
9046
9027
|
msg,
|
|
9047
|
-
|
|
9028
|
+
assert2.includeDeepOrderedMembers,
|
|
9048
9029
|
true
|
|
9049
9030
|
).to.include.deep.ordered.members(subset);
|
|
9050
9031
|
};
|
|
9051
|
-
|
|
9032
|
+
assert2.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
|
|
9052
9033
|
new Assertion(
|
|
9053
9034
|
superset,
|
|
9054
9035
|
msg,
|
|
9055
|
-
|
|
9036
|
+
assert2.notIncludeDeepOrderedMembers,
|
|
9056
9037
|
true
|
|
9057
9038
|
).to.not.include.deep.ordered.members(subset);
|
|
9058
9039
|
};
|
|
9059
|
-
|
|
9060
|
-
new Assertion(inList, msg,
|
|
9040
|
+
assert2.oneOf = function(inList, list, msg) {
|
|
9041
|
+
new Assertion(inList, msg, assert2.oneOf, true).to.be.oneOf(list);
|
|
9061
9042
|
};
|
|
9062
|
-
|
|
9043
|
+
assert2.isIterable = function(obj, msg) {
|
|
9063
9044
|
if (obj == void 0 || !obj[Symbol.iterator]) {
|
|
9064
9045
|
msg = msg ? `${msg} expected ${inspect22(obj)} to be an iterable` : `expected ${inspect22(obj)} to be an iterable`;
|
|
9065
|
-
throw new AssertionError(msg, void 0,
|
|
9046
|
+
throw new AssertionError(msg, void 0, assert2.isIterable);
|
|
9066
9047
|
}
|
|
9067
9048
|
};
|
|
9068
|
-
|
|
9049
|
+
assert2.changes = function(fn2, obj, prop, msg) {
|
|
9069
9050
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9070
9051
|
msg = prop;
|
|
9071
9052
|
prop = null;
|
|
9072
9053
|
}
|
|
9073
|
-
new Assertion(fn2, msg,
|
|
9054
|
+
new Assertion(fn2, msg, assert2.changes, true).to.change(obj, prop);
|
|
9074
9055
|
};
|
|
9075
|
-
|
|
9056
|
+
assert2.changesBy = function(fn2, obj, prop, delta, msg) {
|
|
9076
9057
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9077
|
-
|
|
9058
|
+
var tmpMsg = delta;
|
|
9078
9059
|
delta = prop;
|
|
9079
9060
|
msg = tmpMsg;
|
|
9080
9061
|
} else if (arguments.length === 3) {
|
|
9081
9062
|
delta = prop;
|
|
9082
9063
|
prop = null;
|
|
9083
9064
|
}
|
|
9084
|
-
new Assertion(fn2, msg,
|
|
9065
|
+
new Assertion(fn2, msg, assert2.changesBy, true).to.change(obj, prop).by(delta);
|
|
9085
9066
|
};
|
|
9086
|
-
|
|
9067
|
+
assert2.doesNotChange = function(fn2, obj, prop, msg) {
|
|
9087
9068
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9088
9069
|
msg = prop;
|
|
9089
9070
|
prop = null;
|
|
9090
9071
|
}
|
|
9091
|
-
return new Assertion(fn2, msg,
|
|
9072
|
+
return new Assertion(fn2, msg, assert2.doesNotChange, true).to.not.change(
|
|
9092
9073
|
obj,
|
|
9093
9074
|
prop
|
|
9094
9075
|
);
|
|
9095
9076
|
};
|
|
9096
|
-
|
|
9077
|
+
assert2.changesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
9097
9078
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9098
|
-
|
|
9079
|
+
var tmpMsg = delta;
|
|
9099
9080
|
delta = prop;
|
|
9100
9081
|
msg = tmpMsg;
|
|
9101
9082
|
} else if (arguments.length === 3) {
|
|
9102
9083
|
delta = prop;
|
|
9103
9084
|
prop = null;
|
|
9104
9085
|
}
|
|
9105
|
-
new Assertion(fn2, msg,
|
|
9086
|
+
new Assertion(fn2, msg, assert2.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
|
|
9106
9087
|
};
|
|
9107
|
-
|
|
9088
|
+
assert2.increases = function(fn2, obj, prop, msg) {
|
|
9108
9089
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9109
9090
|
msg = prop;
|
|
9110
9091
|
prop = null;
|
|
9111
9092
|
}
|
|
9112
|
-
return new Assertion(fn2, msg,
|
|
9093
|
+
return new Assertion(fn2, msg, assert2.increases, true).to.increase(obj, prop);
|
|
9113
9094
|
};
|
|
9114
|
-
|
|
9095
|
+
assert2.increasesBy = function(fn2, obj, prop, delta, msg) {
|
|
9115
9096
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9116
|
-
|
|
9097
|
+
var tmpMsg = delta;
|
|
9117
9098
|
delta = prop;
|
|
9118
9099
|
msg = tmpMsg;
|
|
9119
9100
|
} else if (arguments.length === 3) {
|
|
9120
9101
|
delta = prop;
|
|
9121
9102
|
prop = null;
|
|
9122
9103
|
}
|
|
9123
|
-
new Assertion(fn2, msg,
|
|
9104
|
+
new Assertion(fn2, msg, assert2.increasesBy, true).to.increase(obj, prop).by(delta);
|
|
9124
9105
|
};
|
|
9125
|
-
|
|
9106
|
+
assert2.doesNotIncrease = function(fn2, obj, prop, msg) {
|
|
9126
9107
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9127
9108
|
msg = prop;
|
|
9128
9109
|
prop = null;
|
|
9129
9110
|
}
|
|
9130
|
-
return new Assertion(fn2, msg,
|
|
9111
|
+
return new Assertion(fn2, msg, assert2.doesNotIncrease, true).to.not.increase(
|
|
9131
9112
|
obj,
|
|
9132
9113
|
prop
|
|
9133
9114
|
);
|
|
9134
9115
|
};
|
|
9135
|
-
|
|
9116
|
+
assert2.increasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
9136
9117
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9137
|
-
|
|
9118
|
+
var tmpMsg = delta;
|
|
9138
9119
|
delta = prop;
|
|
9139
9120
|
msg = tmpMsg;
|
|
9140
9121
|
} else if (arguments.length === 3) {
|
|
9141
9122
|
delta = prop;
|
|
9142
9123
|
prop = null;
|
|
9143
9124
|
}
|
|
9144
|
-
new Assertion(fn2, msg,
|
|
9125
|
+
new Assertion(fn2, msg, assert2.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
|
|
9145
9126
|
};
|
|
9146
|
-
|
|
9127
|
+
assert2.decreases = function(fn2, obj, prop, msg) {
|
|
9147
9128
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9148
9129
|
msg = prop;
|
|
9149
9130
|
prop = null;
|
|
9150
9131
|
}
|
|
9151
|
-
return new Assertion(fn2, msg,
|
|
9132
|
+
return new Assertion(fn2, msg, assert2.decreases, true).to.decrease(obj, prop);
|
|
9152
9133
|
};
|
|
9153
|
-
|
|
9134
|
+
assert2.decreasesBy = function(fn2, obj, prop, delta, msg) {
|
|
9154
9135
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9155
|
-
|
|
9136
|
+
var tmpMsg = delta;
|
|
9156
9137
|
delta = prop;
|
|
9157
9138
|
msg = tmpMsg;
|
|
9158
9139
|
} else if (arguments.length === 3) {
|
|
9159
9140
|
delta = prop;
|
|
9160
9141
|
prop = null;
|
|
9161
9142
|
}
|
|
9162
|
-
new Assertion(fn2, msg,
|
|
9143
|
+
new Assertion(fn2, msg, assert2.decreasesBy, true).to.decrease(obj, prop).by(delta);
|
|
9163
9144
|
};
|
|
9164
|
-
|
|
9145
|
+
assert2.doesNotDecrease = function(fn2, obj, prop, msg) {
|
|
9165
9146
|
if (arguments.length === 3 && typeof obj === "function") {
|
|
9166
9147
|
msg = prop;
|
|
9167
9148
|
prop = null;
|
|
9168
9149
|
}
|
|
9169
|
-
return new Assertion(fn2, msg,
|
|
9150
|
+
return new Assertion(fn2, msg, assert2.doesNotDecrease, true).to.not.decrease(
|
|
9170
9151
|
obj,
|
|
9171
9152
|
prop
|
|
9172
9153
|
);
|
|
9173
9154
|
};
|
|
9174
|
-
|
|
9155
|
+
assert2.doesNotDecreaseBy = function(fn2, obj, prop, delta, msg) {
|
|
9175
9156
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9176
|
-
|
|
9157
|
+
var tmpMsg = delta;
|
|
9177
9158
|
delta = prop;
|
|
9178
9159
|
msg = tmpMsg;
|
|
9179
9160
|
} else if (arguments.length === 3) {
|
|
9180
9161
|
delta = prop;
|
|
9181
9162
|
prop = null;
|
|
9182
9163
|
}
|
|
9183
|
-
return new Assertion(fn2, msg,
|
|
9164
|
+
return new Assertion(fn2, msg, assert2.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
|
|
9184
9165
|
};
|
|
9185
|
-
|
|
9166
|
+
assert2.decreasesButNotBy = function(fn2, obj, prop, delta, msg) {
|
|
9186
9167
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9187
|
-
|
|
9168
|
+
var tmpMsg = delta;
|
|
9188
9169
|
delta = prop;
|
|
9189
9170
|
msg = tmpMsg;
|
|
9190
9171
|
} else if (arguments.length === 3) {
|
|
9191
9172
|
delta = prop;
|
|
9192
9173
|
prop = null;
|
|
9193
9174
|
}
|
|
9194
|
-
new Assertion(fn2, msg,
|
|
9175
|
+
new Assertion(fn2, msg, assert2.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
|
|
9195
9176
|
};
|
|
9196
|
-
|
|
9177
|
+
assert2.ifError = function(val) {
|
|
9197
9178
|
if (val) {
|
|
9198
9179
|
throw val;
|
|
9199
9180
|
}
|
|
9200
9181
|
};
|
|
9201
|
-
|
|
9202
|
-
new Assertion(obj, msg,
|
|
9182
|
+
assert2.isExtensible = function(obj, msg) {
|
|
9183
|
+
new Assertion(obj, msg, assert2.isExtensible, true).to.be.extensible;
|
|
9203
9184
|
};
|
|
9204
|
-
|
|
9205
|
-
new Assertion(obj, msg,
|
|
9185
|
+
assert2.isNotExtensible = function(obj, msg) {
|
|
9186
|
+
new Assertion(obj, msg, assert2.isNotExtensible, true).to.not.be.extensible;
|
|
9206
9187
|
};
|
|
9207
|
-
|
|
9208
|
-
new Assertion(obj, msg,
|
|
9188
|
+
assert2.isSealed = function(obj, msg) {
|
|
9189
|
+
new Assertion(obj, msg, assert2.isSealed, true).to.be.sealed;
|
|
9209
9190
|
};
|
|
9210
|
-
|
|
9211
|
-
new Assertion(obj, msg,
|
|
9191
|
+
assert2.isNotSealed = function(obj, msg) {
|
|
9192
|
+
new Assertion(obj, msg, assert2.isNotSealed, true).to.not.be.sealed;
|
|
9212
9193
|
};
|
|
9213
|
-
|
|
9214
|
-
new Assertion(obj, msg,
|
|
9194
|
+
assert2.isFrozen = function(obj, msg) {
|
|
9195
|
+
new Assertion(obj, msg, assert2.isFrozen, true).to.be.frozen;
|
|
9215
9196
|
};
|
|
9216
|
-
|
|
9217
|
-
new Assertion(obj, msg,
|
|
9197
|
+
assert2.isNotFrozen = function(obj, msg) {
|
|
9198
|
+
new Assertion(obj, msg, assert2.isNotFrozen, true).to.not.be.frozen;
|
|
9218
9199
|
};
|
|
9219
|
-
|
|
9220
|
-
new Assertion(val, msg,
|
|
9200
|
+
assert2.isEmpty = function(val, msg) {
|
|
9201
|
+
new Assertion(val, msg, assert2.isEmpty, true).to.be.empty;
|
|
9221
9202
|
};
|
|
9222
|
-
|
|
9223
|
-
new Assertion(val, msg,
|
|
9203
|
+
assert2.isNotEmpty = function(val, msg) {
|
|
9204
|
+
new Assertion(val, msg, assert2.isNotEmpty, true).to.not.be.empty;
|
|
9224
9205
|
};
|
|
9225
|
-
|
|
9206
|
+
assert2.containsSubset = function(val, exp, msg) {
|
|
9226
9207
|
new Assertion(val, msg).to.containSubset(exp);
|
|
9227
9208
|
};
|
|
9228
|
-
|
|
9209
|
+
assert2.doesNotContainSubset = function(val, exp, msg) {
|
|
9229
9210
|
new Assertion(val, msg).to.not.containSubset(exp);
|
|
9230
9211
|
};
|
|
9231
9212
|
var aliases = [
|
|
@@ -9246,7 +9227,7 @@ var aliases = [
|
|
|
9246
9227
|
["containsSubset", "containSubset"]
|
|
9247
9228
|
];
|
|
9248
9229
|
for (const [name, as] of aliases) {
|
|
9249
|
-
|
|
9230
|
+
assert2[as] = assert2[name];
|
|
9250
9231
|
}
|
|
9251
9232
|
var used = [];
|
|
9252
9233
|
function use(fn2) {
|
|
@@ -9256,7 +9237,7 @@ function use(fn2) {
|
|
|
9256
9237
|
util: utils_exports,
|
|
9257
9238
|
config,
|
|
9258
9239
|
expect,
|
|
9259
|
-
assert,
|
|
9240
|
+
assert: assert2,
|
|
9260
9241
|
Assertion,
|
|
9261
9242
|
...should_exports
|
|
9262
9243
|
};
|
|
@@ -9400,71 +9381,71 @@ function addCustomEqualityTesters(newTesters) {
|
|
|
9400
9381
|
function getCustomEqualityTesters() {
|
|
9401
9382
|
return globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters;
|
|
9402
9383
|
}
|
|
9403
|
-
function equals(a3,
|
|
9384
|
+
function equals(a3, b, customTesters, strictCheck) {
|
|
9404
9385
|
customTesters = customTesters || [];
|
|
9405
|
-
return eq(a3,
|
|
9386
|
+
return eq(a3, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
|
9406
9387
|
}
|
|
9407
9388
|
var functionToString = Function.prototype.toString;
|
|
9408
9389
|
function isAsymmetric(obj) {
|
|
9409
9390
|
return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
|
|
9410
9391
|
}
|
|
9411
|
-
function asymmetricMatch(a3,
|
|
9392
|
+
function asymmetricMatch(a3, b) {
|
|
9412
9393
|
const asymmetricA = isAsymmetric(a3);
|
|
9413
|
-
const asymmetricB = isAsymmetric(
|
|
9394
|
+
const asymmetricB = isAsymmetric(b);
|
|
9414
9395
|
if (asymmetricA && asymmetricB) {
|
|
9415
9396
|
return void 0;
|
|
9416
9397
|
}
|
|
9417
9398
|
if (asymmetricA) {
|
|
9418
|
-
return a3.asymmetricMatch(
|
|
9399
|
+
return a3.asymmetricMatch(b);
|
|
9419
9400
|
}
|
|
9420
9401
|
if (asymmetricB) {
|
|
9421
|
-
return
|
|
9402
|
+
return b.asymmetricMatch(a3);
|
|
9422
9403
|
}
|
|
9423
9404
|
}
|
|
9424
|
-
function eq(a3,
|
|
9405
|
+
function eq(a3, b, aStack, bStack, customTesters, hasKey2) {
|
|
9425
9406
|
let result = true;
|
|
9426
|
-
const asymmetricResult = asymmetricMatch(a3,
|
|
9407
|
+
const asymmetricResult = asymmetricMatch(a3, b);
|
|
9427
9408
|
if (asymmetricResult !== void 0) {
|
|
9428
9409
|
return asymmetricResult;
|
|
9429
9410
|
}
|
|
9430
9411
|
const testerContext = { equals };
|
|
9431
9412
|
for (let i = 0; i < customTesters.length; i++) {
|
|
9432
|
-
const customTesterResult = customTesters[i].call(testerContext, a3,
|
|
9413
|
+
const customTesterResult = customTesters[i].call(testerContext, a3, b, customTesters);
|
|
9433
9414
|
if (customTesterResult !== void 0) {
|
|
9434
9415
|
return customTesterResult;
|
|
9435
9416
|
}
|
|
9436
9417
|
}
|
|
9437
|
-
if (typeof URL === "function" && a3 instanceof URL &&
|
|
9438
|
-
return a3.href ===
|
|
9418
|
+
if (typeof URL === "function" && a3 instanceof URL && b instanceof URL) {
|
|
9419
|
+
return a3.href === b.href;
|
|
9439
9420
|
}
|
|
9440
|
-
if (Object.is(a3,
|
|
9421
|
+
if (Object.is(a3, b)) {
|
|
9441
9422
|
return true;
|
|
9442
9423
|
}
|
|
9443
|
-
if (a3 === null ||
|
|
9444
|
-
return a3 ===
|
|
9424
|
+
if (a3 === null || b === null) {
|
|
9425
|
+
return a3 === b;
|
|
9445
9426
|
}
|
|
9446
9427
|
const className = Object.prototype.toString.call(a3);
|
|
9447
|
-
if (className !== Object.prototype.toString.call(
|
|
9428
|
+
if (className !== Object.prototype.toString.call(b)) {
|
|
9448
9429
|
return false;
|
|
9449
9430
|
}
|
|
9450
9431
|
switch (className) {
|
|
9451
9432
|
case "[object Boolean]":
|
|
9452
9433
|
case "[object String]":
|
|
9453
9434
|
case "[object Number]":
|
|
9454
|
-
if (typeof a3 !== typeof
|
|
9435
|
+
if (typeof a3 !== typeof b) {
|
|
9455
9436
|
return false;
|
|
9456
|
-
} else if (typeof a3 !== "object" && typeof
|
|
9457
|
-
return Object.is(a3,
|
|
9437
|
+
} else if (typeof a3 !== "object" && typeof b !== "object") {
|
|
9438
|
+
return Object.is(a3, b);
|
|
9458
9439
|
} else {
|
|
9459
|
-
return Object.is(a3.valueOf(),
|
|
9440
|
+
return Object.is(a3.valueOf(), b.valueOf());
|
|
9460
9441
|
}
|
|
9461
9442
|
case "[object Date]": {
|
|
9462
9443
|
const numA = +a3;
|
|
9463
|
-
const numB = +
|
|
9444
|
+
const numB = +b;
|
|
9464
9445
|
return numA === numB || Number.isNaN(numA) && Number.isNaN(numB);
|
|
9465
9446
|
}
|
|
9466
9447
|
case "[object RegExp]":
|
|
9467
|
-
return a3.source ===
|
|
9448
|
+
return a3.source === b.source && a3.flags === b.flags;
|
|
9468
9449
|
case "[object Temporal.Instant]":
|
|
9469
9450
|
case "[object Temporal.ZonedDateTime]":
|
|
9470
9451
|
case "[object Temporal.PlainDateTime]":
|
|
@@ -9472,32 +9453,32 @@ function eq(a3, b2, aStack, bStack, customTesters, hasKey2) {
|
|
|
9472
9453
|
case "[object Temporal.PlainTime]":
|
|
9473
9454
|
case "[object Temporal.PlainYearMonth]":
|
|
9474
9455
|
case "[object Temporal.PlainMonthDay]":
|
|
9475
|
-
return a3.equals(
|
|
9456
|
+
return a3.equals(b);
|
|
9476
9457
|
case "[object Temporal.Duration]":
|
|
9477
|
-
return a3.toString() ===
|
|
9458
|
+
return a3.toString() === b.toString();
|
|
9478
9459
|
}
|
|
9479
|
-
if (typeof a3 !== "object" || typeof
|
|
9460
|
+
if (typeof a3 !== "object" || typeof b !== "object") {
|
|
9480
9461
|
return false;
|
|
9481
9462
|
}
|
|
9482
|
-
if (isDomNode(a3) && isDomNode(
|
|
9483
|
-
return a3.isEqualNode(
|
|
9463
|
+
if (isDomNode(a3) && isDomNode(b)) {
|
|
9464
|
+
return a3.isEqualNode(b);
|
|
9484
9465
|
}
|
|
9485
9466
|
let length = aStack.length;
|
|
9486
9467
|
while (length--) {
|
|
9487
9468
|
if (aStack[length] === a3) {
|
|
9488
|
-
return bStack[length] ===
|
|
9489
|
-
} else if (bStack[length] ===
|
|
9469
|
+
return bStack[length] === b;
|
|
9470
|
+
} else if (bStack[length] === b) {
|
|
9490
9471
|
return false;
|
|
9491
9472
|
}
|
|
9492
9473
|
}
|
|
9493
9474
|
aStack.push(a3);
|
|
9494
|
-
bStack.push(
|
|
9495
|
-
if (className === "[object Array]" && a3.length !==
|
|
9475
|
+
bStack.push(b);
|
|
9476
|
+
if (className === "[object Array]" && a3.length !== b.length) {
|
|
9496
9477
|
return false;
|
|
9497
9478
|
}
|
|
9498
|
-
if (a3 instanceof Error &&
|
|
9479
|
+
if (a3 instanceof Error && b instanceof Error) {
|
|
9499
9480
|
try {
|
|
9500
|
-
return isErrorEqual(a3,
|
|
9481
|
+
return isErrorEqual(a3, b, aStack, bStack, customTesters, hasKey2);
|
|
9501
9482
|
} finally {
|
|
9502
9483
|
aStack.pop();
|
|
9503
9484
|
bStack.pop();
|
|
@@ -9506,12 +9487,12 @@ function eq(a3, b2, aStack, bStack, customTesters, hasKey2) {
|
|
|
9506
9487
|
const aKeys = keys(a3, hasKey2);
|
|
9507
9488
|
let key;
|
|
9508
9489
|
let size = aKeys.length;
|
|
9509
|
-
if (keys(
|
|
9490
|
+
if (keys(b, hasKey2).length !== size) {
|
|
9510
9491
|
return false;
|
|
9511
9492
|
}
|
|
9512
9493
|
while (size--) {
|
|
9513
9494
|
key = aKeys[size];
|
|
9514
|
-
result = hasKey2(
|
|
9495
|
+
result = hasKey2(b, key) && eq(a3[key], b[key], aStack, bStack, customTesters, hasKey2);
|
|
9515
9496
|
if (!result) {
|
|
9516
9497
|
return false;
|
|
9517
9498
|
}
|
|
@@ -9520,15 +9501,15 @@ function eq(a3, b2, aStack, bStack, customTesters, hasKey2) {
|
|
|
9520
9501
|
bStack.pop();
|
|
9521
9502
|
return result;
|
|
9522
9503
|
}
|
|
9523
|
-
function isErrorEqual(a3,
|
|
9524
|
-
let result = Object.getPrototypeOf(a3) === Object.getPrototypeOf(
|
|
9525
|
-
if (typeof
|
|
9526
|
-
result && (result = eq(a3.cause,
|
|
9504
|
+
function isErrorEqual(a3, b, aStack, bStack, customTesters, hasKey2) {
|
|
9505
|
+
let result = Object.getPrototypeOf(a3) === Object.getPrototypeOf(b) && a3.name === b.name && a3.message === b.message;
|
|
9506
|
+
if (typeof b.cause !== "undefined") {
|
|
9507
|
+
result && (result = eq(a3.cause, b.cause, aStack, bStack, customTesters, hasKey2));
|
|
9527
9508
|
}
|
|
9528
|
-
if (a3 instanceof AggregateError &&
|
|
9529
|
-
result && (result = eq(a3.errors,
|
|
9509
|
+
if (a3 instanceof AggregateError && b instanceof AggregateError) {
|
|
9510
|
+
result && (result = eq(a3.errors, b.errors, aStack, bStack, customTesters, hasKey2));
|
|
9530
9511
|
}
|
|
9531
|
-
result && (result = eq({ ...a3 }, { ...
|
|
9512
|
+
result && (result = eq({ ...a3 }, { ...b }, aStack, bStack, customTesters, hasKey2));
|
|
9532
9513
|
return result;
|
|
9533
9514
|
}
|
|
9534
9515
|
function keys(obj, hasKey2) {
|
|
@@ -9582,34 +9563,34 @@ var IteratorSymbol = Symbol.iterator;
|
|
|
9582
9563
|
function hasIterator(object2) {
|
|
9583
9564
|
return !!(object2 != null && object2[IteratorSymbol]);
|
|
9584
9565
|
}
|
|
9585
|
-
function iterableEquality(a3,
|
|
9586
|
-
if (typeof a3 !== "object" || typeof
|
|
9566
|
+
function iterableEquality(a3, b, customTesters = [], aStack = [], bStack = []) {
|
|
9567
|
+
if (typeof a3 !== "object" || typeof b !== "object" || Array.isArray(a3) || Array.isArray(b) || !hasIterator(a3) || !hasIterator(b)) {
|
|
9587
9568
|
return void 0;
|
|
9588
9569
|
}
|
|
9589
|
-
if (a3.constructor !==
|
|
9570
|
+
if (a3.constructor !== b.constructor) {
|
|
9590
9571
|
return false;
|
|
9591
9572
|
}
|
|
9592
9573
|
let length = aStack.length;
|
|
9593
9574
|
while (length--) {
|
|
9594
9575
|
if (aStack[length] === a3) {
|
|
9595
|
-
return bStack[length] ===
|
|
9576
|
+
return bStack[length] === b;
|
|
9596
9577
|
}
|
|
9597
9578
|
}
|
|
9598
9579
|
aStack.push(a3);
|
|
9599
|
-
bStack.push(
|
|
9580
|
+
bStack.push(b);
|
|
9600
9581
|
const filteredCustomTesters = [...customTesters.filter((t) => t !== iterableEquality), iterableEqualityWithStack];
|
|
9601
|
-
function iterableEqualityWithStack(a4,
|
|
9602
|
-
return iterableEquality(a4,
|
|
9582
|
+
function iterableEqualityWithStack(a4, b2) {
|
|
9583
|
+
return iterableEquality(a4, b2, [...customTesters], [...aStack], [...bStack]);
|
|
9603
9584
|
}
|
|
9604
9585
|
if (a3.size !== void 0) {
|
|
9605
|
-
if (a3.size !==
|
|
9586
|
+
if (a3.size !== b.size) {
|
|
9606
9587
|
return false;
|
|
9607
9588
|
} else if (isA("Set", a3) || isImmutableUnorderedSet(a3)) {
|
|
9608
9589
|
let allFound = true;
|
|
9609
9590
|
for (const aValue of a3) {
|
|
9610
|
-
if (!
|
|
9591
|
+
if (!b.has(aValue)) {
|
|
9611
9592
|
let has = false;
|
|
9612
|
-
for (const bValue of
|
|
9593
|
+
for (const bValue of b) {
|
|
9613
9594
|
const isEqual = equals(aValue, bValue, filteredCustomTesters);
|
|
9614
9595
|
if (isEqual === true) {
|
|
9615
9596
|
has = true;
|
|
@@ -9627,9 +9608,9 @@ function iterableEquality(a3, b2, customTesters = [], aStack = [], bStack = [])
|
|
|
9627
9608
|
} else if (isA("Map", a3) || isImmutableUnorderedKeyed(a3)) {
|
|
9628
9609
|
let allFound = true;
|
|
9629
9610
|
for (const aEntry of a3) {
|
|
9630
|
-
if (!
|
|
9611
|
+
if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters)) {
|
|
9631
9612
|
let has = false;
|
|
9632
|
-
for (const bEntry of
|
|
9613
|
+
for (const bEntry of b) {
|
|
9633
9614
|
const matchedKey = equals(aEntry[0], bEntry[0], filteredCustomTesters);
|
|
9634
9615
|
let matchedValue = false;
|
|
9635
9616
|
if (matchedKey === true) {
|
|
@@ -9650,7 +9631,7 @@ function iterableEquality(a3, b2, customTesters = [], aStack = [], bStack = [])
|
|
|
9650
9631
|
return allFound;
|
|
9651
9632
|
}
|
|
9652
9633
|
}
|
|
9653
|
-
const bIterator =
|
|
9634
|
+
const bIterator = b[IteratorSymbol]();
|
|
9654
9635
|
for (const aValue of a3) {
|
|
9655
9636
|
const nextB = bIterator.next();
|
|
9656
9637
|
if (nextB.done || !equals(aValue, nextB.value, filteredCustomTesters)) {
|
|
@@ -9662,7 +9643,7 @@ function iterableEquality(a3, b2, customTesters = [], aStack = [], bStack = [])
|
|
|
9662
9643
|
}
|
|
9663
9644
|
if (!isImmutableList(a3) && !isImmutableOrderedKeyed(a3) && !isImmutableOrderedSet(a3) && !isImmutableRecord(a3)) {
|
|
9664
9645
|
const aEntries = Object.entries(a3);
|
|
9665
|
-
const bEntries = Object.entries(
|
|
9646
|
+
const bEntries = Object.entries(b);
|
|
9666
9647
|
if (!equals(aEntries, bEntries, filteredCustomTesters)) {
|
|
9667
9648
|
return false;
|
|
9668
9649
|
}
|
|
@@ -9701,22 +9682,22 @@ function subsetEquality(object2, subset, customTesters = []) {
|
|
|
9701
9682
|
};
|
|
9702
9683
|
return subsetEqualityWithContext()(object2, subset);
|
|
9703
9684
|
}
|
|
9704
|
-
function typeEquality(a3,
|
|
9705
|
-
if (a3 == null ||
|
|
9685
|
+
function typeEquality(a3, b) {
|
|
9686
|
+
if (a3 == null || b == null || a3.constructor === b.constructor) {
|
|
9706
9687
|
return void 0;
|
|
9707
9688
|
}
|
|
9708
9689
|
return false;
|
|
9709
9690
|
}
|
|
9710
|
-
function arrayBufferEquality(a3,
|
|
9691
|
+
function arrayBufferEquality(a3, b) {
|
|
9711
9692
|
let dataViewA = a3;
|
|
9712
|
-
let dataViewB =
|
|
9713
|
-
if (!(a3 instanceof DataView &&
|
|
9714
|
-
if (!(a3 instanceof ArrayBuffer) || !(
|
|
9693
|
+
let dataViewB = b;
|
|
9694
|
+
if (!(a3 instanceof DataView && b instanceof DataView)) {
|
|
9695
|
+
if (!(a3 instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) {
|
|
9715
9696
|
return void 0;
|
|
9716
9697
|
}
|
|
9717
9698
|
try {
|
|
9718
9699
|
dataViewA = new DataView(a3);
|
|
9719
|
-
dataViewB = new DataView(
|
|
9700
|
+
dataViewB = new DataView(b);
|
|
9720
9701
|
} catch {
|
|
9721
9702
|
return void 0;
|
|
9722
9703
|
}
|
|
@@ -9731,14 +9712,14 @@ function arrayBufferEquality(a3, b2) {
|
|
|
9731
9712
|
}
|
|
9732
9713
|
return true;
|
|
9733
9714
|
}
|
|
9734
|
-
function sparseArrayEquality(a3,
|
|
9735
|
-
if (!Array.isArray(a3) || !Array.isArray(
|
|
9715
|
+
function sparseArrayEquality(a3, b, customTesters = []) {
|
|
9716
|
+
if (!Array.isArray(a3) || !Array.isArray(b)) {
|
|
9736
9717
|
return void 0;
|
|
9737
9718
|
}
|
|
9738
9719
|
const aKeys = Object.keys(a3);
|
|
9739
|
-
const bKeys = Object.keys(
|
|
9720
|
+
const bKeys = Object.keys(b);
|
|
9740
9721
|
const filteredCustomTesters = customTesters.filter((t) => t !== sparseArrayEquality);
|
|
9741
|
-
return equals(a3,
|
|
9722
|
+
return equals(a3, b, filteredCustomTesters, true) && equals(aKeys, bKeys);
|
|
9742
9723
|
}
|
|
9743
9724
|
function generateToBeMessage(deepEqualityName, expected = "#{this}", actual = "#{exp}") {
|
|
9744
9725
|
const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`;
|
|
@@ -10430,7 +10411,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
10430
10411
|
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);
|
|
10431
10412
|
});
|
|
10432
10413
|
function assertIsMock(assertion) {
|
|
10433
|
-
if (!
|
|
10414
|
+
if (!isMockFunction2(assertion._obj)) {
|
|
10434
10415
|
throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
|
|
10435
10416
|
}
|
|
10436
10417
|
}
|
|
@@ -10470,8 +10451,8 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
10470
10451
|
throw new AssertionError2(msg);
|
|
10471
10452
|
}
|
|
10472
10453
|
});
|
|
10473
|
-
function equalsArgumentArray(a3,
|
|
10474
|
-
return a3.length ===
|
|
10454
|
+
function equalsArgumentArray(a3, b) {
|
|
10455
|
+
return a3.length === b.length && a3.every((aItem, i) => equals(aItem, b[i], [...customTesters, iterableEquality]));
|
|
10475
10456
|
}
|
|
10476
10457
|
def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
|
|
10477
10458
|
const spy = getSpy(this);
|
|
@@ -10532,14 +10513,14 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
10532
10513
|
}
|
|
10533
10514
|
def(["toHaveBeenCalledBefore"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
10534
10515
|
const expectSpy = getSpy(this);
|
|
10535
|
-
if (!
|
|
10516
|
+
if (!isMockFunction2(resultSpy)) {
|
|
10536
10517
|
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
10537
10518
|
}
|
|
10538
10519
|
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);
|
|
10539
10520
|
});
|
|
10540
10521
|
def(["toHaveBeenCalledAfter"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
10541
10522
|
const expectSpy = getSpy(this);
|
|
10542
|
-
if (!
|
|
10523
|
+
if (!isMockFunction2(resultSpy)) {
|
|
10543
10524
|
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
10544
10525
|
}
|
|
10545
10526
|
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);
|
|
@@ -10773,15 +10754,15 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
10773
10754
|
});
|
|
10774
10755
|
};
|
|
10775
10756
|
function ordinalOf(i) {
|
|
10776
|
-
const
|
|
10777
|
-
const
|
|
10778
|
-
if (
|
|
10757
|
+
const j = i % 10;
|
|
10758
|
+
const k = i % 100;
|
|
10759
|
+
if (j === 1 && k !== 11) {
|
|
10779
10760
|
return `${i}st`;
|
|
10780
10761
|
}
|
|
10781
|
-
if (
|
|
10762
|
+
if (j === 2 && k !== 12) {
|
|
10782
10763
|
return `${i}nd`;
|
|
10783
10764
|
}
|
|
10784
|
-
if (
|
|
10765
|
+
if (j === 3 && k !== 13) {
|
|
10785
10766
|
return `${i}rd`;
|
|
10786
10767
|
}
|
|
10787
10768
|
return `${i}th`;
|
|
@@ -11150,68 +11131,80 @@ function parseSingleV8Stack(raw) {
|
|
|
11150
11131
|
};
|
|
11151
11132
|
}
|
|
11152
11133
|
var import_js_tokens = (0, import_chunk_2ESYSVXG.__toESM)(require_js_tokens(), 1);
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
|
|
11134
|
+
function stripLiteralJsTokens(code, options) {
|
|
11135
|
+
const FILL = options?.fillChar ?? " ";
|
|
11136
|
+
const FILL_COMMENT = " ";
|
|
11137
|
+
let result = "";
|
|
11138
|
+
const filter = options?.filter ?? (() => true);
|
|
11139
|
+
const tokens = [];
|
|
11140
|
+
for (const token of (0, import_js_tokens.default)(code, { jsx: false })) {
|
|
11141
|
+
tokens.push(token);
|
|
11142
|
+
if (token.type === "SingleLineComment") {
|
|
11143
|
+
result += FILL_COMMENT.repeat(token.value.length);
|
|
11144
|
+
continue;
|
|
11164
11145
|
}
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11146
|
+
if (token.type === "MultiLineComment") {
|
|
11147
|
+
result += token.value.replace(/[^\n]/g, FILL_COMMENT);
|
|
11148
|
+
continue;
|
|
11168
11149
|
}
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11150
|
+
if (token.type === "StringLiteral") {
|
|
11151
|
+
if (!token.closed) {
|
|
11152
|
+
result += token.value;
|
|
11153
|
+
continue;
|
|
11154
|
+
}
|
|
11155
|
+
const body = token.value.slice(1, -1);
|
|
11156
|
+
if (filter(body)) {
|
|
11157
|
+
result += token.value[0] + FILL.repeat(body.length) + token.value[token.value.length - 1];
|
|
11158
|
+
continue;
|
|
11159
|
+
}
|
|
11174
11160
|
}
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11161
|
+
if (token.type === "NoSubstitutionTemplate") {
|
|
11162
|
+
const body = token.value.slice(1, -1);
|
|
11163
|
+
if (filter(body)) {
|
|
11164
|
+
result += `\`${body.replace(/[^\n]/g, FILL)}\``;
|
|
11165
|
+
continue;
|
|
11166
|
+
}
|
|
11180
11167
|
}
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11168
|
+
if (token.type === "RegularExpressionLiteral") {
|
|
11169
|
+
const body = token.value;
|
|
11170
|
+
if (filter(body)) {
|
|
11171
|
+
result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
|
|
11172
|
+
continue;
|
|
11173
|
+
}
|
|
11186
11174
|
}
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11175
|
+
if (token.type === "TemplateHead") {
|
|
11176
|
+
const body = token.value.slice(1, -2);
|
|
11177
|
+
if (filter(body)) {
|
|
11178
|
+
result += `\`${body.replace(/[^\n]/g, FILL)}\${`;
|
|
11179
|
+
continue;
|
|
11180
|
+
}
|
|
11192
11181
|
}
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11182
|
+
if (token.type === "TemplateTail") {
|
|
11183
|
+
const body = token.value.slice(0, -2);
|
|
11184
|
+
if (filter(body)) {
|
|
11185
|
+
result += `}${body.replace(/[^\n]/g, FILL)}\``;
|
|
11186
|
+
continue;
|
|
11187
|
+
}
|
|
11198
11188
|
}
|
|
11189
|
+
if (token.type === "TemplateMiddle") {
|
|
11190
|
+
const body = token.value.slice(1, -2);
|
|
11191
|
+
if (filter(body)) {
|
|
11192
|
+
result += `}${body.replace(/[^\n]/g, FILL)}\${`;
|
|
11193
|
+
continue;
|
|
11194
|
+
}
|
|
11195
|
+
}
|
|
11196
|
+
result += token.value;
|
|
11199
11197
|
}
|
|
11200
|
-
return token.value;
|
|
11201
|
-
}
|
|
11202
|
-
function optionsWithDefaults(options) {
|
|
11203
11198
|
return {
|
|
11204
|
-
|
|
11205
|
-
|
|
11199
|
+
result,
|
|
11200
|
+
tokens
|
|
11206
11201
|
};
|
|
11207
11202
|
}
|
|
11208
11203
|
function stripLiteral(code, options) {
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
}
|
|
11214
|
-
return result;
|
|
11204
|
+
return stripLiteralDetailed(code, options).result;
|
|
11205
|
+
}
|
|
11206
|
+
function stripLiteralDetailed(code, options) {
|
|
11207
|
+
return stripLiteralJsTokens(code, options);
|
|
11215
11208
|
}
|
|
11216
11209
|
var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
11217
11210
|
function normalizeWindowsPath2(input = "") {
|
|
@@ -11634,7 +11627,7 @@ var test3 = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
|
11634
11627
|
var runner;
|
|
11635
11628
|
var defaultSuite;
|
|
11636
11629
|
var currentTestFilepath;
|
|
11637
|
-
function
|
|
11630
|
+
function assert3(condition, message) {
|
|
11638
11631
|
if (!condition) {
|
|
11639
11632
|
throw new Error(`Vitest failed to find ${message}. This is a bug in Vitest. Please, open an issue with reproduction.`);
|
|
11640
11633
|
}
|
|
@@ -11643,12 +11636,12 @@ function getTestFilepath() {
|
|
|
11643
11636
|
return currentTestFilepath;
|
|
11644
11637
|
}
|
|
11645
11638
|
function getRunner() {
|
|
11646
|
-
|
|
11639
|
+
assert3(runner, "the runner");
|
|
11647
11640
|
return runner;
|
|
11648
11641
|
}
|
|
11649
11642
|
function getCurrentSuite() {
|
|
11650
11643
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
11651
|
-
|
|
11644
|
+
assert3(currentSuite, "the current suite");
|
|
11652
11645
|
return currentSuite;
|
|
11653
11646
|
}
|
|
11654
11647
|
function createSuiteHooks() {
|
|
@@ -12047,8 +12040,8 @@ function formatTemplateString(cases, args) {
|
|
|
12047
12040
|
const res = [];
|
|
12048
12041
|
for (let i = 0; i < Math.floor(args.length / header.length); i++) {
|
|
12049
12042
|
const oneCase = {};
|
|
12050
|
-
for (let
|
|
12051
|
-
oneCase[header[
|
|
12043
|
+
for (let j = 0; j < header.length; j++) {
|
|
12044
|
+
oneCase[header[j]] = args[i * header.length + j];
|
|
12052
12045
|
}
|
|
12053
12046
|
res.push(oneCase);
|
|
12054
12047
|
}
|
|
@@ -12319,25 +12312,25 @@ function encodeUint8Array(bytes) {
|
|
|
12319
12312
|
for (let i = 0; i < len; i += 3) {
|
|
12320
12313
|
if (len === i + 1) {
|
|
12321
12314
|
const a3 = (bytes[i] & 252) >> 2;
|
|
12322
|
-
const
|
|
12315
|
+
const b = (bytes[i] & 3) << 4;
|
|
12323
12316
|
base64 += table[a3];
|
|
12324
|
-
base64 += table[
|
|
12317
|
+
base64 += table[b];
|
|
12325
12318
|
base64 += "==";
|
|
12326
12319
|
} else if (len === i + 2) {
|
|
12327
12320
|
const a3 = (bytes[i] & 252) >> 2;
|
|
12328
|
-
const
|
|
12321
|
+
const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
|
|
12329
12322
|
const c = (bytes[i + 1] & 15) << 2;
|
|
12330
12323
|
base64 += table[a3];
|
|
12331
|
-
base64 += table[
|
|
12324
|
+
base64 += table[b];
|
|
12332
12325
|
base64 += table[c];
|
|
12333
12326
|
base64 += "=";
|
|
12334
12327
|
} else {
|
|
12335
12328
|
const a3 = (bytes[i] & 252) >> 2;
|
|
12336
|
-
const
|
|
12329
|
+
const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
|
|
12337
12330
|
const c = (bytes[i + 1] & 15) << 2 | (bytes[i + 2] & 192) >> 6;
|
|
12338
12331
|
const d = bytes[i + 2] & 63;
|
|
12339
12332
|
base64 += table[a3];
|
|
12340
|
-
base64 += table[
|
|
12333
|
+
base64 += table[b];
|
|
12341
12334
|
base64 += table[c];
|
|
12342
12335
|
base64 += table[d];
|
|
12343
12336
|
}
|
|
@@ -12444,8 +12437,8 @@ async function waitForImportsToResolve() {
|
|
|
12444
12437
|
await waitForImportsToResolve();
|
|
12445
12438
|
}
|
|
12446
12439
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
12447
|
-
function getDefaultExportFromCjs3(
|
|
12448
|
-
return
|
|
12440
|
+
function getDefaultExportFromCjs3(x) {
|
|
12441
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
12449
12442
|
}
|
|
12450
12443
|
var comma2 = ",".charCodeAt(0);
|
|
12451
12444
|
var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -12542,8 +12535,8 @@ function decode(mappings) {
|
|
|
12542
12535
|
function sort(line) {
|
|
12543
12536
|
line.sort(sortComparator$1);
|
|
12544
12537
|
}
|
|
12545
|
-
function sortComparator$1(a3,
|
|
12546
|
-
return a3[0] -
|
|
12538
|
+
function sortComparator$1(a3, b) {
|
|
12539
|
+
return a3[0] - b[0];
|
|
12547
12540
|
}
|
|
12548
12541
|
var schemeRegex = /^[\w+.-]+:\/\//;
|
|
12549
12542
|
var urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
@@ -12757,8 +12750,8 @@ function nextUnsortedSegmentLine(mappings, start) {
|
|
|
12757
12750
|
return mappings.length;
|
|
12758
12751
|
}
|
|
12759
12752
|
function isSorted(line) {
|
|
12760
|
-
for (let
|
|
12761
|
-
if (line[
|
|
12753
|
+
for (let j = 1; j < line.length; j++) {
|
|
12754
|
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
|
12762
12755
|
return false;
|
|
12763
12756
|
}
|
|
12764
12757
|
}
|
|
@@ -12769,8 +12762,8 @@ function sortSegments(line, owned) {
|
|
|
12769
12762
|
line = line.slice();
|
|
12770
12763
|
return line.sort(sortComparator);
|
|
12771
12764
|
}
|
|
12772
|
-
function sortComparator(a3,
|
|
12773
|
-
return a3[COLUMN] -
|
|
12765
|
+
function sortComparator(a3, b) {
|
|
12766
|
+
return a3[COLUMN] - b[COLUMN];
|
|
12774
12767
|
}
|
|
12775
12768
|
var found = false;
|
|
12776
12769
|
function binarySearch(haystack, needle, low, high) {
|
|
@@ -12903,8 +12896,8 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
12903
12896
|
return -1;
|
|
12904
12897
|
return index2;
|
|
12905
12898
|
}
|
|
12906
|
-
function notNullish2(
|
|
12907
|
-
return
|
|
12899
|
+
function notNullish2(v) {
|
|
12900
|
+
return v != null;
|
|
12908
12901
|
}
|
|
12909
12902
|
function isPrimitive3(value) {
|
|
12910
12903
|
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
@@ -13119,7 +13112,7 @@ function parseErrorStacktrace(e, options = {}) {
|
|
|
13119
13112
|
}
|
|
13120
13113
|
}
|
|
13121
13114
|
if (options.frameFilter) {
|
|
13122
|
-
stackFrames = stackFrames.filter((
|
|
13115
|
+
stackFrames = stackFrames.filter((f3) => options.frameFilter(e, f3) !== false);
|
|
13123
13116
|
}
|
|
13124
13117
|
e.stacks = stackFrames;
|
|
13125
13118
|
return stackFrames;
|
|
@@ -13139,8 +13132,8 @@ try {
|
|
|
13139
13132
|
} catch (notNode) {
|
|
13140
13133
|
}
|
|
13141
13134
|
var { AsymmetricMatcher: AsymmetricMatcher$1, DOMCollection: DOMCollection$1, DOMElement: DOMElement$1, Immutable: Immutable$1, ReactElement: ReactElement$1, ReactTestComponent: ReactTestComponent$1 } = plugins;
|
|
13142
|
-
function getDefaultExportFromCjs4(
|
|
13143
|
-
return
|
|
13135
|
+
function getDefaultExportFromCjs4(x) {
|
|
13136
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
13144
13137
|
}
|
|
13145
13138
|
var jsTokens_12;
|
|
13146
13139
|
var hasRequiredJsTokens2;
|
|
@@ -13588,7 +13581,7 @@ var reservedWords2 = {
|
|
|
13588
13581
|
};
|
|
13589
13582
|
new Set(reservedWords2.keyword);
|
|
13590
13583
|
new Set(reservedWords2.strict);
|
|
13591
|
-
var
|
|
13584
|
+
var f2 = {
|
|
13592
13585
|
reset: [0, 0],
|
|
13593
13586
|
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
13594
13587
|
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
@@ -13631,7 +13624,7 @@ var f3 = {
|
|
|
13631
13624
|
bgCyanBright: [106, 49],
|
|
13632
13625
|
bgWhiteBright: [107, 49]
|
|
13633
13626
|
};
|
|
13634
|
-
var
|
|
13627
|
+
var h2 = Object.entries(f2);
|
|
13635
13628
|
function a2(n) {
|
|
13636
13629
|
return String(n);
|
|
13637
13630
|
}
|
|
@@ -13643,27 +13636,27 @@ function C2(n = false) {
|
|
|
13643
13636
|
}
|
|
13644
13637
|
function p2(n = false) {
|
|
13645
13638
|
let e = C2(n), i = (r2, t, c, o) => {
|
|
13646
|
-
let
|
|
13639
|
+
let l = "", s2 = 0;
|
|
13647
13640
|
do
|
|
13648
|
-
|
|
13641
|
+
l += r2.substring(s2, o) + c, s2 = o + t.length, o = r2.indexOf(t, s2);
|
|
13649
13642
|
while (~o);
|
|
13650
|
-
return
|
|
13643
|
+
return l + r2.substring(s2);
|
|
13651
13644
|
}, g = (r2, t, c = r2) => {
|
|
13652
|
-
let o = (
|
|
13653
|
-
let s2 = String(
|
|
13654
|
-
return ~
|
|
13645
|
+
let o = (l) => {
|
|
13646
|
+
let s2 = String(l), b = s2.indexOf(t, r2.length);
|
|
13647
|
+
return ~b ? r2 + i(s2, t, c, b) + t : r2 + s2 + t;
|
|
13655
13648
|
};
|
|
13656
13649
|
return o.open = r2, o.close = t, o;
|
|
13657
|
-
},
|
|
13650
|
+
}, u2 = {
|
|
13658
13651
|
isColorSupported: e
|
|
13659
13652
|
}, d = (r2) => `\x1B[${r2}m`;
|
|
13660
|
-
for (let [r2, t] of
|
|
13661
|
-
|
|
13653
|
+
for (let [r2, t] of h2)
|
|
13654
|
+
u2[r2] = e ? g(
|
|
13662
13655
|
d(t[0]),
|
|
13663
13656
|
d(t[1]),
|
|
13664
13657
|
t[2]
|
|
13665
13658
|
) : a2;
|
|
13666
|
-
return
|
|
13659
|
+
return u2;
|
|
13667
13660
|
}
|
|
13668
13661
|
p2();
|
|
13669
13662
|
var lineSplitRE = /\r?\n/;
|
|
@@ -13697,7 +13690,7 @@ function offsetToLineNumber(source, offset) {
|
|
|
13697
13690
|
return line + 1;
|
|
13698
13691
|
}
|
|
13699
13692
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
13700
|
-
const MagicString = (await import("../magic-string.es-
|
|
13693
|
+
const MagicString = (await import("../magic-string.es-3WRPFX2A.js")).default;
|
|
13701
13694
|
const files = new Set(snapshots.map((i) => i.file));
|
|
13702
13695
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
13703
13696
|
const snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -13848,7 +13841,7 @@ var hasRequiredNaturalCompare;
|
|
|
13848
13841
|
function requireNaturalCompare() {
|
|
13849
13842
|
if (hasRequiredNaturalCompare) return naturalCompare$1.exports;
|
|
13850
13843
|
hasRequiredNaturalCompare = 1;
|
|
13851
|
-
var naturalCompare2 = function(a3,
|
|
13844
|
+
var naturalCompare2 = function(a3, b) {
|
|
13852
13845
|
var i, codeA, codeB = 1, posA = 0, posB = 0, alphabet = String.alphabet;
|
|
13853
13846
|
function getCode(str, pos, code) {
|
|
13854
13847
|
if (code) {
|
|
@@ -13858,12 +13851,12 @@ function requireNaturalCompare() {
|
|
|
13858
13851
|
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
13859
13852
|
return code > -1 ? code + 76 : (code = str.charCodeAt(pos) || 0, code < 45 || code > 127) ? code : code < 46 ? 65 : code < 48 ? code - 1 : code < 58 ? code + 18 : code < 65 ? code - 11 : code < 91 ? code + 11 : code < 97 ? code - 37 : code < 123 ? code + 5 : code - 63;
|
|
13860
13853
|
}
|
|
13861
|
-
if ((a3 += "") != (
|
|
13854
|
+
if ((a3 += "") != (b += "")) for (; codeB; ) {
|
|
13862
13855
|
codeA = getCode(a3, posA++);
|
|
13863
|
-
codeB = getCode(
|
|
13856
|
+
codeB = getCode(b, posB++);
|
|
13864
13857
|
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
13865
13858
|
codeA = getCode(a3, posA, posA);
|
|
13866
|
-
codeB = getCode(
|
|
13859
|
+
codeB = getCode(b, posB, posA = i);
|
|
13867
13860
|
posB = i;
|
|
13868
13861
|
}
|
|
13869
13862
|
if (codeA != codeB) return codeA < codeB ? -1 : 1;
|
|
@@ -14054,14 +14047,14 @@ var CounterMap = class extends DefaultMap {
|
|
|
14054
14047
|
return this._total;
|
|
14055
14048
|
}
|
|
14056
14049
|
let total = 0;
|
|
14057
|
-
for (const
|
|
14058
|
-
total +=
|
|
14050
|
+
for (const x of this.values()) {
|
|
14051
|
+
total += x;
|
|
14059
14052
|
}
|
|
14060
14053
|
return total;
|
|
14061
14054
|
}
|
|
14062
14055
|
};
|
|
14063
|
-
function isSameStackPosition(
|
|
14064
|
-
return
|
|
14056
|
+
function isSameStackPosition(x, y) {
|
|
14057
|
+
return x.file === y.file && x.column === y.column && x.line === y.line;
|
|
14065
14058
|
}
|
|
14066
14059
|
var SnapshotState = class _SnapshotState {
|
|
14067
14060
|
_counters = new CounterMap();
|
|
@@ -14476,7 +14469,7 @@ var SnapshotClient = class {
|
|
|
14476
14469
|
var RealDate = Date;
|
|
14477
14470
|
var now2 = null;
|
|
14478
14471
|
var MockDate = class _MockDate extends RealDate {
|
|
14479
|
-
constructor(
|
|
14472
|
+
constructor(y, m2, d, h3, M, s2, ms) {
|
|
14480
14473
|
super();
|
|
14481
14474
|
let date;
|
|
14482
14475
|
switch (arguments.length) {
|
|
@@ -14485,15 +14478,15 @@ var MockDate = class _MockDate extends RealDate {
|
|
|
14485
14478
|
else date = new RealDate();
|
|
14486
14479
|
break;
|
|
14487
14480
|
case 1:
|
|
14488
|
-
date = new RealDate(
|
|
14481
|
+
date = new RealDate(y);
|
|
14489
14482
|
break;
|
|
14490
14483
|
default:
|
|
14491
14484
|
d = typeof d === "undefined" ? 1 : d;
|
|
14492
|
-
|
|
14493
|
-
|
|
14485
|
+
h3 = h3 || 0;
|
|
14486
|
+
M = M || 0;
|
|
14494
14487
|
s2 = s2 || 0;
|
|
14495
14488
|
ms = ms || 0;
|
|
14496
|
-
date = new RealDate(
|
|
14489
|
+
date = new RealDate(y, m2, d, h3, M, s2, ms);
|
|
14497
14490
|
break;
|
|
14498
14491
|
}
|
|
14499
14492
|
Object.setPrototypeOf(date, _MockDate.prototype);
|
|
@@ -14889,11 +14882,11 @@ function createExpect(test5) {
|
|
|
14889
14882
|
const expect2 = (value, message) => {
|
|
14890
14883
|
const { assertionCalls } = getState(expect2);
|
|
14891
14884
|
setState({ assertionCalls: assertionCalls + 1 }, expect2);
|
|
14892
|
-
const
|
|
14885
|
+
const assert4 = expect(value, message);
|
|
14893
14886
|
const _test2 = test5 || getCurrentTest();
|
|
14894
14887
|
if (_test2)
|
|
14895
|
-
return
|
|
14896
|
-
else return
|
|
14888
|
+
return assert4.withTest(_test2);
|
|
14889
|
+
else return assert4;
|
|
14897
14890
|
};
|
|
14898
14891
|
Object.assign(expect2, expect);
|
|
14899
14892
|
Object.assign(expect2, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
@@ -14920,7 +14913,7 @@ function createExpect(test5) {
|
|
|
14920
14913
|
};
|
|
14921
14914
|
expect2.poll = createExpectPoll(expect2);
|
|
14922
14915
|
expect2.unreachable = (message) => {
|
|
14923
|
-
|
|
14916
|
+
assert2.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
|
|
14924
14917
|
};
|
|
14925
14918
|
function assertions(expected) {
|
|
14926
14919
|
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect2.getState().assertionCalls}`);
|
|
@@ -15037,10 +15030,10 @@ function requireCalledInOrder() {
|
|
|
15037
15030
|
}
|
|
15038
15031
|
return callMap[spy.id] < spy.callCount;
|
|
15039
15032
|
}
|
|
15040
|
-
function checkAdjacentCalls(callMap, spy, index2,
|
|
15033
|
+
function checkAdjacentCalls(callMap, spy, index2, spies2) {
|
|
15041
15034
|
var calledBeforeNext = true;
|
|
15042
|
-
if (index2 !==
|
|
15043
|
-
calledBeforeNext = spy.calledBefore(
|
|
15035
|
+
if (index2 !== spies2.length - 1) {
|
|
15036
|
+
calledBeforeNext = spy.calledBefore(spies2[index2 + 1]);
|
|
15044
15037
|
}
|
|
15045
15038
|
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
|
|
15046
15039
|
callMap[spy.id] += 1;
|
|
@@ -15048,9 +15041,9 @@ function requireCalledInOrder() {
|
|
|
15048
15041
|
}
|
|
15049
15042
|
return false;
|
|
15050
15043
|
}
|
|
15051
|
-
function calledInOrder(
|
|
15044
|
+
function calledInOrder(spies2) {
|
|
15052
15045
|
var callMap = {};
|
|
15053
|
-
var _spies = arguments.length > 1 ? arguments :
|
|
15046
|
+
var _spies = arguments.length > 1 ? arguments : spies2;
|
|
15054
15047
|
return every2(_spies, checkAdjacentCalls.bind(null, callMap));
|
|
15055
15048
|
}
|
|
15056
15049
|
calledInOrder_1 = calledInOrder;
|
|
@@ -15147,15 +15140,15 @@ function requireOrderByFirstCall() {
|
|
|
15147
15140
|
hasRequiredOrderByFirstCall = 1;
|
|
15148
15141
|
var sort2 = requireArray().sort;
|
|
15149
15142
|
var slice = requireArray().slice;
|
|
15150
|
-
function comparator(a3,
|
|
15143
|
+
function comparator(a3, b) {
|
|
15151
15144
|
var aCall = a3.getCall(0);
|
|
15152
|
-
var bCall =
|
|
15145
|
+
var bCall = b.getCall(0);
|
|
15153
15146
|
var aId = aCall && aCall.callId || -1;
|
|
15154
15147
|
var bId = bCall && bCall.callId || -1;
|
|
15155
15148
|
return aId < bId ? -1 : 1;
|
|
15156
15149
|
}
|
|
15157
|
-
function orderByFirstCall(
|
|
15158
|
-
return sort2(slice(
|
|
15150
|
+
function orderByFirstCall(spies2) {
|
|
15151
|
+
return sort2(slice(spies2), comparator);
|
|
15159
15152
|
}
|
|
15160
15153
|
orderByFirstCall_1 = orderByFirstCall;
|
|
15161
15154
|
return orderByFirstCall_1;
|
|
@@ -15482,11 +15475,11 @@ function requireFakeTimersSrc() {
|
|
|
15482
15475
|
return 0;
|
|
15483
15476
|
}
|
|
15484
15477
|
const strings = str.split(":");
|
|
15485
|
-
const
|
|
15486
|
-
let i =
|
|
15478
|
+
const l = strings.length;
|
|
15479
|
+
let i = l;
|
|
15487
15480
|
let ms = 0;
|
|
15488
15481
|
let parsed;
|
|
15489
|
-
if (
|
|
15482
|
+
if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
|
|
15490
15483
|
throw new Error(
|
|
15491
15484
|
"tick only understands numbers, 'm:s' and 'h:m:s'. Each part must be two digits"
|
|
15492
15485
|
);
|
|
@@ -15496,7 +15489,7 @@ function requireFakeTimersSrc() {
|
|
|
15496
15489
|
if (parsed >= 60) {
|
|
15497
15490
|
throw new Error(`Invalid time ${str}`);
|
|
15498
15491
|
}
|
|
15499
|
-
ms += parsed * Math.pow(60,
|
|
15492
|
+
ms += parsed * Math.pow(60, l - i - 1);
|
|
15500
15493
|
}
|
|
15501
15494
|
return ms * 1e3;
|
|
15502
15495
|
}
|
|
@@ -15735,29 +15728,29 @@ ${job.error.stack.split("\n").slice(matchedLineIndex + 1).join("\n")}`;
|
|
|
15735
15728
|
}
|
|
15736
15729
|
return timer.id;
|
|
15737
15730
|
}
|
|
15738
|
-
function compareTimers(a3,
|
|
15739
|
-
if (a3.callAt <
|
|
15731
|
+
function compareTimers(a3, b) {
|
|
15732
|
+
if (a3.callAt < b.callAt) {
|
|
15740
15733
|
return -1;
|
|
15741
15734
|
}
|
|
15742
|
-
if (a3.callAt >
|
|
15735
|
+
if (a3.callAt > b.callAt) {
|
|
15743
15736
|
return 1;
|
|
15744
15737
|
}
|
|
15745
|
-
if (a3.immediate && !
|
|
15738
|
+
if (a3.immediate && !b.immediate) {
|
|
15746
15739
|
return -1;
|
|
15747
15740
|
}
|
|
15748
|
-
if (!a3.immediate &&
|
|
15741
|
+
if (!a3.immediate && b.immediate) {
|
|
15749
15742
|
return 1;
|
|
15750
15743
|
}
|
|
15751
|
-
if (a3.createdAt <
|
|
15744
|
+
if (a3.createdAt < b.createdAt) {
|
|
15752
15745
|
return -1;
|
|
15753
15746
|
}
|
|
15754
|
-
if (a3.createdAt >
|
|
15747
|
+
if (a3.createdAt > b.createdAt) {
|
|
15755
15748
|
return 1;
|
|
15756
15749
|
}
|
|
15757
|
-
if (a3.id <
|
|
15750
|
+
if (a3.id < b.id) {
|
|
15758
15751
|
return -1;
|
|
15759
15752
|
}
|
|
15760
|
-
if (a3.id >
|
|
15753
|
+
if (a3.id > b.id) {
|
|
15761
15754
|
return 1;
|
|
15762
15755
|
}
|
|
15763
15756
|
}
|
|
@@ -15868,10 +15861,10 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
15868
15861
|
}
|
|
15869
15862
|
}
|
|
15870
15863
|
function uninstall(clock, config2) {
|
|
15871
|
-
let method, i,
|
|
15864
|
+
let method, i, l;
|
|
15872
15865
|
const installedHrTime = "_hrtime";
|
|
15873
15866
|
const installedNextTick = "_nextTick";
|
|
15874
|
-
for (i = 0,
|
|
15867
|
+
for (i = 0, l = clock.methods.length; i < l; i++) {
|
|
15875
15868
|
method = clock.methods[i];
|
|
15876
15869
|
if (method === "hrtime" && _global.process) {
|
|
15877
15870
|
_global.process.hrtime = clock[installedHrTime];
|
|
@@ -15902,14 +15895,14 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
15902
15895
|
}
|
|
15903
15896
|
}
|
|
15904
15897
|
if (clock.timersModuleMethods !== void 0) {
|
|
15905
|
-
for (let
|
|
15906
|
-
const entry = clock.timersModuleMethods[
|
|
15898
|
+
for (let j = 0; j < clock.timersModuleMethods.length; j++) {
|
|
15899
|
+
const entry = clock.timersModuleMethods[j];
|
|
15907
15900
|
timersModule[entry.methodName] = entry.original;
|
|
15908
15901
|
}
|
|
15909
15902
|
}
|
|
15910
15903
|
if (clock.timersPromisesModuleMethods !== void 0) {
|
|
15911
|
-
for (let
|
|
15912
|
-
const entry = clock.timersPromisesModuleMethods[
|
|
15904
|
+
for (let j = 0; j < clock.timersPromisesModuleMethods.length; j++) {
|
|
15905
|
+
const entry = clock.timersPromisesModuleMethods[j];
|
|
15913
15906
|
timersPromisesModule[entry.methodName] = entry.original;
|
|
15914
15907
|
}
|
|
15915
15908
|
}
|
|
@@ -16414,7 +16407,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
16414
16407
|
});
|
|
16415
16408
|
};
|
|
16416
16409
|
}
|
|
16417
|
-
clock.reset = function
|
|
16410
|
+
clock.reset = function reset2() {
|
|
16418
16411
|
nanos = 0;
|
|
16419
16412
|
clock.timers = {};
|
|
16420
16413
|
clock.jobs = [];
|
|
@@ -16485,7 +16478,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
16485
16478
|
`non-existent timers and/or objects cannot be faked: '${timer}'`
|
|
16486
16479
|
);
|
|
16487
16480
|
}
|
|
16488
|
-
let i,
|
|
16481
|
+
let i, l;
|
|
16489
16482
|
const clock = createClock(config2.now, config2.loopLimit);
|
|
16490
16483
|
clock.shouldClearNativeTimers = config2.shouldClearNativeTimers;
|
|
16491
16484
|
clock.uninstall = function() {
|
|
@@ -16536,7 +16529,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
16536
16529
|
if (_global === globalObject && timersPromisesModule) {
|
|
16537
16530
|
clock.timersPromisesModuleMethods = [];
|
|
16538
16531
|
}
|
|
16539
|
-
for (i = 0,
|
|
16532
|
+
for (i = 0, l = clock.methods.length; i < l; i++) {
|
|
16540
16533
|
const nameOfMethodToReplace = clock.methods[i];
|
|
16541
16534
|
if (!isPresent[nameOfMethodToReplace]) {
|
|
16542
16535
|
handleMissingTimer(nameOfMethodToReplace);
|
|
@@ -17121,7 +17114,7 @@ function createVitest() {
|
|
|
17121
17114
|
return item;
|
|
17122
17115
|
},
|
|
17123
17116
|
isMockFunction(fn2) {
|
|
17124
|
-
return
|
|
17117
|
+
return isMockFunction2(fn2);
|
|
17125
17118
|
},
|
|
17126
17119
|
clearAllMocks() {
|
|
17127
17120
|
[...mocks].reverse().forEach((spy) => spy.mockClear());
|
|
@@ -17241,7 +17234,7 @@ ${[...generateDirectoryTree(children, indent)].join("\n")}
|
|
|
17241
17234
|
c.fs.symlink(import_node_path.default.join(originalCwd, "..", "config"), import_node_path.default.join(c.fs.cwd(), "node_modules", "@prisma", "config"));
|
|
17242
17235
|
};
|
|
17243
17236
|
c.cli = (...input) => {
|
|
17244
|
-
return (0,
|
|
17237
|
+
return (0, import_chunk_3UEKS5W6.execaNode)(import_node_path.default.join(originalCwd, "../cli/build/index.js"), input, {
|
|
17245
17238
|
cwd: c.fs.cwd(),
|
|
17246
17239
|
stdio: "pipe",
|
|
17247
17240
|
all: true
|
|
@@ -17249,7 +17242,7 @@ ${[...generateDirectoryTree(children, indent)].join("\n")}
|
|
|
17249
17242
|
};
|
|
17250
17243
|
c.printDir = (dir, extensions) => {
|
|
17251
17244
|
const content = c.fs.list(dir) ?? [];
|
|
17252
|
-
content.sort((a3,
|
|
17245
|
+
content.sort((a3, b) => a3.localeCompare(b));
|
|
17253
17246
|
return content.filter((name) => extensions.includes(import_node_path.default.extname(name))).map((name) => `${name}:
|
|
17254
17247
|
|
|
17255
17248
|
${c.fs.read(import_node_path.default.join(dir, name))}`).join("\n\n");
|
|
@@ -17375,7 +17368,7 @@ var processExitContext = vitestProcessExitContext;
|
|
|
17375
17368
|
* LICENSE file in the root directory of this source tree.
|
|
17376
17369
|
*)
|
|
17377
17370
|
|
|
17378
|
-
chai/
|
|
17371
|
+
chai/chai.js:
|
|
17379
17372
|
(*!
|
|
17380
17373
|
* Chai - flag utility
|
|
17381
17374
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|