chai 5.0.0 → 5.0.2

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/chai.js DELETED
@@ -1,4119 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
-
12
- // (disabled):util
13
- var require_util = __commonJS({
14
- "(disabled):util"() {
15
- }
16
- });
17
-
18
- // lib/chai/utils/index.js
19
- var utils_exports = {};
20
- __export(utils_exports, {
21
- addChainableMethod: () => addChainableMethod,
22
- addLengthGuard: () => addLengthGuard,
23
- addMethod: () => addMethod,
24
- addProperty: () => addProperty,
25
- checkError: () => check_error_exports,
26
- compareByInspect: () => compareByInspect,
27
- eql: () => deep_eql_default,
28
- expectTypes: () => expectTypes,
29
- flag: () => flag,
30
- getActual: () => getActual,
31
- getMessage: () => getMessage2,
32
- getName: () => getName,
33
- getOperator: () => getOperator,
34
- getOwnEnumerableProperties: () => getOwnEnumerableProperties,
35
- getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols,
36
- getPathInfo: () => getPathInfo,
37
- hasProperty: () => hasProperty,
38
- inspect: () => inspect2,
39
- isNaN: () => isNaN2,
40
- isProxyEnabled: () => isProxyEnabled,
41
- objDisplay: () => objDisplay,
42
- overwriteChainableMethod: () => overwriteChainableMethod,
43
- overwriteMethod: () => overwriteMethod,
44
- overwriteProperty: () => overwriteProperty,
45
- proxify: () => proxify,
46
- test: () => test,
47
- transferFlags: () => transferFlags,
48
- type: () => type
49
- });
50
-
51
- // node_modules/check-error/index.js
52
- var check_error_exports = {};
53
- __export(check_error_exports, {
54
- compatibleConstructor: () => compatibleConstructor,
55
- compatibleInstance: () => compatibleInstance,
56
- compatibleMessage: () => compatibleMessage,
57
- getConstructorName: () => getConstructorName,
58
- getMessage: () => getMessage
59
- });
60
- function compatibleInstance(thrown, errorLike) {
61
- return errorLike instanceof Error && thrown === errorLike;
62
- }
63
- __name(compatibleInstance, "compatibleInstance");
64
- function compatibleConstructor(thrown, errorLike) {
65
- if (errorLike instanceof Error) {
66
- return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
67
- } else if (errorLike.prototype instanceof Error || errorLike === Error) {
68
- return thrown.constructor === errorLike || thrown instanceof errorLike;
69
- }
70
- return false;
71
- }
72
- __name(compatibleConstructor, "compatibleConstructor");
73
- function compatibleMessage(thrown, errMatcher) {
74
- const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
75
- if (errMatcher instanceof RegExp) {
76
- return errMatcher.test(comparisonString);
77
- } else if (typeof errMatcher === "string") {
78
- return comparisonString.indexOf(errMatcher) !== -1;
79
- }
80
- return false;
81
- }
82
- __name(compatibleMessage, "compatibleMessage");
83
- function getConstructorName(errorLike) {
84
- let constructorName = errorLike;
85
- if (errorLike instanceof Error) {
86
- constructorName = errorLike.constructor.name;
87
- } else if (typeof errorLike === "function") {
88
- constructorName = errorLike.name;
89
- if (constructorName === "") {
90
- const newConstructorName = new errorLike().name;
91
- constructorName = newConstructorName || constructorName;
92
- }
93
- }
94
- return constructorName;
95
- }
96
- __name(getConstructorName, "getConstructorName");
97
- function getMessage(errorLike) {
98
- let msg = "";
99
- if (errorLike && errorLike.message) {
100
- msg = errorLike.message;
101
- } else if (typeof errorLike === "string") {
102
- msg = errorLike;
103
- }
104
- return msg;
105
- }
106
- __name(getMessage, "getMessage");
107
-
108
- // lib/chai/utils/flag.js
109
- function flag(obj, key, value) {
110
- var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
111
- if (arguments.length === 3) {
112
- flags[key] = value;
113
- } else {
114
- return flags[key];
115
- }
116
- }
117
- __name(flag, "flag");
118
-
119
- // lib/chai/utils/test.js
120
- function test(obj, args) {
121
- var negate = flag(obj, "negate"), expr = args[0];
122
- return negate ? !expr : expr;
123
- }
124
- __name(test, "test");
125
-
126
- // lib/chai/utils/type-detect.js
127
- function type(obj) {
128
- if (typeof obj === "undefined") {
129
- return "undefined";
130
- }
131
- if (obj === null) {
132
- return "null";
133
- }
134
- const stringTag = obj[Symbol.toStringTag];
135
- if (typeof stringTag === "string") {
136
- return stringTag;
137
- }
138
- const type3 = Object.prototype.toString.call(obj).slice(8, -1);
139
- return type3;
140
- }
141
- __name(type, "type");
142
-
143
- // node_modules/assertion-error/index.js
144
- var canElideFrames = "captureStackTrace" in Error;
145
- var AssertionError = class extends Error {
146
- message;
147
- get name() {
148
- return "AssertionError";
149
- }
150
- get ok() {
151
- return false;
152
- }
153
- constructor(message = "Unspecified AssertionError", props, ssf) {
154
- super(message);
155
- this.message = message;
156
- if (canElideFrames) {
157
- Error.captureStackTrace(this, ssf || AssertionError);
158
- }
159
- for (const key in props) {
160
- if (!(key in this)) {
161
- this[key] = props[key];
162
- }
163
- }
164
- }
165
- toJSON(stack) {
166
- return {
167
- ...this,
168
- name: this.name,
169
- message: this.message,
170
- ok: false,
171
- stack: stack !== false ? this.stack : void 0
172
- };
173
- }
174
- };
175
- __name(AssertionError, "AssertionError");
176
-
177
- // lib/chai/utils/expectTypes.js
178
- function expectTypes(obj, types) {
179
- var flagMsg = flag(obj, "message");
180
- var ssfi = flag(obj, "ssfi");
181
- flagMsg = flagMsg ? flagMsg + ": " : "";
182
- obj = flag(obj, "object");
183
- types = types.map(function(t) {
184
- return t.toLowerCase();
185
- });
186
- types.sort();
187
- var str = types.map(function(t, index) {
188
- var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
189
- var or = types.length > 1 && index === types.length - 1 ? "or " : "";
190
- return or + art + " " + t;
191
- }).join(", ");
192
- var objType = type(obj).toLowerCase();
193
- if (!types.some(function(expected) {
194
- return objType === expected;
195
- })) {
196
- throw new AssertionError(
197
- flagMsg + "object tested must be " + str + ", but " + objType + " given",
198
- void 0,
199
- ssfi
200
- );
201
- }
202
- }
203
- __name(expectTypes, "expectTypes");
204
-
205
- // lib/chai/utils/getActual.js
206
- function getActual(obj, args) {
207
- return args.length > 4 ? args[4] : obj._obj;
208
- }
209
- __name(getActual, "getActual");
210
-
211
- // node_modules/loupe/lib/helpers.js
212
- var ansiColors = {
213
- bold: ["1", "22"],
214
- dim: ["2", "22"],
215
- italic: ["3", "23"],
216
- underline: ["4", "24"],
217
- // 5 & 6 are blinking
218
- inverse: ["7", "27"],
219
- hidden: ["8", "28"],
220
- strike: ["9", "29"],
221
- // 10-20 are fonts
222
- // 21-29 are resets for 1-9
223
- black: ["30", "39"],
224
- red: ["31", "39"],
225
- green: ["32", "39"],
226
- yellow: ["33", "39"],
227
- blue: ["34", "39"],
228
- magenta: ["35", "39"],
229
- cyan: ["36", "39"],
230
- white: ["37", "39"],
231
- brightblack: ["30;1", "39"],
232
- brightred: ["31;1", "39"],
233
- brightgreen: ["32;1", "39"],
234
- brightyellow: ["33;1", "39"],
235
- brightblue: ["34;1", "39"],
236
- brightmagenta: ["35;1", "39"],
237
- brightcyan: ["36;1", "39"],
238
- brightwhite: ["37;1", "39"],
239
- grey: ["90", "39"]
240
- };
241
- var styles = {
242
- special: "cyan",
243
- number: "yellow",
244
- bigint: "yellow",
245
- boolean: "yellow",
246
- undefined: "grey",
247
- null: "bold",
248
- string: "green",
249
- symbol: "green",
250
- date: "magenta",
251
- regexp: "red"
252
- };
253
- var truncator = "\u2026";
254
- function colorise(value, styleType) {
255
- const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
256
- if (!color) {
257
- return String(value);
258
- }
259
- return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
260
- }
261
- __name(colorise, "colorise");
262
- function normaliseOptions({
263
- showHidden = false,
264
- depth = 2,
265
- colors = false,
266
- customInspect = true,
267
- showProxy = false,
268
- maxArrayLength = Infinity,
269
- breakLength = Infinity,
270
- seen = [],
271
- // eslint-disable-next-line no-shadow
272
- truncate: truncate2 = Infinity,
273
- stylize = String
274
- } = {}, inspect3) {
275
- const options = {
276
- showHidden: Boolean(showHidden),
277
- depth: Number(depth),
278
- colors: Boolean(colors),
279
- customInspect: Boolean(customInspect),
280
- showProxy: Boolean(showProxy),
281
- maxArrayLength: Number(maxArrayLength),
282
- breakLength: Number(breakLength),
283
- truncate: Number(truncate2),
284
- seen,
285
- inspect: inspect3,
286
- stylize
287
- };
288
- if (options.colors) {
289
- options.stylize = colorise;
290
- }
291
- return options;
292
- }
293
- __name(normaliseOptions, "normaliseOptions");
294
- function truncate(string, length, tail = truncator) {
295
- string = String(string);
296
- const tailLength = tail.length;
297
- const stringLength = string.length;
298
- if (tailLength > length && stringLength > tailLength) {
299
- return tail;
300
- }
301
- if (stringLength > length && stringLength > tailLength) {
302
- return `${string.slice(0, length - tailLength)}${tail}`;
303
- }
304
- return string;
305
- }
306
- __name(truncate, "truncate");
307
- function inspectList(list, options, inspectItem, separator = ", ") {
308
- inspectItem = inspectItem || options.inspect;
309
- const size = list.length;
310
- if (size === 0)
311
- return "";
312
- const originalLength = options.truncate;
313
- let output = "";
314
- let peek = "";
315
- let truncated = "";
316
- for (let i = 0; i < size; i += 1) {
317
- const last = i + 1 === list.length;
318
- const secondToLast = i + 2 === list.length;
319
- truncated = `${truncator}(${list.length - i})`;
320
- const value = list[i];
321
- options.truncate = originalLength - output.length - (last ? 0 : separator.length);
322
- const string = peek || inspectItem(value, options) + (last ? "" : separator);
323
- const nextLength = output.length + string.length;
324
- const truncatedLength = nextLength + truncated.length;
325
- if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
326
- break;
327
- }
328
- if (!last && !secondToLast && truncatedLength > originalLength) {
329
- break;
330
- }
331
- peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
332
- if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
333
- break;
334
- }
335
- output += string;
336
- if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
337
- truncated = `${truncator}(${list.length - i - 1})`;
338
- break;
339
- }
340
- truncated = "";
341
- }
342
- return `${output}${truncated}`;
343
- }
344
- __name(inspectList, "inspectList");
345
- function quoteComplexKey(key) {
346
- if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
347
- return key;
348
- }
349
- return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
350
- }
351
- __name(quoteComplexKey, "quoteComplexKey");
352
- function inspectProperty([key, value], options) {
353
- options.truncate -= 2;
354
- if (typeof key === "string") {
355
- key = quoteComplexKey(key);
356
- } else if (typeof key !== "number") {
357
- key = `[${options.inspect(key, options)}]`;
358
- }
359
- options.truncate -= key.length;
360
- value = options.inspect(value, options);
361
- return `${key}: ${value}`;
362
- }
363
- __name(inspectProperty, "inspectProperty");
364
-
365
- // node_modules/loupe/lib/array.js
366
- function inspectArray(array, options) {
367
- const nonIndexProperties = Object.keys(array).slice(array.length);
368
- if (!array.length && !nonIndexProperties.length)
369
- return "[]";
370
- options.truncate -= 4;
371
- const listContents = inspectList(array, options);
372
- options.truncate -= listContents.length;
373
- let propertyContents = "";
374
- if (nonIndexProperties.length) {
375
- propertyContents = inspectList(
376
- nonIndexProperties.map((key) => [key, array[key]]),
377
- options,
378
- inspectProperty
379
- );
380
- }
381
- return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
382
- }
383
- __name(inspectArray, "inspectArray");
384
-
385
- // node_modules/loupe/lib/typedarray.js
386
- var getArrayName = /* @__PURE__ */ __name((array) => {
387
- if (typeof Buffer === "function" && array instanceof Buffer) {
388
- return "Buffer";
389
- }
390
- if (array[Symbol.toStringTag]) {
391
- return array[Symbol.toStringTag];
392
- }
393
- return array.constructor.name;
394
- }, "getArrayName");
395
- function inspectTypedArray(array, options) {
396
- const name = getArrayName(array);
397
- options.truncate -= name.length + 4;
398
- const nonIndexProperties = Object.keys(array).slice(array.length);
399
- if (!array.length && !nonIndexProperties.length)
400
- return `${name}[]`;
401
- let output = "";
402
- for (let i = 0; i < array.length; i++) {
403
- const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
404
- options.truncate -= string.length;
405
- if (array[i] !== array.length && options.truncate <= 3) {
406
- output += `${truncator}(${array.length - array[i] + 1})`;
407
- break;
408
- }
409
- output += string;
410
- }
411
- let propertyContents = "";
412
- if (nonIndexProperties.length) {
413
- propertyContents = inspectList(
414
- nonIndexProperties.map((key) => [key, array[key]]),
415
- options,
416
- inspectProperty
417
- );
418
- }
419
- return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
420
- }
421
- __name(inspectTypedArray, "inspectTypedArray");
422
-
423
- // node_modules/loupe/lib/date.js
424
- function inspectDate(dateObject, options) {
425
- const stringRepresentation = dateObject.toJSON();
426
- if (stringRepresentation === null) {
427
- return "Invalid Date";
428
- }
429
- const split = stringRepresentation.split("T");
430
- const date = split[0];
431
- return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
432
- }
433
- __name(inspectDate, "inspectDate");
434
-
435
- // node_modules/loupe/lib/function.js
436
- function inspectFunction(func, options) {
437
- const name = func.name;
438
- if (!name) {
439
- return options.stylize("[Function]", "special");
440
- }
441
- return options.stylize(`[Function ${truncate(name, options.truncate - 11)}]`, "special");
442
- }
443
- __name(inspectFunction, "inspectFunction");
444
-
445
- // node_modules/loupe/lib/map.js
446
- function inspectMapEntry([key, value], options) {
447
- options.truncate -= 4;
448
- key = options.inspect(key, options);
449
- options.truncate -= key.length;
450
- value = options.inspect(value, options);
451
- return `${key} => ${value}`;
452
- }
453
- __name(inspectMapEntry, "inspectMapEntry");
454
- function mapToEntries(map) {
455
- const entries = [];
456
- map.forEach((value, key) => {
457
- entries.push([key, value]);
458
- });
459
- return entries;
460
- }
461
- __name(mapToEntries, "mapToEntries");
462
- function inspectMap(map, options) {
463
- const size = map.size - 1;
464
- if (size <= 0) {
465
- return "Map{}";
466
- }
467
- options.truncate -= 7;
468
- return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
469
- }
470
- __name(inspectMap, "inspectMap");
471
-
472
- // node_modules/loupe/lib/number.js
473
- var isNaN = Number.isNaN || ((i) => i !== i);
474
- function inspectNumber(number, options) {
475
- if (isNaN(number)) {
476
- return options.stylize("NaN", "number");
477
- }
478
- if (number === Infinity) {
479
- return options.stylize("Infinity", "number");
480
- }
481
- if (number === -Infinity) {
482
- return options.stylize("-Infinity", "number");
483
- }
484
- if (number === 0) {
485
- return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
486
- }
487
- return options.stylize(truncate(String(number), options.truncate), "number");
488
- }
489
- __name(inspectNumber, "inspectNumber");
490
-
491
- // node_modules/loupe/lib/bigint.js
492
- function inspectBigInt(number, options) {
493
- let nums = truncate(number.toString(), options.truncate - 1);
494
- if (nums !== truncator)
495
- nums += "n";
496
- return options.stylize(nums, "bigint");
497
- }
498
- __name(inspectBigInt, "inspectBigInt");
499
-
500
- // node_modules/loupe/lib/regexp.js
501
- function inspectRegExp(value, options) {
502
- const flags = value.toString().split("/")[2];
503
- const sourceLength = options.truncate - (2 + flags.length);
504
- const source = value.source;
505
- return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
506
- }
507
- __name(inspectRegExp, "inspectRegExp");
508
-
509
- // node_modules/loupe/lib/set.js
510
- function arrayFromSet(set2) {
511
- const values = [];
512
- set2.forEach((value) => {
513
- values.push(value);
514
- });
515
- return values;
516
- }
517
- __name(arrayFromSet, "arrayFromSet");
518
- function inspectSet(set2, options) {
519
- if (set2.size === 0)
520
- return "Set{}";
521
- options.truncate -= 7;
522
- return `Set{ ${inspectList(arrayFromSet(set2), options)} }`;
523
- }
524
- __name(inspectSet, "inspectSet");
525
-
526
- // node_modules/loupe/lib/string.js
527
- var stringEscapeChars = new RegExp(
528
- "['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]",
529
- "g"
530
- );
531
- var escapeCharacters = {
532
- "\b": "\\b",
533
- " ": "\\t",
534
- "\n": "\\n",
535
- "\f": "\\f",
536
- "\r": "\\r",
537
- "'": "\\'",
538
- "\\": "\\\\"
539
- };
540
- var hex = 16;
541
- var unicodeLength = 4;
542
- function escape(char) {
543
- return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
544
- }
545
- __name(escape, "escape");
546
- function inspectString(string, options) {
547
- if (stringEscapeChars.test(string)) {
548
- string = string.replace(stringEscapeChars, escape);
549
- }
550
- return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
551
- }
552
- __name(inspectString, "inspectString");
553
-
554
- // node_modules/loupe/lib/symbol.js
555
- function inspectSymbol(value) {
556
- if ("description" in Symbol.prototype) {
557
- return value.description ? `Symbol(${value.description})` : "Symbol()";
558
- }
559
- return value.toString();
560
- }
561
- __name(inspectSymbol, "inspectSymbol");
562
-
563
- // node_modules/loupe/lib/promise.js
564
- var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue");
565
- try {
566
- const { getPromiseDetails, kPending, kRejected } = process.binding("util");
567
- if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
568
- getPromiseValue = /* @__PURE__ */ __name((value, options) => {
569
- const [state, innerValue] = getPromiseDetails(value);
570
- if (state === kPending) {
571
- return "Promise{<pending>}";
572
- }
573
- return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
574
- }, "getPromiseValue");
575
- }
576
- } catch (notNode) {
577
- }
578
- var promise_default = getPromiseValue;
579
-
580
- // node_modules/loupe/lib/object.js
581
- function inspectObject(object, options) {
582
- const properties = Object.getOwnPropertyNames(object);
583
- const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
584
- if (properties.length === 0 && symbols.length === 0) {
585
- return "{}";
586
- }
587
- options.truncate -= 4;
588
- options.seen = options.seen || [];
589
- if (options.seen.indexOf(object) >= 0) {
590
- return "[Circular]";
591
- }
592
- options.seen.push(object);
593
- const propertyContents = inspectList(
594
- properties.map((key) => [key, object[key]]),
595
- options,
596
- inspectProperty
597
- );
598
- const symbolContents = inspectList(
599
- symbols.map((key) => [key, object[key]]),
600
- options,
601
- inspectProperty
602
- );
603
- options.seen.pop();
604
- let sep = "";
605
- if (propertyContents && symbolContents) {
606
- sep = ", ";
607
- }
608
- return `{ ${propertyContents}${sep}${symbolContents} }`;
609
- }
610
- __name(inspectObject, "inspectObject");
611
-
612
- // node_modules/loupe/lib/class.js
613
- var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
614
- function inspectClass(value, options) {
615
- let name = "";
616
- if (toStringTag && toStringTag in value) {
617
- name = value[toStringTag];
618
- }
619
- name = name || value.constructor.name;
620
- if (!name || name === "_class") {
621
- name = "<Anonymous Class>";
622
- }
623
- options.truncate -= name.length;
624
- return `${name}${inspectObject(value, options)}`;
625
- }
626
- __name(inspectClass, "inspectClass");
627
-
628
- // node_modules/loupe/lib/arguments.js
629
- function inspectArguments(args, options) {
630
- if (args.length === 0)
631
- return "Arguments[]";
632
- options.truncate -= 13;
633
- return `Arguments[ ${inspectList(args, options)} ]`;
634
- }
635
- __name(inspectArguments, "inspectArguments");
636
-
637
- // node_modules/loupe/lib/error.js
638
- var errorKeys = [
639
- "stack",
640
- "line",
641
- "column",
642
- "name",
643
- "message",
644
- "fileName",
645
- "lineNumber",
646
- "columnNumber",
647
- "number",
648
- "description"
649
- ];
650
- function inspectObject2(error, options) {
651
- const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
652
- const name = error.name;
653
- options.truncate -= name.length;
654
- let message = "";
655
- if (typeof error.message === "string") {
656
- message = truncate(error.message, options.truncate);
657
- } else {
658
- properties.unshift("message");
659
- }
660
- message = message ? `: ${message}` : "";
661
- options.truncate -= message.length + 5;
662
- const propertyContents = inspectList(
663
- properties.map((key) => [key, error[key]]),
664
- options,
665
- inspectProperty
666
- );
667
- return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
668
- }
669
- __name(inspectObject2, "inspectObject");
670
-
671
- // node_modules/loupe/lib/html.js
672
- function inspectAttribute([key, value], options) {
673
- options.truncate -= 3;
674
- if (!value) {
675
- return `${options.stylize(String(key), "yellow")}`;
676
- }
677
- return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
678
- }
679
- __name(inspectAttribute, "inspectAttribute");
680
- function inspectHTMLCollection(collection, options) {
681
- return inspectList(collection, options, inspectHTML, "\n");
682
- }
683
- __name(inspectHTMLCollection, "inspectHTMLCollection");
684
- function inspectHTML(element, options) {
685
- const properties = element.getAttributeNames();
686
- const name = element.tagName.toLowerCase();
687
- const head = options.stylize(`<${name}`, "special");
688
- const headClose = options.stylize(`>`, "special");
689
- const tail = options.stylize(`</${name}>`, "special");
690
- options.truncate -= name.length * 2 + 5;
691
- let propertyContents = "";
692
- if (properties.length > 0) {
693
- propertyContents += " ";
694
- propertyContents += inspectList(
695
- properties.map((key) => [key, element.getAttribute(key)]),
696
- options,
697
- inspectAttribute,
698
- " "
699
- );
700
- }
701
- options.truncate -= propertyContents.length;
702
- const truncate2 = options.truncate;
703
- let children = inspectHTMLCollection(element.children, options);
704
- if (children && children.length > truncate2) {
705
- children = `${truncator}(${element.children.length})`;
706
- }
707
- return `${head}${propertyContents}${headClose}${children}${tail}`;
708
- }
709
- __name(inspectHTML, "inspectHTML");
710
-
711
- // node_modules/loupe/lib/index.js
712
- var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
713
- var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
714
- var nodeInspect = false;
715
- try {
716
- const nodeUtil = require_util();
717
- nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
718
- } catch (noNodeInspect) {
719
- nodeInspect = false;
720
- }
721
- var constructorMap = /* @__PURE__ */ new WeakMap();
722
- var stringTagMap = {};
723
- var baseTypesMap = {
724
- undefined: (value, options) => options.stylize("undefined", "undefined"),
725
- null: (value, options) => options.stylize("null", "null"),
726
- boolean: (value, options) => options.stylize(String(value), "boolean"),
727
- Boolean: (value, options) => options.stylize(String(value), "boolean"),
728
- number: inspectNumber,
729
- Number: inspectNumber,
730
- bigint: inspectBigInt,
731
- BigInt: inspectBigInt,
732
- string: inspectString,
733
- String: inspectString,
734
- function: inspectFunction,
735
- Function: inspectFunction,
736
- symbol: inspectSymbol,
737
- // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
738
- Symbol: inspectSymbol,
739
- Array: inspectArray,
740
- Date: inspectDate,
741
- Map: inspectMap,
742
- Set: inspectSet,
743
- RegExp: inspectRegExp,
744
- Promise: promise_default,
745
- // WeakSet, WeakMap are totally opaque to us
746
- WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
747
- WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
748
- Arguments: inspectArguments,
749
- Int8Array: inspectTypedArray,
750
- Uint8Array: inspectTypedArray,
751
- Uint8ClampedArray: inspectTypedArray,
752
- Int16Array: inspectTypedArray,
753
- Uint16Array: inspectTypedArray,
754
- Int32Array: inspectTypedArray,
755
- Uint32Array: inspectTypedArray,
756
- Float32Array: inspectTypedArray,
757
- Float64Array: inspectTypedArray,
758
- Generator: () => "",
759
- DataView: () => "",
760
- ArrayBuffer: () => "",
761
- Error: inspectObject2,
762
- HTMLCollection: inspectHTMLCollection,
763
- NodeList: inspectHTMLCollection
764
- };
765
- var inspectCustom = /* @__PURE__ */ __name((value, options, type3) => {
766
- if (chaiInspect in value && typeof value[chaiInspect] === "function") {
767
- return value[chaiInspect](options);
768
- }
769
- if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === "function") {
770
- return value[nodeInspect](options.depth, options);
771
- }
772
- if ("inspect" in value && typeof value.inspect === "function") {
773
- return value.inspect(options.depth, options);
774
- }
775
- if ("constructor" in value && constructorMap.has(value.constructor)) {
776
- return constructorMap.get(value.constructor)(value, options);
777
- }
778
- if (stringTagMap[type3]) {
779
- return stringTagMap[type3](value, options);
780
- }
781
- return "";
782
- }, "inspectCustom");
783
- var toString = Object.prototype.toString;
784
- function inspect(value, opts = {}) {
785
- const options = normaliseOptions(opts, inspect);
786
- const { customInspect } = options;
787
- let type3 = value === null ? "null" : typeof value;
788
- if (type3 === "object") {
789
- type3 = toString.call(value).slice(8, -1);
790
- }
791
- if (type3 in baseTypesMap) {
792
- return baseTypesMap[type3](value, options);
793
- }
794
- if (customInspect && value) {
795
- const output = inspectCustom(value, options, type3);
796
- if (output) {
797
- if (typeof output === "string")
798
- return output;
799
- return inspect(output, options);
800
- }
801
- }
802
- const proto = value ? Object.getPrototypeOf(value) : false;
803
- if (proto === Object.prototype || proto === null) {
804
- return inspectObject(value, options);
805
- }
806
- if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
807
- return inspectHTML(value, options);
808
- }
809
- if ("constructor" in value) {
810
- if (value.constructor !== Object) {
811
- return inspectClass(value, options);
812
- }
813
- return inspectObject(value, options);
814
- }
815
- if (value === Object(value)) {
816
- return inspectObject(value, options);
817
- }
818
- return options.stylize(String(value), type3);
819
- }
820
- __name(inspect, "inspect");
821
-
822
- // lib/chai/config.js
823
- var config = {
824
- /**
825
- * ### config.includeStack
826
- *
827
- * User configurable property, influences whether stack trace
828
- * is included in Assertion error message. Default of false
829
- * suppresses stack trace in the error message.
830
- *
831
- * chai.config.includeStack = true; // enable stack on error
832
- *
833
- * @param {Boolean}
834
- * @api public
835
- */
836
- includeStack: false,
837
- /**
838
- * ### config.showDiff
839
- *
840
- * User configurable property, influences whether or not
841
- * the `showDiff` flag should be included in the thrown
842
- * AssertionErrors. `false` will always be `false`; `true`
843
- * will be true when the assertion has requested a diff
844
- * be shown.
845
- *
846
- * @param {Boolean}
847
- * @api public
848
- */
849
- showDiff: true,
850
- /**
851
- * ### config.truncateThreshold
852
- *
853
- * User configurable property, sets length threshold for actual and
854
- * expected values in assertion errors. If this threshold is exceeded, for
855
- * example for large data structures, the value is replaced with something
856
- * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
857
- *
858
- * Set it to zero if you want to disable truncating altogether.
859
- *
860
- * This is especially userful when doing assertions on arrays: having this
861
- * set to a reasonable large value makes the failure messages readily
862
- * inspectable.
863
- *
864
- * chai.config.truncateThreshold = 0; // disable truncating
865
- *
866
- * @param {Number}
867
- * @api public
868
- */
869
- truncateThreshold: 40,
870
- /**
871
- * ### config.useProxy
872
- *
873
- * User configurable property, defines if chai will use a Proxy to throw
874
- * an error when a non-existent property is read, which protects users
875
- * from typos when using property-based assertions.
876
- *
877
- * Set it to false if you want to disable this feature.
878
- *
879
- * chai.config.useProxy = false; // disable use of Proxy
880
- *
881
- * This feature is automatically disabled regardless of this config value
882
- * in environments that don't support proxies.
883
- *
884
- * @param {Boolean}
885
- * @api public
886
- */
887
- useProxy: true,
888
- /**
889
- * ### config.proxyExcludedKeys
890
- *
891
- * User configurable property, defines which properties should be ignored
892
- * instead of throwing an error if they do not exist on the assertion.
893
- * This is only applied if the environment Chai is running in supports proxies and
894
- * if the `useProxy` configuration setting is enabled.
895
- * By default, `then` and `inspect` will not throw an error if they do not exist on the
896
- * assertion object because the `.inspect` property is read by `util.inspect` (for example, when
897
- * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
898
- *
899
- * // By default these keys will not throw an error if they do not exist on the assertion object
900
- * chai.config.proxyExcludedKeys = ['then', 'inspect'];
901
- *
902
- * @param {Array}
903
- * @api public
904
- */
905
- proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"]
906
- };
907
-
908
- // lib/chai/utils/inspect.js
909
- function inspect2(obj, showHidden, depth, colors) {
910
- var options = {
911
- colors,
912
- depth: typeof depth === "undefined" ? 2 : depth,
913
- showHidden,
914
- truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
915
- };
916
- return inspect(obj, options);
917
- }
918
- __name(inspect2, "inspect");
919
-
920
- // lib/chai/utils/objDisplay.js
921
- function objDisplay(obj) {
922
- var str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
923
- if (config.truncateThreshold && str.length >= config.truncateThreshold) {
924
- if (type3 === "[object Function]") {
925
- return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
926
- } else if (type3 === "[object Array]") {
927
- return "[ Array(" + obj.length + ") ]";
928
- } else if (type3 === "[object Object]") {
929
- var keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
930
- return "{ Object (" + kstr + ") }";
931
- } else {
932
- return str;
933
- }
934
- } else {
935
- return str;
936
- }
937
- }
938
- __name(objDisplay, "objDisplay");
939
-
940
- // lib/chai/utils/getMessage.js
941
- function getMessage2(obj, args) {
942
- 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");
943
- if (typeof msg === "function")
944
- msg = msg();
945
- msg = msg || "";
946
- msg = msg.replace(/#\{this\}/g, function() {
947
- return objDisplay(val);
948
- }).replace(/#\{act\}/g, function() {
949
- return objDisplay(actual);
950
- }).replace(/#\{exp\}/g, function() {
951
- return objDisplay(expected);
952
- });
953
- return flagMsg ? flagMsg + ": " + msg : msg;
954
- }
955
- __name(getMessage2, "getMessage");
956
-
957
- // lib/chai/utils/transferFlags.js
958
- function transferFlags(assertion, object, includeAll) {
959
- var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
960
- if (!object.__flags) {
961
- object.__flags = /* @__PURE__ */ Object.create(null);
962
- }
963
- includeAll = arguments.length === 3 ? includeAll : true;
964
- for (var flag3 in flags) {
965
- if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
966
- object.__flags[flag3] = flags[flag3];
967
- }
968
- }
969
- }
970
- __name(transferFlags, "transferFlags");
971
-
972
- // node_modules/deep-eql/index.js
973
- function type2(obj) {
974
- if (typeof obj === "undefined") {
975
- return "undefined";
976
- }
977
- if (obj === null) {
978
- return "null";
979
- }
980
- const stringTag = obj[Symbol.toStringTag];
981
- if (typeof stringTag === "string") {
982
- return stringTag;
983
- }
984
- const sliceStart = 8;
985
- const sliceEnd = -1;
986
- return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
987
- }
988
- __name(type2, "type");
989
- function FakeMap() {
990
- this._key = "chai/deep-eql__" + Math.random() + Date.now();
991
- }
992
- __name(FakeMap, "FakeMap");
993
- FakeMap.prototype = {
994
- get: /* @__PURE__ */ __name(function get(key) {
995
- return key[this._key];
996
- }, "get"),
997
- set: /* @__PURE__ */ __name(function set(key, value) {
998
- if (Object.isExtensible(key)) {
999
- Object.defineProperty(key, this._key, {
1000
- value,
1001
- configurable: true
1002
- });
1003
- }
1004
- }, "set")
1005
- };
1006
- var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
1007
- function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
1008
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1009
- return null;
1010
- }
1011
- var leftHandMap = memoizeMap.get(leftHandOperand);
1012
- if (leftHandMap) {
1013
- var result = leftHandMap.get(rightHandOperand);
1014
- if (typeof result === "boolean") {
1015
- return result;
1016
- }
1017
- }
1018
- return null;
1019
- }
1020
- __name(memoizeCompare, "memoizeCompare");
1021
- function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
1022
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1023
- return;
1024
- }
1025
- var leftHandMap = memoizeMap.get(leftHandOperand);
1026
- if (leftHandMap) {
1027
- leftHandMap.set(rightHandOperand, result);
1028
- } else {
1029
- leftHandMap = new MemoizeMap();
1030
- leftHandMap.set(rightHandOperand, result);
1031
- memoizeMap.set(leftHandOperand, leftHandMap);
1032
- }
1033
- }
1034
- __name(memoizeSet, "memoizeSet");
1035
- var deep_eql_default = deepEqual;
1036
- function deepEqual(leftHandOperand, rightHandOperand, options) {
1037
- if (options && options.comparator) {
1038
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1039
- }
1040
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1041
- if (simpleResult !== null) {
1042
- return simpleResult;
1043
- }
1044
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1045
- }
1046
- __name(deepEqual, "deepEqual");
1047
- function simpleEqual(leftHandOperand, rightHandOperand) {
1048
- if (leftHandOperand === rightHandOperand) {
1049
- return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
1050
- }
1051
- if (leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare
1052
- rightHandOperand !== rightHandOperand) {
1053
- return true;
1054
- }
1055
- if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1056
- return false;
1057
- }
1058
- return null;
1059
- }
1060
- __name(simpleEqual, "simpleEqual");
1061
- function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
1062
- options = options || {};
1063
- options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();
1064
- var comparator = options && options.comparator;
1065
- var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
1066
- if (memoizeResultLeft !== null) {
1067
- return memoizeResultLeft;
1068
- }
1069
- var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
1070
- if (memoizeResultRight !== null) {
1071
- return memoizeResultRight;
1072
- }
1073
- if (comparator) {
1074
- var comparatorResult = comparator(leftHandOperand, rightHandOperand);
1075
- if (comparatorResult === false || comparatorResult === true) {
1076
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
1077
- return comparatorResult;
1078
- }
1079
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1080
- if (simpleResult !== null) {
1081
- return simpleResult;
1082
- }
1083
- }
1084
- var leftHandType = type2(leftHandOperand);
1085
- if (leftHandType !== type2(rightHandOperand)) {
1086
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
1087
- return false;
1088
- }
1089
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
1090
- var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
1091
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
1092
- return result;
1093
- }
1094
- __name(extensiveDeepEqual, "extensiveDeepEqual");
1095
- function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
1096
- switch (leftHandType) {
1097
- case "String":
1098
- case "Number":
1099
- case "Boolean":
1100
- case "Date":
1101
- return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
1102
- case "Promise":
1103
- case "Symbol":
1104
- case "function":
1105
- case "WeakMap":
1106
- case "WeakSet":
1107
- return leftHandOperand === rightHandOperand;
1108
- case "Error":
1109
- return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options);
1110
- case "Arguments":
1111
- case "Int8Array":
1112
- case "Uint8Array":
1113
- case "Uint8ClampedArray":
1114
- case "Int16Array":
1115
- case "Uint16Array":
1116
- case "Int32Array":
1117
- case "Uint32Array":
1118
- case "Float32Array":
1119
- case "Float64Array":
1120
- case "Array":
1121
- return iterableEqual(leftHandOperand, rightHandOperand, options);
1122
- case "RegExp":
1123
- return regexpEqual(leftHandOperand, rightHandOperand);
1124
- case "Generator":
1125
- return generatorEqual(leftHandOperand, rightHandOperand, options);
1126
- case "DataView":
1127
- return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
1128
- case "ArrayBuffer":
1129
- return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
1130
- case "Set":
1131
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1132
- case "Map":
1133
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1134
- case "Temporal.PlainDate":
1135
- case "Temporal.PlainTime":
1136
- case "Temporal.PlainDateTime":
1137
- case "Temporal.Instant":
1138
- case "Temporal.ZonedDateTime":
1139
- case "Temporal.PlainYearMonth":
1140
- case "Temporal.PlainMonthDay":
1141
- return leftHandOperand.equals(rightHandOperand);
1142
- case "Temporal.Duration":
1143
- return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds");
1144
- case "Temporal.TimeZone":
1145
- case "Temporal.Calendar":
1146
- return leftHandOperand.toString() === rightHandOperand.toString();
1147
- default:
1148
- return objectEqual(leftHandOperand, rightHandOperand, options);
1149
- }
1150
- }
1151
- __name(extensiveDeepEqualByType, "extensiveDeepEqualByType");
1152
- function regexpEqual(leftHandOperand, rightHandOperand) {
1153
- return leftHandOperand.toString() === rightHandOperand.toString();
1154
- }
1155
- __name(regexpEqual, "regexpEqual");
1156
- function entriesEqual(leftHandOperand, rightHandOperand, options) {
1157
- if (leftHandOperand.size !== rightHandOperand.size) {
1158
- return false;
1159
- }
1160
- if (leftHandOperand.size === 0) {
1161
- return true;
1162
- }
1163
- var leftHandItems = [];
1164
- var rightHandItems = [];
1165
- leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1166
- leftHandItems.push([key, value]);
1167
- }, "gatherEntries"));
1168
- rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1169
- rightHandItems.push([key, value]);
1170
- }, "gatherEntries"));
1171
- return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
1172
- }
1173
- __name(entriesEqual, "entriesEqual");
1174
- function iterableEqual(leftHandOperand, rightHandOperand, options) {
1175
- var length = leftHandOperand.length;
1176
- if (length !== rightHandOperand.length) {
1177
- return false;
1178
- }
1179
- if (length === 0) {
1180
- return true;
1181
- }
1182
- var index = -1;
1183
- while (++index < length) {
1184
- if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
1185
- return false;
1186
- }
1187
- }
1188
- return true;
1189
- }
1190
- __name(iterableEqual, "iterableEqual");
1191
- function generatorEqual(leftHandOperand, rightHandOperand, options) {
1192
- return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
1193
- }
1194
- __name(generatorEqual, "generatorEqual");
1195
- function hasIteratorFunction(target) {
1196
- return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
1197
- }
1198
- __name(hasIteratorFunction, "hasIteratorFunction");
1199
- function getIteratorEntries(target) {
1200
- if (hasIteratorFunction(target)) {
1201
- try {
1202
- return getGeneratorEntries(target[Symbol.iterator]());
1203
- } catch (iteratorError) {
1204
- return [];
1205
- }
1206
- }
1207
- return [];
1208
- }
1209
- __name(getIteratorEntries, "getIteratorEntries");
1210
- function getGeneratorEntries(generator) {
1211
- var generatorResult = generator.next();
1212
- var accumulator = [generatorResult.value];
1213
- while (generatorResult.done === false) {
1214
- generatorResult = generator.next();
1215
- accumulator.push(generatorResult.value);
1216
- }
1217
- return accumulator;
1218
- }
1219
- __name(getGeneratorEntries, "getGeneratorEntries");
1220
- function getEnumerableKeys(target) {
1221
- var keys = [];
1222
- for (var key in target) {
1223
- keys.push(key);
1224
- }
1225
- return keys;
1226
- }
1227
- __name(getEnumerableKeys, "getEnumerableKeys");
1228
- function getEnumerableSymbols(target) {
1229
- var keys = [];
1230
- var allKeys = Object.getOwnPropertySymbols(target);
1231
- for (var i = 0; i < allKeys.length; i += 1) {
1232
- var key = allKeys[i];
1233
- if (Object.getOwnPropertyDescriptor(target, key).enumerable) {
1234
- keys.push(key);
1235
- }
1236
- }
1237
- return keys;
1238
- }
1239
- __name(getEnumerableSymbols, "getEnumerableSymbols");
1240
- function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
1241
- var length = keys.length;
1242
- if (length === 0) {
1243
- return true;
1244
- }
1245
- for (var i = 0; i < length; i += 1) {
1246
- if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
1247
- return false;
1248
- }
1249
- }
1250
- return true;
1251
- }
1252
- __name(keysEqual, "keysEqual");
1253
- function objectEqual(leftHandOperand, rightHandOperand, options) {
1254
- var leftHandKeys = getEnumerableKeys(leftHandOperand);
1255
- var rightHandKeys = getEnumerableKeys(rightHandOperand);
1256
- var leftHandSymbols = getEnumerableSymbols(leftHandOperand);
1257
- var rightHandSymbols = getEnumerableSymbols(rightHandOperand);
1258
- leftHandKeys = leftHandKeys.concat(leftHandSymbols);
1259
- rightHandKeys = rightHandKeys.concat(rightHandSymbols);
1260
- if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
1261
- if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
1262
- return false;
1263
- }
1264
- return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
1265
- }
1266
- var leftHandEntries = getIteratorEntries(leftHandOperand);
1267
- var rightHandEntries = getIteratorEntries(rightHandOperand);
1268
- if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
1269
- leftHandEntries.sort();
1270
- rightHandEntries.sort();
1271
- return iterableEqual(leftHandEntries, rightHandEntries, options);
1272
- }
1273
- if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
1274
- return true;
1275
- }
1276
- return false;
1277
- }
1278
- __name(objectEqual, "objectEqual");
1279
- function isPrimitive(value) {
1280
- return value === null || typeof value !== "object";
1281
- }
1282
- __name(isPrimitive, "isPrimitive");
1283
- function mapSymbols(arr) {
1284
- return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) {
1285
- if (typeof entry === "symbol") {
1286
- return entry.toString();
1287
- }
1288
- return entry;
1289
- }, "mapSymbol"));
1290
- }
1291
- __name(mapSymbols, "mapSymbols");
1292
-
1293
- // node_modules/pathval/index.js
1294
- function hasProperty(obj, name) {
1295
- if (typeof obj === "undefined" || obj === null) {
1296
- return false;
1297
- }
1298
- return name in Object(obj);
1299
- }
1300
- __name(hasProperty, "hasProperty");
1301
- function parsePath(path) {
1302
- const str = path.replace(/([^\\])\[/g, "$1.[");
1303
- const parts = str.match(/(\\\.|[^.]+?)+/g);
1304
- return parts.map((value) => {
1305
- if (value === "constructor" || value === "__proto__" || value === "prototype") {
1306
- return {};
1307
- }
1308
- const regexp = /^\[(\d+)\]$/;
1309
- const mArr = regexp.exec(value);
1310
- let parsed = null;
1311
- if (mArr) {
1312
- parsed = { i: parseFloat(mArr[1]) };
1313
- } else {
1314
- parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
1315
- }
1316
- return parsed;
1317
- });
1318
- }
1319
- __name(parsePath, "parsePath");
1320
- function internalGetPathValue(obj, parsed, pathDepth) {
1321
- let temporaryValue = obj;
1322
- let res = null;
1323
- pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
1324
- for (let i = 0; i < pathDepth; i++) {
1325
- const part = parsed[i];
1326
- if (temporaryValue) {
1327
- if (typeof part.p === "undefined") {
1328
- temporaryValue = temporaryValue[part.i];
1329
- } else {
1330
- temporaryValue = temporaryValue[part.p];
1331
- }
1332
- if (i === pathDepth - 1) {
1333
- res = temporaryValue;
1334
- }
1335
- }
1336
- }
1337
- return res;
1338
- }
1339
- __name(internalGetPathValue, "internalGetPathValue");
1340
- function getPathInfo(obj, path) {
1341
- const parsed = parsePath(path);
1342
- const last = parsed[parsed.length - 1];
1343
- const info = {
1344
- parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
1345
- name: last.p || last.i,
1346
- value: internalGetPathValue(obj, parsed)
1347
- };
1348
- info.exists = hasProperty(info.parent, info.name);
1349
- return info;
1350
- }
1351
- __name(getPathInfo, "getPathInfo");
1352
-
1353
- // lib/chai/assertion.js
1354
- function Assertion(obj, msg, ssfi, lockSsfi) {
1355
- flag(this, "ssfi", ssfi || Assertion);
1356
- flag(this, "lockSsfi", lockSsfi);
1357
- flag(this, "object", obj);
1358
- flag(this, "message", msg);
1359
- return proxify(this);
1360
- }
1361
- __name(Assertion, "Assertion");
1362
- Object.defineProperty(Assertion, "includeStack", {
1363
- get: function() {
1364
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1365
- return config.includeStack;
1366
- },
1367
- set: function(value) {
1368
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1369
- config.includeStack = value;
1370
- }
1371
- });
1372
- Object.defineProperty(Assertion, "showDiff", {
1373
- get: function() {
1374
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1375
- return config.showDiff;
1376
- },
1377
- set: function(value) {
1378
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1379
- config.showDiff = value;
1380
- }
1381
- });
1382
- Assertion.addProperty = function(name, fn) {
1383
- addProperty(this.prototype, name, fn);
1384
- };
1385
- Assertion.addMethod = function(name, fn) {
1386
- addMethod(this.prototype, name, fn);
1387
- };
1388
- Assertion.addChainableMethod = function(name, fn, chainingBehavior) {
1389
- addChainableMethod(this.prototype, name, fn, chainingBehavior);
1390
- };
1391
- Assertion.overwriteProperty = function(name, fn) {
1392
- overwriteProperty(this.prototype, name, fn);
1393
- };
1394
- Assertion.overwriteMethod = function(name, fn) {
1395
- overwriteMethod(this.prototype, name, fn);
1396
- };
1397
- Assertion.overwriteChainableMethod = function(name, fn, chainingBehavior) {
1398
- overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
1399
- };
1400
- Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) {
1401
- var ok = test(this, arguments);
1402
- if (false !== showDiff)
1403
- showDiff = true;
1404
- if (void 0 === expected && void 0 === _actual)
1405
- showDiff = false;
1406
- if (true !== config.showDiff)
1407
- showDiff = false;
1408
- if (!ok) {
1409
- msg = getMessage2(this, arguments);
1410
- var actual = getActual(this, arguments);
1411
- var assertionErrorObjectProperties = {
1412
- actual,
1413
- expected,
1414
- showDiff
1415
- };
1416
- var operator = getOperator(this, arguments);
1417
- if (operator) {
1418
- assertionErrorObjectProperties.operator = operator;
1419
- }
1420
- throw new AssertionError(
1421
- msg,
1422
- assertionErrorObjectProperties,
1423
- config.includeStack ? this.assert : flag(this, "ssfi")
1424
- );
1425
- }
1426
- };
1427
- Object.defineProperty(
1428
- Assertion.prototype,
1429
- "_obj",
1430
- {
1431
- get: function() {
1432
- return flag(this, "object");
1433
- },
1434
- set: function(val) {
1435
- flag(this, "object", val);
1436
- }
1437
- }
1438
- );
1439
-
1440
- // lib/chai/utils/isProxyEnabled.js
1441
- function isProxyEnabled() {
1442
- return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
1443
- }
1444
- __name(isProxyEnabled, "isProxyEnabled");
1445
-
1446
- // lib/chai/utils/addProperty.js
1447
- function addProperty(ctx, name, getter) {
1448
- getter = getter === void 0 ? function() {
1449
- } : getter;
1450
- Object.defineProperty(
1451
- ctx,
1452
- name,
1453
- {
1454
- get: /* @__PURE__ */ __name(function propertyGetter() {
1455
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1456
- flag(this, "ssfi", propertyGetter);
1457
- }
1458
- var result = getter.call(this);
1459
- if (result !== void 0)
1460
- return result;
1461
- var newAssertion = new Assertion();
1462
- transferFlags(this, newAssertion);
1463
- return newAssertion;
1464
- }, "propertyGetter"),
1465
- configurable: true
1466
- }
1467
- );
1468
- }
1469
- __name(addProperty, "addProperty");
1470
-
1471
- // lib/chai/utils/addLengthGuard.js
1472
- var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
1473
- }, "length");
1474
- function addLengthGuard(fn, assertionName, isChainable) {
1475
- if (!fnLengthDesc.configurable)
1476
- return fn;
1477
- Object.defineProperty(fn, "length", {
1478
- get: function() {
1479
- if (isChainable) {
1480
- throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
1481
- }
1482
- throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".');
1483
- }
1484
- });
1485
- return fn;
1486
- }
1487
- __name(addLengthGuard, "addLengthGuard");
1488
-
1489
- // lib/chai/utils/getProperties.js
1490
- function getProperties(object) {
1491
- var result = Object.getOwnPropertyNames(object);
1492
- function addProperty2(property) {
1493
- if (result.indexOf(property) === -1) {
1494
- result.push(property);
1495
- }
1496
- }
1497
- __name(addProperty2, "addProperty");
1498
- var proto = Object.getPrototypeOf(object);
1499
- while (proto !== null) {
1500
- Object.getOwnPropertyNames(proto).forEach(addProperty2);
1501
- proto = Object.getPrototypeOf(proto);
1502
- }
1503
- return result;
1504
- }
1505
- __name(getProperties, "getProperties");
1506
-
1507
- // lib/chai/utils/proxify.js
1508
- var builtins = ["__flags", "__methods", "_obj", "assert"];
1509
- function proxify(obj, nonChainableMethodName) {
1510
- if (!isProxyEnabled())
1511
- return obj;
1512
- return new Proxy(obj, {
1513
- get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
1514
- if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
1515
- if (nonChainableMethodName) {
1516
- throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
1517
- }
1518
- var suggestion = null;
1519
- var suggestionDistance = 4;
1520
- getProperties(target).forEach(function(prop) {
1521
- if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) {
1522
- var dist = stringDistanceCapped(
1523
- property,
1524
- prop,
1525
- suggestionDistance
1526
- );
1527
- if (dist < suggestionDistance) {
1528
- suggestion = prop;
1529
- suggestionDistance = dist;
1530
- }
1531
- }
1532
- });
1533
- if (suggestion !== null) {
1534
- throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?');
1535
- } else {
1536
- throw Error("Invalid Chai property: " + property);
1537
- }
1538
- }
1539
- if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
1540
- flag(target, "ssfi", proxyGetter);
1541
- }
1542
- return Reflect.get(target, property);
1543
- }, "proxyGetter")
1544
- });
1545
- }
1546
- __name(proxify, "proxify");
1547
- function stringDistanceCapped(strA, strB, cap) {
1548
- if (Math.abs(strA.length - strB.length) >= cap) {
1549
- return cap;
1550
- }
1551
- var memo = [];
1552
- for (var i = 0; i <= strA.length; i++) {
1553
- memo[i] = Array(strB.length + 1).fill(0);
1554
- memo[i][0] = i;
1555
- }
1556
- for (var j = 0; j < strB.length; j++) {
1557
- memo[0][j] = j;
1558
- }
1559
- for (var i = 1; i <= strA.length; i++) {
1560
- var ch = strA.charCodeAt(i - 1);
1561
- for (var j = 1; j <= strB.length; j++) {
1562
- if (Math.abs(i - j) >= cap) {
1563
- memo[i][j] = cap;
1564
- continue;
1565
- }
1566
- memo[i][j] = Math.min(
1567
- memo[i - 1][j] + 1,
1568
- memo[i][j - 1] + 1,
1569
- memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1)
1570
- );
1571
- }
1572
- }
1573
- return memo[strA.length][strB.length];
1574
- }
1575
- __name(stringDistanceCapped, "stringDistanceCapped");
1576
-
1577
- // lib/chai/utils/addMethod.js
1578
- function addMethod(ctx, name, method) {
1579
- var methodWrapper = /* @__PURE__ */ __name(function() {
1580
- if (!flag(this, "lockSsfi")) {
1581
- flag(this, "ssfi", methodWrapper);
1582
- }
1583
- var result = method.apply(this, arguments);
1584
- if (result !== void 0)
1585
- return result;
1586
- var newAssertion = new Assertion();
1587
- transferFlags(this, newAssertion);
1588
- return newAssertion;
1589
- }, "methodWrapper");
1590
- addLengthGuard(methodWrapper, name, false);
1591
- ctx[name] = proxify(methodWrapper, name);
1592
- }
1593
- __name(addMethod, "addMethod");
1594
-
1595
- // lib/chai/utils/overwriteProperty.js
1596
- function overwriteProperty(ctx, name, getter) {
1597
- var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
1598
- }, "_super");
1599
- if (_get && "function" === typeof _get.get)
1600
- _super = _get.get;
1601
- Object.defineProperty(
1602
- ctx,
1603
- name,
1604
- {
1605
- get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
1606
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1607
- flag(this, "ssfi", overwritingPropertyGetter);
1608
- }
1609
- var origLockSsfi = flag(this, "lockSsfi");
1610
- flag(this, "lockSsfi", true);
1611
- var result = getter(_super).call(this);
1612
- flag(this, "lockSsfi", origLockSsfi);
1613
- if (result !== void 0) {
1614
- return result;
1615
- }
1616
- var newAssertion = new Assertion();
1617
- transferFlags(this, newAssertion);
1618
- return newAssertion;
1619
- }, "overwritingPropertyGetter"),
1620
- configurable: true
1621
- }
1622
- );
1623
- }
1624
- __name(overwriteProperty, "overwriteProperty");
1625
-
1626
- // lib/chai/utils/overwriteMethod.js
1627
- function overwriteMethod(ctx, name, method) {
1628
- var _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
1629
- throw new Error(name + " is not a function");
1630
- }, "_super");
1631
- if (_method && "function" === typeof _method)
1632
- _super = _method;
1633
- var overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
1634
- if (!flag(this, "lockSsfi")) {
1635
- flag(this, "ssfi", overwritingMethodWrapper);
1636
- }
1637
- var origLockSsfi = flag(this, "lockSsfi");
1638
- flag(this, "lockSsfi", true);
1639
- var result = method(_super).apply(this, arguments);
1640
- flag(this, "lockSsfi", origLockSsfi);
1641
- if (result !== void 0) {
1642
- return result;
1643
- }
1644
- var newAssertion = new Assertion();
1645
- transferFlags(this, newAssertion);
1646
- return newAssertion;
1647
- }, "overwritingMethodWrapper");
1648
- addLengthGuard(overwritingMethodWrapper, name, false);
1649
- ctx[name] = proxify(overwritingMethodWrapper, name);
1650
- }
1651
- __name(overwriteMethod, "overwriteMethod");
1652
-
1653
- // lib/chai/utils/addChainableMethod.js
1654
- var canSetPrototype = typeof Object.setPrototypeOf === "function";
1655
- var testFn = /* @__PURE__ */ __name(function() {
1656
- }, "testFn");
1657
- var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
1658
- var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
1659
- if (typeof propDesc !== "object")
1660
- return true;
1661
- return !propDesc.configurable;
1662
- });
1663
- var call = Function.prototype.call;
1664
- var apply = Function.prototype.apply;
1665
- function addChainableMethod(ctx, name, method, chainingBehavior) {
1666
- if (typeof chainingBehavior !== "function") {
1667
- chainingBehavior = /* @__PURE__ */ __name(function() {
1668
- }, "chainingBehavior");
1669
- }
1670
- var chainableBehavior = {
1671
- method,
1672
- chainingBehavior
1673
- };
1674
- if (!ctx.__methods) {
1675
- ctx.__methods = {};
1676
- }
1677
- ctx.__methods[name] = chainableBehavior;
1678
- Object.defineProperty(
1679
- ctx,
1680
- name,
1681
- {
1682
- get: /* @__PURE__ */ __name(function chainableMethodGetter() {
1683
- chainableBehavior.chainingBehavior.call(this);
1684
- var chainableMethodWrapper = /* @__PURE__ */ __name(function() {
1685
- if (!flag(this, "lockSsfi")) {
1686
- flag(this, "ssfi", chainableMethodWrapper);
1687
- }
1688
- var result = chainableBehavior.method.apply(this, arguments);
1689
- if (result !== void 0) {
1690
- return result;
1691
- }
1692
- var newAssertion = new Assertion();
1693
- transferFlags(this, newAssertion);
1694
- return newAssertion;
1695
- }, "chainableMethodWrapper");
1696
- addLengthGuard(chainableMethodWrapper, name, true);
1697
- if (canSetPrototype) {
1698
- var prototype = Object.create(this);
1699
- prototype.call = call;
1700
- prototype.apply = apply;
1701
- Object.setPrototypeOf(chainableMethodWrapper, prototype);
1702
- } else {
1703
- var asserterNames = Object.getOwnPropertyNames(ctx);
1704
- asserterNames.forEach(function(asserterName) {
1705
- if (excludeNames.indexOf(asserterName) !== -1) {
1706
- return;
1707
- }
1708
- var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
1709
- Object.defineProperty(chainableMethodWrapper, asserterName, pd);
1710
- });
1711
- }
1712
- transferFlags(this, chainableMethodWrapper);
1713
- return proxify(chainableMethodWrapper);
1714
- }, "chainableMethodGetter"),
1715
- configurable: true
1716
- }
1717
- );
1718
- }
1719
- __name(addChainableMethod, "addChainableMethod");
1720
-
1721
- // lib/chai/utils/overwriteChainableMethod.js
1722
- function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
1723
- var chainableBehavior = ctx.__methods[name];
1724
- var _chainingBehavior = chainableBehavior.chainingBehavior;
1725
- chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
1726
- var result = chainingBehavior(_chainingBehavior).call(this);
1727
- if (result !== void 0) {
1728
- return result;
1729
- }
1730
- var newAssertion = new Assertion();
1731
- transferFlags(this, newAssertion);
1732
- return newAssertion;
1733
- }, "overwritingChainableMethodGetter");
1734
- var _method = chainableBehavior.method;
1735
- chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
1736
- var result = method(_method).apply(this, arguments);
1737
- if (result !== void 0) {
1738
- return result;
1739
- }
1740
- var newAssertion = new Assertion();
1741
- transferFlags(this, newAssertion);
1742
- return newAssertion;
1743
- }, "overwritingChainableMethodWrapper");
1744
- }
1745
- __name(overwriteChainableMethod, "overwriteChainableMethod");
1746
-
1747
- // lib/chai/utils/compareByInspect.js
1748
- function compareByInspect(a, b) {
1749
- return inspect2(a) < inspect2(b) ? -1 : 1;
1750
- }
1751
- __name(compareByInspect, "compareByInspect");
1752
-
1753
- // lib/chai/utils/getOwnEnumerablePropertySymbols.js
1754
- function getOwnEnumerablePropertySymbols(obj) {
1755
- if (typeof Object.getOwnPropertySymbols !== "function")
1756
- return [];
1757
- return Object.getOwnPropertySymbols(obj).filter(function(sym) {
1758
- return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
1759
- });
1760
- }
1761
- __name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
1762
-
1763
- // lib/chai/utils/getOwnEnumerableProperties.js
1764
- function getOwnEnumerableProperties(obj) {
1765
- return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
1766
- }
1767
- __name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
1768
-
1769
- // lib/chai/utils/isNaN.js
1770
- function _isNaN(value) {
1771
- return value !== value;
1772
- }
1773
- __name(_isNaN, "_isNaN");
1774
- var isNaN2 = Number.isNaN || _isNaN;
1775
-
1776
- // lib/chai/utils/getOperator.js
1777
- function isObjectType(obj) {
1778
- var objectType = type(obj);
1779
- var objectTypes = ["Array", "Object", "Function"];
1780
- return objectTypes.indexOf(objectType) !== -1;
1781
- }
1782
- __name(isObjectType, "isObjectType");
1783
- function getOperator(obj, args) {
1784
- var operator = flag(obj, "operator");
1785
- var negate = flag(obj, "negate");
1786
- var expected = args[3];
1787
- var msg = negate ? args[2] : args[1];
1788
- if (operator) {
1789
- return operator;
1790
- }
1791
- if (typeof msg === "function")
1792
- msg = msg();
1793
- msg = msg || "";
1794
- if (!msg) {
1795
- return void 0;
1796
- }
1797
- if (/\shave\s/.test(msg)) {
1798
- return void 0;
1799
- }
1800
- var isObject = isObjectType(expected);
1801
- if (/\snot\s/.test(msg)) {
1802
- return isObject ? "notDeepStrictEqual" : "notStrictEqual";
1803
- }
1804
- return isObject ? "deepStrictEqual" : "strictEqual";
1805
- }
1806
- __name(getOperator, "getOperator");
1807
-
1808
- // lib/chai/utils/index.js
1809
- function getName(fn) {
1810
- return fn.name;
1811
- }
1812
- __name(getName, "getName");
1813
-
1814
- // lib/chai/core/assertions.js
1815
- var { flag: flag2 } = utils_exports;
1816
- [
1817
- "to",
1818
- "be",
1819
- "been",
1820
- "is",
1821
- "and",
1822
- "has",
1823
- "have",
1824
- "with",
1825
- "that",
1826
- "which",
1827
- "at",
1828
- "of",
1829
- "same",
1830
- "but",
1831
- "does",
1832
- "still",
1833
- "also"
1834
- ].forEach(function(chain) {
1835
- Assertion.addProperty(chain);
1836
- });
1837
- Assertion.addProperty("not", function() {
1838
- flag2(this, "negate", true);
1839
- });
1840
- Assertion.addProperty("deep", function() {
1841
- flag2(this, "deep", true);
1842
- });
1843
- Assertion.addProperty("nested", function() {
1844
- flag2(this, "nested", true);
1845
- });
1846
- Assertion.addProperty("own", function() {
1847
- flag2(this, "own", true);
1848
- });
1849
- Assertion.addProperty("ordered", function() {
1850
- flag2(this, "ordered", true);
1851
- });
1852
- Assertion.addProperty("any", function() {
1853
- flag2(this, "any", true);
1854
- flag2(this, "all", false);
1855
- });
1856
- Assertion.addProperty("all", function() {
1857
- flag2(this, "all", true);
1858
- flag2(this, "any", false);
1859
- });
1860
- function an(type3, msg) {
1861
- if (msg)
1862
- flag2(this, "message", msg);
1863
- type3 = type3.toLowerCase();
1864
- var obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
1865
- this.assert(
1866
- type3 === type(obj).toLowerCase(),
1867
- "expected #{this} to be " + article + type3,
1868
- "expected #{this} not to be " + article + type3
1869
- );
1870
- }
1871
- __name(an, "an");
1872
- Assertion.addChainableMethod("an", an);
1873
- Assertion.addChainableMethod("a", an);
1874
- function SameValueZero(a, b) {
1875
- return isNaN2(a) && isNaN2(b) || a === b;
1876
- }
1877
- __name(SameValueZero, "SameValueZero");
1878
- function includeChainingBehavior() {
1879
- flag2(this, "contains", true);
1880
- }
1881
- __name(includeChainingBehavior, "includeChainingBehavior");
1882
- function include(val, msg) {
1883
- if (msg)
1884
- flag2(this, "message", msg);
1885
- 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 " : "";
1886
- flagMsg = flagMsg ? flagMsg + ": " : "";
1887
- var included = false;
1888
- switch (objType) {
1889
- case "string":
1890
- included = obj.indexOf(val) !== -1;
1891
- break;
1892
- case "weakset":
1893
- if (isDeep) {
1894
- throw new AssertionError(
1895
- flagMsg + "unable to use .deep.include with WeakSet",
1896
- void 0,
1897
- ssfi
1898
- );
1899
- }
1900
- included = obj.has(val);
1901
- break;
1902
- case "map":
1903
- var isEql = isDeep ? deep_eql_default : SameValueZero;
1904
- obj.forEach(function(item) {
1905
- included = included || isEql(item, val);
1906
- });
1907
- break;
1908
- case "set":
1909
- if (isDeep) {
1910
- obj.forEach(function(item) {
1911
- included = included || deep_eql_default(item, val);
1912
- });
1913
- } else {
1914
- included = obj.has(val);
1915
- }
1916
- break;
1917
- case "array":
1918
- if (isDeep) {
1919
- included = obj.some(function(item) {
1920
- return deep_eql_default(item, val);
1921
- });
1922
- } else {
1923
- included = obj.indexOf(val) !== -1;
1924
- }
1925
- break;
1926
- default:
1927
- if (val !== Object(val)) {
1928
- throw new AssertionError(
1929
- 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(),
1930
- void 0,
1931
- ssfi
1932
- );
1933
- }
1934
- var props = Object.keys(val), firstErr = null, numErrs = 0;
1935
- props.forEach(function(prop) {
1936
- var propAssertion = new Assertion(obj);
1937
- transferFlags(this, propAssertion, true);
1938
- flag2(propAssertion, "lockSsfi", true);
1939
- if (!negate || props.length === 1) {
1940
- propAssertion.property(prop, val[prop]);
1941
- return;
1942
- }
1943
- try {
1944
- propAssertion.property(prop, val[prop]);
1945
- } catch (err) {
1946
- if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
1947
- throw err;
1948
- }
1949
- if (firstErr === null)
1950
- firstErr = err;
1951
- numErrs++;
1952
- }
1953
- }, this);
1954
- if (negate && props.length > 1 && numErrs === props.length) {
1955
- throw firstErr;
1956
- }
1957
- return;
1958
- }
1959
- this.assert(
1960
- included,
1961
- "expected #{this} to " + descriptor + "include " + inspect2(val),
1962
- "expected #{this} to not " + descriptor + "include " + inspect2(val)
1963
- );
1964
- }
1965
- __name(include, "include");
1966
- Assertion.addChainableMethod("include", include, includeChainingBehavior);
1967
- Assertion.addChainableMethod("contain", include, includeChainingBehavior);
1968
- Assertion.addChainableMethod("contains", include, includeChainingBehavior);
1969
- Assertion.addChainableMethod("includes", include, includeChainingBehavior);
1970
- Assertion.addProperty("ok", function() {
1971
- this.assert(
1972
- flag2(this, "object"),
1973
- "expected #{this} to be truthy",
1974
- "expected #{this} to be falsy"
1975
- );
1976
- });
1977
- Assertion.addProperty("true", function() {
1978
- this.assert(
1979
- true === flag2(this, "object"),
1980
- "expected #{this} to be true",
1981
- "expected #{this} to be false",
1982
- flag2(this, "negate") ? false : true
1983
- );
1984
- });
1985
- Assertion.addProperty("false", function() {
1986
- this.assert(
1987
- false === flag2(this, "object"),
1988
- "expected #{this} to be false",
1989
- "expected #{this} to be true",
1990
- flag2(this, "negate") ? true : false
1991
- );
1992
- });
1993
- Assertion.addProperty("null", function() {
1994
- this.assert(
1995
- null === flag2(this, "object"),
1996
- "expected #{this} to be null",
1997
- "expected #{this} not to be null"
1998
- );
1999
- });
2000
- Assertion.addProperty("undefined", function() {
2001
- this.assert(
2002
- void 0 === flag2(this, "object"),
2003
- "expected #{this} to be undefined",
2004
- "expected #{this} not to be undefined"
2005
- );
2006
- });
2007
- Assertion.addProperty("NaN", function() {
2008
- this.assert(
2009
- isNaN2(flag2(this, "object")),
2010
- "expected #{this} to be NaN",
2011
- "expected #{this} not to be NaN"
2012
- );
2013
- });
2014
- function assertExist() {
2015
- var val = flag2(this, "object");
2016
- this.assert(
2017
- val !== null && val !== void 0,
2018
- "expected #{this} to exist",
2019
- "expected #{this} to not exist"
2020
- );
2021
- }
2022
- __name(assertExist, "assertExist");
2023
- Assertion.addProperty("exist", assertExist);
2024
- Assertion.addProperty("exists", assertExist);
2025
- Assertion.addProperty("empty", function() {
2026
- var val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
2027
- flagMsg = flagMsg ? flagMsg + ": " : "";
2028
- switch (type(val).toLowerCase()) {
2029
- case "array":
2030
- case "string":
2031
- itemsCount = val.length;
2032
- break;
2033
- case "map":
2034
- case "set":
2035
- itemsCount = val.size;
2036
- break;
2037
- case "weakmap":
2038
- case "weakset":
2039
- throw new AssertionError(
2040
- flagMsg + ".empty was passed a weak collection",
2041
- void 0,
2042
- ssfi
2043
- );
2044
- case "function":
2045
- var msg = flagMsg + ".empty was passed a function " + getName(val);
2046
- throw new AssertionError(msg.trim(), void 0, ssfi);
2047
- default:
2048
- if (val !== Object(val)) {
2049
- throw new AssertionError(
2050
- flagMsg + ".empty was passed non-string primitive " + inspect2(val),
2051
- void 0,
2052
- ssfi
2053
- );
2054
- }
2055
- itemsCount = Object.keys(val).length;
2056
- }
2057
- this.assert(
2058
- 0 === itemsCount,
2059
- "expected #{this} to be empty",
2060
- "expected #{this} not to be empty"
2061
- );
2062
- });
2063
- function checkArguments() {
2064
- var obj = flag2(this, "object"), type3 = type(obj);
2065
- this.assert(
2066
- "Arguments" === type3,
2067
- "expected #{this} to be arguments but got " + type3,
2068
- "expected #{this} to not be arguments"
2069
- );
2070
- }
2071
- __name(checkArguments, "checkArguments");
2072
- Assertion.addProperty("arguments", checkArguments);
2073
- Assertion.addProperty("Arguments", checkArguments);
2074
- function assertEqual(val, msg) {
2075
- if (msg)
2076
- flag2(this, "message", msg);
2077
- var obj = flag2(this, "object");
2078
- if (flag2(this, "deep")) {
2079
- var prevLockSsfi = flag2(this, "lockSsfi");
2080
- flag2(this, "lockSsfi", true);
2081
- this.eql(val);
2082
- flag2(this, "lockSsfi", prevLockSsfi);
2083
- } else {
2084
- this.assert(
2085
- val === obj,
2086
- "expected #{this} to equal #{exp}",
2087
- "expected #{this} to not equal #{exp}",
2088
- val,
2089
- this._obj,
2090
- true
2091
- );
2092
- }
2093
- }
2094
- __name(assertEqual, "assertEqual");
2095
- Assertion.addMethod("equal", assertEqual);
2096
- Assertion.addMethod("equals", assertEqual);
2097
- Assertion.addMethod("eq", assertEqual);
2098
- function assertEql(obj, msg) {
2099
- if (msg)
2100
- flag2(this, "message", msg);
2101
- this.assert(
2102
- deep_eql_default(obj, flag2(this, "object")),
2103
- "expected #{this} to deeply equal #{exp}",
2104
- "expected #{this} to not deeply equal #{exp}",
2105
- obj,
2106
- this._obj,
2107
- true
2108
- );
2109
- }
2110
- __name(assertEql, "assertEql");
2111
- Assertion.addMethod("eql", assertEql);
2112
- Assertion.addMethod("eqls", assertEql);
2113
- function assertAbove(n, msg) {
2114
- if (msg)
2115
- flag2(this, "message", msg);
2116
- 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;
2117
- if (doLength && objType !== "map" && objType !== "set") {
2118
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2119
- }
2120
- if (!doLength && (objType === "date" && nType !== "date")) {
2121
- errorMessage = msgPrefix + "the argument to above must be a date";
2122
- } else if (nType !== "number" && (doLength || objType === "number")) {
2123
- errorMessage = msgPrefix + "the argument to above must be a number";
2124
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2125
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2126
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2127
- } else {
2128
- shouldThrow = false;
2129
- }
2130
- if (shouldThrow) {
2131
- throw new AssertionError(errorMessage, void 0, ssfi);
2132
- }
2133
- if (doLength) {
2134
- var descriptor = "length", itemsCount;
2135
- if (objType === "map" || objType === "set") {
2136
- descriptor = "size";
2137
- itemsCount = obj.size;
2138
- } else {
2139
- itemsCount = obj.length;
2140
- }
2141
- this.assert(
2142
- itemsCount > n,
2143
- "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}",
2144
- "expected #{this} to not have a " + descriptor + " above #{exp}",
2145
- n,
2146
- itemsCount
2147
- );
2148
- } else {
2149
- this.assert(
2150
- obj > n,
2151
- "expected #{this} to be above #{exp}",
2152
- "expected #{this} to be at most #{exp}",
2153
- n
2154
- );
2155
- }
2156
- }
2157
- __name(assertAbove, "assertAbove");
2158
- Assertion.addMethod("above", assertAbove);
2159
- Assertion.addMethod("gt", assertAbove);
2160
- Assertion.addMethod("greaterThan", assertAbove);
2161
- function assertLeast(n, msg) {
2162
- if (msg)
2163
- flag2(this, "message", msg);
2164
- 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;
2165
- if (doLength && objType !== "map" && objType !== "set") {
2166
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2167
- }
2168
- if (!doLength && (objType === "date" && nType !== "date")) {
2169
- errorMessage = msgPrefix + "the argument to least must be a date";
2170
- } else if (nType !== "number" && (doLength || objType === "number")) {
2171
- errorMessage = msgPrefix + "the argument to least must be a number";
2172
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2173
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2174
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2175
- } else {
2176
- shouldThrow = false;
2177
- }
2178
- if (shouldThrow) {
2179
- throw new AssertionError(errorMessage, void 0, ssfi);
2180
- }
2181
- if (doLength) {
2182
- var descriptor = "length", itemsCount;
2183
- if (objType === "map" || objType === "set") {
2184
- descriptor = "size";
2185
- itemsCount = obj.size;
2186
- } else {
2187
- itemsCount = obj.length;
2188
- }
2189
- this.assert(
2190
- itemsCount >= n,
2191
- "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}",
2192
- "expected #{this} to have a " + descriptor + " below #{exp}",
2193
- n,
2194
- itemsCount
2195
- );
2196
- } else {
2197
- this.assert(
2198
- obj >= n,
2199
- "expected #{this} to be at least #{exp}",
2200
- "expected #{this} to be below #{exp}",
2201
- n
2202
- );
2203
- }
2204
- }
2205
- __name(assertLeast, "assertLeast");
2206
- Assertion.addMethod("least", assertLeast);
2207
- Assertion.addMethod("gte", assertLeast);
2208
- Assertion.addMethod("greaterThanOrEqual", assertLeast);
2209
- function assertBelow(n, msg) {
2210
- if (msg)
2211
- flag2(this, "message", msg);
2212
- 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;
2213
- if (doLength && objType !== "map" && objType !== "set") {
2214
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2215
- }
2216
- if (!doLength && (objType === "date" && nType !== "date")) {
2217
- errorMessage = msgPrefix + "the argument to below must be a date";
2218
- } else if (nType !== "number" && (doLength || objType === "number")) {
2219
- errorMessage = msgPrefix + "the argument to below must be a number";
2220
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2221
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2222
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2223
- } else {
2224
- shouldThrow = false;
2225
- }
2226
- if (shouldThrow) {
2227
- throw new AssertionError(errorMessage, void 0, ssfi);
2228
- }
2229
- if (doLength) {
2230
- var descriptor = "length", itemsCount;
2231
- if (objType === "map" || objType === "set") {
2232
- descriptor = "size";
2233
- itemsCount = obj.size;
2234
- } else {
2235
- itemsCount = obj.length;
2236
- }
2237
- this.assert(
2238
- itemsCount < n,
2239
- "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}",
2240
- "expected #{this} to not have a " + descriptor + " below #{exp}",
2241
- n,
2242
- itemsCount
2243
- );
2244
- } else {
2245
- this.assert(
2246
- obj < n,
2247
- "expected #{this} to be below #{exp}",
2248
- "expected #{this} to be at least #{exp}",
2249
- n
2250
- );
2251
- }
2252
- }
2253
- __name(assertBelow, "assertBelow");
2254
- Assertion.addMethod("below", assertBelow);
2255
- Assertion.addMethod("lt", assertBelow);
2256
- Assertion.addMethod("lessThan", assertBelow);
2257
- function assertMost(n, msg) {
2258
- if (msg)
2259
- flag2(this, "message", msg);
2260
- 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;
2261
- if (doLength && objType !== "map" && objType !== "set") {
2262
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2263
- }
2264
- if (!doLength && (objType === "date" && nType !== "date")) {
2265
- errorMessage = msgPrefix + "the argument to most must be a date";
2266
- } else if (nType !== "number" && (doLength || objType === "number")) {
2267
- errorMessage = msgPrefix + "the argument to most must be a number";
2268
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2269
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2270
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2271
- } else {
2272
- shouldThrow = false;
2273
- }
2274
- if (shouldThrow) {
2275
- throw new AssertionError(errorMessage, void 0, ssfi);
2276
- }
2277
- if (doLength) {
2278
- var descriptor = "length", itemsCount;
2279
- if (objType === "map" || objType === "set") {
2280
- descriptor = "size";
2281
- itemsCount = obj.size;
2282
- } else {
2283
- itemsCount = obj.length;
2284
- }
2285
- this.assert(
2286
- itemsCount <= n,
2287
- "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}",
2288
- "expected #{this} to have a " + descriptor + " above #{exp}",
2289
- n,
2290
- itemsCount
2291
- );
2292
- } else {
2293
- this.assert(
2294
- obj <= n,
2295
- "expected #{this} to be at most #{exp}",
2296
- "expected #{this} to be above #{exp}",
2297
- n
2298
- );
2299
- }
2300
- }
2301
- __name(assertMost, "assertMost");
2302
- Assertion.addMethod("most", assertMost);
2303
- Assertion.addMethod("lte", assertMost);
2304
- Assertion.addMethod("lessThanOrEqual", assertMost);
2305
- Assertion.addMethod("within", function(start, finish, msg) {
2306
- if (msg)
2307
- flag2(this, "message", msg);
2308
- 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;
2309
- if (doLength && objType !== "map" && objType !== "set") {
2310
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2311
- }
2312
- if (!doLength && (objType === "date" && (startType !== "date" || finishType !== "date"))) {
2313
- errorMessage = msgPrefix + "the arguments to within must be dates";
2314
- } else if ((startType !== "number" || finishType !== "number") && (doLength || objType === "number")) {
2315
- errorMessage = msgPrefix + "the arguments to within must be numbers";
2316
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2317
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2318
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2319
- } else {
2320
- shouldThrow = false;
2321
- }
2322
- if (shouldThrow) {
2323
- throw new AssertionError(errorMessage, void 0, ssfi);
2324
- }
2325
- if (doLength) {
2326
- var descriptor = "length", itemsCount;
2327
- if (objType === "map" || objType === "set") {
2328
- descriptor = "size";
2329
- itemsCount = obj.size;
2330
- } else {
2331
- itemsCount = obj.length;
2332
- }
2333
- this.assert(
2334
- itemsCount >= start && itemsCount <= finish,
2335
- "expected #{this} to have a " + descriptor + " within " + range,
2336
- "expected #{this} to not have a " + descriptor + " within " + range
2337
- );
2338
- } else {
2339
- this.assert(
2340
- obj >= start && obj <= finish,
2341
- "expected #{this} to be within " + range,
2342
- "expected #{this} to not be within " + range
2343
- );
2344
- }
2345
- });
2346
- function assertInstanceOf(constructor, msg) {
2347
- if (msg)
2348
- flag2(this, "message", msg);
2349
- var target = flag2(this, "object");
2350
- var ssfi = flag2(this, "ssfi");
2351
- var flagMsg = flag2(this, "message");
2352
- try {
2353
- var isInstanceOf = target instanceof constructor;
2354
- } catch (err) {
2355
- if (err instanceof TypeError) {
2356
- flagMsg = flagMsg ? flagMsg + ": " : "";
2357
- throw new AssertionError(
2358
- flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.",
2359
- void 0,
2360
- ssfi
2361
- );
2362
- }
2363
- throw err;
2364
- }
2365
- var name = getName(constructor);
2366
- if (name == null) {
2367
- name = "an unnamed constructor";
2368
- }
2369
- this.assert(
2370
- isInstanceOf,
2371
- "expected #{this} to be an instance of " + name,
2372
- "expected #{this} to not be an instance of " + name
2373
- );
2374
- }
2375
- __name(assertInstanceOf, "assertInstanceOf");
2376
- Assertion.addMethod("instanceof", assertInstanceOf);
2377
- Assertion.addMethod("instanceOf", assertInstanceOf);
2378
- function assertProperty(name, val, msg) {
2379
- if (msg)
2380
- flag2(this, "message", msg);
2381
- var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
2382
- flagMsg = flagMsg ? flagMsg + ": " : "";
2383
- if (isNested) {
2384
- if (nameType !== "string") {
2385
- throw new AssertionError(
2386
- flagMsg + "the argument to property must be a string when using nested syntax",
2387
- void 0,
2388
- ssfi
2389
- );
2390
- }
2391
- } else {
2392
- if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
2393
- throw new AssertionError(
2394
- flagMsg + "the argument to property must be a string, number, or symbol",
2395
- void 0,
2396
- ssfi
2397
- );
2398
- }
2399
- }
2400
- if (isNested && isOwn) {
2401
- throw new AssertionError(
2402
- flagMsg + 'The "nested" and "own" flags cannot be combined.',
2403
- void 0,
2404
- ssfi
2405
- );
2406
- }
2407
- if (obj === null || obj === void 0) {
2408
- throw new AssertionError(
2409
- flagMsg + "Target cannot be null or undefined.",
2410
- void 0,
2411
- ssfi
2412
- );
2413
- }
2414
- var isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name];
2415
- var descriptor = "";
2416
- if (isDeep)
2417
- descriptor += "deep ";
2418
- if (isOwn)
2419
- descriptor += "own ";
2420
- if (isNested)
2421
- descriptor += "nested ";
2422
- descriptor += "property ";
2423
- var hasProperty2;
2424
- if (isOwn)
2425
- hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
2426
- else if (isNested)
2427
- hasProperty2 = pathInfo.exists;
2428
- else
2429
- hasProperty2 = hasProperty(obj, name);
2430
- if (!negate || arguments.length === 1) {
2431
- this.assert(
2432
- hasProperty2,
2433
- "expected #{this} to have " + descriptor + inspect2(name),
2434
- "expected #{this} to not have " + descriptor + inspect2(name)
2435
- );
2436
- }
2437
- if (arguments.length > 1) {
2438
- this.assert(
2439
- hasProperty2 && (isDeep ? deep_eql_default(val, value) : val === value),
2440
- "expected #{this} to have " + descriptor + inspect2(name) + " of #{exp}, but got #{act}",
2441
- "expected #{this} to not have " + descriptor + inspect2(name) + " of #{act}",
2442
- val,
2443
- value
2444
- );
2445
- }
2446
- flag2(this, "object", value);
2447
- }
2448
- __name(assertProperty, "assertProperty");
2449
- Assertion.addMethod("property", assertProperty);
2450
- function assertOwnProperty(name, value, msg) {
2451
- flag2(this, "own", true);
2452
- assertProperty.apply(this, arguments);
2453
- }
2454
- __name(assertOwnProperty, "assertOwnProperty");
2455
- Assertion.addMethod("ownProperty", assertOwnProperty);
2456
- Assertion.addMethod("haveOwnProperty", assertOwnProperty);
2457
- function assertOwnPropertyDescriptor(name, descriptor, msg) {
2458
- if (typeof descriptor === "string") {
2459
- msg = descriptor;
2460
- descriptor = null;
2461
- }
2462
- if (msg)
2463
- flag2(this, "message", msg);
2464
- var obj = flag2(this, "object");
2465
- var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
2466
- if (actualDescriptor && descriptor) {
2467
- this.assert(
2468
- deep_eql_default(descriptor, actualDescriptor),
2469
- "expected the own property descriptor for " + inspect2(name) + " on #{this} to match " + inspect2(descriptor) + ", got " + inspect2(actualDescriptor),
2470
- "expected the own property descriptor for " + inspect2(name) + " on #{this} to not match " + inspect2(descriptor),
2471
- descriptor,
2472
- actualDescriptor,
2473
- true
2474
- );
2475
- } else {
2476
- this.assert(
2477
- actualDescriptor,
2478
- "expected #{this} to have an own property descriptor for " + inspect2(name),
2479
- "expected #{this} to not have an own property descriptor for " + inspect2(name)
2480
- );
2481
- }
2482
- flag2(this, "object", actualDescriptor);
2483
- }
2484
- __name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor");
2485
- Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
2486
- Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
2487
- function assertLengthChain() {
2488
- flag2(this, "doLength", true);
2489
- }
2490
- __name(assertLengthChain, "assertLengthChain");
2491
- function assertLength(n, msg) {
2492
- if (msg)
2493
- flag2(this, "message", msg);
2494
- var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
2495
- switch (objType) {
2496
- case "map":
2497
- case "set":
2498
- descriptor = "size";
2499
- itemsCount = obj.size;
2500
- break;
2501
- default:
2502
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2503
- itemsCount = obj.length;
2504
- }
2505
- this.assert(
2506
- itemsCount == n,
2507
- "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}",
2508
- "expected #{this} to not have a " + descriptor + " of #{act}",
2509
- n,
2510
- itemsCount
2511
- );
2512
- }
2513
- __name(assertLength, "assertLength");
2514
- Assertion.addChainableMethod("length", assertLength, assertLengthChain);
2515
- Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
2516
- function assertMatch(re, msg) {
2517
- if (msg)
2518
- flag2(this, "message", msg);
2519
- var obj = flag2(this, "object");
2520
- this.assert(
2521
- re.exec(obj),
2522
- "expected #{this} to match " + re,
2523
- "expected #{this} not to match " + re
2524
- );
2525
- }
2526
- __name(assertMatch, "assertMatch");
2527
- Assertion.addMethod("match", assertMatch);
2528
- Assertion.addMethod("matches", assertMatch);
2529
- Assertion.addMethod("string", function(str, msg) {
2530
- if (msg)
2531
- flag2(this, "message", msg);
2532
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2533
- new Assertion(obj, flagMsg, ssfi, true).is.a("string");
2534
- this.assert(
2535
- ~obj.indexOf(str),
2536
- "expected #{this} to contain " + inspect2(str),
2537
- "expected #{this} to not contain " + inspect2(str)
2538
- );
2539
- });
2540
- function assertKeys(keys) {
2541
- var obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
2542
- flagMsg = flagMsg ? flagMsg + ": " : "";
2543
- 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";
2544
- if (objType === "Map" || objType === "Set") {
2545
- deepStr = isDeep ? "deeply " : "";
2546
- actual = [];
2547
- obj.forEach(function(val, key) {
2548
- actual.push(key);
2549
- });
2550
- if (keysType !== "Array") {
2551
- keys = Array.prototype.slice.call(arguments);
2552
- }
2553
- } else {
2554
- actual = getOwnEnumerableProperties(obj);
2555
- switch (keysType) {
2556
- case "Array":
2557
- if (arguments.length > 1) {
2558
- throw new AssertionError(mixedArgsMsg, void 0, ssfi);
2559
- }
2560
- break;
2561
- case "Object":
2562
- if (arguments.length > 1) {
2563
- throw new AssertionError(mixedArgsMsg, void 0, ssfi);
2564
- }
2565
- keys = Object.keys(keys);
2566
- break;
2567
- default:
2568
- keys = Array.prototype.slice.call(arguments);
2569
- }
2570
- keys = keys.map(function(val) {
2571
- return typeof val === "symbol" ? val : String(val);
2572
- });
2573
- }
2574
- if (!keys.length) {
2575
- throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
2576
- }
2577
- var len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys;
2578
- if (!any && !all) {
2579
- all = true;
2580
- }
2581
- if (any) {
2582
- ok = expected.some(function(expectedKey) {
2583
- return actual.some(function(actualKey) {
2584
- if (isDeep) {
2585
- return deep_eql_default(expectedKey, actualKey);
2586
- } else {
2587
- return expectedKey === actualKey;
2588
- }
2589
- });
2590
- });
2591
- }
2592
- if (all) {
2593
- ok = expected.every(function(expectedKey) {
2594
- return actual.some(function(actualKey) {
2595
- if (isDeep) {
2596
- return deep_eql_default(expectedKey, actualKey);
2597
- } else {
2598
- return expectedKey === actualKey;
2599
- }
2600
- });
2601
- });
2602
- if (!flag2(this, "contains")) {
2603
- ok = ok && keys.length == actual.length;
2604
- }
2605
- }
2606
- if (len > 1) {
2607
- keys = keys.map(function(key) {
2608
- return inspect2(key);
2609
- });
2610
- var last = keys.pop();
2611
- if (all) {
2612
- str = keys.join(", ") + ", and " + last;
2613
- }
2614
- if (any) {
2615
- str = keys.join(", ") + ", or " + last;
2616
- }
2617
- } else {
2618
- str = inspect2(keys[0]);
2619
- }
2620
- str = (len > 1 ? "keys " : "key ") + str;
2621
- str = (flag2(this, "contains") ? "contain " : "have ") + str;
2622
- this.assert(
2623
- ok,
2624
- "expected #{this} to " + deepStr + str,
2625
- "expected #{this} to not " + deepStr + str,
2626
- expected.slice(0).sort(compareByInspect),
2627
- actual.sort(compareByInspect),
2628
- true
2629
- );
2630
- }
2631
- __name(assertKeys, "assertKeys");
2632
- Assertion.addMethod("keys", assertKeys);
2633
- Assertion.addMethod("key", assertKeys);
2634
- function assertThrows(errorLike, errMsgMatcher, msg) {
2635
- if (msg)
2636
- flag2(this, "message", msg);
2637
- var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
2638
- new Assertion(obj, flagMsg, ssfi, true).is.a("function");
2639
- if (errorLike instanceof RegExp || typeof errorLike === "string") {
2640
- errMsgMatcher = errorLike;
2641
- errorLike = null;
2642
- }
2643
- var caughtErr;
2644
- try {
2645
- obj();
2646
- } catch (err) {
2647
- caughtErr = err;
2648
- }
2649
- var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
2650
- var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
2651
- var errorLikeFail = false;
2652
- var errMsgMatcherFail = false;
2653
- if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
2654
- var errorLikeString = "an error";
2655
- if (errorLike instanceof Error) {
2656
- errorLikeString = "#{exp}";
2657
- } else if (errorLike) {
2658
- errorLikeString = check_error_exports.getConstructorName(errorLike);
2659
- }
2660
- this.assert(
2661
- caughtErr,
2662
- "expected #{this} to throw " + errorLikeString,
2663
- "expected #{this} to not throw an error but #{act} was thrown",
2664
- errorLike && errorLike.toString(),
2665
- caughtErr instanceof Error ? caughtErr.toString() : typeof caughtErr === "string" ? caughtErr : caughtErr && check_error_exports.getConstructorName(caughtErr)
2666
- );
2667
- }
2668
- if (errorLike && caughtErr) {
2669
- if (errorLike instanceof Error) {
2670
- var isCompatibleInstance = check_error_exports.compatibleInstance(caughtErr, errorLike);
2671
- if (isCompatibleInstance === negate) {
2672
- if (everyArgIsDefined && negate) {
2673
- errorLikeFail = true;
2674
- } else {
2675
- this.assert(
2676
- negate,
2677
- "expected #{this} to throw #{exp} but #{act} was thrown",
2678
- "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""),
2679
- errorLike.toString(),
2680
- caughtErr.toString()
2681
- );
2682
- }
2683
- }
2684
- }
2685
- var isCompatibleConstructor = check_error_exports.compatibleConstructor(caughtErr, errorLike);
2686
- if (isCompatibleConstructor === negate) {
2687
- if (everyArgIsDefined && negate) {
2688
- errorLikeFail = true;
2689
- } else {
2690
- this.assert(
2691
- negate,
2692
- "expected #{this} to throw #{exp} but #{act} was thrown",
2693
- "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""),
2694
- errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike),
2695
- caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr)
2696
- );
2697
- }
2698
- }
2699
- }
2700
- if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
2701
- var placeholder = "including";
2702
- if (errMsgMatcher instanceof RegExp) {
2703
- placeholder = "matching";
2704
- }
2705
- var isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher);
2706
- if (isCompatibleMessage === negate) {
2707
- if (everyArgIsDefined && negate) {
2708
- errMsgMatcherFail = true;
2709
- } else {
2710
- this.assert(
2711
- negate,
2712
- "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}",
2713
- "expected #{this} to throw error not " + placeholder + " #{exp}",
2714
- errMsgMatcher,
2715
- check_error_exports.getMessage(caughtErr)
2716
- );
2717
- }
2718
- }
2719
- }
2720
- if (errorLikeFail && errMsgMatcherFail) {
2721
- this.assert(
2722
- negate,
2723
- "expected #{this} to throw #{exp} but #{act} was thrown",
2724
- "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""),
2725
- errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike),
2726
- caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr)
2727
- );
2728
- }
2729
- flag2(this, "object", caughtErr);
2730
- }
2731
- __name(assertThrows, "assertThrows");
2732
- Assertion.addMethod("throw", assertThrows);
2733
- Assertion.addMethod("throws", assertThrows);
2734
- Assertion.addMethod("Throw", assertThrows);
2735
- function respondTo(method, msg) {
2736
- if (msg)
2737
- flag2(this, "message", msg);
2738
- var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
2739
- this.assert(
2740
- "function" === typeof context,
2741
- "expected #{this} to respond to " + inspect2(method),
2742
- "expected #{this} to not respond to " + inspect2(method)
2743
- );
2744
- }
2745
- __name(respondTo, "respondTo");
2746
- Assertion.addMethod("respondTo", respondTo);
2747
- Assertion.addMethod("respondsTo", respondTo);
2748
- Assertion.addProperty("itself", function() {
2749
- flag2(this, "itself", true);
2750
- });
2751
- function satisfy(matcher, msg) {
2752
- if (msg)
2753
- flag2(this, "message", msg);
2754
- var obj = flag2(this, "object");
2755
- var result = matcher(obj);
2756
- this.assert(
2757
- result,
2758
- "expected #{this} to satisfy " + objDisplay(matcher),
2759
- "expected #{this} to not satisfy" + objDisplay(matcher),
2760
- flag2(this, "negate") ? false : true,
2761
- result
2762
- );
2763
- }
2764
- __name(satisfy, "satisfy");
2765
- Assertion.addMethod("satisfy", satisfy);
2766
- Assertion.addMethod("satisfies", satisfy);
2767
- function closeTo(expected, delta, msg) {
2768
- if (msg)
2769
- flag2(this, "message", msg);
2770
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2771
- new Assertion(obj, flagMsg, ssfi, true).is.a("number");
2772
- if (typeof expected !== "number" || typeof delta !== "number") {
2773
- flagMsg = flagMsg ? flagMsg + ": " : "";
2774
- var deltaMessage = delta === void 0 ? ", and a delta is required" : "";
2775
- throw new AssertionError(
2776
- flagMsg + "the arguments to closeTo or approximately must be numbers" + deltaMessage,
2777
- void 0,
2778
- ssfi
2779
- );
2780
- }
2781
- this.assert(
2782
- Math.abs(obj - expected) <= delta,
2783
- "expected #{this} to be close to " + expected + " +/- " + delta,
2784
- "expected #{this} not to be close to " + expected + " +/- " + delta
2785
- );
2786
- }
2787
- __name(closeTo, "closeTo");
2788
- Assertion.addMethod("closeTo", closeTo);
2789
- Assertion.addMethod("approximately", closeTo);
2790
- function isSubsetOf(subset, superset, cmp, contains, ordered) {
2791
- if (!contains) {
2792
- if (subset.length !== superset.length)
2793
- return false;
2794
- superset = superset.slice();
2795
- }
2796
- return subset.every(function(elem, idx) {
2797
- if (ordered)
2798
- return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
2799
- if (!cmp) {
2800
- var matchIdx = superset.indexOf(elem);
2801
- if (matchIdx === -1)
2802
- return false;
2803
- if (!contains)
2804
- superset.splice(matchIdx, 1);
2805
- return true;
2806
- }
2807
- return superset.some(function(elem2, matchIdx2) {
2808
- if (!cmp(elem, elem2))
2809
- return false;
2810
- if (!contains)
2811
- superset.splice(matchIdx2, 1);
2812
- return true;
2813
- });
2814
- });
2815
- }
2816
- __name(isSubsetOf, "isSubsetOf");
2817
- Assertion.addMethod("members", function(subset, msg) {
2818
- if (msg)
2819
- flag2(this, "message", msg);
2820
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2821
- new Assertion(obj, flagMsg, ssfi, true).to.be.an("array");
2822
- new Assertion(subset, flagMsg, ssfi, true).to.be.an("array");
2823
- var contains = flag2(this, "contains");
2824
- var ordered = flag2(this, "ordered");
2825
- var subject, failMsg, failNegateMsg;
2826
- if (contains) {
2827
- subject = ordered ? "an ordered superset" : "a superset";
2828
- failMsg = "expected #{this} to be " + subject + " of #{exp}";
2829
- failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
2830
- } else {
2831
- subject = ordered ? "ordered members" : "members";
2832
- failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
2833
- failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
2834
- }
2835
- var cmp = flag2(this, "deep") ? deep_eql_default : void 0;
2836
- this.assert(
2837
- isSubsetOf(subset, obj, cmp, contains, ordered),
2838
- failMsg,
2839
- failNegateMsg,
2840
- subset,
2841
- obj,
2842
- true
2843
- );
2844
- });
2845
- function oneOf(list, msg) {
2846
- if (msg)
2847
- flag2(this, "message", msg);
2848
- var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep");
2849
- new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
2850
- if (contains) {
2851
- this.assert(
2852
- list.some(function(possibility) {
2853
- return expected.indexOf(possibility) > -1;
2854
- }),
2855
- "expected #{this} to contain one of #{exp}",
2856
- "expected #{this} to not contain one of #{exp}",
2857
- list,
2858
- expected
2859
- );
2860
- } else {
2861
- if (isDeep) {
2862
- this.assert(
2863
- list.some(function(possibility) {
2864
- return deep_eql_default(expected, possibility);
2865
- }),
2866
- "expected #{this} to deeply equal one of #{exp}",
2867
- "expected #{this} to deeply equal one of #{exp}",
2868
- list,
2869
- expected
2870
- );
2871
- } else {
2872
- this.assert(
2873
- list.indexOf(expected) > -1,
2874
- "expected #{this} to be one of #{exp}",
2875
- "expected #{this} to not be one of #{exp}",
2876
- list,
2877
- expected
2878
- );
2879
- }
2880
- }
2881
- }
2882
- __name(oneOf, "oneOf");
2883
- Assertion.addMethod("oneOf", oneOf);
2884
- function assertChanges(subject, prop, msg) {
2885
- if (msg)
2886
- flag2(this, "message", msg);
2887
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2888
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2889
- var initial;
2890
- if (!prop) {
2891
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2892
- initial = subject();
2893
- } else {
2894
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2895
- initial = subject[prop];
2896
- }
2897
- fn();
2898
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2899
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2900
- flag2(this, "deltaMsgObj", msgObj);
2901
- flag2(this, "initialDeltaValue", initial);
2902
- flag2(this, "finalDeltaValue", final);
2903
- flag2(this, "deltaBehavior", "change");
2904
- flag2(this, "realDelta", final !== initial);
2905
- this.assert(
2906
- initial !== final,
2907
- "expected " + msgObj + " to change",
2908
- "expected " + msgObj + " to not change"
2909
- );
2910
- }
2911
- __name(assertChanges, "assertChanges");
2912
- Assertion.addMethod("change", assertChanges);
2913
- Assertion.addMethod("changes", assertChanges);
2914
- function assertIncreases(subject, prop, msg) {
2915
- if (msg)
2916
- flag2(this, "message", msg);
2917
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2918
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2919
- var initial;
2920
- if (!prop) {
2921
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2922
- initial = subject();
2923
- } else {
2924
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2925
- initial = subject[prop];
2926
- }
2927
- new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2928
- fn();
2929
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2930
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2931
- flag2(this, "deltaMsgObj", msgObj);
2932
- flag2(this, "initialDeltaValue", initial);
2933
- flag2(this, "finalDeltaValue", final);
2934
- flag2(this, "deltaBehavior", "increase");
2935
- flag2(this, "realDelta", final - initial);
2936
- this.assert(
2937
- final - initial > 0,
2938
- "expected " + msgObj + " to increase",
2939
- "expected " + msgObj + " to not increase"
2940
- );
2941
- }
2942
- __name(assertIncreases, "assertIncreases");
2943
- Assertion.addMethod("increase", assertIncreases);
2944
- Assertion.addMethod("increases", assertIncreases);
2945
- function assertDecreases(subject, prop, msg) {
2946
- if (msg)
2947
- flag2(this, "message", msg);
2948
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2949
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2950
- var initial;
2951
- if (!prop) {
2952
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2953
- initial = subject();
2954
- } else {
2955
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2956
- initial = subject[prop];
2957
- }
2958
- new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2959
- fn();
2960
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2961
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2962
- flag2(this, "deltaMsgObj", msgObj);
2963
- flag2(this, "initialDeltaValue", initial);
2964
- flag2(this, "finalDeltaValue", final);
2965
- flag2(this, "deltaBehavior", "decrease");
2966
- flag2(this, "realDelta", initial - final);
2967
- this.assert(
2968
- final - initial < 0,
2969
- "expected " + msgObj + " to decrease",
2970
- "expected " + msgObj + " to not decrease"
2971
- );
2972
- }
2973
- __name(assertDecreases, "assertDecreases");
2974
- Assertion.addMethod("decrease", assertDecreases);
2975
- Assertion.addMethod("decreases", assertDecreases);
2976
- function assertDelta(delta, msg) {
2977
- if (msg)
2978
- flag2(this, "message", msg);
2979
- var msgObj = flag2(this, "deltaMsgObj");
2980
- var initial = flag2(this, "initialDeltaValue");
2981
- var final = flag2(this, "finalDeltaValue");
2982
- var behavior = flag2(this, "deltaBehavior");
2983
- var realDelta = flag2(this, "realDelta");
2984
- var expression;
2985
- if (behavior === "change") {
2986
- expression = Math.abs(final - initial) === Math.abs(delta);
2987
- } else {
2988
- expression = realDelta === Math.abs(delta);
2989
- }
2990
- this.assert(
2991
- expression,
2992
- "expected " + msgObj + " to " + behavior + " by " + delta,
2993
- "expected " + msgObj + " to not " + behavior + " by " + delta
2994
- );
2995
- }
2996
- __name(assertDelta, "assertDelta");
2997
- Assertion.addMethod("by", assertDelta);
2998
- Assertion.addProperty("extensible", function() {
2999
- var obj = flag2(this, "object");
3000
- var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
3001
- this.assert(
3002
- isExtensible,
3003
- "expected #{this} to be extensible",
3004
- "expected #{this} to not be extensible"
3005
- );
3006
- });
3007
- Assertion.addProperty("sealed", function() {
3008
- var obj = flag2(this, "object");
3009
- var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
3010
- this.assert(
3011
- isSealed,
3012
- "expected #{this} to be sealed",
3013
- "expected #{this} to not be sealed"
3014
- );
3015
- });
3016
- Assertion.addProperty("frozen", function() {
3017
- var obj = flag2(this, "object");
3018
- var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
3019
- this.assert(
3020
- isFrozen,
3021
- "expected #{this} to be frozen",
3022
- "expected #{this} to not be frozen"
3023
- );
3024
- });
3025
- Assertion.addProperty("finite", function(msg) {
3026
- var obj = flag2(this, "object");
3027
- this.assert(
3028
- typeof obj === "number" && isFinite(obj),
3029
- "expected #{this} to be a finite number",
3030
- "expected #{this} to not be a finite number"
3031
- );
3032
- });
3033
-
3034
- // lib/chai/interface/expect.js
3035
- function expect(val, message) {
3036
- return new Assertion(val, message);
3037
- }
3038
- __name(expect, "expect");
3039
- expect.fail = function(actual, expected, message, operator) {
3040
- if (arguments.length < 2) {
3041
- message = actual;
3042
- actual = void 0;
3043
- }
3044
- message = message || "expect.fail()";
3045
- throw new AssertionError(message, {
3046
- actual,
3047
- expected,
3048
- operator
3049
- }, expect.fail);
3050
- };
3051
-
3052
- // lib/chai/interface/should.js
3053
- var should_exports = {};
3054
- __export(should_exports, {
3055
- Should: () => Should,
3056
- should: () => should
3057
- });
3058
- function loadShould() {
3059
- function shouldGetter() {
3060
- if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
3061
- return new Assertion(this.valueOf(), null, shouldGetter);
3062
- }
3063
- return new Assertion(this, null, shouldGetter);
3064
- }
3065
- __name(shouldGetter, "shouldGetter");
3066
- function shouldSetter(value) {
3067
- Object.defineProperty(this, "should", {
3068
- value,
3069
- enumerable: true,
3070
- configurable: true,
3071
- writable: true
3072
- });
3073
- }
3074
- __name(shouldSetter, "shouldSetter");
3075
- Object.defineProperty(Object.prototype, "should", {
3076
- set: shouldSetter,
3077
- get: shouldGetter,
3078
- configurable: true
3079
- });
3080
- var should2 = {};
3081
- should2.fail = function(actual, expected, message, operator) {
3082
- if (arguments.length < 2) {
3083
- message = actual;
3084
- actual = void 0;
3085
- }
3086
- message = message || "should.fail()";
3087
- throw new AssertionError(message, {
3088
- actual,
3089
- expected,
3090
- operator
3091
- }, should2.fail);
3092
- };
3093
- should2.equal = function(val1, val2, msg) {
3094
- new Assertion(val1, msg).to.equal(val2);
3095
- };
3096
- should2.Throw = function(fn, errt, errs, msg) {
3097
- new Assertion(fn, msg).to.Throw(errt, errs);
3098
- };
3099
- should2.exist = function(val, msg) {
3100
- new Assertion(val, msg).to.exist;
3101
- };
3102
- should2.not = {};
3103
- should2.not.equal = function(val1, val2, msg) {
3104
- new Assertion(val1, msg).to.not.equal(val2);
3105
- };
3106
- should2.not.Throw = function(fn, errt, errs, msg) {
3107
- new Assertion(fn, msg).to.not.Throw(errt, errs);
3108
- };
3109
- should2.not.exist = function(val, msg) {
3110
- new Assertion(val, msg).to.not.exist;
3111
- };
3112
- should2["throw"] = should2["Throw"];
3113
- should2.not["throw"] = should2.not["Throw"];
3114
- return should2;
3115
- }
3116
- __name(loadShould, "loadShould");
3117
- var should = loadShould;
3118
- var Should = loadShould;
3119
-
3120
- // lib/chai/interface/assert.js
3121
- function assert(express, errmsg) {
3122
- var test2 = new Assertion(null, null, assert, true);
3123
- test2.assert(
3124
- express,
3125
- errmsg,
3126
- "[ negation message unavailable ]"
3127
- );
3128
- }
3129
- __name(assert, "assert");
3130
- assert.fail = function(actual, expected, message, operator) {
3131
- if (arguments.length < 2) {
3132
- message = actual;
3133
- actual = void 0;
3134
- }
3135
- message = message || "assert.fail()";
3136
- throw new AssertionError(message, {
3137
- actual,
3138
- expected,
3139
- operator
3140
- }, assert.fail);
3141
- };
3142
- assert.isOk = function(val, msg) {
3143
- new Assertion(val, msg, assert.isOk, true).is.ok;
3144
- };
3145
- assert.isNotOk = function(val, msg) {
3146
- new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
3147
- };
3148
- assert.equal = function(act, exp, msg) {
3149
- var test2 = new Assertion(act, msg, assert.equal, true);
3150
- test2.assert(
3151
- exp == flag(test2, "object"),
3152
- "expected #{this} to equal #{exp}",
3153
- "expected #{this} to not equal #{act}",
3154
- exp,
3155
- act,
3156
- true
3157
- );
3158
- };
3159
- assert.notEqual = function(act, exp, msg) {
3160
- var test2 = new Assertion(act, msg, assert.notEqual, true);
3161
- test2.assert(
3162
- exp != flag(test2, "object"),
3163
- "expected #{this} to not equal #{exp}",
3164
- "expected #{this} to equal #{act}",
3165
- exp,
3166
- act,
3167
- true
3168
- );
3169
- };
3170
- assert.strictEqual = function(act, exp, msg) {
3171
- new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
3172
- };
3173
- assert.notStrictEqual = function(act, exp, msg) {
3174
- new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
3175
- };
3176
- assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) {
3177
- new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
3178
- };
3179
- assert.notDeepEqual = function(act, exp, msg) {
3180
- new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
3181
- };
3182
- assert.isAbove = function(val, abv, msg) {
3183
- new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
3184
- };
3185
- assert.isAtLeast = function(val, atlst, msg) {
3186
- new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
3187
- };
3188
- assert.isBelow = function(val, blw, msg) {
3189
- new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
3190
- };
3191
- assert.isAtMost = function(val, atmst, msg) {
3192
- new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
3193
- };
3194
- assert.isTrue = function(val, msg) {
3195
- new Assertion(val, msg, assert.isTrue, true).is["true"];
3196
- };
3197
- assert.isNotTrue = function(val, msg) {
3198
- new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
3199
- };
3200
- assert.isFalse = function(val, msg) {
3201
- new Assertion(val, msg, assert.isFalse, true).is["false"];
3202
- };
3203
- assert.isNotFalse = function(val, msg) {
3204
- new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
3205
- };
3206
- assert.isNull = function(val, msg) {
3207
- new Assertion(val, msg, assert.isNull, true).to.equal(null);
3208
- };
3209
- assert.isNotNull = function(val, msg) {
3210
- new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
3211
- };
3212
- assert.isNaN = function(val, msg) {
3213
- new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
3214
- };
3215
- assert.isNotNaN = function(val, msg) {
3216
- new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN;
3217
- };
3218
- assert.exists = function(val, msg) {
3219
- new Assertion(val, msg, assert.exists, true).to.exist;
3220
- };
3221
- assert.notExists = function(val, msg) {
3222
- new Assertion(val, msg, assert.notExists, true).to.not.exist;
3223
- };
3224
- assert.isUndefined = function(val, msg) {
3225
- new Assertion(val, msg, assert.isUndefined, true).to.equal(void 0);
3226
- };
3227
- assert.isDefined = function(val, msg) {
3228
- new Assertion(val, msg, assert.isDefined, true).to.not.equal(void 0);
3229
- };
3230
- assert.isFunction = function(val, msg) {
3231
- new Assertion(val, msg, assert.isFunction, true).to.be.a("function");
3232
- };
3233
- assert.isNotFunction = function(val, msg) {
3234
- new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a("function");
3235
- };
3236
- assert.isObject = function(val, msg) {
3237
- new Assertion(val, msg, assert.isObject, true).to.be.a("object");
3238
- };
3239
- assert.isNotObject = function(val, msg) {
3240
- new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object");
3241
- };
3242
- assert.isArray = function(val, msg) {
3243
- new Assertion(val, msg, assert.isArray, true).to.be.an("array");
3244
- };
3245
- assert.isNotArray = function(val, msg) {
3246
- new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array");
3247
- };
3248
- assert.isString = function(val, msg) {
3249
- new Assertion(val, msg, assert.isString, true).to.be.a("string");
3250
- };
3251
- assert.isNotString = function(val, msg) {
3252
- new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string");
3253
- };
3254
- assert.isNumber = function(val, msg) {
3255
- new Assertion(val, msg, assert.isNumber, true).to.be.a("number");
3256
- };
3257
- assert.isNotNumber = function(val, msg) {
3258
- new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number");
3259
- };
3260
- assert.isFinite = function(val, msg) {
3261
- new Assertion(val, msg, assert.isFinite, true).to.be.finite;
3262
- };
3263
- assert.isBoolean = function(val, msg) {
3264
- new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean");
3265
- };
3266
- assert.isNotBoolean = function(val, msg) {
3267
- new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean");
3268
- };
3269
- assert.typeOf = function(val, type3, msg) {
3270
- new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
3271
- };
3272
- assert.notTypeOf = function(val, type3, msg) {
3273
- new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type3);
3274
- };
3275
- assert.instanceOf = function(val, type3, msg) {
3276
- new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
3277
- };
3278
- assert.notInstanceOf = function(val, type3, msg) {
3279
- new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(type3);
3280
- };
3281
- assert.include = function(exp, inc, msg) {
3282
- new Assertion(exp, msg, assert.include, true).include(inc);
3283
- };
3284
- assert.notInclude = function(exp, inc, msg) {
3285
- new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
3286
- };
3287
- assert.deepInclude = function(exp, inc, msg) {
3288
- new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
3289
- };
3290
- assert.notDeepInclude = function(exp, inc, msg) {
3291
- new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
3292
- };
3293
- assert.nestedInclude = function(exp, inc, msg) {
3294
- new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
3295
- };
3296
- assert.notNestedInclude = function(exp, inc, msg) {
3297
- new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(inc);
3298
- };
3299
- assert.deepNestedInclude = function(exp, inc, msg) {
3300
- new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(inc);
3301
- };
3302
- assert.notDeepNestedInclude = function(exp, inc, msg) {
3303
- new Assertion(exp, msg, assert.notDeepNestedInclude, true).not.deep.nested.include(inc);
3304
- };
3305
- assert.ownInclude = function(exp, inc, msg) {
3306
- new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
3307
- };
3308
- assert.notOwnInclude = function(exp, inc, msg) {
3309
- new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
3310
- };
3311
- assert.deepOwnInclude = function(exp, inc, msg) {
3312
- new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc);
3313
- };
3314
- assert.notDeepOwnInclude = function(exp, inc, msg) {
3315
- new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(inc);
3316
- };
3317
- assert.match = function(exp, re, msg) {
3318
- new Assertion(exp, msg, assert.match, true).to.match(re);
3319
- };
3320
- assert.notMatch = function(exp, re, msg) {
3321
- new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
3322
- };
3323
- assert.property = function(obj, prop, msg) {
3324
- new Assertion(obj, msg, assert.property, true).to.have.property(prop);
3325
- };
3326
- assert.notProperty = function(obj, prop, msg) {
3327
- new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop);
3328
- };
3329
- assert.propertyVal = function(obj, prop, val, msg) {
3330
- new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val);
3331
- };
3332
- assert.notPropertyVal = function(obj, prop, val, msg) {
3333
- new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(prop, val);
3334
- };
3335
- assert.deepPropertyVal = function(obj, prop, val, msg) {
3336
- new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(prop, val);
3337
- };
3338
- assert.notDeepPropertyVal = function(obj, prop, val, msg) {
3339
- new Assertion(obj, msg, assert.notDeepPropertyVal, true).to.not.have.deep.property(prop, val);
3340
- };
3341
- assert.ownProperty = function(obj, prop, msg) {
3342
- new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop);
3343
- };
3344
- assert.notOwnProperty = function(obj, prop, msg) {
3345
- new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(prop);
3346
- };
3347
- assert.ownPropertyVal = function(obj, prop, value, msg) {
3348
- new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(prop, value);
3349
- };
3350
- assert.notOwnPropertyVal = function(obj, prop, value, msg) {
3351
- new Assertion(obj, msg, assert.notOwnPropertyVal, true).to.not.have.own.property(prop, value);
3352
- };
3353
- assert.deepOwnPropertyVal = function(obj, prop, value, msg) {
3354
- new Assertion(obj, msg, assert.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value);
3355
- };
3356
- assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
3357
- new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value);
3358
- };
3359
- assert.nestedProperty = function(obj, prop, msg) {
3360
- new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(prop);
3361
- };
3362
- assert.notNestedProperty = function(obj, prop, msg) {
3363
- new Assertion(obj, msg, assert.notNestedProperty, true).to.not.have.nested.property(prop);
3364
- };
3365
- assert.nestedPropertyVal = function(obj, prop, val, msg) {
3366
- new Assertion(obj, msg, assert.nestedPropertyVal, true).to.have.nested.property(prop, val);
3367
- };
3368
- assert.notNestedPropertyVal = function(obj, prop, val, msg) {
3369
- new Assertion(obj, msg, assert.notNestedPropertyVal, true).to.not.have.nested.property(prop, val);
3370
- };
3371
- assert.deepNestedPropertyVal = function(obj, prop, val, msg) {
3372
- new Assertion(obj, msg, assert.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val);
3373
- };
3374
- assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
3375
- new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val);
3376
- };
3377
- assert.lengthOf = function(exp, len, msg) {
3378
- new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
3379
- };
3380
- assert.hasAnyKeys = function(obj, keys, msg) {
3381
- new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
3382
- };
3383
- assert.hasAllKeys = function(obj, keys, msg) {
3384
- new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
3385
- };
3386
- assert.containsAllKeys = function(obj, keys, msg) {
3387
- new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(keys);
3388
- };
3389
- assert.doesNotHaveAnyKeys = function(obj, keys, msg) {
3390
- new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys);
3391
- };
3392
- assert.doesNotHaveAllKeys = function(obj, keys, msg) {
3393
- new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(keys);
3394
- };
3395
- assert.hasAnyDeepKeys = function(obj, keys, msg) {
3396
- new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(keys);
3397
- };
3398
- assert.hasAllDeepKeys = function(obj, keys, msg) {
3399
- new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(keys);
3400
- };
3401
- assert.containsAllDeepKeys = function(obj, keys, msg) {
3402
- new Assertion(obj, msg, assert.containsAllDeepKeys, true).to.contain.all.deep.keys(keys);
3403
- };
3404
- assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
3405
- new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys);
3406
- };
3407
- assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
3408
- new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys);
3409
- };
3410
- assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
3411
- if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3412
- errMsgMatcher = errorLike;
3413
- errorLike = null;
3414
- }
3415
- var assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher);
3416
- return flag(assertErr, "object");
3417
- };
3418
- assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, msg) {
3419
- if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3420
- errMsgMatcher = errorLike;
3421
- errorLike = null;
3422
- }
3423
- new Assertion(fn, msg, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3424
- };
3425
- assert.operator = function(val, operator, val2, msg) {
3426
- var ok;
3427
- switch (operator) {
3428
- case "==":
3429
- ok = val == val2;
3430
- break;
3431
- case "===":
3432
- ok = val === val2;
3433
- break;
3434
- case ">":
3435
- ok = val > val2;
3436
- break;
3437
- case ">=":
3438
- ok = val >= val2;
3439
- break;
3440
- case "<":
3441
- ok = val < val2;
3442
- break;
3443
- case "<=":
3444
- ok = val <= val2;
3445
- break;
3446
- case "!=":
3447
- ok = val != val2;
3448
- break;
3449
- case "!==":
3450
- ok = val !== val2;
3451
- break;
3452
- default:
3453
- msg = msg ? msg + ": " : msg;
3454
- throw new AssertionError(
3455
- msg + 'Invalid operator "' + operator + '"',
3456
- void 0,
3457
- assert.operator
3458
- );
3459
- }
3460
- var test2 = new Assertion(ok, msg, assert.operator, true);
3461
- test2.assert(
3462
- true === flag(test2, "object"),
3463
- "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2),
3464
- "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2)
3465
- );
3466
- };
3467
- assert.closeTo = function(act, exp, delta, msg) {
3468
- new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
3469
- };
3470
- assert.approximately = function(act, exp, delta, msg) {
3471
- new Assertion(act, msg, assert.approximately, true).to.be.approximately(exp, delta);
3472
- };
3473
- assert.sameMembers = function(set1, set2, msg) {
3474
- new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2);
3475
- };
3476
- assert.notSameMembers = function(set1, set2, msg) {
3477
- new Assertion(set1, msg, assert.notSameMembers, true).to.not.have.same.members(set2);
3478
- };
3479
- assert.sameDeepMembers = function(set1, set2, msg) {
3480
- new Assertion(set1, msg, assert.sameDeepMembers, true).to.have.same.deep.members(set2);
3481
- };
3482
- assert.notSameDeepMembers = function(set1, set2, msg) {
3483
- new Assertion(set1, msg, assert.notSameDeepMembers, true).to.not.have.same.deep.members(set2);
3484
- };
3485
- assert.sameOrderedMembers = function(set1, set2, msg) {
3486
- new Assertion(set1, msg, assert.sameOrderedMembers, true).to.have.same.ordered.members(set2);
3487
- };
3488
- assert.notSameOrderedMembers = function(set1, set2, msg) {
3489
- new Assertion(set1, msg, assert.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2);
3490
- };
3491
- assert.sameDeepOrderedMembers = function(set1, set2, msg) {
3492
- new Assertion(set1, msg, assert.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2);
3493
- };
3494
- assert.notSameDeepOrderedMembers = function(set1, set2, msg) {
3495
- new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2);
3496
- };
3497
- assert.includeMembers = function(superset, subset, msg) {
3498
- new Assertion(superset, msg, assert.includeMembers, true).to.include.members(subset);
3499
- };
3500
- assert.notIncludeMembers = function(superset, subset, msg) {
3501
- new Assertion(superset, msg, assert.notIncludeMembers, true).to.not.include.members(subset);
3502
- };
3503
- assert.includeDeepMembers = function(superset, subset, msg) {
3504
- new Assertion(superset, msg, assert.includeDeepMembers, true).to.include.deep.members(subset);
3505
- };
3506
- assert.notIncludeDeepMembers = function(superset, subset, msg) {
3507
- new Assertion(superset, msg, assert.notIncludeDeepMembers, true).to.not.include.deep.members(subset);
3508
- };
3509
- assert.includeOrderedMembers = function(superset, subset, msg) {
3510
- new Assertion(superset, msg, assert.includeOrderedMembers, true).to.include.ordered.members(subset);
3511
- };
3512
- assert.notIncludeOrderedMembers = function(superset, subset, msg) {
3513
- new Assertion(superset, msg, assert.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset);
3514
- };
3515
- assert.includeDeepOrderedMembers = function(superset, subset, msg) {
3516
- new Assertion(superset, msg, assert.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset);
3517
- };
3518
- assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
3519
- new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset);
3520
- };
3521
- assert.oneOf = function(inList, list, msg) {
3522
- new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
3523
- };
3524
- assert.changes = function(fn, obj, prop, msg) {
3525
- if (arguments.length === 3 && typeof obj === "function") {
3526
- msg = prop;
3527
- prop = null;
3528
- }
3529
- new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
3530
- };
3531
- assert.changesBy = function(fn, obj, prop, delta, msg) {
3532
- if (arguments.length === 4 && typeof obj === "function") {
3533
- var tmpMsg = delta;
3534
- delta = prop;
3535
- msg = tmpMsg;
3536
- } else if (arguments.length === 3) {
3537
- delta = prop;
3538
- prop = null;
3539
- }
3540
- new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta);
3541
- };
3542
- assert.doesNotChange = function(fn, obj, prop, msg) {
3543
- if (arguments.length === 3 && typeof obj === "function") {
3544
- msg = prop;
3545
- prop = null;
3546
- }
3547
- return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(obj, prop);
3548
- };
3549
- assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
3550
- if (arguments.length === 4 && typeof obj === "function") {
3551
- var tmpMsg = delta;
3552
- delta = prop;
3553
- msg = tmpMsg;
3554
- } else if (arguments.length === 3) {
3555
- delta = prop;
3556
- prop = null;
3557
- }
3558
- new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
3559
- };
3560
- assert.increases = function(fn, obj, prop, msg) {
3561
- if (arguments.length === 3 && typeof obj === "function") {
3562
- msg = prop;
3563
- prop = null;
3564
- }
3565
- return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop);
3566
- };
3567
- assert.increasesBy = function(fn, obj, prop, delta, msg) {
3568
- if (arguments.length === 4 && typeof obj === "function") {
3569
- var tmpMsg = delta;
3570
- delta = prop;
3571
- msg = tmpMsg;
3572
- } else if (arguments.length === 3) {
3573
- delta = prop;
3574
- prop = null;
3575
- }
3576
- new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta);
3577
- };
3578
- assert.doesNotIncrease = function(fn, obj, prop, msg) {
3579
- if (arguments.length === 3 && typeof obj === "function") {
3580
- msg = prop;
3581
- prop = null;
3582
- }
3583
- return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(obj, prop);
3584
- };
3585
- assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
3586
- if (arguments.length === 4 && typeof obj === "function") {
3587
- var tmpMsg = delta;
3588
- delta = prop;
3589
- msg = tmpMsg;
3590
- } else if (arguments.length === 3) {
3591
- delta = prop;
3592
- prop = null;
3593
- }
3594
- new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
3595
- };
3596
- assert.decreases = function(fn, obj, prop, msg) {
3597
- if (arguments.length === 3 && typeof obj === "function") {
3598
- msg = prop;
3599
- prop = null;
3600
- }
3601
- return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop);
3602
- };
3603
- assert.decreasesBy = function(fn, obj, prop, delta, msg) {
3604
- if (arguments.length === 4 && typeof obj === "function") {
3605
- var tmpMsg = delta;
3606
- delta = prop;
3607
- msg = tmpMsg;
3608
- } else if (arguments.length === 3) {
3609
- delta = prop;
3610
- prop = null;
3611
- }
3612
- new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta);
3613
- };
3614
- assert.doesNotDecrease = function(fn, obj, prop, msg) {
3615
- if (arguments.length === 3 && typeof obj === "function") {
3616
- msg = prop;
3617
- prop = null;
3618
- }
3619
- return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(obj, prop);
3620
- };
3621
- assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
3622
- if (arguments.length === 4 && typeof obj === "function") {
3623
- var tmpMsg = delta;
3624
- delta = prop;
3625
- msg = tmpMsg;
3626
- } else if (arguments.length === 3) {
3627
- delta = prop;
3628
- prop = null;
3629
- }
3630
- return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
3631
- };
3632
- assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
3633
- if (arguments.length === 4 && typeof obj === "function") {
3634
- var tmpMsg = delta;
3635
- delta = prop;
3636
- msg = tmpMsg;
3637
- } else if (arguments.length === 3) {
3638
- delta = prop;
3639
- prop = null;
3640
- }
3641
- new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
3642
- };
3643
- assert.ifError = function(val) {
3644
- if (val) {
3645
- throw val;
3646
- }
3647
- };
3648
- assert.isExtensible = function(obj, msg) {
3649
- new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
3650
- };
3651
- assert.isNotExtensible = function(obj, msg) {
3652
- new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
3653
- };
3654
- assert.isSealed = function(obj, msg) {
3655
- new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
3656
- };
3657
- assert.isNotSealed = function(obj, msg) {
3658
- new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
3659
- };
3660
- assert.isFrozen = function(obj, msg) {
3661
- new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
3662
- };
3663
- assert.isNotFrozen = function(obj, msg) {
3664
- new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
3665
- };
3666
- assert.isEmpty = function(val, msg) {
3667
- new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
3668
- };
3669
- assert.isNotEmpty = function(val, msg) {
3670
- new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
3671
- };
3672
- (/* @__PURE__ */ __name(function alias(name, as) {
3673
- assert[as] = assert[name];
3674
- return alias;
3675
- }, "alias"))("isOk", "ok")("isNotOk", "notOk")("throws", "throw")("throws", "Throw")("isExtensible", "extensible")("isNotExtensible", "notExtensible")("isSealed", "sealed")("isNotSealed", "notSealed")("isFrozen", "frozen")("isNotFrozen", "notFrozen")("isEmpty", "empty")("isNotEmpty", "notEmpty");
3676
-
3677
- // lib/chai.js
3678
- var used = [];
3679
- function use(fn) {
3680
- const exports = {
3681
- AssertionError,
3682
- util: utils_exports,
3683
- config,
3684
- expect,
3685
- assert,
3686
- Assertion,
3687
- ...should_exports
3688
- };
3689
- if (!~used.indexOf(fn)) {
3690
- fn(exports, utils_exports);
3691
- used.push(fn);
3692
- }
3693
- return exports;
3694
- }
3695
- __name(use, "use");
3696
- export {
3697
- Assertion,
3698
- AssertionError,
3699
- Should,
3700
- assert,
3701
- config,
3702
- expect,
3703
- should,
3704
- use,
3705
- utils_exports as util
3706
- };
3707
- /*!
3708
- * Chai - flag utility
3709
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3710
- * MIT Licensed
3711
- */
3712
- /*!
3713
- * Chai - test utility
3714
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3715
- * MIT Licensed
3716
- */
3717
- /*!
3718
- * Module dependencies
3719
- */
3720
- /*!
3721
- * Chai - expectTypes utility
3722
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3723
- * MIT Licensed
3724
- */
3725
- /*!
3726
- * Chai - getActual utility
3727
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3728
- * MIT Licensed
3729
- */
3730
- /*!
3731
- * Chai - message composition utility
3732
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3733
- * MIT Licensed
3734
- */
3735
- /*!
3736
- * Chai - transferFlags utility
3737
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3738
- * MIT Licensed
3739
- */
3740
- /*!
3741
- * chai
3742
- * http://chaijs.com
3743
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
3744
- * MIT Licensed
3745
- */
3746
- /*!
3747
- * Assertion Constructor
3748
- *
3749
- * Creates object for chaining.
3750
- *
3751
- * `Assertion` objects contain metadata in the form of flags. Three flags can
3752
- * be assigned during instantiation by passing arguments to this constructor:
3753
- *
3754
- * - `object`: This flag contains the target of the assertion. For example, in
3755
- * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
3756
- * contain `numKittens` so that the `equal` assertion can reference it when
3757
- * needed.
3758
- *
3759
- * - `message`: This flag contains an optional custom error message to be
3760
- * prepended to the error message that's generated by the assertion when it
3761
- * fails.
3762
- *
3763
- * - `ssfi`: This flag stands for "start stack function indicator". It
3764
- * contains a function reference that serves as the starting point for
3765
- * removing frames from the stack trace of the error that's created by the
3766
- * assertion when it fails. The goal is to provide a cleaner stack trace to
3767
- * end users by removing Chai's internal functions. Note that it only works
3768
- * in environments that support `Error.captureStackTrace`, and only when
3769
- * `Chai.config.includeStack` hasn't been set to `false`.
3770
- *
3771
- * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
3772
- * should retain its current value, even as assertions are chained off of
3773
- * this object. This is usually set to `true` when creating a new assertion
3774
- * from within another assertion. It's also temporarily set to `true` before
3775
- * an overwritten assertion gets called by the overwriting assertion.
3776
- *
3777
- * @param {Mixed} obj target of the assertion
3778
- * @param {String} msg (optional) custom error message
3779
- * @param {Function} ssfi (optional) starting point for removing stack frames
3780
- * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
3781
- * @api private
3782
- */
3783
- /*!
3784
- * ### ._obj
3785
- *
3786
- * Quick reference to stored `actual` value for plugin developers.
3787
- *
3788
- * @api private
3789
- */
3790
- /*!
3791
- * Chai - isProxyEnabled helper
3792
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3793
- * MIT Licensed
3794
- */
3795
- /*!
3796
- * Chai - addProperty utility
3797
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3798
- * MIT Licensed
3799
- */
3800
- /*!
3801
- * Chai - addLengthGuard utility
3802
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3803
- * MIT Licensed
3804
- */
3805
- /*!
3806
- * Chai - getProperties utility
3807
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3808
- * MIT Licensed
3809
- */
3810
- /*!
3811
- * Chai - proxify utility
3812
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3813
- * MIT Licensed
3814
- */
3815
- /*!
3816
- * Chai - addMethod utility
3817
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3818
- * MIT Licensed
3819
- */
3820
- /*!
3821
- * Chai - overwriteProperty utility
3822
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3823
- * MIT Licensed
3824
- */
3825
- /*!
3826
- * Chai - overwriteMethod utility
3827
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3828
- * MIT Licensed
3829
- */
3830
- /*!
3831
- * Chai - addChainingMethod utility
3832
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3833
- * MIT Licensed
3834
- */
3835
- /*!
3836
- * Module variables
3837
- */
3838
- /*!
3839
- * Chai - overwriteChainableMethod utility
3840
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3841
- * MIT Licensed
3842
- */
3843
- /*!
3844
- * Chai - compareByInspect utility
3845
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
3846
- * MIT Licensed
3847
- */
3848
- /*!
3849
- * Chai - getOwnEnumerablePropertySymbols utility
3850
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
3851
- * MIT Licensed
3852
- */
3853
- /*!
3854
- * Chai - getOwnEnumerableProperties utility
3855
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
3856
- * MIT Licensed
3857
- */
3858
- /*!
3859
- * Chai - isNaN utility
3860
- * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
3861
- * MIT Licensed
3862
- */
3863
- /*!
3864
- * chai
3865
- * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
3866
- * MIT Licensed
3867
- */
3868
- /*!
3869
- * Dependencies that are used for multiple exports are required here only once
3870
- */
3871
- /*!
3872
- * test utility
3873
- */
3874
- /*!
3875
- * type utility
3876
- */
3877
- /*!
3878
- * expectTypes utility
3879
- */
3880
- /*!
3881
- * message utility
3882
- */
3883
- /*!
3884
- * actual utility
3885
- */
3886
- /*!
3887
- * Inspect util
3888
- */
3889
- /*!
3890
- * Object Display util
3891
- */
3892
- /*!
3893
- * Flag utility
3894
- */
3895
- /*!
3896
- * Flag transferring utility
3897
- */
3898
- /*!
3899
- * Deep equal utility
3900
- */
3901
- /*!
3902
- * Deep path info
3903
- */
3904
- /*!
3905
- * Function name
3906
- */
3907
- /*!
3908
- * add Property
3909
- */
3910
- /*!
3911
- * add Method
3912
- */
3913
- /*!
3914
- * overwrite Property
3915
- */
3916
- /*!
3917
- * overwrite Method
3918
- */
3919
- /*!
3920
- * Add a chainable method
3921
- */
3922
- /*!
3923
- * Overwrite chainable method
3924
- */
3925
- /*!
3926
- * Compare by inspect method
3927
- */
3928
- /*!
3929
- * Get own enumerable property symbols method
3930
- */
3931
- /*!
3932
- * Get own enumerable properties method
3933
- */
3934
- /*!
3935
- * Checks error against a given set of criteria
3936
- */
3937
- /*!
3938
- * Proxify util
3939
- */
3940
- /*!
3941
- * addLengthGuard util
3942
- */
3943
- /*!
3944
- * isProxyEnabled helper
3945
- */
3946
- /*!
3947
- * isNaN method
3948
- */
3949
- /*!
3950
- * getOperator method
3951
- */
3952
- /*!
3953
- * chai
3954
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
3955
- * MIT Licensed
3956
- */
3957
- /*!
3958
- * ### .ifError(object)
3959
- *
3960
- * Asserts if value is not a false value, and throws if it is a true value.
3961
- * This is added to allow for chai to be a drop-in replacement for Node's
3962
- * assert class.
3963
- *
3964
- * var err = new Error('I am a custom error');
3965
- * assert.ifError(err); // Rethrows err!
3966
- *
3967
- * @name ifError
3968
- * @param {Object} object
3969
- * @namespace Assert
3970
- * @api public
3971
- */
3972
- /*!
3973
- * Aliases.
3974
- */
3975
- /*!
3976
- * Assertion Error
3977
- */
3978
- /*!
3979
- * Utility Functions
3980
- */
3981
- /*!
3982
- * Configuration
3983
- */
3984
- /*!
3985
- * Primary `Assertion` prototype
3986
- */
3987
- /*!
3988
- * Expect interface
3989
- */
3990
- /*!
3991
- * Should interface
3992
- */
3993
- /*!
3994
- * Assert interface
3995
- */
3996
- /*! Bundled license information:
3997
-
3998
- deep-eql/index.js:
3999
- (*!
4000
- * deep-eql
4001
- * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
4002
- * MIT Licensed
4003
- *)
4004
- (*!
4005
- * Check to see if the MemoizeMap has recorded a result of the two operands
4006
- *
4007
- * @param {Mixed} leftHandOperand
4008
- * @param {Mixed} rightHandOperand
4009
- * @param {MemoizeMap} memoizeMap
4010
- * @returns {Boolean|null} result
4011
- *)
4012
- (*!
4013
- * Set the result of the equality into the MemoizeMap
4014
- *
4015
- * @param {Mixed} leftHandOperand
4016
- * @param {Mixed} rightHandOperand
4017
- * @param {MemoizeMap} memoizeMap
4018
- * @param {Boolean} result
4019
- *)
4020
- (*!
4021
- * Primary Export
4022
- *)
4023
- (*!
4024
- * The main logic of the `deepEqual` function.
4025
- *
4026
- * @param {Mixed} leftHandOperand
4027
- * @param {Mixed} rightHandOperand
4028
- * @param {Object} [options] (optional) Additional options
4029
- * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
4030
- * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
4031
- complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
4032
- references to blow the stack.
4033
- * @return {Boolean} equal match
4034
- *)
4035
- (*!
4036
- * Compare two Regular Expressions for equality.
4037
- *
4038
- * @param {RegExp} leftHandOperand
4039
- * @param {RegExp} rightHandOperand
4040
- * @return {Boolean} result
4041
- *)
4042
- (*!
4043
- * Compare two Sets/Maps for equality. Faster than other equality functions.
4044
- *
4045
- * @param {Set} leftHandOperand
4046
- * @param {Set} rightHandOperand
4047
- * @param {Object} [options] (Optional)
4048
- * @return {Boolean} result
4049
- *)
4050
- (*!
4051
- * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
4052
- *
4053
- * @param {Iterable} leftHandOperand
4054
- * @param {Iterable} rightHandOperand
4055
- * @param {Object} [options] (Optional)
4056
- * @return {Boolean} result
4057
- *)
4058
- (*!
4059
- * Simple equality for generator objects such as those returned by generator functions.
4060
- *
4061
- * @param {Iterable} leftHandOperand
4062
- * @param {Iterable} rightHandOperand
4063
- * @param {Object} [options] (Optional)
4064
- * @return {Boolean} result
4065
- *)
4066
- (*!
4067
- * Determine if the given object has an @@iterator function.
4068
- *
4069
- * @param {Object} target
4070
- * @return {Boolean} `true` if the object has an @@iterator function.
4071
- *)
4072
- (*!
4073
- * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
4074
- * This will consume the iterator - which could have side effects depending on the @@iterator implementation.
4075
- *
4076
- * @param {Object} target
4077
- * @returns {Array} an array of entries from the @@iterator function
4078
- *)
4079
- (*!
4080
- * Gets all entries from a Generator. This will consume the generator - which could have side effects.
4081
- *
4082
- * @param {Generator} target
4083
- * @returns {Array} an array of entries from the Generator.
4084
- *)
4085
- (*!
4086
- * Gets all own and inherited enumerable keys from a target.
4087
- *
4088
- * @param {Object} target
4089
- * @returns {Array} an array of own and inherited enumerable keys from the target.
4090
- *)
4091
- (*!
4092
- * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
4093
- * each key. If any value of the given key is not equal, the function will return false (early).
4094
- *
4095
- * @param {Mixed} leftHandOperand
4096
- * @param {Mixed} rightHandOperand
4097
- * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
4098
- * @param {Object} [options] (Optional)
4099
- * @return {Boolean} result
4100
- *)
4101
- (*!
4102
- * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
4103
- * for each enumerable key in the object.
4104
- *
4105
- * @param {Mixed} leftHandOperand
4106
- * @param {Mixed} rightHandOperand
4107
- * @param {Object} [options] (Optional)
4108
- * @return {Boolean} result
4109
- *)
4110
- (*!
4111
- * Returns true if the argument is a primitive.
4112
- *
4113
- * This intentionally returns true for all objects that can be compared by reference,
4114
- * including functions and symbols.
4115
- *
4116
- * @param {Mixed} value
4117
- * @return {Boolean} result
4118
- *)
4119
- */