@noma.to/qwik-testing-library 1.0.3 → 1.1.0

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