tutuca 0.9.44 → 0.9.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tutuca-cli.js +3764 -81
- package/dist/tutuca-dev.js +3851 -109
- package/dist/tutuca-dev.min.js +4 -3
- package/dist/tutuca-extra.js +4 -0
- package/dist/tutuca-extra.min.js +1 -1
- package/dist/tutuca.js +4 -0
- package/dist/tutuca.min.js +1 -1
- package/package.json +3 -2
- package/skill/tutuca/advanced.md +3 -4
- package/skill/tutuca/cli.md +78 -7
- package/skill/tutuca/core.md +19 -6
- package/skill/SKILL.md +0 -46
- package/skill/advanced.md +0 -146
- package/skill/cli.md +0 -117
- package/skill/core.md +0 -766
package/dist/tutuca-dev.js
CHANGED
|
@@ -1,3 +1,3298 @@
|
|
|
1
|
+
// node_modules/chai/index.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => (key in obj) ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
10
|
+
var utils_exports = {};
|
|
11
|
+
__export(utils_exports, {
|
|
12
|
+
addChainableMethod: () => addChainableMethod,
|
|
13
|
+
addLengthGuard: () => addLengthGuard,
|
|
14
|
+
addMethod: () => addMethod,
|
|
15
|
+
addProperty: () => addProperty,
|
|
16
|
+
checkError: () => check_error_exports,
|
|
17
|
+
compareByInspect: () => compareByInspect,
|
|
18
|
+
eql: () => deep_eql_default,
|
|
19
|
+
events: () => events,
|
|
20
|
+
expectTypes: () => expectTypes,
|
|
21
|
+
flag: () => flag,
|
|
22
|
+
getActual: () => getActual,
|
|
23
|
+
getMessage: () => getMessage2,
|
|
24
|
+
getName: () => getName,
|
|
25
|
+
getOperator: () => getOperator,
|
|
26
|
+
getOwnEnumerableProperties: () => getOwnEnumerableProperties,
|
|
27
|
+
getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols,
|
|
28
|
+
getPathInfo: () => getPathInfo,
|
|
29
|
+
hasProperty: () => hasProperty,
|
|
30
|
+
inspect: () => inspect2,
|
|
31
|
+
isNaN: () => isNaN2,
|
|
32
|
+
isNumeric: () => isNumeric,
|
|
33
|
+
isProxyEnabled: () => isProxyEnabled,
|
|
34
|
+
isRegExp: () => isRegExp2,
|
|
35
|
+
objDisplay: () => objDisplay,
|
|
36
|
+
overwriteChainableMethod: () => overwriteChainableMethod,
|
|
37
|
+
overwriteMethod: () => overwriteMethod,
|
|
38
|
+
overwriteProperty: () => overwriteProperty,
|
|
39
|
+
proxify: () => proxify,
|
|
40
|
+
test: () => test,
|
|
41
|
+
transferFlags: () => transferFlags,
|
|
42
|
+
type: () => type
|
|
43
|
+
});
|
|
44
|
+
var check_error_exports = {};
|
|
45
|
+
__export(check_error_exports, {
|
|
46
|
+
compatibleConstructor: () => compatibleConstructor,
|
|
47
|
+
compatibleInstance: () => compatibleInstance,
|
|
48
|
+
compatibleMessage: () => compatibleMessage,
|
|
49
|
+
getConstructorName: () => getConstructorName,
|
|
50
|
+
getMessage: () => getMessage
|
|
51
|
+
});
|
|
52
|
+
function isErrorInstance(obj) {
|
|
53
|
+
return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]";
|
|
54
|
+
}
|
|
55
|
+
__name(isErrorInstance, "isErrorInstance");
|
|
56
|
+
function isRegExp(obj) {
|
|
57
|
+
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
58
|
+
}
|
|
59
|
+
__name(isRegExp, "isRegExp");
|
|
60
|
+
function compatibleInstance(thrown, errorLike) {
|
|
61
|
+
return isErrorInstance(errorLike) && thrown === errorLike;
|
|
62
|
+
}
|
|
63
|
+
__name(compatibleInstance, "compatibleInstance");
|
|
64
|
+
function compatibleConstructor(thrown, errorLike) {
|
|
65
|
+
if (isErrorInstance(errorLike)) {
|
|
66
|
+
return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
|
|
67
|
+
} else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) {
|
|
68
|
+
return thrown.constructor === errorLike || thrown instanceof errorLike;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
__name(compatibleConstructor, "compatibleConstructor");
|
|
73
|
+
function compatibleMessage(thrown, errMatcher) {
|
|
74
|
+
const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
|
|
75
|
+
if (isRegExp(errMatcher)) {
|
|
76
|
+
return errMatcher.test(comparisonString);
|
|
77
|
+
} else if (typeof errMatcher === "string") {
|
|
78
|
+
return comparisonString.indexOf(errMatcher) !== -1;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
__name(compatibleMessage, "compatibleMessage");
|
|
83
|
+
function getConstructorName(errorLike) {
|
|
84
|
+
let constructorName = errorLike;
|
|
85
|
+
if (isErrorInstance(errorLike)) {
|
|
86
|
+
constructorName = errorLike.constructor.name;
|
|
87
|
+
} else if (typeof errorLike === "function") {
|
|
88
|
+
constructorName = errorLike.name;
|
|
89
|
+
if (constructorName === "") {
|
|
90
|
+
const newConstructorName = new errorLike().name;
|
|
91
|
+
constructorName = newConstructorName || constructorName;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return constructorName;
|
|
95
|
+
}
|
|
96
|
+
__name(getConstructorName, "getConstructorName");
|
|
97
|
+
function getMessage(errorLike) {
|
|
98
|
+
let msg = "";
|
|
99
|
+
if (errorLike && errorLike.message) {
|
|
100
|
+
msg = errorLike.message;
|
|
101
|
+
} else if (typeof errorLike === "string") {
|
|
102
|
+
msg = errorLike;
|
|
103
|
+
}
|
|
104
|
+
return msg;
|
|
105
|
+
}
|
|
106
|
+
__name(getMessage, "getMessage");
|
|
107
|
+
function flag(obj, key, value) {
|
|
108
|
+
let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
|
|
109
|
+
if (arguments.length === 3) {
|
|
110
|
+
flags[key] = value;
|
|
111
|
+
} else {
|
|
112
|
+
return flags[key];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
__name(flag, "flag");
|
|
116
|
+
function test(obj, args) {
|
|
117
|
+
let negate = flag(obj, "negate"), expr = args[0];
|
|
118
|
+
return negate ? !expr : expr;
|
|
119
|
+
}
|
|
120
|
+
__name(test, "test");
|
|
121
|
+
function type(obj) {
|
|
122
|
+
if (typeof obj === "undefined") {
|
|
123
|
+
return "undefined";
|
|
124
|
+
}
|
|
125
|
+
if (obj === null) {
|
|
126
|
+
return "null";
|
|
127
|
+
}
|
|
128
|
+
const stringTag = obj[Symbol.toStringTag];
|
|
129
|
+
if (typeof stringTag === "string") {
|
|
130
|
+
return stringTag;
|
|
131
|
+
}
|
|
132
|
+
const type3 = Object.prototype.toString.call(obj).slice(8, -1);
|
|
133
|
+
return type3;
|
|
134
|
+
}
|
|
135
|
+
__name(type, "type");
|
|
136
|
+
var canElideFrames = "captureStackTrace" in Error;
|
|
137
|
+
var _AssertionError = class _AssertionError2 extends Error {
|
|
138
|
+
constructor(message = "Unspecified AssertionError", props, ssf) {
|
|
139
|
+
super(message);
|
|
140
|
+
__publicField(this, "message");
|
|
141
|
+
this.message = message;
|
|
142
|
+
if (canElideFrames) {
|
|
143
|
+
Error.captureStackTrace(this, ssf || _AssertionError2);
|
|
144
|
+
}
|
|
145
|
+
for (const key in props) {
|
|
146
|
+
if (!(key in this)) {
|
|
147
|
+
this[key] = props[key];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
get name() {
|
|
152
|
+
return "AssertionError";
|
|
153
|
+
}
|
|
154
|
+
get ok() {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
toJSON(stack) {
|
|
158
|
+
return {
|
|
159
|
+
...this,
|
|
160
|
+
name: this.name,
|
|
161
|
+
message: this.message,
|
|
162
|
+
ok: false,
|
|
163
|
+
stack: stack !== false ? this.stack : undefined
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
__name(_AssertionError, "AssertionError");
|
|
168
|
+
var AssertionError = _AssertionError;
|
|
169
|
+
function expectTypes(obj, types) {
|
|
170
|
+
let flagMsg = flag(obj, "message");
|
|
171
|
+
let ssfi = flag(obj, "ssfi");
|
|
172
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
173
|
+
obj = flag(obj, "object");
|
|
174
|
+
types = types.map(function(t) {
|
|
175
|
+
return t.toLowerCase();
|
|
176
|
+
});
|
|
177
|
+
types.sort();
|
|
178
|
+
let str = types.map(function(t, index) {
|
|
179
|
+
let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
|
|
180
|
+
let or = types.length > 1 && index === types.length - 1 ? "or " : "";
|
|
181
|
+
return or + art + " " + t;
|
|
182
|
+
}).join(", ");
|
|
183
|
+
let objType = type(obj).toLowerCase();
|
|
184
|
+
if (!types.some(function(expected) {
|
|
185
|
+
return objType === expected;
|
|
186
|
+
})) {
|
|
187
|
+
throw new AssertionError(flagMsg + "object tested must be " + str + ", but " + objType + " given", undefined, ssfi);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
__name(expectTypes, "expectTypes");
|
|
191
|
+
function getActual(obj, args) {
|
|
192
|
+
return args.length > 4 ? args[4] : obj._obj;
|
|
193
|
+
}
|
|
194
|
+
__name(getActual, "getActual");
|
|
195
|
+
var ansiColors = {
|
|
196
|
+
bold: ["1", "22"],
|
|
197
|
+
dim: ["2", "22"],
|
|
198
|
+
italic: ["3", "23"],
|
|
199
|
+
underline: ["4", "24"],
|
|
200
|
+
inverse: ["7", "27"],
|
|
201
|
+
hidden: ["8", "28"],
|
|
202
|
+
strike: ["9", "29"],
|
|
203
|
+
black: ["30", "39"],
|
|
204
|
+
red: ["31", "39"],
|
|
205
|
+
green: ["32", "39"],
|
|
206
|
+
yellow: ["33", "39"],
|
|
207
|
+
blue: ["34", "39"],
|
|
208
|
+
magenta: ["35", "39"],
|
|
209
|
+
cyan: ["36", "39"],
|
|
210
|
+
white: ["37", "39"],
|
|
211
|
+
brightblack: ["30;1", "39"],
|
|
212
|
+
brightred: ["31;1", "39"],
|
|
213
|
+
brightgreen: ["32;1", "39"],
|
|
214
|
+
brightyellow: ["33;1", "39"],
|
|
215
|
+
brightblue: ["34;1", "39"],
|
|
216
|
+
brightmagenta: ["35;1", "39"],
|
|
217
|
+
brightcyan: ["36;1", "39"],
|
|
218
|
+
brightwhite: ["37;1", "39"],
|
|
219
|
+
grey: ["90", "39"]
|
|
220
|
+
};
|
|
221
|
+
var styles = {
|
|
222
|
+
special: "cyan",
|
|
223
|
+
number: "yellow",
|
|
224
|
+
bigint: "yellow",
|
|
225
|
+
boolean: "yellow",
|
|
226
|
+
undefined: "grey",
|
|
227
|
+
null: "bold",
|
|
228
|
+
string: "green",
|
|
229
|
+
symbol: "green",
|
|
230
|
+
date: "magenta",
|
|
231
|
+
regexp: "red"
|
|
232
|
+
};
|
|
233
|
+
var truncator = "…";
|
|
234
|
+
function colorise(value, styleType) {
|
|
235
|
+
const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
|
|
236
|
+
if (!color) {
|
|
237
|
+
return String(value);
|
|
238
|
+
}
|
|
239
|
+
return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
|
|
240
|
+
}
|
|
241
|
+
__name(colorise, "colorise");
|
|
242
|
+
function normaliseOptions({
|
|
243
|
+
showHidden = false,
|
|
244
|
+
depth = 2,
|
|
245
|
+
colors = false,
|
|
246
|
+
customInspect = true,
|
|
247
|
+
showProxy = false,
|
|
248
|
+
maxArrayLength = Infinity,
|
|
249
|
+
breakLength = Infinity,
|
|
250
|
+
seen = [],
|
|
251
|
+
truncate: truncate2 = Infinity,
|
|
252
|
+
stylize = String
|
|
253
|
+
} = {}, inspect3) {
|
|
254
|
+
const options = {
|
|
255
|
+
showHidden: Boolean(showHidden),
|
|
256
|
+
depth: Number(depth),
|
|
257
|
+
colors: Boolean(colors),
|
|
258
|
+
customInspect: Boolean(customInspect),
|
|
259
|
+
showProxy: Boolean(showProxy),
|
|
260
|
+
maxArrayLength: Number(maxArrayLength),
|
|
261
|
+
breakLength: Number(breakLength),
|
|
262
|
+
truncate: Number(truncate2),
|
|
263
|
+
seen,
|
|
264
|
+
inspect: inspect3,
|
|
265
|
+
stylize
|
|
266
|
+
};
|
|
267
|
+
if (options.colors) {
|
|
268
|
+
options.stylize = colorise;
|
|
269
|
+
}
|
|
270
|
+
return options;
|
|
271
|
+
}
|
|
272
|
+
__name(normaliseOptions, "normaliseOptions");
|
|
273
|
+
function isHighSurrogate(char) {
|
|
274
|
+
return char >= "\uD800" && char <= "\uDBFF";
|
|
275
|
+
}
|
|
276
|
+
__name(isHighSurrogate, "isHighSurrogate");
|
|
277
|
+
function truncate(string, length, tail = truncator) {
|
|
278
|
+
string = String(string);
|
|
279
|
+
const tailLength = tail.length;
|
|
280
|
+
const stringLength = string.length;
|
|
281
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
282
|
+
return tail;
|
|
283
|
+
}
|
|
284
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
285
|
+
let end = length - tailLength;
|
|
286
|
+
if (end > 0 && isHighSurrogate(string[end - 1])) {
|
|
287
|
+
end = end - 1;
|
|
288
|
+
}
|
|
289
|
+
return `${string.slice(0, end)}${tail}`;
|
|
290
|
+
}
|
|
291
|
+
return string;
|
|
292
|
+
}
|
|
293
|
+
__name(truncate, "truncate");
|
|
294
|
+
function inspectList(list, options, inspectItem, separator = ", ") {
|
|
295
|
+
inspectItem = inspectItem || options.inspect;
|
|
296
|
+
const size = list.length;
|
|
297
|
+
if (size === 0)
|
|
298
|
+
return "";
|
|
299
|
+
const originalLength = options.truncate;
|
|
300
|
+
let output = "";
|
|
301
|
+
let peek = "";
|
|
302
|
+
let truncated = "";
|
|
303
|
+
for (let i = 0;i < size; i += 1) {
|
|
304
|
+
const last = i + 1 === list.length;
|
|
305
|
+
const secondToLast = i + 2 === list.length;
|
|
306
|
+
truncated = `${truncator}(${list.length - i})`;
|
|
307
|
+
const value = list[i];
|
|
308
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
309
|
+
const string = peek || inspectItem(value, options) + (last ? "" : separator);
|
|
310
|
+
const nextLength = output.length + string.length;
|
|
311
|
+
const truncatedLength = nextLength + truncated.length;
|
|
312
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
|
|
319
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
output += string;
|
|
323
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
324
|
+
truncated = `${truncator}(${list.length - i - 1})`;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
truncated = "";
|
|
328
|
+
}
|
|
329
|
+
return `${output}${truncated}`;
|
|
330
|
+
}
|
|
331
|
+
__name(inspectList, "inspectList");
|
|
332
|
+
function quoteComplexKey(key) {
|
|
333
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
334
|
+
return key;
|
|
335
|
+
}
|
|
336
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
337
|
+
}
|
|
338
|
+
__name(quoteComplexKey, "quoteComplexKey");
|
|
339
|
+
function inspectProperty([key, value], options) {
|
|
340
|
+
options.truncate -= 2;
|
|
341
|
+
if (typeof key === "string") {
|
|
342
|
+
key = quoteComplexKey(key);
|
|
343
|
+
} else if (typeof key !== "number") {
|
|
344
|
+
key = `[${options.inspect(key, options)}]`;
|
|
345
|
+
}
|
|
346
|
+
options.truncate -= key.length;
|
|
347
|
+
value = options.inspect(value, options);
|
|
348
|
+
return `${key}: ${value}`;
|
|
349
|
+
}
|
|
350
|
+
__name(inspectProperty, "inspectProperty");
|
|
351
|
+
function inspectArray(array, options) {
|
|
352
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
353
|
+
if (!array.length && !nonIndexProperties.length)
|
|
354
|
+
return "[]";
|
|
355
|
+
options.truncate -= 4;
|
|
356
|
+
const listContents = inspectList(array, options);
|
|
357
|
+
options.truncate -= listContents.length;
|
|
358
|
+
let propertyContents = "";
|
|
359
|
+
if (nonIndexProperties.length) {
|
|
360
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
361
|
+
}
|
|
362
|
+
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
363
|
+
}
|
|
364
|
+
__name(inspectArray, "inspectArray");
|
|
365
|
+
var getArrayName = /* @__PURE__ */ __name((array) => {
|
|
366
|
+
if (typeof Buffer === "function" && array instanceof Buffer) {
|
|
367
|
+
return "Buffer";
|
|
368
|
+
}
|
|
369
|
+
if (array[Symbol.toStringTag]) {
|
|
370
|
+
return array[Symbol.toStringTag];
|
|
371
|
+
}
|
|
372
|
+
return array.constructor.name;
|
|
373
|
+
}, "getArrayName");
|
|
374
|
+
function inspectTypedArray(array, options) {
|
|
375
|
+
const name = getArrayName(array);
|
|
376
|
+
options.truncate -= name.length + 4;
|
|
377
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
378
|
+
if (!array.length && !nonIndexProperties.length)
|
|
379
|
+
return `${name}[]`;
|
|
380
|
+
let output = "";
|
|
381
|
+
for (let i = 0;i < array.length; i++) {
|
|
382
|
+
const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
|
|
383
|
+
options.truncate -= string.length;
|
|
384
|
+
if (array[i] !== array.length && options.truncate <= 3) {
|
|
385
|
+
output += `${truncator}(${array.length - array[i] + 1})`;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
output += string;
|
|
389
|
+
}
|
|
390
|
+
let propertyContents = "";
|
|
391
|
+
if (nonIndexProperties.length) {
|
|
392
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
393
|
+
}
|
|
394
|
+
return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
395
|
+
}
|
|
396
|
+
__name(inspectTypedArray, "inspectTypedArray");
|
|
397
|
+
function inspectDate(dateObject, options) {
|
|
398
|
+
const stringRepresentation = dateObject.toJSON();
|
|
399
|
+
if (stringRepresentation === null) {
|
|
400
|
+
return "Invalid Date";
|
|
401
|
+
}
|
|
402
|
+
const split = stringRepresentation.split("T");
|
|
403
|
+
const date = split[0];
|
|
404
|
+
return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
405
|
+
}
|
|
406
|
+
__name(inspectDate, "inspectDate");
|
|
407
|
+
function inspectFunction(func, options) {
|
|
408
|
+
const functionType = func[Symbol.toStringTag] || "Function";
|
|
409
|
+
const name = func.name;
|
|
410
|
+
if (!name) {
|
|
411
|
+
return options.stylize(`[${functionType}]`, "special");
|
|
412
|
+
}
|
|
413
|
+
return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
|
|
414
|
+
}
|
|
415
|
+
__name(inspectFunction, "inspectFunction");
|
|
416
|
+
function inspectMapEntry([key, value], options) {
|
|
417
|
+
options.truncate -= 4;
|
|
418
|
+
key = options.inspect(key, options);
|
|
419
|
+
options.truncate -= key.length;
|
|
420
|
+
value = options.inspect(value, options);
|
|
421
|
+
return `${key} => ${value}`;
|
|
422
|
+
}
|
|
423
|
+
__name(inspectMapEntry, "inspectMapEntry");
|
|
424
|
+
function mapToEntries(map) {
|
|
425
|
+
const entries = [];
|
|
426
|
+
map.forEach((value, key) => {
|
|
427
|
+
entries.push([key, value]);
|
|
428
|
+
});
|
|
429
|
+
return entries;
|
|
430
|
+
}
|
|
431
|
+
__name(mapToEntries, "mapToEntries");
|
|
432
|
+
function inspectMap(map, options) {
|
|
433
|
+
if (map.size === 0)
|
|
434
|
+
return "Map{}";
|
|
435
|
+
options.truncate -= 7;
|
|
436
|
+
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
437
|
+
}
|
|
438
|
+
__name(inspectMap, "inspectMap");
|
|
439
|
+
var isNaN = Number.isNaN || ((i) => i !== i);
|
|
440
|
+
function inspectNumber(number, options) {
|
|
441
|
+
if (isNaN(number)) {
|
|
442
|
+
return options.stylize("NaN", "number");
|
|
443
|
+
}
|
|
444
|
+
if (number === Infinity) {
|
|
445
|
+
return options.stylize("Infinity", "number");
|
|
446
|
+
}
|
|
447
|
+
if (number === -Infinity) {
|
|
448
|
+
return options.stylize("-Infinity", "number");
|
|
449
|
+
}
|
|
450
|
+
if (number === 0) {
|
|
451
|
+
return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
|
|
452
|
+
}
|
|
453
|
+
return options.stylize(truncate(String(number), options.truncate), "number");
|
|
454
|
+
}
|
|
455
|
+
__name(inspectNumber, "inspectNumber");
|
|
456
|
+
function inspectBigInt(number, options) {
|
|
457
|
+
let nums = truncate(number.toString(), options.truncate - 1);
|
|
458
|
+
if (nums !== truncator)
|
|
459
|
+
nums += "n";
|
|
460
|
+
return options.stylize(nums, "bigint");
|
|
461
|
+
}
|
|
462
|
+
__name(inspectBigInt, "inspectBigInt");
|
|
463
|
+
function inspectRegExp(value, options) {
|
|
464
|
+
const flags = value.toString().split("/")[2];
|
|
465
|
+
const sourceLength = options.truncate - (2 + flags.length);
|
|
466
|
+
const source = value.source;
|
|
467
|
+
return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
|
|
468
|
+
}
|
|
469
|
+
__name(inspectRegExp, "inspectRegExp");
|
|
470
|
+
function arrayFromSet(set2) {
|
|
471
|
+
const values = [];
|
|
472
|
+
set2.forEach((value) => {
|
|
473
|
+
values.push(value);
|
|
474
|
+
});
|
|
475
|
+
return values;
|
|
476
|
+
}
|
|
477
|
+
__name(arrayFromSet, "arrayFromSet");
|
|
478
|
+
function inspectSet(set2, options) {
|
|
479
|
+
if (set2.size === 0)
|
|
480
|
+
return "Set{}";
|
|
481
|
+
options.truncate -= 7;
|
|
482
|
+
return `Set{ ${inspectList(arrayFromSet(set2), options)} }`;
|
|
483
|
+
}
|
|
484
|
+
__name(inspectSet, "inspectSet");
|
|
485
|
+
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
|
|
486
|
+
var escapeCharacters = {
|
|
487
|
+
"\b": "\\b",
|
|
488
|
+
"\t": "\\t",
|
|
489
|
+
"\n": "\\n",
|
|
490
|
+
"\f": "\\f",
|
|
491
|
+
"\r": "\\r",
|
|
492
|
+
"'": "\\'",
|
|
493
|
+
"\\": "\\\\"
|
|
494
|
+
};
|
|
495
|
+
var hex = 16;
|
|
496
|
+
var unicodeLength = 4;
|
|
497
|
+
function escape(char) {
|
|
498
|
+
return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
|
|
499
|
+
}
|
|
500
|
+
__name(escape, "escape");
|
|
501
|
+
function inspectString(string, options) {
|
|
502
|
+
if (stringEscapeChars.test(string)) {
|
|
503
|
+
string = string.replace(stringEscapeChars, escape);
|
|
504
|
+
}
|
|
505
|
+
return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
|
|
506
|
+
}
|
|
507
|
+
__name(inspectString, "inspectString");
|
|
508
|
+
function inspectSymbol(value) {
|
|
509
|
+
if ("description" in Symbol.prototype) {
|
|
510
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
511
|
+
}
|
|
512
|
+
return value.toString();
|
|
513
|
+
}
|
|
514
|
+
__name(inspectSymbol, "inspectSymbol");
|
|
515
|
+
var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{…}", "getPromiseValue");
|
|
516
|
+
var promise_default = getPromiseValue;
|
|
517
|
+
function inspectObject(object, options) {
|
|
518
|
+
const properties = Object.getOwnPropertyNames(object);
|
|
519
|
+
const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
520
|
+
if (properties.length === 0 && symbols.length === 0) {
|
|
521
|
+
return "{}";
|
|
522
|
+
}
|
|
523
|
+
options.truncate -= 4;
|
|
524
|
+
options.seen = options.seen || [];
|
|
525
|
+
if (options.seen.includes(object)) {
|
|
526
|
+
return "[Circular]";
|
|
527
|
+
}
|
|
528
|
+
options.seen.push(object);
|
|
529
|
+
const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
|
|
530
|
+
const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
|
|
531
|
+
options.seen.pop();
|
|
532
|
+
let sep = "";
|
|
533
|
+
if (propertyContents && symbolContents) {
|
|
534
|
+
sep = ", ";
|
|
535
|
+
}
|
|
536
|
+
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
537
|
+
}
|
|
538
|
+
__name(inspectObject, "inspectObject");
|
|
539
|
+
var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
540
|
+
function inspectClass(value, options) {
|
|
541
|
+
let name = "";
|
|
542
|
+
if (toStringTag && toStringTag in value) {
|
|
543
|
+
name = value[toStringTag];
|
|
544
|
+
}
|
|
545
|
+
name = name || value.constructor.name;
|
|
546
|
+
if (!name || name === "_class") {
|
|
547
|
+
name = "<Anonymous Class>";
|
|
548
|
+
}
|
|
549
|
+
options.truncate -= name.length;
|
|
550
|
+
return `${name}${inspectObject(value, options)}`;
|
|
551
|
+
}
|
|
552
|
+
__name(inspectClass, "inspectClass");
|
|
553
|
+
function inspectArguments(args, options) {
|
|
554
|
+
if (args.length === 0)
|
|
555
|
+
return "Arguments[]";
|
|
556
|
+
options.truncate -= 13;
|
|
557
|
+
return `Arguments[ ${inspectList(args, options)} ]`;
|
|
558
|
+
}
|
|
559
|
+
__name(inspectArguments, "inspectArguments");
|
|
560
|
+
var errorKeys = [
|
|
561
|
+
"stack",
|
|
562
|
+
"line",
|
|
563
|
+
"column",
|
|
564
|
+
"name",
|
|
565
|
+
"message",
|
|
566
|
+
"fileName",
|
|
567
|
+
"lineNumber",
|
|
568
|
+
"columnNumber",
|
|
569
|
+
"number",
|
|
570
|
+
"description",
|
|
571
|
+
"cause"
|
|
572
|
+
];
|
|
573
|
+
function inspectObject2(error, options) {
|
|
574
|
+
const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
|
|
575
|
+
const name = error.name;
|
|
576
|
+
options.truncate -= name.length;
|
|
577
|
+
let message = "";
|
|
578
|
+
if (typeof error.message === "string") {
|
|
579
|
+
message = truncate(error.message, options.truncate);
|
|
580
|
+
} else {
|
|
581
|
+
properties.unshift("message");
|
|
582
|
+
}
|
|
583
|
+
message = message ? `: ${message}` : "";
|
|
584
|
+
options.truncate -= message.length + 5;
|
|
585
|
+
options.seen = options.seen || [];
|
|
586
|
+
if (options.seen.includes(error)) {
|
|
587
|
+
return "[Circular]";
|
|
588
|
+
}
|
|
589
|
+
options.seen.push(error);
|
|
590
|
+
const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
|
|
591
|
+
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
592
|
+
}
|
|
593
|
+
__name(inspectObject2, "inspectObject");
|
|
594
|
+
function inspectAttribute([key, value], options) {
|
|
595
|
+
options.truncate -= 3;
|
|
596
|
+
if (!value) {
|
|
597
|
+
return `${options.stylize(String(key), "yellow")}`;
|
|
598
|
+
}
|
|
599
|
+
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
600
|
+
}
|
|
601
|
+
__name(inspectAttribute, "inspectAttribute");
|
|
602
|
+
function inspectNodeCollection(collection, options) {
|
|
603
|
+
return inspectList(collection, options, inspectNode, `
|
|
604
|
+
`);
|
|
605
|
+
}
|
|
606
|
+
__name(inspectNodeCollection, "inspectNodeCollection");
|
|
607
|
+
function inspectNode(node, options) {
|
|
608
|
+
switch (node.nodeType) {
|
|
609
|
+
case 1:
|
|
610
|
+
return inspectHTML(node, options);
|
|
611
|
+
case 3:
|
|
612
|
+
return options.inspect(node.data, options);
|
|
613
|
+
default:
|
|
614
|
+
return options.inspect(node, options);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
__name(inspectNode, "inspectNode");
|
|
618
|
+
function inspectHTML(element, options) {
|
|
619
|
+
const properties = element.getAttributeNames();
|
|
620
|
+
const name = element.tagName.toLowerCase();
|
|
621
|
+
const head = options.stylize(`<${name}`, "special");
|
|
622
|
+
const headClose = options.stylize(`>`, "special");
|
|
623
|
+
const tail = options.stylize(`</${name}>`, "special");
|
|
624
|
+
options.truncate -= name.length * 2 + 5;
|
|
625
|
+
let propertyContents = "";
|
|
626
|
+
if (properties.length > 0) {
|
|
627
|
+
propertyContents += " ";
|
|
628
|
+
propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
|
|
629
|
+
}
|
|
630
|
+
options.truncate -= propertyContents.length;
|
|
631
|
+
const truncate2 = options.truncate;
|
|
632
|
+
let children = inspectNodeCollection(element.children, options);
|
|
633
|
+
if (children && children.length > truncate2) {
|
|
634
|
+
children = `${truncator}(${element.children.length})`;
|
|
635
|
+
}
|
|
636
|
+
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
637
|
+
}
|
|
638
|
+
__name(inspectHTML, "inspectHTML");
|
|
639
|
+
var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
640
|
+
var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
641
|
+
var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
642
|
+
var constructorMap = /* @__PURE__ */ new WeakMap;
|
|
643
|
+
var stringTagMap = {};
|
|
644
|
+
var baseTypesMap = {
|
|
645
|
+
undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
|
|
646
|
+
null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
|
|
647
|
+
boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
|
|
648
|
+
Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
|
|
649
|
+
number: inspectNumber,
|
|
650
|
+
Number: inspectNumber,
|
|
651
|
+
bigint: inspectBigInt,
|
|
652
|
+
BigInt: inspectBigInt,
|
|
653
|
+
string: inspectString,
|
|
654
|
+
String: inspectString,
|
|
655
|
+
function: inspectFunction,
|
|
656
|
+
Function: inspectFunction,
|
|
657
|
+
symbol: inspectSymbol,
|
|
658
|
+
Symbol: inspectSymbol,
|
|
659
|
+
Array: inspectArray,
|
|
660
|
+
Date: inspectDate,
|
|
661
|
+
Map: inspectMap,
|
|
662
|
+
Set: inspectSet,
|
|
663
|
+
RegExp: inspectRegExp,
|
|
664
|
+
Promise: promise_default,
|
|
665
|
+
WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{…}", "special"), "WeakSet"),
|
|
666
|
+
WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{…}", "special"), "WeakMap"),
|
|
667
|
+
Arguments: inspectArguments,
|
|
668
|
+
Int8Array: inspectTypedArray,
|
|
669
|
+
Uint8Array: inspectTypedArray,
|
|
670
|
+
Uint8ClampedArray: inspectTypedArray,
|
|
671
|
+
Int16Array: inspectTypedArray,
|
|
672
|
+
Uint16Array: inspectTypedArray,
|
|
673
|
+
Int32Array: inspectTypedArray,
|
|
674
|
+
Uint32Array: inspectTypedArray,
|
|
675
|
+
Float32Array: inspectTypedArray,
|
|
676
|
+
Float64Array: inspectTypedArray,
|
|
677
|
+
Generator: /* @__PURE__ */ __name(() => "", "Generator"),
|
|
678
|
+
DataView: /* @__PURE__ */ __name(() => "", "DataView"),
|
|
679
|
+
ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
|
|
680
|
+
Error: inspectObject2,
|
|
681
|
+
HTMLCollection: inspectNodeCollection,
|
|
682
|
+
NodeList: inspectNodeCollection
|
|
683
|
+
};
|
|
684
|
+
var inspectCustom = /* @__PURE__ */ __name((value, options, type3, inspectFn) => {
|
|
685
|
+
if (chaiInspect in value && typeof value[chaiInspect] === "function") {
|
|
686
|
+
return value[chaiInspect](options);
|
|
687
|
+
}
|
|
688
|
+
if (nodeInspect in value && typeof value[nodeInspect] === "function") {
|
|
689
|
+
return value[nodeInspect](options.depth, options, inspectFn);
|
|
690
|
+
}
|
|
691
|
+
if ("inspect" in value && typeof value.inspect === "function") {
|
|
692
|
+
return value.inspect(options.depth, options);
|
|
693
|
+
}
|
|
694
|
+
if ("constructor" in value && constructorMap.has(value.constructor)) {
|
|
695
|
+
return constructorMap.get(value.constructor)(value, options);
|
|
696
|
+
}
|
|
697
|
+
if (stringTagMap[type3]) {
|
|
698
|
+
return stringTagMap[type3](value, options);
|
|
699
|
+
}
|
|
700
|
+
return "";
|
|
701
|
+
}, "inspectCustom");
|
|
702
|
+
var toString = Object.prototype.toString;
|
|
703
|
+
function inspect(value, opts = {}) {
|
|
704
|
+
const options = normaliseOptions(opts, inspect);
|
|
705
|
+
const { customInspect } = options;
|
|
706
|
+
let type3 = value === null ? "null" : typeof value;
|
|
707
|
+
if (type3 === "object") {
|
|
708
|
+
type3 = toString.call(value).slice(8, -1);
|
|
709
|
+
}
|
|
710
|
+
if (type3 in baseTypesMap) {
|
|
711
|
+
return baseTypesMap[type3](value, options);
|
|
712
|
+
}
|
|
713
|
+
if (customInspect && value) {
|
|
714
|
+
const output = inspectCustom(value, options, type3, inspect);
|
|
715
|
+
if (output) {
|
|
716
|
+
if (typeof output === "string")
|
|
717
|
+
return output;
|
|
718
|
+
return inspect(output, options);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const proto = value ? Object.getPrototypeOf(value) : false;
|
|
722
|
+
if (proto === Object.prototype || proto === null) {
|
|
723
|
+
return inspectObject(value, options);
|
|
724
|
+
}
|
|
725
|
+
if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
|
|
726
|
+
return inspectHTML(value, options);
|
|
727
|
+
}
|
|
728
|
+
if ("constructor" in value) {
|
|
729
|
+
if (value.constructor !== Object) {
|
|
730
|
+
return inspectClass(value, options);
|
|
731
|
+
}
|
|
732
|
+
return inspectObject(value, options);
|
|
733
|
+
}
|
|
734
|
+
if (value === Object(value)) {
|
|
735
|
+
return inspectObject(value, options);
|
|
736
|
+
}
|
|
737
|
+
return options.stylize(String(value), type3);
|
|
738
|
+
}
|
|
739
|
+
__name(inspect, "inspect");
|
|
740
|
+
var config = {
|
|
741
|
+
includeStack: false,
|
|
742
|
+
showDiff: true,
|
|
743
|
+
truncateThreshold: 40,
|
|
744
|
+
useProxy: true,
|
|
745
|
+
proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"],
|
|
746
|
+
deepEqual: null
|
|
747
|
+
};
|
|
748
|
+
function inspect2(obj, showHidden, depth, colors) {
|
|
749
|
+
let options = {
|
|
750
|
+
colors,
|
|
751
|
+
depth: typeof depth === "undefined" ? 2 : depth,
|
|
752
|
+
showHidden,
|
|
753
|
+
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
|
|
754
|
+
};
|
|
755
|
+
return inspect(obj, options);
|
|
756
|
+
}
|
|
757
|
+
__name(inspect2, "inspect");
|
|
758
|
+
function objDisplay(obj) {
|
|
759
|
+
let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
|
|
760
|
+
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
761
|
+
if (type3 === "[object Function]") {
|
|
762
|
+
return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
|
|
763
|
+
} else if (type3 === "[object Array]") {
|
|
764
|
+
return "[ Array(" + obj.length + ") ]";
|
|
765
|
+
} else if (type3 === "[object Object]") {
|
|
766
|
+
let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
|
|
767
|
+
return "{ Object (" + kstr + ") }";
|
|
768
|
+
} else {
|
|
769
|
+
return str;
|
|
770
|
+
}
|
|
771
|
+
} else {
|
|
772
|
+
return str;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
__name(objDisplay, "objDisplay");
|
|
776
|
+
function getMessage2(obj, args) {
|
|
777
|
+
let negate = flag(obj, "negate");
|
|
778
|
+
let val = flag(obj, "object");
|
|
779
|
+
let expected = args[3];
|
|
780
|
+
let actual = getActual(obj, args);
|
|
781
|
+
let msg = negate ? args[2] : args[1];
|
|
782
|
+
let flagMsg = flag(obj, "message");
|
|
783
|
+
if (typeof msg === "function")
|
|
784
|
+
msg = msg();
|
|
785
|
+
msg = msg || "";
|
|
786
|
+
msg = msg.replace(/#\{this\}/g, function() {
|
|
787
|
+
return objDisplay(val);
|
|
788
|
+
}).replace(/#\{act\}/g, function() {
|
|
789
|
+
return objDisplay(actual);
|
|
790
|
+
}).replace(/#\{exp\}/g, function() {
|
|
791
|
+
return objDisplay(expected);
|
|
792
|
+
});
|
|
793
|
+
return flagMsg ? flagMsg + ": " + msg : msg;
|
|
794
|
+
}
|
|
795
|
+
__name(getMessage2, "getMessage");
|
|
796
|
+
function transferFlags(assertion, object, includeAll) {
|
|
797
|
+
let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
|
|
798
|
+
if (!object.__flags) {
|
|
799
|
+
object.__flags = /* @__PURE__ */ Object.create(null);
|
|
800
|
+
}
|
|
801
|
+
includeAll = arguments.length === 3 ? includeAll : true;
|
|
802
|
+
for (let flag3 in flags) {
|
|
803
|
+
if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
|
|
804
|
+
object.__flags[flag3] = flags[flag3];
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
__name(transferFlags, "transferFlags");
|
|
809
|
+
function type2(obj) {
|
|
810
|
+
if (typeof obj === "undefined") {
|
|
811
|
+
return "undefined";
|
|
812
|
+
}
|
|
813
|
+
if (obj === null) {
|
|
814
|
+
return "null";
|
|
815
|
+
}
|
|
816
|
+
const stringTag = obj[Symbol.toStringTag];
|
|
817
|
+
if (typeof stringTag === "string") {
|
|
818
|
+
return stringTag;
|
|
819
|
+
}
|
|
820
|
+
const sliceStart = 8;
|
|
821
|
+
const sliceEnd = -1;
|
|
822
|
+
return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
|
|
823
|
+
}
|
|
824
|
+
__name(type2, "type");
|
|
825
|
+
function FakeMap() {
|
|
826
|
+
this._key = "chai/deep-eql__" + Math.random() + Date.now();
|
|
827
|
+
}
|
|
828
|
+
__name(FakeMap, "FakeMap");
|
|
829
|
+
FakeMap.prototype = {
|
|
830
|
+
get: /* @__PURE__ */ __name(function get(key) {
|
|
831
|
+
return key[this._key];
|
|
832
|
+
}, "get"),
|
|
833
|
+
set: /* @__PURE__ */ __name(function set(key, value) {
|
|
834
|
+
if (Object.isExtensible(key)) {
|
|
835
|
+
Object.defineProperty(key, this._key, {
|
|
836
|
+
value,
|
|
837
|
+
configurable: true
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
}, "set")
|
|
841
|
+
};
|
|
842
|
+
var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
|
|
843
|
+
function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
|
|
844
|
+
if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
var leftHandMap = memoizeMap.get(leftHandOperand);
|
|
848
|
+
if (leftHandMap) {
|
|
849
|
+
var result = leftHandMap.get(rightHandOperand);
|
|
850
|
+
if (typeof result === "boolean") {
|
|
851
|
+
return result;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
__name(memoizeCompare, "memoizeCompare");
|
|
857
|
+
function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
|
|
858
|
+
if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
var leftHandMap = memoizeMap.get(leftHandOperand);
|
|
862
|
+
if (leftHandMap) {
|
|
863
|
+
leftHandMap.set(rightHandOperand, result);
|
|
864
|
+
} else {
|
|
865
|
+
leftHandMap = new MemoizeMap;
|
|
866
|
+
leftHandMap.set(rightHandOperand, result);
|
|
867
|
+
memoizeMap.set(leftHandOperand, leftHandMap);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
__name(memoizeSet, "memoizeSet");
|
|
871
|
+
var deep_eql_default = deepEqual;
|
|
872
|
+
function deepEqual(leftHandOperand, rightHandOperand, options) {
|
|
873
|
+
if (options && options.comparator) {
|
|
874
|
+
return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
|
|
875
|
+
}
|
|
876
|
+
var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
|
|
877
|
+
if (simpleResult !== null) {
|
|
878
|
+
return simpleResult;
|
|
879
|
+
}
|
|
880
|
+
return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
|
|
881
|
+
}
|
|
882
|
+
__name(deepEqual, "deepEqual");
|
|
883
|
+
function simpleEqual(leftHandOperand, rightHandOperand) {
|
|
884
|
+
if (leftHandOperand === rightHandOperand) {
|
|
885
|
+
return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
|
|
886
|
+
}
|
|
887
|
+
if (leftHandOperand !== leftHandOperand && rightHandOperand !== rightHandOperand) {
|
|
888
|
+
return true;
|
|
889
|
+
}
|
|
890
|
+
if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
|
891
|
+
return false;
|
|
892
|
+
}
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
895
|
+
__name(simpleEqual, "simpleEqual");
|
|
896
|
+
function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
|
|
897
|
+
options = options || {};
|
|
898
|
+
options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap;
|
|
899
|
+
var comparator = options && options.comparator;
|
|
900
|
+
var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
|
|
901
|
+
if (memoizeResultLeft !== null) {
|
|
902
|
+
return memoizeResultLeft;
|
|
903
|
+
}
|
|
904
|
+
var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
|
|
905
|
+
if (memoizeResultRight !== null) {
|
|
906
|
+
return memoizeResultRight;
|
|
907
|
+
}
|
|
908
|
+
if (comparator) {
|
|
909
|
+
var comparatorResult = comparator(leftHandOperand, rightHandOperand);
|
|
910
|
+
if (comparatorResult === false || comparatorResult === true) {
|
|
911
|
+
memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
|
|
912
|
+
return comparatorResult;
|
|
913
|
+
}
|
|
914
|
+
var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
|
|
915
|
+
if (simpleResult !== null) {
|
|
916
|
+
return simpleResult;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
var leftHandType = type2(leftHandOperand);
|
|
920
|
+
if (leftHandType !== type2(rightHandOperand)) {
|
|
921
|
+
memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
|
|
925
|
+
var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
|
|
926
|
+
memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
|
|
927
|
+
return result;
|
|
928
|
+
}
|
|
929
|
+
__name(extensiveDeepEqual, "extensiveDeepEqual");
|
|
930
|
+
function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
|
|
931
|
+
switch (leftHandType) {
|
|
932
|
+
case "String":
|
|
933
|
+
case "Number":
|
|
934
|
+
case "Boolean":
|
|
935
|
+
case "Date":
|
|
936
|
+
return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
|
|
937
|
+
case "Promise":
|
|
938
|
+
case "Symbol":
|
|
939
|
+
case "function":
|
|
940
|
+
case "WeakMap":
|
|
941
|
+
case "WeakSet":
|
|
942
|
+
return leftHandOperand === rightHandOperand;
|
|
943
|
+
case "Error":
|
|
944
|
+
return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options);
|
|
945
|
+
case "Arguments":
|
|
946
|
+
case "Int8Array":
|
|
947
|
+
case "Uint8Array":
|
|
948
|
+
case "Uint8ClampedArray":
|
|
949
|
+
case "Int16Array":
|
|
950
|
+
case "Uint16Array":
|
|
951
|
+
case "Int32Array":
|
|
952
|
+
case "Uint32Array":
|
|
953
|
+
case "Float32Array":
|
|
954
|
+
case "Float64Array":
|
|
955
|
+
case "Array":
|
|
956
|
+
return iterableEqual(leftHandOperand, rightHandOperand, options);
|
|
957
|
+
case "RegExp":
|
|
958
|
+
return regexpEqual(leftHandOperand, rightHandOperand);
|
|
959
|
+
case "Generator":
|
|
960
|
+
return generatorEqual(leftHandOperand, rightHandOperand, options);
|
|
961
|
+
case "DataView":
|
|
962
|
+
return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
|
|
963
|
+
case "ArrayBuffer":
|
|
964
|
+
return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
|
|
965
|
+
case "Set":
|
|
966
|
+
return entriesEqual(leftHandOperand, rightHandOperand, options);
|
|
967
|
+
case "Map":
|
|
968
|
+
return entriesEqual(leftHandOperand, rightHandOperand, options);
|
|
969
|
+
case "Temporal.PlainDate":
|
|
970
|
+
case "Temporal.PlainTime":
|
|
971
|
+
case "Temporal.PlainDateTime":
|
|
972
|
+
case "Temporal.Instant":
|
|
973
|
+
case "Temporal.ZonedDateTime":
|
|
974
|
+
case "Temporal.PlainYearMonth":
|
|
975
|
+
case "Temporal.PlainMonthDay":
|
|
976
|
+
return leftHandOperand.equals(rightHandOperand);
|
|
977
|
+
case "Temporal.Duration":
|
|
978
|
+
return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds");
|
|
979
|
+
case "Temporal.TimeZone":
|
|
980
|
+
case "Temporal.Calendar":
|
|
981
|
+
return leftHandOperand.toString() === rightHandOperand.toString();
|
|
982
|
+
default:
|
|
983
|
+
return objectEqual(leftHandOperand, rightHandOperand, options);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
__name(extensiveDeepEqualByType, "extensiveDeepEqualByType");
|
|
987
|
+
function regexpEqual(leftHandOperand, rightHandOperand) {
|
|
988
|
+
return leftHandOperand.toString() === rightHandOperand.toString();
|
|
989
|
+
}
|
|
990
|
+
__name(regexpEqual, "regexpEqual");
|
|
991
|
+
function entriesEqual(leftHandOperand, rightHandOperand, options) {
|
|
992
|
+
try {
|
|
993
|
+
if (leftHandOperand.size !== rightHandOperand.size) {
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
if (leftHandOperand.size === 0) {
|
|
997
|
+
return true;
|
|
998
|
+
}
|
|
999
|
+
} catch (sizeError) {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
var leftHandItems = [];
|
|
1003
|
+
var rightHandItems = [];
|
|
1004
|
+
leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
|
|
1005
|
+
leftHandItems.push([key, value]);
|
|
1006
|
+
}, "gatherEntries"));
|
|
1007
|
+
rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
|
|
1008
|
+
rightHandItems.push([key, value]);
|
|
1009
|
+
}, "gatherEntries"));
|
|
1010
|
+
return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
|
|
1011
|
+
}
|
|
1012
|
+
__name(entriesEqual, "entriesEqual");
|
|
1013
|
+
function iterableEqual(leftHandOperand, rightHandOperand, options) {
|
|
1014
|
+
var length = leftHandOperand.length;
|
|
1015
|
+
if (length !== rightHandOperand.length) {
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
if (length === 0) {
|
|
1019
|
+
return true;
|
|
1020
|
+
}
|
|
1021
|
+
var index = -1;
|
|
1022
|
+
while (++index < length) {
|
|
1023
|
+
if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
|
|
1024
|
+
return false;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
__name(iterableEqual, "iterableEqual");
|
|
1030
|
+
function generatorEqual(leftHandOperand, rightHandOperand, options) {
|
|
1031
|
+
return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
|
|
1032
|
+
}
|
|
1033
|
+
__name(generatorEqual, "generatorEqual");
|
|
1034
|
+
function hasIteratorFunction(target) {
|
|
1035
|
+
return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
|
|
1036
|
+
}
|
|
1037
|
+
__name(hasIteratorFunction, "hasIteratorFunction");
|
|
1038
|
+
function getIteratorEntries(target) {
|
|
1039
|
+
if (hasIteratorFunction(target)) {
|
|
1040
|
+
try {
|
|
1041
|
+
return getGeneratorEntries(target[Symbol.iterator]());
|
|
1042
|
+
} catch (iteratorError) {
|
|
1043
|
+
return [];
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return [];
|
|
1047
|
+
}
|
|
1048
|
+
__name(getIteratorEntries, "getIteratorEntries");
|
|
1049
|
+
function getGeneratorEntries(generator) {
|
|
1050
|
+
var generatorResult = generator.next();
|
|
1051
|
+
var accumulator = [generatorResult.value];
|
|
1052
|
+
while (generatorResult.done === false) {
|
|
1053
|
+
generatorResult = generator.next();
|
|
1054
|
+
accumulator.push(generatorResult.value);
|
|
1055
|
+
}
|
|
1056
|
+
return accumulator;
|
|
1057
|
+
}
|
|
1058
|
+
__name(getGeneratorEntries, "getGeneratorEntries");
|
|
1059
|
+
function getEnumerableKeys(target) {
|
|
1060
|
+
var keys = [];
|
|
1061
|
+
for (var key in target) {
|
|
1062
|
+
keys.push(key);
|
|
1063
|
+
}
|
|
1064
|
+
return keys;
|
|
1065
|
+
}
|
|
1066
|
+
__name(getEnumerableKeys, "getEnumerableKeys");
|
|
1067
|
+
function getEnumerableSymbols(target) {
|
|
1068
|
+
var keys = [];
|
|
1069
|
+
var allKeys = Object.getOwnPropertySymbols(target);
|
|
1070
|
+
for (var i = 0;i < allKeys.length; i += 1) {
|
|
1071
|
+
var key = allKeys[i];
|
|
1072
|
+
if (Object.getOwnPropertyDescriptor(target, key).enumerable) {
|
|
1073
|
+
keys.push(key);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
return keys;
|
|
1077
|
+
}
|
|
1078
|
+
__name(getEnumerableSymbols, "getEnumerableSymbols");
|
|
1079
|
+
function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
|
|
1080
|
+
var length = keys.length;
|
|
1081
|
+
if (length === 0) {
|
|
1082
|
+
return true;
|
|
1083
|
+
}
|
|
1084
|
+
for (var i = 0;i < length; i += 1) {
|
|
1085
|
+
if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
|
|
1086
|
+
return false;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
__name(keysEqual, "keysEqual");
|
|
1092
|
+
function objectEqual(leftHandOperand, rightHandOperand, options) {
|
|
1093
|
+
var leftHandKeys = getEnumerableKeys(leftHandOperand);
|
|
1094
|
+
var rightHandKeys = getEnumerableKeys(rightHandOperand);
|
|
1095
|
+
var leftHandSymbols = getEnumerableSymbols(leftHandOperand);
|
|
1096
|
+
var rightHandSymbols = getEnumerableSymbols(rightHandOperand);
|
|
1097
|
+
leftHandKeys = leftHandKeys.concat(leftHandSymbols);
|
|
1098
|
+
rightHandKeys = rightHandKeys.concat(rightHandSymbols);
|
|
1099
|
+
if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
|
|
1100
|
+
if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
|
|
1101
|
+
return false;
|
|
1102
|
+
}
|
|
1103
|
+
return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
|
|
1104
|
+
}
|
|
1105
|
+
var leftHandEntries = getIteratorEntries(leftHandOperand);
|
|
1106
|
+
var rightHandEntries = getIteratorEntries(rightHandOperand);
|
|
1107
|
+
if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
|
|
1108
|
+
leftHandEntries.sort();
|
|
1109
|
+
rightHandEntries.sort();
|
|
1110
|
+
return iterableEqual(leftHandEntries, rightHandEntries, options);
|
|
1111
|
+
}
|
|
1112
|
+
if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
|
|
1113
|
+
return true;
|
|
1114
|
+
}
|
|
1115
|
+
return false;
|
|
1116
|
+
}
|
|
1117
|
+
__name(objectEqual, "objectEqual");
|
|
1118
|
+
function isPrimitive(value) {
|
|
1119
|
+
return value === null || typeof value !== "object";
|
|
1120
|
+
}
|
|
1121
|
+
__name(isPrimitive, "isPrimitive");
|
|
1122
|
+
function mapSymbols(arr) {
|
|
1123
|
+
return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) {
|
|
1124
|
+
if (typeof entry === "symbol") {
|
|
1125
|
+
return entry.toString();
|
|
1126
|
+
}
|
|
1127
|
+
return entry;
|
|
1128
|
+
}, "mapSymbol"));
|
|
1129
|
+
}
|
|
1130
|
+
__name(mapSymbols, "mapSymbols");
|
|
1131
|
+
function hasProperty(obj, name) {
|
|
1132
|
+
if (typeof obj === "undefined" || obj === null) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
return name in Object(obj);
|
|
1136
|
+
}
|
|
1137
|
+
__name(hasProperty, "hasProperty");
|
|
1138
|
+
function parsePath(path) {
|
|
1139
|
+
const str = path.replace(/([^\\])\[/g, "$1.[");
|
|
1140
|
+
const parts = str.match(/(\\\.|[^.]+?)+/g);
|
|
1141
|
+
return parts.map((value) => {
|
|
1142
|
+
if (value === "constructor" || value === "__proto__" || value === "prototype") {
|
|
1143
|
+
return {};
|
|
1144
|
+
}
|
|
1145
|
+
const regexp = /^\[(\d+)\]$/;
|
|
1146
|
+
const mArr = regexp.exec(value);
|
|
1147
|
+
let parsed = null;
|
|
1148
|
+
if (mArr) {
|
|
1149
|
+
parsed = { i: parseFloat(mArr[1]) };
|
|
1150
|
+
} else {
|
|
1151
|
+
parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
|
|
1152
|
+
}
|
|
1153
|
+
return parsed;
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
__name(parsePath, "parsePath");
|
|
1157
|
+
function internalGetPathValue(obj, parsed, pathDepth) {
|
|
1158
|
+
let temporaryValue = obj;
|
|
1159
|
+
let res = null;
|
|
1160
|
+
pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
|
|
1161
|
+
for (let i = 0;i < pathDepth; i++) {
|
|
1162
|
+
const part = parsed[i];
|
|
1163
|
+
if (temporaryValue) {
|
|
1164
|
+
if (typeof part.p === "undefined") {
|
|
1165
|
+
temporaryValue = temporaryValue[part.i];
|
|
1166
|
+
} else {
|
|
1167
|
+
temporaryValue = temporaryValue[part.p];
|
|
1168
|
+
}
|
|
1169
|
+
if (i === pathDepth - 1) {
|
|
1170
|
+
res = temporaryValue;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return res;
|
|
1175
|
+
}
|
|
1176
|
+
__name(internalGetPathValue, "internalGetPathValue");
|
|
1177
|
+
function getPathInfo(obj, path) {
|
|
1178
|
+
const parsed = parsePath(path);
|
|
1179
|
+
const last = parsed[parsed.length - 1];
|
|
1180
|
+
const info = {
|
|
1181
|
+
parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
|
|
1182
|
+
name: last.p || last.i,
|
|
1183
|
+
value: internalGetPathValue(obj, parsed)
|
|
1184
|
+
};
|
|
1185
|
+
info.exists = hasProperty(info.parent, info.name);
|
|
1186
|
+
return info;
|
|
1187
|
+
}
|
|
1188
|
+
__name(getPathInfo, "getPathInfo");
|
|
1189
|
+
var _Assertion = class _Assertion2 {
|
|
1190
|
+
constructor(obj, msg, ssfi, lockSsfi) {
|
|
1191
|
+
__publicField(this, "__flags", {});
|
|
1192
|
+
flag(this, "ssfi", ssfi || _Assertion2);
|
|
1193
|
+
flag(this, "lockSsfi", lockSsfi);
|
|
1194
|
+
flag(this, "object", obj);
|
|
1195
|
+
flag(this, "message", msg);
|
|
1196
|
+
flag(this, "eql", config.deepEqual || deep_eql_default);
|
|
1197
|
+
return proxify(this);
|
|
1198
|
+
}
|
|
1199
|
+
static get includeStack() {
|
|
1200
|
+
console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
|
|
1201
|
+
return config.includeStack;
|
|
1202
|
+
}
|
|
1203
|
+
static set includeStack(value) {
|
|
1204
|
+
console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
|
|
1205
|
+
config.includeStack = value;
|
|
1206
|
+
}
|
|
1207
|
+
static get showDiff() {
|
|
1208
|
+
console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
|
|
1209
|
+
return config.showDiff;
|
|
1210
|
+
}
|
|
1211
|
+
static set showDiff(value) {
|
|
1212
|
+
console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
|
|
1213
|
+
config.showDiff = value;
|
|
1214
|
+
}
|
|
1215
|
+
static addProperty(name, fn) {
|
|
1216
|
+
addProperty(this.prototype, name, fn);
|
|
1217
|
+
}
|
|
1218
|
+
static addMethod(name, fn) {
|
|
1219
|
+
addMethod(this.prototype, name, fn);
|
|
1220
|
+
}
|
|
1221
|
+
static addChainableMethod(name, fn, chainingBehavior) {
|
|
1222
|
+
addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
1223
|
+
}
|
|
1224
|
+
static overwriteProperty(name, fn) {
|
|
1225
|
+
overwriteProperty(this.prototype, name, fn);
|
|
1226
|
+
}
|
|
1227
|
+
static overwriteMethod(name, fn) {
|
|
1228
|
+
overwriteMethod(this.prototype, name, fn);
|
|
1229
|
+
}
|
|
1230
|
+
static overwriteChainableMethod(name, fn, chainingBehavior) {
|
|
1231
|
+
overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
1232
|
+
}
|
|
1233
|
+
assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
|
|
1234
|
+
const ok = test(this, arguments);
|
|
1235
|
+
if (showDiff !== false)
|
|
1236
|
+
showDiff = true;
|
|
1237
|
+
if (expected === undefined && _actual === undefined)
|
|
1238
|
+
showDiff = false;
|
|
1239
|
+
if (config.showDiff !== true)
|
|
1240
|
+
showDiff = false;
|
|
1241
|
+
if (!ok) {
|
|
1242
|
+
msg = getMessage2(this, arguments);
|
|
1243
|
+
const actual = getActual(this, arguments);
|
|
1244
|
+
const assertionErrorObjectProperties = {
|
|
1245
|
+
actual,
|
|
1246
|
+
expected,
|
|
1247
|
+
showDiff
|
|
1248
|
+
};
|
|
1249
|
+
const operator = getOperator(this, arguments);
|
|
1250
|
+
if (operator) {
|
|
1251
|
+
assertionErrorObjectProperties.operator = operator;
|
|
1252
|
+
}
|
|
1253
|
+
throw new AssertionError(msg, assertionErrorObjectProperties, config.includeStack ? this.assert : flag(this, "ssfi"));
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
get _obj() {
|
|
1257
|
+
return flag(this, "object");
|
|
1258
|
+
}
|
|
1259
|
+
set _obj(val) {
|
|
1260
|
+
flag(this, "object", val);
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
__name(_Assertion, "Assertion");
|
|
1264
|
+
var Assertion = _Assertion;
|
|
1265
|
+
var events = new EventTarget;
|
|
1266
|
+
var _PluginEvent = class _PluginEvent2 extends Event {
|
|
1267
|
+
constructor(type3, name, fn) {
|
|
1268
|
+
super(type3);
|
|
1269
|
+
this.name = String(name);
|
|
1270
|
+
this.fn = fn;
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
__name(_PluginEvent, "PluginEvent");
|
|
1274
|
+
var PluginEvent = _PluginEvent;
|
|
1275
|
+
function isProxyEnabled() {
|
|
1276
|
+
return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
|
|
1277
|
+
}
|
|
1278
|
+
__name(isProxyEnabled, "isProxyEnabled");
|
|
1279
|
+
function addProperty(ctx, name, getter) {
|
|
1280
|
+
getter = getter === undefined ? function() {} : getter;
|
|
1281
|
+
Object.defineProperty(ctx, name, {
|
|
1282
|
+
get: /* @__PURE__ */ __name(function propertyGetter() {
|
|
1283
|
+
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
1284
|
+
flag(this, "ssfi", propertyGetter);
|
|
1285
|
+
}
|
|
1286
|
+
let result = getter.call(this);
|
|
1287
|
+
if (result !== undefined)
|
|
1288
|
+
return result;
|
|
1289
|
+
let newAssertion = new Assertion;
|
|
1290
|
+
transferFlags(this, newAssertion);
|
|
1291
|
+
return newAssertion;
|
|
1292
|
+
}, "propertyGetter"),
|
|
1293
|
+
configurable: true
|
|
1294
|
+
});
|
|
1295
|
+
events.dispatchEvent(new PluginEvent("addProperty", name, getter));
|
|
1296
|
+
}
|
|
1297
|
+
__name(addProperty, "addProperty");
|
|
1298
|
+
var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {}, "length");
|
|
1299
|
+
function addLengthGuard(fn, assertionName, isChainable) {
|
|
1300
|
+
if (!fnLengthDesc.configurable)
|
|
1301
|
+
return fn;
|
|
1302
|
+
Object.defineProperty(fn, "length", {
|
|
1303
|
+
get: /* @__PURE__ */ __name(function() {
|
|
1304
|
+
if (isChainable) {
|
|
1305
|
+
throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
|
|
1306
|
+
}
|
|
1307
|
+
throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".');
|
|
1308
|
+
}, "get")
|
|
1309
|
+
});
|
|
1310
|
+
return fn;
|
|
1311
|
+
}
|
|
1312
|
+
__name(addLengthGuard, "addLengthGuard");
|
|
1313
|
+
function getProperties(object) {
|
|
1314
|
+
let result = Object.getOwnPropertyNames(object);
|
|
1315
|
+
function addProperty2(property) {
|
|
1316
|
+
if (result.indexOf(property) === -1) {
|
|
1317
|
+
result.push(property);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
__name(addProperty2, "addProperty");
|
|
1321
|
+
let proto = Object.getPrototypeOf(object);
|
|
1322
|
+
while (proto !== null) {
|
|
1323
|
+
Object.getOwnPropertyNames(proto).forEach(addProperty2);
|
|
1324
|
+
proto = Object.getPrototypeOf(proto);
|
|
1325
|
+
}
|
|
1326
|
+
return result;
|
|
1327
|
+
}
|
|
1328
|
+
__name(getProperties, "getProperties");
|
|
1329
|
+
var builtins = ["__flags", "__methods", "_obj", "assert"];
|
|
1330
|
+
function proxify(obj, nonChainableMethodName) {
|
|
1331
|
+
if (!isProxyEnabled())
|
|
1332
|
+
return obj;
|
|
1333
|
+
return new Proxy(obj, {
|
|
1334
|
+
get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
|
|
1335
|
+
if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
|
|
1336
|
+
if (nonChainableMethodName) {
|
|
1337
|
+
throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
|
|
1338
|
+
}
|
|
1339
|
+
let suggestion = null;
|
|
1340
|
+
let suggestionDistance = 4;
|
|
1341
|
+
getProperties(target).forEach(function(prop) {
|
|
1342
|
+
if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) {
|
|
1343
|
+
let dist = stringDistanceCapped(property, prop, suggestionDistance);
|
|
1344
|
+
if (dist < suggestionDistance) {
|
|
1345
|
+
suggestion = prop;
|
|
1346
|
+
suggestionDistance = dist;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
if (suggestion !== null) {
|
|
1351
|
+
throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?');
|
|
1352
|
+
} else {
|
|
1353
|
+
throw Error("Invalid Chai property: " + property);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
|
|
1357
|
+
flag(target, "ssfi", proxyGetter);
|
|
1358
|
+
}
|
|
1359
|
+
return Reflect.get(target, property);
|
|
1360
|
+
}, "proxyGetter")
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
__name(proxify, "proxify");
|
|
1364
|
+
function stringDistanceCapped(strA, strB, cap) {
|
|
1365
|
+
if (Math.abs(strA.length - strB.length) >= cap) {
|
|
1366
|
+
return cap;
|
|
1367
|
+
}
|
|
1368
|
+
let memo = [];
|
|
1369
|
+
for (let i = 0;i <= strA.length; i++) {
|
|
1370
|
+
memo[i] = Array(strB.length + 1).fill(0);
|
|
1371
|
+
memo[i][0] = i;
|
|
1372
|
+
}
|
|
1373
|
+
for (let j = 0;j < strB.length; j++) {
|
|
1374
|
+
memo[0][j] = j;
|
|
1375
|
+
}
|
|
1376
|
+
for (let i = 1;i <= strA.length; i++) {
|
|
1377
|
+
let ch = strA.charCodeAt(i - 1);
|
|
1378
|
+
for (let j = 1;j <= strB.length; j++) {
|
|
1379
|
+
if (Math.abs(i - j) >= cap) {
|
|
1380
|
+
memo[i][j] = cap;
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
memo[i][j] = Math.min(memo[i - 1][j] + 1, memo[i][j - 1] + 1, memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1));
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return memo[strA.length][strB.length];
|
|
1387
|
+
}
|
|
1388
|
+
__name(stringDistanceCapped, "stringDistanceCapped");
|
|
1389
|
+
function addMethod(ctx, name, method) {
|
|
1390
|
+
let methodWrapper = /* @__PURE__ */ __name(function() {
|
|
1391
|
+
if (!flag(this, "lockSsfi")) {
|
|
1392
|
+
flag(this, "ssfi", methodWrapper);
|
|
1393
|
+
}
|
|
1394
|
+
let result = method.apply(this, arguments);
|
|
1395
|
+
if (result !== undefined)
|
|
1396
|
+
return result;
|
|
1397
|
+
let newAssertion = new Assertion;
|
|
1398
|
+
transferFlags(this, newAssertion);
|
|
1399
|
+
return newAssertion;
|
|
1400
|
+
}, "methodWrapper");
|
|
1401
|
+
addLengthGuard(methodWrapper, name, false);
|
|
1402
|
+
ctx[name] = proxify(methodWrapper, name);
|
|
1403
|
+
events.dispatchEvent(new PluginEvent("addMethod", name, method));
|
|
1404
|
+
}
|
|
1405
|
+
__name(addMethod, "addMethod");
|
|
1406
|
+
function overwriteProperty(ctx, name, getter) {
|
|
1407
|
+
let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {}, "_super");
|
|
1408
|
+
if (_get && typeof _get.get === "function")
|
|
1409
|
+
_super = _get.get;
|
|
1410
|
+
Object.defineProperty(ctx, name, {
|
|
1411
|
+
get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
|
|
1412
|
+
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
1413
|
+
flag(this, "ssfi", overwritingPropertyGetter);
|
|
1414
|
+
}
|
|
1415
|
+
let origLockSsfi = flag(this, "lockSsfi");
|
|
1416
|
+
flag(this, "lockSsfi", true);
|
|
1417
|
+
let result = getter(_super).call(this);
|
|
1418
|
+
flag(this, "lockSsfi", origLockSsfi);
|
|
1419
|
+
if (result !== undefined) {
|
|
1420
|
+
return result;
|
|
1421
|
+
}
|
|
1422
|
+
let newAssertion = new Assertion;
|
|
1423
|
+
transferFlags(this, newAssertion);
|
|
1424
|
+
return newAssertion;
|
|
1425
|
+
}, "overwritingPropertyGetter"),
|
|
1426
|
+
configurable: true
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
__name(overwriteProperty, "overwriteProperty");
|
|
1430
|
+
function overwriteMethod(ctx, name, method) {
|
|
1431
|
+
let _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
|
|
1432
|
+
throw new Error(name + " is not a function");
|
|
1433
|
+
}, "_super");
|
|
1434
|
+
if (_method && typeof _method === "function")
|
|
1435
|
+
_super = _method;
|
|
1436
|
+
let overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
1437
|
+
if (!flag(this, "lockSsfi")) {
|
|
1438
|
+
flag(this, "ssfi", overwritingMethodWrapper);
|
|
1439
|
+
}
|
|
1440
|
+
let origLockSsfi = flag(this, "lockSsfi");
|
|
1441
|
+
flag(this, "lockSsfi", true);
|
|
1442
|
+
let result = method(_super).apply(this, arguments);
|
|
1443
|
+
flag(this, "lockSsfi", origLockSsfi);
|
|
1444
|
+
if (result !== undefined) {
|
|
1445
|
+
return result;
|
|
1446
|
+
}
|
|
1447
|
+
let newAssertion = new Assertion;
|
|
1448
|
+
transferFlags(this, newAssertion);
|
|
1449
|
+
return newAssertion;
|
|
1450
|
+
}, "overwritingMethodWrapper");
|
|
1451
|
+
addLengthGuard(overwritingMethodWrapper, name, false);
|
|
1452
|
+
ctx[name] = proxify(overwritingMethodWrapper, name);
|
|
1453
|
+
}
|
|
1454
|
+
__name(overwriteMethod, "overwriteMethod");
|
|
1455
|
+
var canSetPrototype = typeof Object.setPrototypeOf === "function";
|
|
1456
|
+
var testFn = /* @__PURE__ */ __name(function() {}, "testFn");
|
|
1457
|
+
var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
|
1458
|
+
let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
|
1459
|
+
if (typeof propDesc !== "object")
|
|
1460
|
+
return true;
|
|
1461
|
+
return !propDesc.configurable;
|
|
1462
|
+
});
|
|
1463
|
+
var call = Function.prototype.call;
|
|
1464
|
+
var apply = Function.prototype.apply;
|
|
1465
|
+
var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent2 extends PluginEvent {
|
|
1466
|
+
constructor(type3, name, fn, chainingBehavior) {
|
|
1467
|
+
super(type3, name, fn);
|
|
1468
|
+
this.chainingBehavior = chainingBehavior;
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
__name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
|
|
1472
|
+
var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
|
|
1473
|
+
function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
1474
|
+
if (typeof chainingBehavior !== "function") {
|
|
1475
|
+
chainingBehavior = /* @__PURE__ */ __name(function() {}, "chainingBehavior");
|
|
1476
|
+
}
|
|
1477
|
+
let chainableBehavior = {
|
|
1478
|
+
method,
|
|
1479
|
+
chainingBehavior
|
|
1480
|
+
};
|
|
1481
|
+
if (!ctx.__methods) {
|
|
1482
|
+
ctx.__methods = {};
|
|
1483
|
+
}
|
|
1484
|
+
ctx.__methods[name] = chainableBehavior;
|
|
1485
|
+
Object.defineProperty(ctx, name, {
|
|
1486
|
+
get: /* @__PURE__ */ __name(function chainableMethodGetter() {
|
|
1487
|
+
chainableBehavior.chainingBehavior.call(this);
|
|
1488
|
+
let chainableMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
1489
|
+
if (!flag(this, "lockSsfi")) {
|
|
1490
|
+
flag(this, "ssfi", chainableMethodWrapper);
|
|
1491
|
+
}
|
|
1492
|
+
let result = chainableBehavior.method.apply(this, arguments);
|
|
1493
|
+
if (result !== undefined) {
|
|
1494
|
+
return result;
|
|
1495
|
+
}
|
|
1496
|
+
let newAssertion = new Assertion;
|
|
1497
|
+
transferFlags(this, newAssertion);
|
|
1498
|
+
return newAssertion;
|
|
1499
|
+
}, "chainableMethodWrapper");
|
|
1500
|
+
addLengthGuard(chainableMethodWrapper, name, true);
|
|
1501
|
+
if (canSetPrototype) {
|
|
1502
|
+
let prototype = Object.create(this);
|
|
1503
|
+
prototype.call = call;
|
|
1504
|
+
prototype.apply = apply;
|
|
1505
|
+
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
|
1506
|
+
} else {
|
|
1507
|
+
let asserterNames = Object.getOwnPropertyNames(ctx);
|
|
1508
|
+
asserterNames.forEach(function(asserterName) {
|
|
1509
|
+
if (excludeNames.indexOf(asserterName) !== -1) {
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
|
1513
|
+
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
transferFlags(this, chainableMethodWrapper);
|
|
1517
|
+
return proxify(chainableMethodWrapper);
|
|
1518
|
+
}, "chainableMethodGetter"),
|
|
1519
|
+
configurable: true
|
|
1520
|
+
});
|
|
1521
|
+
events.dispatchEvent(new PluginAddChainableMethodEvent("addChainableMethod", name, method, chainingBehavior));
|
|
1522
|
+
}
|
|
1523
|
+
__name(addChainableMethod, "addChainableMethod");
|
|
1524
|
+
function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
|
1525
|
+
let chainableBehavior = ctx.__methods[name];
|
|
1526
|
+
let _chainingBehavior = chainableBehavior.chainingBehavior;
|
|
1527
|
+
chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
|
|
1528
|
+
let result = chainingBehavior(_chainingBehavior).call(this);
|
|
1529
|
+
if (result !== undefined) {
|
|
1530
|
+
return result;
|
|
1531
|
+
}
|
|
1532
|
+
let newAssertion = new Assertion;
|
|
1533
|
+
transferFlags(this, newAssertion);
|
|
1534
|
+
return newAssertion;
|
|
1535
|
+
}, "overwritingChainableMethodGetter");
|
|
1536
|
+
let _method = chainableBehavior.method;
|
|
1537
|
+
chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
|
|
1538
|
+
let result = method(_method).apply(this, arguments);
|
|
1539
|
+
if (result !== undefined) {
|
|
1540
|
+
return result;
|
|
1541
|
+
}
|
|
1542
|
+
let newAssertion = new Assertion;
|
|
1543
|
+
transferFlags(this, newAssertion);
|
|
1544
|
+
return newAssertion;
|
|
1545
|
+
}, "overwritingChainableMethodWrapper");
|
|
1546
|
+
}
|
|
1547
|
+
__name(overwriteChainableMethod, "overwriteChainableMethod");
|
|
1548
|
+
function compareByInspect(a, b) {
|
|
1549
|
+
return inspect2(a) < inspect2(b) ? -1 : 1;
|
|
1550
|
+
}
|
|
1551
|
+
__name(compareByInspect, "compareByInspect");
|
|
1552
|
+
function getOwnEnumerablePropertySymbols(obj) {
|
|
1553
|
+
if (typeof Object.getOwnPropertySymbols !== "function")
|
|
1554
|
+
return [];
|
|
1555
|
+
return Object.getOwnPropertySymbols(obj).filter(function(sym) {
|
|
1556
|
+
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
__name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
|
|
1560
|
+
function getOwnEnumerableProperties(obj) {
|
|
1561
|
+
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
|
1562
|
+
}
|
|
1563
|
+
__name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
|
|
1564
|
+
var isNaN2 = Number.isNaN;
|
|
1565
|
+
function isObjectType(obj) {
|
|
1566
|
+
let objectType = type(obj);
|
|
1567
|
+
let objectTypes = ["Array", "Object", "Function"];
|
|
1568
|
+
return objectTypes.indexOf(objectType) !== -1;
|
|
1569
|
+
}
|
|
1570
|
+
__name(isObjectType, "isObjectType");
|
|
1571
|
+
function getOperator(obj, args) {
|
|
1572
|
+
let operator = flag(obj, "operator");
|
|
1573
|
+
let negate = flag(obj, "negate");
|
|
1574
|
+
let expected = args[3];
|
|
1575
|
+
let msg = negate ? args[2] : args[1];
|
|
1576
|
+
if (operator) {
|
|
1577
|
+
return operator;
|
|
1578
|
+
}
|
|
1579
|
+
if (typeof msg === "function")
|
|
1580
|
+
msg = msg();
|
|
1581
|
+
msg = msg || "";
|
|
1582
|
+
if (!msg) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
if (/\shave\s/.test(msg)) {
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
let isObject = isObjectType(expected);
|
|
1589
|
+
if (/\snot\s/.test(msg)) {
|
|
1590
|
+
return isObject ? "notDeepStrictEqual" : "notStrictEqual";
|
|
1591
|
+
}
|
|
1592
|
+
return isObject ? "deepStrictEqual" : "strictEqual";
|
|
1593
|
+
}
|
|
1594
|
+
__name(getOperator, "getOperator");
|
|
1595
|
+
function getName(fn) {
|
|
1596
|
+
return fn.name;
|
|
1597
|
+
}
|
|
1598
|
+
__name(getName, "getName");
|
|
1599
|
+
function isRegExp2(obj) {
|
|
1600
|
+
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
1601
|
+
}
|
|
1602
|
+
__name(isRegExp2, "isRegExp");
|
|
1603
|
+
function isNumeric(obj) {
|
|
1604
|
+
return ["Number", "BigInt"].includes(type(obj));
|
|
1605
|
+
}
|
|
1606
|
+
__name(isNumeric, "isNumeric");
|
|
1607
|
+
var { flag: flag2 } = utils_exports;
|
|
1608
|
+
[
|
|
1609
|
+
"to",
|
|
1610
|
+
"be",
|
|
1611
|
+
"been",
|
|
1612
|
+
"is",
|
|
1613
|
+
"and",
|
|
1614
|
+
"has",
|
|
1615
|
+
"have",
|
|
1616
|
+
"with",
|
|
1617
|
+
"that",
|
|
1618
|
+
"which",
|
|
1619
|
+
"at",
|
|
1620
|
+
"of",
|
|
1621
|
+
"same",
|
|
1622
|
+
"but",
|
|
1623
|
+
"does",
|
|
1624
|
+
"still",
|
|
1625
|
+
"also"
|
|
1626
|
+
].forEach(function(chain) {
|
|
1627
|
+
Assertion.addProperty(chain);
|
|
1628
|
+
});
|
|
1629
|
+
Assertion.addProperty("not", function() {
|
|
1630
|
+
flag2(this, "negate", true);
|
|
1631
|
+
});
|
|
1632
|
+
Assertion.addProperty("deep", function() {
|
|
1633
|
+
flag2(this, "deep", true);
|
|
1634
|
+
});
|
|
1635
|
+
Assertion.addProperty("nested", function() {
|
|
1636
|
+
flag2(this, "nested", true);
|
|
1637
|
+
});
|
|
1638
|
+
Assertion.addProperty("own", function() {
|
|
1639
|
+
flag2(this, "own", true);
|
|
1640
|
+
});
|
|
1641
|
+
Assertion.addProperty("ordered", function() {
|
|
1642
|
+
flag2(this, "ordered", true);
|
|
1643
|
+
});
|
|
1644
|
+
Assertion.addProperty("any", function() {
|
|
1645
|
+
flag2(this, "any", true);
|
|
1646
|
+
flag2(this, "all", false);
|
|
1647
|
+
});
|
|
1648
|
+
Assertion.addProperty("all", function() {
|
|
1649
|
+
flag2(this, "all", true);
|
|
1650
|
+
flag2(this, "any", false);
|
|
1651
|
+
});
|
|
1652
|
+
var functionTypes = {
|
|
1653
|
+
function: [
|
|
1654
|
+
"function",
|
|
1655
|
+
"asyncfunction",
|
|
1656
|
+
"generatorfunction",
|
|
1657
|
+
"asyncgeneratorfunction"
|
|
1658
|
+
],
|
|
1659
|
+
asyncfunction: ["asyncfunction", "asyncgeneratorfunction"],
|
|
1660
|
+
generatorfunction: ["generatorfunction", "asyncgeneratorfunction"],
|
|
1661
|
+
asyncgeneratorfunction: ["asyncgeneratorfunction"]
|
|
1662
|
+
};
|
|
1663
|
+
function an(type3, msg) {
|
|
1664
|
+
if (msg)
|
|
1665
|
+
flag2(this, "message", msg);
|
|
1666
|
+
type3 = type3.toLowerCase();
|
|
1667
|
+
let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
|
|
1668
|
+
const detectedType = type(obj).toLowerCase();
|
|
1669
|
+
if (functionTypes["function"].includes(type3)) {
|
|
1670
|
+
this.assert(functionTypes[type3].includes(detectedType), "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
|
|
1671
|
+
} else {
|
|
1672
|
+
this.assert(type3 === detectedType, "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
__name(an, "an");
|
|
1676
|
+
Assertion.addChainableMethod("an", an);
|
|
1677
|
+
Assertion.addChainableMethod("a", an);
|
|
1678
|
+
function SameValueZero(a, b) {
|
|
1679
|
+
return isNaN2(a) && isNaN2(b) || a === b;
|
|
1680
|
+
}
|
|
1681
|
+
__name(SameValueZero, "SameValueZero");
|
|
1682
|
+
function includeChainingBehavior() {
|
|
1683
|
+
flag2(this, "contains", true);
|
|
1684
|
+
}
|
|
1685
|
+
__name(includeChainingBehavior, "includeChainingBehavior");
|
|
1686
|
+
function include(val, msg) {
|
|
1687
|
+
if (msg)
|
|
1688
|
+
flag2(this, "message", msg);
|
|
1689
|
+
let 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;
|
|
1690
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
1691
|
+
let included = false;
|
|
1692
|
+
switch (objType) {
|
|
1693
|
+
case "string":
|
|
1694
|
+
included = obj.indexOf(val) !== -1;
|
|
1695
|
+
break;
|
|
1696
|
+
case "weakset":
|
|
1697
|
+
if (isDeep) {
|
|
1698
|
+
throw new AssertionError(flagMsg + "unable to use .deep.include with WeakSet", undefined, ssfi);
|
|
1699
|
+
}
|
|
1700
|
+
included = obj.has(val);
|
|
1701
|
+
break;
|
|
1702
|
+
case "map":
|
|
1703
|
+
obj.forEach(function(item) {
|
|
1704
|
+
included = included || isEql(item, val);
|
|
1705
|
+
});
|
|
1706
|
+
break;
|
|
1707
|
+
case "set":
|
|
1708
|
+
if (isDeep) {
|
|
1709
|
+
obj.forEach(function(item) {
|
|
1710
|
+
included = included || isEql(item, val);
|
|
1711
|
+
});
|
|
1712
|
+
} else {
|
|
1713
|
+
included = obj.has(val);
|
|
1714
|
+
}
|
|
1715
|
+
break;
|
|
1716
|
+
case "array":
|
|
1717
|
+
if (isDeep) {
|
|
1718
|
+
included = obj.some(function(item) {
|
|
1719
|
+
return isEql(item, val);
|
|
1720
|
+
});
|
|
1721
|
+
} else {
|
|
1722
|
+
included = obj.indexOf(val) !== -1;
|
|
1723
|
+
}
|
|
1724
|
+
break;
|
|
1725
|
+
default: {
|
|
1726
|
+
if (val !== Object(val)) {
|
|
1727
|
+
throw new AssertionError(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(), undefined, ssfi);
|
|
1728
|
+
}
|
|
1729
|
+
let props = Object.keys(val);
|
|
1730
|
+
let firstErr = null;
|
|
1731
|
+
let numErrs = 0;
|
|
1732
|
+
props.forEach(function(prop) {
|
|
1733
|
+
let propAssertion = new Assertion(obj);
|
|
1734
|
+
transferFlags(this, propAssertion, true);
|
|
1735
|
+
flag2(propAssertion, "lockSsfi", true);
|
|
1736
|
+
if (!negate || props.length === 1) {
|
|
1737
|
+
propAssertion.property(prop, val[prop]);
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
try {
|
|
1741
|
+
propAssertion.property(prop, val[prop]);
|
|
1742
|
+
} catch (err) {
|
|
1743
|
+
if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
|
|
1744
|
+
throw err;
|
|
1745
|
+
}
|
|
1746
|
+
if (firstErr === null)
|
|
1747
|
+
firstErr = err;
|
|
1748
|
+
numErrs++;
|
|
1749
|
+
}
|
|
1750
|
+
}, this);
|
|
1751
|
+
if (negate && props.length > 1 && numErrs === props.length) {
|
|
1752
|
+
throw firstErr;
|
|
1753
|
+
}
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
this.assert(included, "expected #{this} to " + descriptor + "include " + inspect2(val), "expected #{this} to not " + descriptor + "include " + inspect2(val));
|
|
1758
|
+
}
|
|
1759
|
+
__name(include, "include");
|
|
1760
|
+
Assertion.addChainableMethod("include", include, includeChainingBehavior);
|
|
1761
|
+
Assertion.addChainableMethod("contain", include, includeChainingBehavior);
|
|
1762
|
+
Assertion.addChainableMethod("contains", include, includeChainingBehavior);
|
|
1763
|
+
Assertion.addChainableMethod("includes", include, includeChainingBehavior);
|
|
1764
|
+
Assertion.addProperty("ok", function() {
|
|
1765
|
+
this.assert(flag2(this, "object"), "expected #{this} to be truthy", "expected #{this} to be falsy");
|
|
1766
|
+
});
|
|
1767
|
+
Assertion.addProperty("true", function() {
|
|
1768
|
+
this.assert(flag2(this, "object") === true, "expected #{this} to be true", "expected #{this} to be false", flag2(this, "negate") ? false : true);
|
|
1769
|
+
});
|
|
1770
|
+
Assertion.addProperty("numeric", function() {
|
|
1771
|
+
const object = flag2(this, "object");
|
|
1772
|
+
this.assert(["Number", "BigInt"].includes(type(object)), "expected #{this} to be numeric", "expected #{this} to not be numeric", flag2(this, "negate") ? false : true);
|
|
1773
|
+
});
|
|
1774
|
+
Assertion.addProperty("callable", function() {
|
|
1775
|
+
const val = flag2(this, "object");
|
|
1776
|
+
const ssfi = flag2(this, "ssfi");
|
|
1777
|
+
const message = flag2(this, "message");
|
|
1778
|
+
const msg = message ? `${message}: ` : "";
|
|
1779
|
+
const negate = flag2(this, "negate");
|
|
1780
|
+
const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`;
|
|
1781
|
+
const isCallable = [
|
|
1782
|
+
"Function",
|
|
1783
|
+
"AsyncFunction",
|
|
1784
|
+
"GeneratorFunction",
|
|
1785
|
+
"AsyncGeneratorFunction"
|
|
1786
|
+
].includes(type(val));
|
|
1787
|
+
if (isCallable && negate || !isCallable && !negate) {
|
|
1788
|
+
throw new AssertionError(assertionMessage, undefined, ssfi);
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
Assertion.addProperty("false", function() {
|
|
1792
|
+
this.assert(flag2(this, "object") === false, "expected #{this} to be false", "expected #{this} to be true", flag2(this, "negate") ? true : false);
|
|
1793
|
+
});
|
|
1794
|
+
Assertion.addProperty("null", function() {
|
|
1795
|
+
this.assert(flag2(this, "object") === null, "expected #{this} to be null", "expected #{this} not to be null");
|
|
1796
|
+
});
|
|
1797
|
+
Assertion.addProperty("undefined", function() {
|
|
1798
|
+
this.assert(flag2(this, "object") === undefined, "expected #{this} to be undefined", "expected #{this} not to be undefined");
|
|
1799
|
+
});
|
|
1800
|
+
Assertion.addProperty("NaN", function() {
|
|
1801
|
+
this.assert(isNaN2(flag2(this, "object")), "expected #{this} to be NaN", "expected #{this} not to be NaN");
|
|
1802
|
+
});
|
|
1803
|
+
function assertExist() {
|
|
1804
|
+
let val = flag2(this, "object");
|
|
1805
|
+
this.assert(val !== null && val !== undefined, "expected #{this} to exist", "expected #{this} to not exist");
|
|
1806
|
+
}
|
|
1807
|
+
__name(assertExist, "assertExist");
|
|
1808
|
+
Assertion.addProperty("exist", assertExist);
|
|
1809
|
+
Assertion.addProperty("exists", assertExist);
|
|
1810
|
+
Assertion.addProperty("empty", function() {
|
|
1811
|
+
let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
|
|
1812
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
1813
|
+
switch (type(val).toLowerCase()) {
|
|
1814
|
+
case "array":
|
|
1815
|
+
case "string":
|
|
1816
|
+
itemsCount = val.length;
|
|
1817
|
+
break;
|
|
1818
|
+
case "map":
|
|
1819
|
+
case "set":
|
|
1820
|
+
itemsCount = val.size;
|
|
1821
|
+
break;
|
|
1822
|
+
case "weakmap":
|
|
1823
|
+
case "weakset":
|
|
1824
|
+
throw new AssertionError(flagMsg + ".empty was passed a weak collection", undefined, ssfi);
|
|
1825
|
+
case "function": {
|
|
1826
|
+
const msg = flagMsg + ".empty was passed a function " + getName(val);
|
|
1827
|
+
throw new AssertionError(msg.trim(), undefined, ssfi);
|
|
1828
|
+
}
|
|
1829
|
+
default:
|
|
1830
|
+
if (val !== Object(val)) {
|
|
1831
|
+
throw new AssertionError(flagMsg + ".empty was passed non-string primitive " + inspect2(val), undefined, ssfi);
|
|
1832
|
+
}
|
|
1833
|
+
itemsCount = Object.keys(val).length;
|
|
1834
|
+
}
|
|
1835
|
+
this.assert(itemsCount === 0, "expected #{this} to be empty", "expected #{this} not to be empty");
|
|
1836
|
+
});
|
|
1837
|
+
function checkArguments() {
|
|
1838
|
+
let obj = flag2(this, "object"), type3 = type(obj);
|
|
1839
|
+
this.assert(type3 === "Arguments", "expected #{this} to be arguments but got " + type3, "expected #{this} to not be arguments");
|
|
1840
|
+
}
|
|
1841
|
+
__name(checkArguments, "checkArguments");
|
|
1842
|
+
Assertion.addProperty("arguments", checkArguments);
|
|
1843
|
+
Assertion.addProperty("Arguments", checkArguments);
|
|
1844
|
+
function assertEqual(val, msg) {
|
|
1845
|
+
if (msg)
|
|
1846
|
+
flag2(this, "message", msg);
|
|
1847
|
+
let obj = flag2(this, "object");
|
|
1848
|
+
if (flag2(this, "deep")) {
|
|
1849
|
+
let prevLockSsfi = flag2(this, "lockSsfi");
|
|
1850
|
+
flag2(this, "lockSsfi", true);
|
|
1851
|
+
this.eql(val);
|
|
1852
|
+
flag2(this, "lockSsfi", prevLockSsfi);
|
|
1853
|
+
} else {
|
|
1854
|
+
this.assert(val === obj, "expected #{this} to equal #{exp}", "expected #{this} to not equal #{exp}", val, this._obj, true);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
__name(assertEqual, "assertEqual");
|
|
1858
|
+
Assertion.addMethod("equal", assertEqual);
|
|
1859
|
+
Assertion.addMethod("equals", assertEqual);
|
|
1860
|
+
Assertion.addMethod("eq", assertEqual);
|
|
1861
|
+
function assertEql(obj, msg) {
|
|
1862
|
+
if (msg)
|
|
1863
|
+
flag2(this, "message", msg);
|
|
1864
|
+
let eql = flag2(this, "eql");
|
|
1865
|
+
this.assert(eql(obj, flag2(this, "object")), "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", obj, this._obj, true);
|
|
1866
|
+
}
|
|
1867
|
+
__name(assertEql, "assertEql");
|
|
1868
|
+
Assertion.addMethod("eql", assertEql);
|
|
1869
|
+
Assertion.addMethod("eqls", assertEql);
|
|
1870
|
+
function assertAbove(n, msg) {
|
|
1871
|
+
if (msg)
|
|
1872
|
+
flag2(this, "message", msg);
|
|
1873
|
+
let 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();
|
|
1874
|
+
if (doLength && objType !== "map" && objType !== "set") {
|
|
1875
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
1876
|
+
}
|
|
1877
|
+
if (!doLength && objType === "date" && nType !== "date") {
|
|
1878
|
+
throw new AssertionError(msgPrefix + "the argument to above must be a date", undefined, ssfi);
|
|
1879
|
+
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
1880
|
+
throw new AssertionError(msgPrefix + "the argument to above must be a number", undefined, ssfi);
|
|
1881
|
+
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
1882
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
1883
|
+
throw new AssertionError(msgPrefix + "expected " + printObj + " to be a number or a date", undefined, ssfi);
|
|
1884
|
+
}
|
|
1885
|
+
if (doLength) {
|
|
1886
|
+
let descriptor = "length", itemsCount;
|
|
1887
|
+
if (objType === "map" || objType === "set") {
|
|
1888
|
+
descriptor = "size";
|
|
1889
|
+
itemsCount = obj.size;
|
|
1890
|
+
} else {
|
|
1891
|
+
itemsCount = obj.length;
|
|
1892
|
+
}
|
|
1893
|
+
this.assert(itemsCount > n, "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " above #{exp}", n, itemsCount);
|
|
1894
|
+
} else {
|
|
1895
|
+
this.assert(obj > n, "expected #{this} to be above #{exp}", "expected #{this} to be at most #{exp}", n);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
__name(assertAbove, "assertAbove");
|
|
1899
|
+
Assertion.addMethod("above", assertAbove);
|
|
1900
|
+
Assertion.addMethod("gt", assertAbove);
|
|
1901
|
+
Assertion.addMethod("greaterThan", assertAbove);
|
|
1902
|
+
function assertLeast(n, msg) {
|
|
1903
|
+
if (msg)
|
|
1904
|
+
flag2(this, "message", msg);
|
|
1905
|
+
let 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;
|
|
1906
|
+
if (doLength && objType !== "map" && objType !== "set") {
|
|
1907
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
1908
|
+
}
|
|
1909
|
+
if (!doLength && objType === "date" && nType !== "date") {
|
|
1910
|
+
errorMessage = msgPrefix + "the argument to least must be a date";
|
|
1911
|
+
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
1912
|
+
errorMessage = msgPrefix + "the argument to least must be a number";
|
|
1913
|
+
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
1914
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
1915
|
+
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
1916
|
+
} else {
|
|
1917
|
+
shouldThrow = false;
|
|
1918
|
+
}
|
|
1919
|
+
if (shouldThrow) {
|
|
1920
|
+
throw new AssertionError(errorMessage, undefined, ssfi);
|
|
1921
|
+
}
|
|
1922
|
+
if (doLength) {
|
|
1923
|
+
let descriptor = "length", itemsCount;
|
|
1924
|
+
if (objType === "map" || objType === "set") {
|
|
1925
|
+
descriptor = "size";
|
|
1926
|
+
itemsCount = obj.size;
|
|
1927
|
+
} else {
|
|
1928
|
+
itemsCount = obj.length;
|
|
1929
|
+
}
|
|
1930
|
+
this.assert(itemsCount >= n, "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " below #{exp}", n, itemsCount);
|
|
1931
|
+
} else {
|
|
1932
|
+
this.assert(obj >= n, "expected #{this} to be at least #{exp}", "expected #{this} to be below #{exp}", n);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
__name(assertLeast, "assertLeast");
|
|
1936
|
+
Assertion.addMethod("least", assertLeast);
|
|
1937
|
+
Assertion.addMethod("gte", assertLeast);
|
|
1938
|
+
Assertion.addMethod("greaterThanOrEqual", assertLeast);
|
|
1939
|
+
function assertBelow(n, msg) {
|
|
1940
|
+
if (msg)
|
|
1941
|
+
flag2(this, "message", msg);
|
|
1942
|
+
let 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;
|
|
1943
|
+
if (doLength && objType !== "map" && objType !== "set") {
|
|
1944
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
1945
|
+
}
|
|
1946
|
+
if (!doLength && objType === "date" && nType !== "date") {
|
|
1947
|
+
errorMessage = msgPrefix + "the argument to below must be a date";
|
|
1948
|
+
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
1949
|
+
errorMessage = msgPrefix + "the argument to below must be a number";
|
|
1950
|
+
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
1951
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
1952
|
+
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
1953
|
+
} else {
|
|
1954
|
+
shouldThrow = false;
|
|
1955
|
+
}
|
|
1956
|
+
if (shouldThrow) {
|
|
1957
|
+
throw new AssertionError(errorMessage, undefined, ssfi);
|
|
1958
|
+
}
|
|
1959
|
+
if (doLength) {
|
|
1960
|
+
let descriptor = "length", itemsCount;
|
|
1961
|
+
if (objType === "map" || objType === "set") {
|
|
1962
|
+
descriptor = "size";
|
|
1963
|
+
itemsCount = obj.size;
|
|
1964
|
+
} else {
|
|
1965
|
+
itemsCount = obj.length;
|
|
1966
|
+
}
|
|
1967
|
+
this.assert(itemsCount < n, "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " below #{exp}", n, itemsCount);
|
|
1968
|
+
} else {
|
|
1969
|
+
this.assert(obj < n, "expected #{this} to be below #{exp}", "expected #{this} to be at least #{exp}", n);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
__name(assertBelow, "assertBelow");
|
|
1973
|
+
Assertion.addMethod("below", assertBelow);
|
|
1974
|
+
Assertion.addMethod("lt", assertBelow);
|
|
1975
|
+
Assertion.addMethod("lessThan", assertBelow);
|
|
1976
|
+
function assertMost(n, msg) {
|
|
1977
|
+
if (msg)
|
|
1978
|
+
flag2(this, "message", msg);
|
|
1979
|
+
let 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;
|
|
1980
|
+
if (doLength && objType !== "map" && objType !== "set") {
|
|
1981
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
1982
|
+
}
|
|
1983
|
+
if (!doLength && objType === "date" && nType !== "date") {
|
|
1984
|
+
errorMessage = msgPrefix + "the argument to most must be a date";
|
|
1985
|
+
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
1986
|
+
errorMessage = msgPrefix + "the argument to most must be a number";
|
|
1987
|
+
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
1988
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
1989
|
+
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
1990
|
+
} else {
|
|
1991
|
+
shouldThrow = false;
|
|
1992
|
+
}
|
|
1993
|
+
if (shouldThrow) {
|
|
1994
|
+
throw new AssertionError(errorMessage, undefined, ssfi);
|
|
1995
|
+
}
|
|
1996
|
+
if (doLength) {
|
|
1997
|
+
let descriptor = "length", itemsCount;
|
|
1998
|
+
if (objType === "map" || objType === "set") {
|
|
1999
|
+
descriptor = "size";
|
|
2000
|
+
itemsCount = obj.size;
|
|
2001
|
+
} else {
|
|
2002
|
+
itemsCount = obj.length;
|
|
2003
|
+
}
|
|
2004
|
+
this.assert(itemsCount <= n, "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " above #{exp}", n, itemsCount);
|
|
2005
|
+
} else {
|
|
2006
|
+
this.assert(obj <= n, "expected #{this} to be at most #{exp}", "expected #{this} to be above #{exp}", n);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
__name(assertMost, "assertMost");
|
|
2010
|
+
Assertion.addMethod("most", assertMost);
|
|
2011
|
+
Assertion.addMethod("lte", assertMost);
|
|
2012
|
+
Assertion.addMethod("lessThanOrEqual", assertMost);
|
|
2013
|
+
Assertion.addMethod("within", function(start, finish, msg) {
|
|
2014
|
+
if (msg)
|
|
2015
|
+
flag2(this, "message", msg);
|
|
2016
|
+
let 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;
|
|
2017
|
+
if (doLength && objType !== "map" && objType !== "set") {
|
|
2018
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
2019
|
+
}
|
|
2020
|
+
if (!doLength && objType === "date" && (startType !== "date" || finishType !== "date")) {
|
|
2021
|
+
errorMessage = msgPrefix + "the arguments to within must be dates";
|
|
2022
|
+
} else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
|
|
2023
|
+
errorMessage = msgPrefix + "the arguments to within must be numbers";
|
|
2024
|
+
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
2025
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
2026
|
+
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
2027
|
+
} else {
|
|
2028
|
+
shouldThrow = false;
|
|
2029
|
+
}
|
|
2030
|
+
if (shouldThrow) {
|
|
2031
|
+
throw new AssertionError(errorMessage, undefined, ssfi);
|
|
2032
|
+
}
|
|
2033
|
+
if (doLength) {
|
|
2034
|
+
let descriptor = "length", itemsCount;
|
|
2035
|
+
if (objType === "map" || objType === "set") {
|
|
2036
|
+
descriptor = "size";
|
|
2037
|
+
itemsCount = obj.size;
|
|
2038
|
+
} else {
|
|
2039
|
+
itemsCount = obj.length;
|
|
2040
|
+
}
|
|
2041
|
+
this.assert(itemsCount >= start && itemsCount <= finish, "expected #{this} to have a " + descriptor + " within " + range, "expected #{this} to not have a " + descriptor + " within " + range);
|
|
2042
|
+
} else {
|
|
2043
|
+
this.assert(obj >= start && obj <= finish, "expected #{this} to be within " + range, "expected #{this} to not be within " + range);
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
function assertInstanceOf(constructor, msg) {
|
|
2047
|
+
if (msg)
|
|
2048
|
+
flag2(this, "message", msg);
|
|
2049
|
+
let target = flag2(this, "object");
|
|
2050
|
+
let ssfi = flag2(this, "ssfi");
|
|
2051
|
+
let flagMsg = flag2(this, "message");
|
|
2052
|
+
let isInstanceOf;
|
|
2053
|
+
try {
|
|
2054
|
+
isInstanceOf = target instanceof constructor;
|
|
2055
|
+
} catch (err) {
|
|
2056
|
+
if (err instanceof TypeError) {
|
|
2057
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
2058
|
+
throw new AssertionError(flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.", undefined, ssfi);
|
|
2059
|
+
}
|
|
2060
|
+
throw err;
|
|
2061
|
+
}
|
|
2062
|
+
let name = getName(constructor);
|
|
2063
|
+
if (name == null) {
|
|
2064
|
+
name = "an unnamed constructor";
|
|
2065
|
+
}
|
|
2066
|
+
this.assert(isInstanceOf, "expected #{this} to be an instance of " + name, "expected #{this} to not be an instance of " + name);
|
|
2067
|
+
}
|
|
2068
|
+
__name(assertInstanceOf, "assertInstanceOf");
|
|
2069
|
+
Assertion.addMethod("instanceof", assertInstanceOf);
|
|
2070
|
+
Assertion.addMethod("instanceOf", assertInstanceOf);
|
|
2071
|
+
function assertProperty(name, val, msg) {
|
|
2072
|
+
if (msg)
|
|
2073
|
+
flag2(this, "message", msg);
|
|
2074
|
+
let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
|
|
2075
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
2076
|
+
if (isNested) {
|
|
2077
|
+
if (nameType !== "string") {
|
|
2078
|
+
throw new AssertionError(flagMsg + "the argument to property must be a string when using nested syntax", undefined, ssfi);
|
|
2079
|
+
}
|
|
2080
|
+
} else {
|
|
2081
|
+
if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
|
|
2082
|
+
throw new AssertionError(flagMsg + "the argument to property must be a string, number, or symbol", undefined, ssfi);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
if (isNested && isOwn) {
|
|
2086
|
+
throw new AssertionError(flagMsg + 'The "nested" and "own" flags cannot be combined.', undefined, ssfi);
|
|
2087
|
+
}
|
|
2088
|
+
if (obj === null || obj === undefined) {
|
|
2089
|
+
throw new AssertionError(flagMsg + "Target cannot be null or undefined.", undefined, ssfi);
|
|
2090
|
+
}
|
|
2091
|
+
let 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;
|
|
2092
|
+
let descriptor = "";
|
|
2093
|
+
if (isDeep)
|
|
2094
|
+
descriptor += "deep ";
|
|
2095
|
+
if (isOwn)
|
|
2096
|
+
descriptor += "own ";
|
|
2097
|
+
if (isNested)
|
|
2098
|
+
descriptor += "nested ";
|
|
2099
|
+
descriptor += "property ";
|
|
2100
|
+
let hasProperty2;
|
|
2101
|
+
if (isOwn)
|
|
2102
|
+
hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
|
|
2103
|
+
else if (isNested)
|
|
2104
|
+
hasProperty2 = pathInfo.exists;
|
|
2105
|
+
else
|
|
2106
|
+
hasProperty2 = hasProperty(obj, name);
|
|
2107
|
+
if (!negate || arguments.length === 1) {
|
|
2108
|
+
this.assert(hasProperty2, "expected #{this} to have " + descriptor + inspect2(name), "expected #{this} to not have " + descriptor + inspect2(name));
|
|
2109
|
+
}
|
|
2110
|
+
if (arguments.length > 1) {
|
|
2111
|
+
this.assert(hasProperty2 && isEql(val, value), "expected #{this} to have " + descriptor + inspect2(name) + " of #{exp}, but got #{act}", "expected #{this} to not have " + descriptor + inspect2(name) + " of #{act}", val, value);
|
|
2112
|
+
}
|
|
2113
|
+
flag2(this, "object", value);
|
|
2114
|
+
}
|
|
2115
|
+
__name(assertProperty, "assertProperty");
|
|
2116
|
+
Assertion.addMethod("property", assertProperty);
|
|
2117
|
+
function assertOwnProperty(_name, _value, _msg) {
|
|
2118
|
+
flag2(this, "own", true);
|
|
2119
|
+
assertProperty.apply(this, arguments);
|
|
2120
|
+
}
|
|
2121
|
+
__name(assertOwnProperty, "assertOwnProperty");
|
|
2122
|
+
Assertion.addMethod("ownProperty", assertOwnProperty);
|
|
2123
|
+
Assertion.addMethod("haveOwnProperty", assertOwnProperty);
|
|
2124
|
+
function assertOwnPropertyDescriptor(name, descriptor, msg) {
|
|
2125
|
+
if (typeof descriptor === "string") {
|
|
2126
|
+
msg = descriptor;
|
|
2127
|
+
descriptor = null;
|
|
2128
|
+
}
|
|
2129
|
+
if (msg)
|
|
2130
|
+
flag2(this, "message", msg);
|
|
2131
|
+
let obj = flag2(this, "object");
|
|
2132
|
+
let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
|
|
2133
|
+
let eql = flag2(this, "eql");
|
|
2134
|
+
if (actualDescriptor && descriptor) {
|
|
2135
|
+
this.assert(eql(descriptor, actualDescriptor), "expected the own property descriptor for " + inspect2(name) + " on #{this} to match " + inspect2(descriptor) + ", got " + inspect2(actualDescriptor), "expected the own property descriptor for " + inspect2(name) + " on #{this} to not match " + inspect2(descriptor), descriptor, actualDescriptor, true);
|
|
2136
|
+
} else {
|
|
2137
|
+
this.assert(actualDescriptor, "expected #{this} to have an own property descriptor for " + inspect2(name), "expected #{this} to not have an own property descriptor for " + inspect2(name));
|
|
2138
|
+
}
|
|
2139
|
+
flag2(this, "object", actualDescriptor);
|
|
2140
|
+
}
|
|
2141
|
+
__name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor");
|
|
2142
|
+
Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
|
|
2143
|
+
Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
|
|
2144
|
+
function assertLengthChain() {
|
|
2145
|
+
flag2(this, "doLength", true);
|
|
2146
|
+
}
|
|
2147
|
+
__name(assertLengthChain, "assertLengthChain");
|
|
2148
|
+
function assertLength(n, msg) {
|
|
2149
|
+
if (msg)
|
|
2150
|
+
flag2(this, "message", msg);
|
|
2151
|
+
let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
|
|
2152
|
+
switch (objType) {
|
|
2153
|
+
case "map":
|
|
2154
|
+
case "set":
|
|
2155
|
+
descriptor = "size";
|
|
2156
|
+
itemsCount = obj.size;
|
|
2157
|
+
break;
|
|
2158
|
+
default:
|
|
2159
|
+
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
2160
|
+
itemsCount = obj.length;
|
|
2161
|
+
}
|
|
2162
|
+
this.assert(itemsCount == n, "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " of #{act}", n, itemsCount);
|
|
2163
|
+
}
|
|
2164
|
+
__name(assertLength, "assertLength");
|
|
2165
|
+
Assertion.addChainableMethod("length", assertLength, assertLengthChain);
|
|
2166
|
+
Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
|
|
2167
|
+
function assertMatch(re, msg) {
|
|
2168
|
+
if (msg)
|
|
2169
|
+
flag2(this, "message", msg);
|
|
2170
|
+
let obj = flag2(this, "object");
|
|
2171
|
+
this.assert(re.exec(obj), "expected #{this} to match " + re, "expected #{this} not to match " + re);
|
|
2172
|
+
}
|
|
2173
|
+
__name(assertMatch, "assertMatch");
|
|
2174
|
+
Assertion.addMethod("match", assertMatch);
|
|
2175
|
+
Assertion.addMethod("matches", assertMatch);
|
|
2176
|
+
Assertion.addMethod("string", function(str, msg) {
|
|
2177
|
+
if (msg)
|
|
2178
|
+
flag2(this, "message", msg);
|
|
2179
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2180
|
+
new Assertion(obj, flagMsg, ssfi, true).is.a("string");
|
|
2181
|
+
this.assert(~obj.indexOf(str), "expected #{this} to contain " + inspect2(str), "expected #{this} to not contain " + inspect2(str));
|
|
2182
|
+
});
|
|
2183
|
+
function assertKeys(keys) {
|
|
2184
|
+
let 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");
|
|
2185
|
+
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
2186
|
+
let mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
|
|
2187
|
+
if (objType === "Map" || objType === "Set") {
|
|
2188
|
+
deepStr = isDeep ? "deeply " : "";
|
|
2189
|
+
actual = [];
|
|
2190
|
+
obj.forEach(function(val, key) {
|
|
2191
|
+
actual.push(key);
|
|
2192
|
+
});
|
|
2193
|
+
if (keysType !== "Array") {
|
|
2194
|
+
keys = Array.prototype.slice.call(arguments);
|
|
2195
|
+
}
|
|
2196
|
+
} else {
|
|
2197
|
+
actual = getOwnEnumerableProperties(obj);
|
|
2198
|
+
switch (keysType) {
|
|
2199
|
+
case "Array":
|
|
2200
|
+
if (arguments.length > 1) {
|
|
2201
|
+
throw new AssertionError(mixedArgsMsg, undefined, ssfi);
|
|
2202
|
+
}
|
|
2203
|
+
break;
|
|
2204
|
+
case "Object":
|
|
2205
|
+
if (arguments.length > 1) {
|
|
2206
|
+
throw new AssertionError(mixedArgsMsg, undefined, ssfi);
|
|
2207
|
+
}
|
|
2208
|
+
keys = Object.keys(keys);
|
|
2209
|
+
break;
|
|
2210
|
+
default:
|
|
2211
|
+
keys = Array.prototype.slice.call(arguments);
|
|
2212
|
+
}
|
|
2213
|
+
keys = keys.map(function(val) {
|
|
2214
|
+
return typeof val === "symbol" ? val : String(val);
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
if (!keys.length) {
|
|
2218
|
+
throw new AssertionError(flagMsg + "keys required", undefined, ssfi);
|
|
2219
|
+
}
|
|
2220
|
+
let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
2221
|
+
if (!any && !all) {
|
|
2222
|
+
all = true;
|
|
2223
|
+
}
|
|
2224
|
+
if (any) {
|
|
2225
|
+
ok = expected.some(function(expectedKey) {
|
|
2226
|
+
return actual.some(function(actualKey) {
|
|
2227
|
+
return isEql(expectedKey, actualKey);
|
|
2228
|
+
});
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
if (all) {
|
|
2232
|
+
ok = expected.every(function(expectedKey) {
|
|
2233
|
+
return actual.some(function(actualKey) {
|
|
2234
|
+
return isEql(expectedKey, actualKey);
|
|
2235
|
+
});
|
|
2236
|
+
});
|
|
2237
|
+
if (!flag2(this, "contains")) {
|
|
2238
|
+
ok = ok && keys.length == actual.length;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
if (len > 1) {
|
|
2242
|
+
keys = keys.map(function(key) {
|
|
2243
|
+
return inspect2(key);
|
|
2244
|
+
});
|
|
2245
|
+
let last = keys.pop();
|
|
2246
|
+
if (all) {
|
|
2247
|
+
str = keys.join(", ") + ", and " + last;
|
|
2248
|
+
}
|
|
2249
|
+
if (any) {
|
|
2250
|
+
str = keys.join(", ") + ", or " + last;
|
|
2251
|
+
}
|
|
2252
|
+
} else {
|
|
2253
|
+
str = inspect2(keys[0]);
|
|
2254
|
+
}
|
|
2255
|
+
str = (len > 1 ? "keys " : "key ") + str;
|
|
2256
|
+
str = (flag2(this, "contains") ? "contain " : "have ") + str;
|
|
2257
|
+
this.assert(ok, "expected #{this} to " + deepStr + str, "expected #{this} to not " + deepStr + str, expected.slice(0).sort(compareByInspect), actual.sort(compareByInspect), true);
|
|
2258
|
+
}
|
|
2259
|
+
__name(assertKeys, "assertKeys");
|
|
2260
|
+
Assertion.addMethod("keys", assertKeys);
|
|
2261
|
+
Assertion.addMethod("key", assertKeys);
|
|
2262
|
+
function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
2263
|
+
if (msg)
|
|
2264
|
+
flag2(this, "message", msg);
|
|
2265
|
+
let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
|
|
2266
|
+
new Assertion(obj, flagMsg, ssfi, true).is.a("function");
|
|
2267
|
+
if (isRegExp2(errorLike) || typeof errorLike === "string") {
|
|
2268
|
+
errMsgMatcher = errorLike;
|
|
2269
|
+
errorLike = null;
|
|
2270
|
+
}
|
|
2271
|
+
let caughtErr;
|
|
2272
|
+
let errorWasThrown = false;
|
|
2273
|
+
try {
|
|
2274
|
+
obj();
|
|
2275
|
+
} catch (err) {
|
|
2276
|
+
errorWasThrown = true;
|
|
2277
|
+
caughtErr = err;
|
|
2278
|
+
}
|
|
2279
|
+
let everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;
|
|
2280
|
+
let everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
|
|
2281
|
+
let errorLikeFail = false;
|
|
2282
|
+
let errMsgMatcherFail = false;
|
|
2283
|
+
if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
|
|
2284
|
+
let errorLikeString = "an error";
|
|
2285
|
+
if (errorLike instanceof Error) {
|
|
2286
|
+
errorLikeString = "#{exp}";
|
|
2287
|
+
} else if (errorLike) {
|
|
2288
|
+
errorLikeString = check_error_exports.getConstructorName(errorLike);
|
|
2289
|
+
}
|
|
2290
|
+
let actual = caughtErr;
|
|
2291
|
+
if (caughtErr instanceof Error) {
|
|
2292
|
+
actual = caughtErr.toString();
|
|
2293
|
+
} else if (typeof caughtErr === "string") {
|
|
2294
|
+
actual = caughtErr;
|
|
2295
|
+
} else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) {
|
|
2296
|
+
try {
|
|
2297
|
+
actual = check_error_exports.getConstructorName(caughtErr);
|
|
2298
|
+
} catch (_err) {}
|
|
2299
|
+
}
|
|
2300
|
+
this.assert(errorWasThrown, "expected #{this} to throw " + errorLikeString, "expected #{this} to not throw an error but #{act} was thrown", errorLike && errorLike.toString(), actual);
|
|
2301
|
+
}
|
|
2302
|
+
if (errorLike && caughtErr) {
|
|
2303
|
+
if (errorLike instanceof Error) {
|
|
2304
|
+
let isCompatibleInstance = check_error_exports.compatibleInstance(caughtErr, errorLike);
|
|
2305
|
+
if (isCompatibleInstance === negate) {
|
|
2306
|
+
if (everyArgIsDefined && negate) {
|
|
2307
|
+
errorLikeFail = true;
|
|
2308
|
+
} else {
|
|
2309
|
+
this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""), errorLike.toString(), caughtErr.toString());
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
let isCompatibleConstructor = check_error_exports.compatibleConstructor(caughtErr, errorLike);
|
|
2314
|
+
if (isCompatibleConstructor === negate) {
|
|
2315
|
+
if (everyArgIsDefined && negate) {
|
|
2316
|
+
errorLikeFail = true;
|
|
2317
|
+
} else {
|
|
2318
|
+
this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {
|
|
2323
|
+
let placeholder = "including";
|
|
2324
|
+
if (isRegExp2(errMsgMatcher)) {
|
|
2325
|
+
placeholder = "matching";
|
|
2326
|
+
}
|
|
2327
|
+
let isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher);
|
|
2328
|
+
if (isCompatibleMessage === negate) {
|
|
2329
|
+
if (everyArgIsDefined && negate) {
|
|
2330
|
+
errMsgMatcherFail = true;
|
|
2331
|
+
} else {
|
|
2332
|
+
this.assert(negate, "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}", "expected #{this} to throw error not " + placeholder + " #{exp}", errMsgMatcher, check_error_exports.getMessage(caughtErr));
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
if (errorLikeFail && errMsgMatcherFail) {
|
|
2337
|
+
this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
|
|
2338
|
+
}
|
|
2339
|
+
flag2(this, "object", caughtErr);
|
|
2340
|
+
}
|
|
2341
|
+
__name(assertThrows, "assertThrows");
|
|
2342
|
+
Assertion.addMethod("throw", assertThrows);
|
|
2343
|
+
Assertion.addMethod("throws", assertThrows);
|
|
2344
|
+
Assertion.addMethod("Throw", assertThrows);
|
|
2345
|
+
function respondTo(method, msg) {
|
|
2346
|
+
if (msg)
|
|
2347
|
+
flag2(this, "message", msg);
|
|
2348
|
+
let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = typeof obj === "function" && !itself ? obj.prototype[method] : obj[method];
|
|
2349
|
+
this.assert(typeof context === "function", "expected #{this} to respond to " + inspect2(method), "expected #{this} to not respond to " + inspect2(method));
|
|
2350
|
+
}
|
|
2351
|
+
__name(respondTo, "respondTo");
|
|
2352
|
+
Assertion.addMethod("respondTo", respondTo);
|
|
2353
|
+
Assertion.addMethod("respondsTo", respondTo);
|
|
2354
|
+
Assertion.addProperty("itself", function() {
|
|
2355
|
+
flag2(this, "itself", true);
|
|
2356
|
+
});
|
|
2357
|
+
function satisfy(matcher, msg) {
|
|
2358
|
+
if (msg)
|
|
2359
|
+
flag2(this, "message", msg);
|
|
2360
|
+
let obj = flag2(this, "object");
|
|
2361
|
+
let result = matcher(obj);
|
|
2362
|
+
this.assert(result, "expected #{this} to satisfy " + objDisplay(matcher), "expected #{this} to not satisfy" + objDisplay(matcher), flag2(this, "negate") ? false : true, result);
|
|
2363
|
+
}
|
|
2364
|
+
__name(satisfy, "satisfy");
|
|
2365
|
+
Assertion.addMethod("satisfy", satisfy);
|
|
2366
|
+
Assertion.addMethod("satisfies", satisfy);
|
|
2367
|
+
function closeTo(expected, delta, msg) {
|
|
2368
|
+
if (msg)
|
|
2369
|
+
flag2(this, "message", msg);
|
|
2370
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2371
|
+
new Assertion(obj, flagMsg, ssfi, true).is.numeric;
|
|
2372
|
+
let message = "A `delta` value is required for `closeTo`";
|
|
2373
|
+
if (delta == undefined) {
|
|
2374
|
+
throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
|
|
2375
|
+
}
|
|
2376
|
+
new Assertion(delta, flagMsg, ssfi, true).is.numeric;
|
|
2377
|
+
message = "A `expected` value is required for `closeTo`";
|
|
2378
|
+
if (expected == undefined) {
|
|
2379
|
+
throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
|
|
2380
|
+
}
|
|
2381
|
+
new Assertion(expected, flagMsg, ssfi, true).is.numeric;
|
|
2382
|
+
const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs");
|
|
2383
|
+
const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
|
|
2384
|
+
this.assert(strip(abs(obj - expected)) <= delta, "expected #{this} to be close to " + expected + " +/- " + delta, "expected #{this} not to be close to " + expected + " +/- " + delta);
|
|
2385
|
+
}
|
|
2386
|
+
__name(closeTo, "closeTo");
|
|
2387
|
+
Assertion.addMethod("closeTo", closeTo);
|
|
2388
|
+
Assertion.addMethod("approximately", closeTo);
|
|
2389
|
+
function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
|
|
2390
|
+
let superset = Array.from(_superset);
|
|
2391
|
+
let subset = Array.from(_subset);
|
|
2392
|
+
if (!contains) {
|
|
2393
|
+
if (subset.length !== superset.length)
|
|
2394
|
+
return false;
|
|
2395
|
+
superset = superset.slice();
|
|
2396
|
+
}
|
|
2397
|
+
return subset.every(function(elem, idx) {
|
|
2398
|
+
if (ordered)
|
|
2399
|
+
return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
|
|
2400
|
+
if (!cmp) {
|
|
2401
|
+
let matchIdx = superset.indexOf(elem);
|
|
2402
|
+
if (matchIdx === -1)
|
|
2403
|
+
return false;
|
|
2404
|
+
if (!contains)
|
|
2405
|
+
superset.splice(matchIdx, 1);
|
|
2406
|
+
return true;
|
|
2407
|
+
}
|
|
2408
|
+
return superset.some(function(elem2, matchIdx) {
|
|
2409
|
+
if (!cmp(elem, elem2))
|
|
2410
|
+
return false;
|
|
2411
|
+
if (!contains)
|
|
2412
|
+
superset.splice(matchIdx, 1);
|
|
2413
|
+
return true;
|
|
2414
|
+
});
|
|
2415
|
+
});
|
|
2416
|
+
}
|
|
2417
|
+
__name(isSubsetOf, "isSubsetOf");
|
|
2418
|
+
Assertion.addMethod("members", function(subset, msg) {
|
|
2419
|
+
if (msg)
|
|
2420
|
+
flag2(this, "message", msg);
|
|
2421
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2422
|
+
new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
|
|
2423
|
+
new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
|
|
2424
|
+
let contains = flag2(this, "contains");
|
|
2425
|
+
let ordered = flag2(this, "ordered");
|
|
2426
|
+
let subject, failMsg, failNegateMsg;
|
|
2427
|
+
if (contains) {
|
|
2428
|
+
subject = ordered ? "an ordered superset" : "a superset";
|
|
2429
|
+
failMsg = "expected #{this} to be " + subject + " of #{exp}";
|
|
2430
|
+
failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
|
|
2431
|
+
} else {
|
|
2432
|
+
subject = ordered ? "ordered members" : "members";
|
|
2433
|
+
failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
|
|
2434
|
+
failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
|
|
2435
|
+
}
|
|
2436
|
+
let cmp = flag2(this, "deep") ? flag2(this, "eql") : undefined;
|
|
2437
|
+
this.assert(isSubsetOf(subset, obj, cmp, contains, ordered), failMsg, failNegateMsg, subset, obj, true);
|
|
2438
|
+
});
|
|
2439
|
+
Assertion.addProperty("iterable", function(msg) {
|
|
2440
|
+
if (msg)
|
|
2441
|
+
flag2(this, "message", msg);
|
|
2442
|
+
let obj = flag2(this, "object");
|
|
2443
|
+
this.assert(obj != null && obj[Symbol.iterator], "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj);
|
|
2444
|
+
});
|
|
2445
|
+
function oneOf(list, msg) {
|
|
2446
|
+
if (msg)
|
|
2447
|
+
flag2(this, "message", msg);
|
|
2448
|
+
let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
|
|
2449
|
+
new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
|
|
2450
|
+
if (contains) {
|
|
2451
|
+
this.assert(list.some(function(possibility) {
|
|
2452
|
+
return expected.indexOf(possibility) > -1;
|
|
2453
|
+
}), "expected #{this} to contain one of #{exp}", "expected #{this} to not contain one of #{exp}", list, expected);
|
|
2454
|
+
} else {
|
|
2455
|
+
if (isDeep) {
|
|
2456
|
+
this.assert(list.some(function(possibility) {
|
|
2457
|
+
return eql(expected, possibility);
|
|
2458
|
+
}), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected);
|
|
2459
|
+
} else {
|
|
2460
|
+
this.assert(list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
__name(oneOf, "oneOf");
|
|
2465
|
+
Assertion.addMethod("oneOf", oneOf);
|
|
2466
|
+
function assertChanges(subject, prop, msg) {
|
|
2467
|
+
if (msg)
|
|
2468
|
+
flag2(this, "message", msg);
|
|
2469
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2470
|
+
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
2471
|
+
let initial;
|
|
2472
|
+
if (!prop) {
|
|
2473
|
+
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
2474
|
+
initial = subject();
|
|
2475
|
+
} else {
|
|
2476
|
+
new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
|
2477
|
+
initial = subject[prop];
|
|
2478
|
+
}
|
|
2479
|
+
fn();
|
|
2480
|
+
let final = prop === undefined || prop === null ? subject() : subject[prop];
|
|
2481
|
+
let msgObj = prop === undefined || prop === null ? initial : "." + prop;
|
|
2482
|
+
flag2(this, "deltaMsgObj", msgObj);
|
|
2483
|
+
flag2(this, "initialDeltaValue", initial);
|
|
2484
|
+
flag2(this, "finalDeltaValue", final);
|
|
2485
|
+
flag2(this, "deltaBehavior", "change");
|
|
2486
|
+
flag2(this, "realDelta", final !== initial);
|
|
2487
|
+
this.assert(initial !== final, "expected " + msgObj + " to change", "expected " + msgObj + " to not change");
|
|
2488
|
+
}
|
|
2489
|
+
__name(assertChanges, "assertChanges");
|
|
2490
|
+
Assertion.addMethod("change", assertChanges);
|
|
2491
|
+
Assertion.addMethod("changes", assertChanges);
|
|
2492
|
+
function assertIncreases(subject, prop, msg) {
|
|
2493
|
+
if (msg)
|
|
2494
|
+
flag2(this, "message", msg);
|
|
2495
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2496
|
+
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
2497
|
+
let initial;
|
|
2498
|
+
if (!prop) {
|
|
2499
|
+
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
2500
|
+
initial = subject();
|
|
2501
|
+
} else {
|
|
2502
|
+
new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
|
2503
|
+
initial = subject[prop];
|
|
2504
|
+
}
|
|
2505
|
+
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
2506
|
+
fn();
|
|
2507
|
+
let final = prop === undefined || prop === null ? subject() : subject[prop];
|
|
2508
|
+
let msgObj = prop === undefined || prop === null ? initial : "." + prop;
|
|
2509
|
+
flag2(this, "deltaMsgObj", msgObj);
|
|
2510
|
+
flag2(this, "initialDeltaValue", initial);
|
|
2511
|
+
flag2(this, "finalDeltaValue", final);
|
|
2512
|
+
flag2(this, "deltaBehavior", "increase");
|
|
2513
|
+
flag2(this, "realDelta", final - initial);
|
|
2514
|
+
this.assert(final - initial > 0, "expected " + msgObj + " to increase", "expected " + msgObj + " to not increase");
|
|
2515
|
+
}
|
|
2516
|
+
__name(assertIncreases, "assertIncreases");
|
|
2517
|
+
Assertion.addMethod("increase", assertIncreases);
|
|
2518
|
+
Assertion.addMethod("increases", assertIncreases);
|
|
2519
|
+
function assertDecreases(subject, prop, msg) {
|
|
2520
|
+
if (msg)
|
|
2521
|
+
flag2(this, "message", msg);
|
|
2522
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
2523
|
+
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
2524
|
+
let initial;
|
|
2525
|
+
if (!prop) {
|
|
2526
|
+
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
2527
|
+
initial = subject();
|
|
2528
|
+
} else {
|
|
2529
|
+
new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
|
2530
|
+
initial = subject[prop];
|
|
2531
|
+
}
|
|
2532
|
+
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
2533
|
+
fn();
|
|
2534
|
+
let final = prop === undefined || prop === null ? subject() : subject[prop];
|
|
2535
|
+
let msgObj = prop === undefined || prop === null ? initial : "." + prop;
|
|
2536
|
+
flag2(this, "deltaMsgObj", msgObj);
|
|
2537
|
+
flag2(this, "initialDeltaValue", initial);
|
|
2538
|
+
flag2(this, "finalDeltaValue", final);
|
|
2539
|
+
flag2(this, "deltaBehavior", "decrease");
|
|
2540
|
+
flag2(this, "realDelta", initial - final);
|
|
2541
|
+
this.assert(final - initial < 0, "expected " + msgObj + " to decrease", "expected " + msgObj + " to not decrease");
|
|
2542
|
+
}
|
|
2543
|
+
__name(assertDecreases, "assertDecreases");
|
|
2544
|
+
Assertion.addMethod("decrease", assertDecreases);
|
|
2545
|
+
Assertion.addMethod("decreases", assertDecreases);
|
|
2546
|
+
function assertDelta(delta, msg) {
|
|
2547
|
+
if (msg)
|
|
2548
|
+
flag2(this, "message", msg);
|
|
2549
|
+
let msgObj = flag2(this, "deltaMsgObj");
|
|
2550
|
+
let initial = flag2(this, "initialDeltaValue");
|
|
2551
|
+
let final = flag2(this, "finalDeltaValue");
|
|
2552
|
+
let behavior = flag2(this, "deltaBehavior");
|
|
2553
|
+
let realDelta = flag2(this, "realDelta");
|
|
2554
|
+
let expression;
|
|
2555
|
+
if (behavior === "change") {
|
|
2556
|
+
expression = Math.abs(final - initial) === Math.abs(delta);
|
|
2557
|
+
} else {
|
|
2558
|
+
expression = realDelta === Math.abs(delta);
|
|
2559
|
+
}
|
|
2560
|
+
this.assert(expression, "expected " + msgObj + " to " + behavior + " by " + delta, "expected " + msgObj + " to not " + behavior + " by " + delta);
|
|
2561
|
+
}
|
|
2562
|
+
__name(assertDelta, "assertDelta");
|
|
2563
|
+
Assertion.addMethod("by", assertDelta);
|
|
2564
|
+
Assertion.addProperty("extensible", function() {
|
|
2565
|
+
let obj = flag2(this, "object");
|
|
2566
|
+
let isExtensible = obj === Object(obj) && Object.isExtensible(obj);
|
|
2567
|
+
this.assert(isExtensible, "expected #{this} to be extensible", "expected #{this} to not be extensible");
|
|
2568
|
+
});
|
|
2569
|
+
Assertion.addProperty("sealed", function() {
|
|
2570
|
+
let obj = flag2(this, "object");
|
|
2571
|
+
let isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
|
|
2572
|
+
this.assert(isSealed, "expected #{this} to be sealed", "expected #{this} to not be sealed");
|
|
2573
|
+
});
|
|
2574
|
+
Assertion.addProperty("frozen", function() {
|
|
2575
|
+
let obj = flag2(this, "object");
|
|
2576
|
+
let isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
|
|
2577
|
+
this.assert(isFrozen, "expected #{this} to be frozen", "expected #{this} to not be frozen");
|
|
2578
|
+
});
|
|
2579
|
+
Assertion.addProperty("finite", function(_msg) {
|
|
2580
|
+
let obj = flag2(this, "object");
|
|
2581
|
+
this.assert(typeof obj === "number" && isFinite(obj), "expected #{this} to be a finite number", "expected #{this} to not be a finite number");
|
|
2582
|
+
});
|
|
2583
|
+
function compareSubset(expected, actual) {
|
|
2584
|
+
if (expected === actual) {
|
|
2585
|
+
return true;
|
|
2586
|
+
}
|
|
2587
|
+
if (typeof actual !== typeof expected) {
|
|
2588
|
+
return false;
|
|
2589
|
+
}
|
|
2590
|
+
if (typeof expected !== "object" || expected === null) {
|
|
2591
|
+
return expected === actual;
|
|
2592
|
+
}
|
|
2593
|
+
if (!actual) {
|
|
2594
|
+
return false;
|
|
2595
|
+
}
|
|
2596
|
+
if (Array.isArray(expected)) {
|
|
2597
|
+
if (!Array.isArray(actual)) {
|
|
2598
|
+
return false;
|
|
2599
|
+
}
|
|
2600
|
+
return expected.every(function(exp) {
|
|
2601
|
+
return actual.some(function(act) {
|
|
2602
|
+
return compareSubset(exp, act);
|
|
2603
|
+
});
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
if (expected instanceof Date) {
|
|
2607
|
+
if (actual instanceof Date) {
|
|
2608
|
+
return expected.getTime() === actual.getTime();
|
|
2609
|
+
} else {
|
|
2610
|
+
return false;
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
return Object.keys(expected).every(function(key) {
|
|
2614
|
+
let expectedValue = expected[key];
|
|
2615
|
+
let actualValue = actual[key];
|
|
2616
|
+
if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
|
|
2617
|
+
return compareSubset(expectedValue, actualValue);
|
|
2618
|
+
}
|
|
2619
|
+
if (typeof expectedValue === "function") {
|
|
2620
|
+
return expectedValue(actualValue);
|
|
2621
|
+
}
|
|
2622
|
+
return actualValue === expectedValue;
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
__name(compareSubset, "compareSubset");
|
|
2626
|
+
Assertion.addMethod("containSubset", function(expected) {
|
|
2627
|
+
const actual = flag(this, "object");
|
|
2628
|
+
const showDiff = config.showDiff;
|
|
2629
|
+
this.assert(compareSubset(expected, actual), "expected #{act} to contain subset #{exp}", "expected #{act} to not contain subset #{exp}", expected, actual, showDiff);
|
|
2630
|
+
});
|
|
2631
|
+
function expect(val, message) {
|
|
2632
|
+
return new Assertion(val, message);
|
|
2633
|
+
}
|
|
2634
|
+
__name(expect, "expect");
|
|
2635
|
+
expect.fail = function(actual, expected, message, operator) {
|
|
2636
|
+
if (arguments.length < 2) {
|
|
2637
|
+
message = actual;
|
|
2638
|
+
actual = undefined;
|
|
2639
|
+
}
|
|
2640
|
+
message = message || "expect.fail()";
|
|
2641
|
+
throw new AssertionError(message, {
|
|
2642
|
+
actual,
|
|
2643
|
+
expected,
|
|
2644
|
+
operator
|
|
2645
|
+
}, expect.fail);
|
|
2646
|
+
};
|
|
2647
|
+
var should_exports = {};
|
|
2648
|
+
__export(should_exports, {
|
|
2649
|
+
Should: () => Should,
|
|
2650
|
+
should: () => should
|
|
2651
|
+
});
|
|
2652
|
+
function loadShould() {
|
|
2653
|
+
function shouldGetter() {
|
|
2654
|
+
if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
|
|
2655
|
+
return new Assertion(this.valueOf(), null, shouldGetter);
|
|
2656
|
+
}
|
|
2657
|
+
return new Assertion(this, null, shouldGetter);
|
|
2658
|
+
}
|
|
2659
|
+
__name(shouldGetter, "shouldGetter");
|
|
2660
|
+
function shouldSetter(value) {
|
|
2661
|
+
Object.defineProperty(this, "should", {
|
|
2662
|
+
value,
|
|
2663
|
+
enumerable: true,
|
|
2664
|
+
configurable: true,
|
|
2665
|
+
writable: true
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
__name(shouldSetter, "shouldSetter");
|
|
2669
|
+
Object.defineProperty(Object.prototype, "should", {
|
|
2670
|
+
set: shouldSetter,
|
|
2671
|
+
get: shouldGetter,
|
|
2672
|
+
configurable: true
|
|
2673
|
+
});
|
|
2674
|
+
let should2 = {};
|
|
2675
|
+
should2.fail = function(actual, expected, message, operator) {
|
|
2676
|
+
if (arguments.length < 2) {
|
|
2677
|
+
message = actual;
|
|
2678
|
+
actual = undefined;
|
|
2679
|
+
}
|
|
2680
|
+
message = message || "should.fail()";
|
|
2681
|
+
throw new AssertionError(message, {
|
|
2682
|
+
actual,
|
|
2683
|
+
expected,
|
|
2684
|
+
operator
|
|
2685
|
+
}, should2.fail);
|
|
2686
|
+
};
|
|
2687
|
+
should2.equal = function(actual, expected, message) {
|
|
2688
|
+
new Assertion(actual, message).to.equal(expected);
|
|
2689
|
+
};
|
|
2690
|
+
should2.Throw = function(fn, errt, errs, msg) {
|
|
2691
|
+
new Assertion(fn, msg).to.Throw(errt, errs);
|
|
2692
|
+
};
|
|
2693
|
+
should2.exist = function(val, msg) {
|
|
2694
|
+
new Assertion(val, msg).to.exist;
|
|
2695
|
+
};
|
|
2696
|
+
should2.not = {};
|
|
2697
|
+
should2.not.equal = function(actual, expected, msg) {
|
|
2698
|
+
new Assertion(actual, msg).to.not.equal(expected);
|
|
2699
|
+
};
|
|
2700
|
+
should2.not.Throw = function(fn, errt, errs, msg) {
|
|
2701
|
+
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
|
2702
|
+
};
|
|
2703
|
+
should2.not.exist = function(val, msg) {
|
|
2704
|
+
new Assertion(val, msg).to.not.exist;
|
|
2705
|
+
};
|
|
2706
|
+
should2["throw"] = should2["Throw"];
|
|
2707
|
+
should2.not["throw"] = should2.not["Throw"];
|
|
2708
|
+
return should2;
|
|
2709
|
+
}
|
|
2710
|
+
__name(loadShould, "loadShould");
|
|
2711
|
+
var should = loadShould;
|
|
2712
|
+
var Should = loadShould;
|
|
2713
|
+
function assert(express, errmsg) {
|
|
2714
|
+
let test2 = new Assertion(null, null, assert, true);
|
|
2715
|
+
test2.assert(express, errmsg, "[ negation message unavailable ]");
|
|
2716
|
+
}
|
|
2717
|
+
__name(assert, "assert");
|
|
2718
|
+
assert.fail = function(actual, expected, message, operator) {
|
|
2719
|
+
if (arguments.length < 2) {
|
|
2720
|
+
message = actual;
|
|
2721
|
+
actual = undefined;
|
|
2722
|
+
}
|
|
2723
|
+
message = message || "assert.fail()";
|
|
2724
|
+
throw new AssertionError(message, {
|
|
2725
|
+
actual,
|
|
2726
|
+
expected,
|
|
2727
|
+
operator
|
|
2728
|
+
}, assert.fail);
|
|
2729
|
+
};
|
|
2730
|
+
assert.isOk = function(val, msg) {
|
|
2731
|
+
new Assertion(val, msg, assert.isOk, true).is.ok;
|
|
2732
|
+
};
|
|
2733
|
+
assert.isNotOk = function(val, msg) {
|
|
2734
|
+
new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
|
|
2735
|
+
};
|
|
2736
|
+
assert.equal = function(act, exp, msg) {
|
|
2737
|
+
let test2 = new Assertion(act, msg, assert.equal, true);
|
|
2738
|
+
test2.assert(exp == flag(test2, "object"), "expected #{this} to equal #{exp}", "expected #{this} to not equal #{act}", exp, act, true);
|
|
2739
|
+
};
|
|
2740
|
+
assert.notEqual = function(act, exp, msg) {
|
|
2741
|
+
let test2 = new Assertion(act, msg, assert.notEqual, true);
|
|
2742
|
+
test2.assert(exp != flag(test2, "object"), "expected #{this} to not equal #{exp}", "expected #{this} to equal #{act}", exp, act, true);
|
|
2743
|
+
};
|
|
2744
|
+
assert.strictEqual = function(act, exp, msg) {
|
|
2745
|
+
new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
|
|
2746
|
+
};
|
|
2747
|
+
assert.notStrictEqual = function(act, exp, msg) {
|
|
2748
|
+
new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
|
|
2749
|
+
};
|
|
2750
|
+
assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) {
|
|
2751
|
+
new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
|
|
2752
|
+
};
|
|
2753
|
+
assert.notDeepEqual = function(act, exp, msg) {
|
|
2754
|
+
new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
|
|
2755
|
+
};
|
|
2756
|
+
assert.isAbove = function(val, abv, msg) {
|
|
2757
|
+
new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
|
|
2758
|
+
};
|
|
2759
|
+
assert.isAtLeast = function(val, atlst, msg) {
|
|
2760
|
+
new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
|
|
2761
|
+
};
|
|
2762
|
+
assert.isBelow = function(val, blw, msg) {
|
|
2763
|
+
new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
|
|
2764
|
+
};
|
|
2765
|
+
assert.isAtMost = function(val, atmst, msg) {
|
|
2766
|
+
new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
|
|
2767
|
+
};
|
|
2768
|
+
assert.isTrue = function(val, msg) {
|
|
2769
|
+
new Assertion(val, msg, assert.isTrue, true).is["true"];
|
|
2770
|
+
};
|
|
2771
|
+
assert.isNotTrue = function(val, msg) {
|
|
2772
|
+
new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
|
|
2773
|
+
};
|
|
2774
|
+
assert.isFalse = function(val, msg) {
|
|
2775
|
+
new Assertion(val, msg, assert.isFalse, true).is["false"];
|
|
2776
|
+
};
|
|
2777
|
+
assert.isNotFalse = function(val, msg) {
|
|
2778
|
+
new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
|
|
2779
|
+
};
|
|
2780
|
+
assert.isNull = function(val, msg) {
|
|
2781
|
+
new Assertion(val, msg, assert.isNull, true).to.equal(null);
|
|
2782
|
+
};
|
|
2783
|
+
assert.isNotNull = function(val, msg) {
|
|
2784
|
+
new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
|
|
2785
|
+
};
|
|
2786
|
+
assert.isNaN = function(val, msg) {
|
|
2787
|
+
new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
|
|
2788
|
+
};
|
|
2789
|
+
assert.isNotNaN = function(value, message) {
|
|
2790
|
+
new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
|
|
2791
|
+
};
|
|
2792
|
+
assert.exists = function(val, msg) {
|
|
2793
|
+
new Assertion(val, msg, assert.exists, true).to.exist;
|
|
2794
|
+
};
|
|
2795
|
+
assert.notExists = function(val, msg) {
|
|
2796
|
+
new Assertion(val, msg, assert.notExists, true).to.not.exist;
|
|
2797
|
+
};
|
|
2798
|
+
assert.isUndefined = function(val, msg) {
|
|
2799
|
+
new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
|
|
2800
|
+
};
|
|
2801
|
+
assert.isDefined = function(val, msg) {
|
|
2802
|
+
new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
|
|
2803
|
+
};
|
|
2804
|
+
assert.isCallable = function(value, message) {
|
|
2805
|
+
new Assertion(value, message, assert.isCallable, true).is.callable;
|
|
2806
|
+
};
|
|
2807
|
+
assert.isNotCallable = function(value, message) {
|
|
2808
|
+
new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
|
|
2809
|
+
};
|
|
2810
|
+
assert.isObject = function(val, msg) {
|
|
2811
|
+
new Assertion(val, msg, assert.isObject, true).to.be.a("object");
|
|
2812
|
+
};
|
|
2813
|
+
assert.isNotObject = function(val, msg) {
|
|
2814
|
+
new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object");
|
|
2815
|
+
};
|
|
2816
|
+
assert.isArray = function(val, msg) {
|
|
2817
|
+
new Assertion(val, msg, assert.isArray, true).to.be.an("array");
|
|
2818
|
+
};
|
|
2819
|
+
assert.isNotArray = function(val, msg) {
|
|
2820
|
+
new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array");
|
|
2821
|
+
};
|
|
2822
|
+
assert.isString = function(val, msg) {
|
|
2823
|
+
new Assertion(val, msg, assert.isString, true).to.be.a("string");
|
|
2824
|
+
};
|
|
2825
|
+
assert.isNotString = function(val, msg) {
|
|
2826
|
+
new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string");
|
|
2827
|
+
};
|
|
2828
|
+
assert.isNumber = function(val, msg) {
|
|
2829
|
+
new Assertion(val, msg, assert.isNumber, true).to.be.a("number");
|
|
2830
|
+
};
|
|
2831
|
+
assert.isNotNumber = function(val, msg) {
|
|
2832
|
+
new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number");
|
|
2833
|
+
};
|
|
2834
|
+
assert.isNumeric = function(val, msg) {
|
|
2835
|
+
new Assertion(val, msg, assert.isNumeric, true).is.numeric;
|
|
2836
|
+
};
|
|
2837
|
+
assert.isNotNumeric = function(val, msg) {
|
|
2838
|
+
new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric;
|
|
2839
|
+
};
|
|
2840
|
+
assert.isFinite = function(val, msg) {
|
|
2841
|
+
new Assertion(val, msg, assert.isFinite, true).to.be.finite;
|
|
2842
|
+
};
|
|
2843
|
+
assert.isBoolean = function(val, msg) {
|
|
2844
|
+
new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean");
|
|
2845
|
+
};
|
|
2846
|
+
assert.isNotBoolean = function(val, msg) {
|
|
2847
|
+
new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean");
|
|
2848
|
+
};
|
|
2849
|
+
assert.typeOf = function(val, type3, msg) {
|
|
2850
|
+
new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
|
|
2851
|
+
};
|
|
2852
|
+
assert.notTypeOf = function(value, type3, message) {
|
|
2853
|
+
new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3);
|
|
2854
|
+
};
|
|
2855
|
+
assert.instanceOf = function(val, type3, msg) {
|
|
2856
|
+
new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
|
|
2857
|
+
};
|
|
2858
|
+
assert.notInstanceOf = function(val, type3, msg) {
|
|
2859
|
+
new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(type3);
|
|
2860
|
+
};
|
|
2861
|
+
assert.include = function(exp, inc, msg) {
|
|
2862
|
+
new Assertion(exp, msg, assert.include, true).include(inc);
|
|
2863
|
+
};
|
|
2864
|
+
assert.notInclude = function(exp, inc, msg) {
|
|
2865
|
+
new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
|
|
2866
|
+
};
|
|
2867
|
+
assert.deepInclude = function(exp, inc, msg) {
|
|
2868
|
+
new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
|
|
2869
|
+
};
|
|
2870
|
+
assert.notDeepInclude = function(exp, inc, msg) {
|
|
2871
|
+
new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
|
|
2872
|
+
};
|
|
2873
|
+
assert.nestedInclude = function(exp, inc, msg) {
|
|
2874
|
+
new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
|
|
2875
|
+
};
|
|
2876
|
+
assert.notNestedInclude = function(exp, inc, msg) {
|
|
2877
|
+
new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(inc);
|
|
2878
|
+
};
|
|
2879
|
+
assert.deepNestedInclude = function(exp, inc, msg) {
|
|
2880
|
+
new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(inc);
|
|
2881
|
+
};
|
|
2882
|
+
assert.notDeepNestedInclude = function(exp, inc, msg) {
|
|
2883
|
+
new Assertion(exp, msg, assert.notDeepNestedInclude, true).not.deep.nested.include(inc);
|
|
2884
|
+
};
|
|
2885
|
+
assert.ownInclude = function(exp, inc, msg) {
|
|
2886
|
+
new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
|
|
2887
|
+
};
|
|
2888
|
+
assert.notOwnInclude = function(exp, inc, msg) {
|
|
2889
|
+
new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
|
|
2890
|
+
};
|
|
2891
|
+
assert.deepOwnInclude = function(exp, inc, msg) {
|
|
2892
|
+
new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc);
|
|
2893
|
+
};
|
|
2894
|
+
assert.notDeepOwnInclude = function(exp, inc, msg) {
|
|
2895
|
+
new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(inc);
|
|
2896
|
+
};
|
|
2897
|
+
assert.match = function(exp, re, msg) {
|
|
2898
|
+
new Assertion(exp, msg, assert.match, true).to.match(re);
|
|
2899
|
+
};
|
|
2900
|
+
assert.notMatch = function(exp, re, msg) {
|
|
2901
|
+
new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
|
|
2902
|
+
};
|
|
2903
|
+
assert.property = function(obj, prop, msg) {
|
|
2904
|
+
new Assertion(obj, msg, assert.property, true).to.have.property(prop);
|
|
2905
|
+
};
|
|
2906
|
+
assert.notProperty = function(obj, prop, msg) {
|
|
2907
|
+
new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop);
|
|
2908
|
+
};
|
|
2909
|
+
assert.propertyVal = function(obj, prop, val, msg) {
|
|
2910
|
+
new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val);
|
|
2911
|
+
};
|
|
2912
|
+
assert.notPropertyVal = function(obj, prop, val, msg) {
|
|
2913
|
+
new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(prop, val);
|
|
2914
|
+
};
|
|
2915
|
+
assert.deepPropertyVal = function(obj, prop, val, msg) {
|
|
2916
|
+
new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(prop, val);
|
|
2917
|
+
};
|
|
2918
|
+
assert.notDeepPropertyVal = function(obj, prop, val, msg) {
|
|
2919
|
+
new Assertion(obj, msg, assert.notDeepPropertyVal, true).to.not.have.deep.property(prop, val);
|
|
2920
|
+
};
|
|
2921
|
+
assert.ownProperty = function(obj, prop, msg) {
|
|
2922
|
+
new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop);
|
|
2923
|
+
};
|
|
2924
|
+
assert.notOwnProperty = function(obj, prop, msg) {
|
|
2925
|
+
new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(prop);
|
|
2926
|
+
};
|
|
2927
|
+
assert.ownPropertyVal = function(obj, prop, value, msg) {
|
|
2928
|
+
new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(prop, value);
|
|
2929
|
+
};
|
|
2930
|
+
assert.notOwnPropertyVal = function(obj, prop, value, msg) {
|
|
2931
|
+
new Assertion(obj, msg, assert.notOwnPropertyVal, true).to.not.have.own.property(prop, value);
|
|
2932
|
+
};
|
|
2933
|
+
assert.deepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
2934
|
+
new Assertion(obj, msg, assert.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value);
|
|
2935
|
+
};
|
|
2936
|
+
assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
|
|
2937
|
+
new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value);
|
|
2938
|
+
};
|
|
2939
|
+
assert.nestedProperty = function(obj, prop, msg) {
|
|
2940
|
+
new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(prop);
|
|
2941
|
+
};
|
|
2942
|
+
assert.notNestedProperty = function(obj, prop, msg) {
|
|
2943
|
+
new Assertion(obj, msg, assert.notNestedProperty, true).to.not.have.nested.property(prop);
|
|
2944
|
+
};
|
|
2945
|
+
assert.nestedPropertyVal = function(obj, prop, val, msg) {
|
|
2946
|
+
new Assertion(obj, msg, assert.nestedPropertyVal, true).to.have.nested.property(prop, val);
|
|
2947
|
+
};
|
|
2948
|
+
assert.notNestedPropertyVal = function(obj, prop, val, msg) {
|
|
2949
|
+
new Assertion(obj, msg, assert.notNestedPropertyVal, true).to.not.have.nested.property(prop, val);
|
|
2950
|
+
};
|
|
2951
|
+
assert.deepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
2952
|
+
new Assertion(obj, msg, assert.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val);
|
|
2953
|
+
};
|
|
2954
|
+
assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
|
|
2955
|
+
new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val);
|
|
2956
|
+
};
|
|
2957
|
+
assert.lengthOf = function(exp, len, msg) {
|
|
2958
|
+
new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
|
|
2959
|
+
};
|
|
2960
|
+
assert.hasAnyKeys = function(obj, keys, msg) {
|
|
2961
|
+
new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
|
|
2962
|
+
};
|
|
2963
|
+
assert.hasAllKeys = function(obj, keys, msg) {
|
|
2964
|
+
new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
|
|
2965
|
+
};
|
|
2966
|
+
assert.containsAllKeys = function(obj, keys, msg) {
|
|
2967
|
+
new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(keys);
|
|
2968
|
+
};
|
|
2969
|
+
assert.doesNotHaveAnyKeys = function(obj, keys, msg) {
|
|
2970
|
+
new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys);
|
|
2971
|
+
};
|
|
2972
|
+
assert.doesNotHaveAllKeys = function(obj, keys, msg) {
|
|
2973
|
+
new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(keys);
|
|
2974
|
+
};
|
|
2975
|
+
assert.hasAnyDeepKeys = function(obj, keys, msg) {
|
|
2976
|
+
new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(keys);
|
|
2977
|
+
};
|
|
2978
|
+
assert.hasAllDeepKeys = function(obj, keys, msg) {
|
|
2979
|
+
new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(keys);
|
|
2980
|
+
};
|
|
2981
|
+
assert.containsAllDeepKeys = function(obj, keys, msg) {
|
|
2982
|
+
new Assertion(obj, msg, assert.containsAllDeepKeys, true).to.contain.all.deep.keys(keys);
|
|
2983
|
+
};
|
|
2984
|
+
assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
|
|
2985
|
+
new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys);
|
|
2986
|
+
};
|
|
2987
|
+
assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
|
|
2988
|
+
new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys);
|
|
2989
|
+
};
|
|
2990
|
+
assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
|
|
2991
|
+
if (typeof errorLike === "string" || errorLike instanceof RegExp) {
|
|
2992
|
+
errMsgMatcher = errorLike;
|
|
2993
|
+
errorLike = null;
|
|
2994
|
+
}
|
|
2995
|
+
let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher);
|
|
2996
|
+
return flag(assertErr, "object");
|
|
2997
|
+
};
|
|
2998
|
+
assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
|
|
2999
|
+
if (typeof errorLike === "string" || errorLike instanceof RegExp) {
|
|
3000
|
+
errMsgMatcher = errorLike;
|
|
3001
|
+
errorLike = null;
|
|
3002
|
+
}
|
|
3003
|
+
new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
|
|
3004
|
+
};
|
|
3005
|
+
assert.operator = function(val, operator, val2, msg) {
|
|
3006
|
+
let ok;
|
|
3007
|
+
switch (operator) {
|
|
3008
|
+
case "==":
|
|
3009
|
+
ok = val == val2;
|
|
3010
|
+
break;
|
|
3011
|
+
case "===":
|
|
3012
|
+
ok = val === val2;
|
|
3013
|
+
break;
|
|
3014
|
+
case ">":
|
|
3015
|
+
ok = val > val2;
|
|
3016
|
+
break;
|
|
3017
|
+
case ">=":
|
|
3018
|
+
ok = val >= val2;
|
|
3019
|
+
break;
|
|
3020
|
+
case "<":
|
|
3021
|
+
ok = val < val2;
|
|
3022
|
+
break;
|
|
3023
|
+
case "<=":
|
|
3024
|
+
ok = val <= val2;
|
|
3025
|
+
break;
|
|
3026
|
+
case "!=":
|
|
3027
|
+
ok = val != val2;
|
|
3028
|
+
break;
|
|
3029
|
+
case "!==":
|
|
3030
|
+
ok = val !== val2;
|
|
3031
|
+
break;
|
|
3032
|
+
default:
|
|
3033
|
+
msg = msg ? msg + ": " : msg;
|
|
3034
|
+
throw new AssertionError(msg + 'Invalid operator "' + operator + '"', undefined, assert.operator);
|
|
3035
|
+
}
|
|
3036
|
+
let test2 = new Assertion(ok, msg, assert.operator, true);
|
|
3037
|
+
test2.assert(flag(test2, "object") === true, "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2), "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2));
|
|
3038
|
+
};
|
|
3039
|
+
assert.closeTo = function(act, exp, delta, msg) {
|
|
3040
|
+
new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
|
|
3041
|
+
};
|
|
3042
|
+
assert.approximately = function(act, exp, delta, msg) {
|
|
3043
|
+
new Assertion(act, msg, assert.approximately, true).to.be.approximately(exp, delta);
|
|
3044
|
+
};
|
|
3045
|
+
assert.sameMembers = function(set1, set2, msg) {
|
|
3046
|
+
new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2);
|
|
3047
|
+
};
|
|
3048
|
+
assert.notSameMembers = function(set1, set2, msg) {
|
|
3049
|
+
new Assertion(set1, msg, assert.notSameMembers, true).to.not.have.same.members(set2);
|
|
3050
|
+
};
|
|
3051
|
+
assert.sameDeepMembers = function(set1, set2, msg) {
|
|
3052
|
+
new Assertion(set1, msg, assert.sameDeepMembers, true).to.have.same.deep.members(set2);
|
|
3053
|
+
};
|
|
3054
|
+
assert.notSameDeepMembers = function(set1, set2, msg) {
|
|
3055
|
+
new Assertion(set1, msg, assert.notSameDeepMembers, true).to.not.have.same.deep.members(set2);
|
|
3056
|
+
};
|
|
3057
|
+
assert.sameOrderedMembers = function(set1, set2, msg) {
|
|
3058
|
+
new Assertion(set1, msg, assert.sameOrderedMembers, true).to.have.same.ordered.members(set2);
|
|
3059
|
+
};
|
|
3060
|
+
assert.notSameOrderedMembers = function(set1, set2, msg) {
|
|
3061
|
+
new Assertion(set1, msg, assert.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2);
|
|
3062
|
+
};
|
|
3063
|
+
assert.sameDeepOrderedMembers = function(set1, set2, msg) {
|
|
3064
|
+
new Assertion(set1, msg, assert.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2);
|
|
3065
|
+
};
|
|
3066
|
+
assert.notSameDeepOrderedMembers = function(set1, set2, msg) {
|
|
3067
|
+
new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2);
|
|
3068
|
+
};
|
|
3069
|
+
assert.includeMembers = function(superset, subset, msg) {
|
|
3070
|
+
new Assertion(superset, msg, assert.includeMembers, true).to.include.members(subset);
|
|
3071
|
+
};
|
|
3072
|
+
assert.notIncludeMembers = function(superset, subset, msg) {
|
|
3073
|
+
new Assertion(superset, msg, assert.notIncludeMembers, true).to.not.include.members(subset);
|
|
3074
|
+
};
|
|
3075
|
+
assert.includeDeepMembers = function(superset, subset, msg) {
|
|
3076
|
+
new Assertion(superset, msg, assert.includeDeepMembers, true).to.include.deep.members(subset);
|
|
3077
|
+
};
|
|
3078
|
+
assert.notIncludeDeepMembers = function(superset, subset, msg) {
|
|
3079
|
+
new Assertion(superset, msg, assert.notIncludeDeepMembers, true).to.not.include.deep.members(subset);
|
|
3080
|
+
};
|
|
3081
|
+
assert.includeOrderedMembers = function(superset, subset, msg) {
|
|
3082
|
+
new Assertion(superset, msg, assert.includeOrderedMembers, true).to.include.ordered.members(subset);
|
|
3083
|
+
};
|
|
3084
|
+
assert.notIncludeOrderedMembers = function(superset, subset, msg) {
|
|
3085
|
+
new Assertion(superset, msg, assert.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset);
|
|
3086
|
+
};
|
|
3087
|
+
assert.includeDeepOrderedMembers = function(superset, subset, msg) {
|
|
3088
|
+
new Assertion(superset, msg, assert.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset);
|
|
3089
|
+
};
|
|
3090
|
+
assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
|
|
3091
|
+
new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset);
|
|
3092
|
+
};
|
|
3093
|
+
assert.oneOf = function(inList, list, msg) {
|
|
3094
|
+
new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
|
|
3095
|
+
};
|
|
3096
|
+
assert.isIterable = function(obj, msg) {
|
|
3097
|
+
if (obj == undefined || !obj[Symbol.iterator]) {
|
|
3098
|
+
msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`;
|
|
3099
|
+
throw new AssertionError(msg, undefined, assert.isIterable);
|
|
3100
|
+
}
|
|
3101
|
+
};
|
|
3102
|
+
assert.changes = function(fn, obj, prop, msg) {
|
|
3103
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3104
|
+
msg = prop;
|
|
3105
|
+
prop = null;
|
|
3106
|
+
}
|
|
3107
|
+
new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
|
|
3108
|
+
};
|
|
3109
|
+
assert.changesBy = function(fn, obj, prop, delta, msg) {
|
|
3110
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3111
|
+
let tmpMsg = delta;
|
|
3112
|
+
delta = prop;
|
|
3113
|
+
msg = tmpMsg;
|
|
3114
|
+
} else if (arguments.length === 3) {
|
|
3115
|
+
delta = prop;
|
|
3116
|
+
prop = null;
|
|
3117
|
+
}
|
|
3118
|
+
new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta);
|
|
3119
|
+
};
|
|
3120
|
+
assert.doesNotChange = function(fn, obj, prop, msg) {
|
|
3121
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3122
|
+
msg = prop;
|
|
3123
|
+
prop = null;
|
|
3124
|
+
}
|
|
3125
|
+
return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(obj, prop);
|
|
3126
|
+
};
|
|
3127
|
+
assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
3128
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3129
|
+
let tmpMsg = delta;
|
|
3130
|
+
delta = prop;
|
|
3131
|
+
msg = tmpMsg;
|
|
3132
|
+
} else if (arguments.length === 3) {
|
|
3133
|
+
delta = prop;
|
|
3134
|
+
prop = null;
|
|
3135
|
+
}
|
|
3136
|
+
new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
|
|
3137
|
+
};
|
|
3138
|
+
assert.increases = function(fn, obj, prop, msg) {
|
|
3139
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3140
|
+
msg = prop;
|
|
3141
|
+
prop = null;
|
|
3142
|
+
}
|
|
3143
|
+
return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop);
|
|
3144
|
+
};
|
|
3145
|
+
assert.increasesBy = function(fn, obj, prop, delta, msg) {
|
|
3146
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3147
|
+
let tmpMsg = delta;
|
|
3148
|
+
delta = prop;
|
|
3149
|
+
msg = tmpMsg;
|
|
3150
|
+
} else if (arguments.length === 3) {
|
|
3151
|
+
delta = prop;
|
|
3152
|
+
prop = null;
|
|
3153
|
+
}
|
|
3154
|
+
new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta);
|
|
3155
|
+
};
|
|
3156
|
+
assert.doesNotIncrease = function(fn, obj, prop, msg) {
|
|
3157
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3158
|
+
msg = prop;
|
|
3159
|
+
prop = null;
|
|
3160
|
+
}
|
|
3161
|
+
return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(obj, prop);
|
|
3162
|
+
};
|
|
3163
|
+
assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
3164
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3165
|
+
let tmpMsg = delta;
|
|
3166
|
+
delta = prop;
|
|
3167
|
+
msg = tmpMsg;
|
|
3168
|
+
} else if (arguments.length === 3) {
|
|
3169
|
+
delta = prop;
|
|
3170
|
+
prop = null;
|
|
3171
|
+
}
|
|
3172
|
+
new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
|
|
3173
|
+
};
|
|
3174
|
+
assert.decreases = function(fn, obj, prop, msg) {
|
|
3175
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3176
|
+
msg = prop;
|
|
3177
|
+
prop = null;
|
|
3178
|
+
}
|
|
3179
|
+
return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop);
|
|
3180
|
+
};
|
|
3181
|
+
assert.decreasesBy = function(fn, obj, prop, delta, msg) {
|
|
3182
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3183
|
+
let tmpMsg = delta;
|
|
3184
|
+
delta = prop;
|
|
3185
|
+
msg = tmpMsg;
|
|
3186
|
+
} else if (arguments.length === 3) {
|
|
3187
|
+
delta = prop;
|
|
3188
|
+
prop = null;
|
|
3189
|
+
}
|
|
3190
|
+
new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta);
|
|
3191
|
+
};
|
|
3192
|
+
assert.doesNotDecrease = function(fn, obj, prop, msg) {
|
|
3193
|
+
if (arguments.length === 3 && typeof obj === "function") {
|
|
3194
|
+
msg = prop;
|
|
3195
|
+
prop = null;
|
|
3196
|
+
}
|
|
3197
|
+
return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(obj, prop);
|
|
3198
|
+
};
|
|
3199
|
+
assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
|
|
3200
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3201
|
+
let tmpMsg = delta;
|
|
3202
|
+
delta = prop;
|
|
3203
|
+
msg = tmpMsg;
|
|
3204
|
+
} else if (arguments.length === 3) {
|
|
3205
|
+
delta = prop;
|
|
3206
|
+
prop = null;
|
|
3207
|
+
}
|
|
3208
|
+
return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
|
|
3209
|
+
};
|
|
3210
|
+
assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
3211
|
+
if (arguments.length === 4 && typeof obj === "function") {
|
|
3212
|
+
let tmpMsg = delta;
|
|
3213
|
+
delta = prop;
|
|
3214
|
+
msg = tmpMsg;
|
|
3215
|
+
} else if (arguments.length === 3) {
|
|
3216
|
+
delta = prop;
|
|
3217
|
+
prop = null;
|
|
3218
|
+
}
|
|
3219
|
+
new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
|
|
3220
|
+
};
|
|
3221
|
+
assert.ifError = function(val) {
|
|
3222
|
+
if (val) {
|
|
3223
|
+
throw val;
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
assert.isExtensible = function(obj, msg) {
|
|
3227
|
+
new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
|
|
3228
|
+
};
|
|
3229
|
+
assert.isNotExtensible = function(obj, msg) {
|
|
3230
|
+
new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
|
|
3231
|
+
};
|
|
3232
|
+
assert.isSealed = function(obj, msg) {
|
|
3233
|
+
new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
|
|
3234
|
+
};
|
|
3235
|
+
assert.isNotSealed = function(obj, msg) {
|
|
3236
|
+
new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
|
|
3237
|
+
};
|
|
3238
|
+
assert.isFrozen = function(obj, msg) {
|
|
3239
|
+
new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
|
|
3240
|
+
};
|
|
3241
|
+
assert.isNotFrozen = function(obj, msg) {
|
|
3242
|
+
new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
|
|
3243
|
+
};
|
|
3244
|
+
assert.isEmpty = function(val, msg) {
|
|
3245
|
+
new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
|
|
3246
|
+
};
|
|
3247
|
+
assert.isNotEmpty = function(val, msg) {
|
|
3248
|
+
new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
|
|
3249
|
+
};
|
|
3250
|
+
assert.containsSubset = function(val, exp, msg) {
|
|
3251
|
+
new Assertion(val, msg).to.containSubset(exp);
|
|
3252
|
+
};
|
|
3253
|
+
assert.doesNotContainSubset = function(val, exp, msg) {
|
|
3254
|
+
new Assertion(val, msg).to.not.containSubset(exp);
|
|
3255
|
+
};
|
|
3256
|
+
var aliases = [
|
|
3257
|
+
["isOk", "ok"],
|
|
3258
|
+
["isNotOk", "notOk"],
|
|
3259
|
+
["throws", "throw"],
|
|
3260
|
+
["throws", "Throw"],
|
|
3261
|
+
["isExtensible", "extensible"],
|
|
3262
|
+
["isNotExtensible", "notExtensible"],
|
|
3263
|
+
["isSealed", "sealed"],
|
|
3264
|
+
["isNotSealed", "notSealed"],
|
|
3265
|
+
["isFrozen", "frozen"],
|
|
3266
|
+
["isNotFrozen", "notFrozen"],
|
|
3267
|
+
["isEmpty", "empty"],
|
|
3268
|
+
["isNotEmpty", "notEmpty"],
|
|
3269
|
+
["isCallable", "isFunction"],
|
|
3270
|
+
["isNotCallable", "isNotFunction"],
|
|
3271
|
+
["containsSubset", "containSubset"]
|
|
3272
|
+
];
|
|
3273
|
+
for (const [name, as] of aliases) {
|
|
3274
|
+
assert[as] = assert[name];
|
|
3275
|
+
}
|
|
3276
|
+
var used = [];
|
|
3277
|
+
function use(fn) {
|
|
3278
|
+
const exports = {
|
|
3279
|
+
use,
|
|
3280
|
+
AssertionError,
|
|
3281
|
+
util: utils_exports,
|
|
3282
|
+
config,
|
|
3283
|
+
expect,
|
|
3284
|
+
assert,
|
|
3285
|
+
Assertion,
|
|
3286
|
+
...should_exports
|
|
3287
|
+
};
|
|
3288
|
+
if (!~used.indexOf(fn)) {
|
|
3289
|
+
fn(exports, utils_exports);
|
|
3290
|
+
used.push(fn);
|
|
3291
|
+
}
|
|
3292
|
+
return exports;
|
|
3293
|
+
}
|
|
3294
|
+
__name(use, "use");
|
|
3295
|
+
|
|
1
3296
|
// src/path.js
|
|
2
3297
|
class Step {
|
|
3
3298
|
lookup(_v, dval = null) {
|
|
@@ -183,8 +3478,8 @@ class Path {
|
|
|
183
3478
|
return [new Path(pathSteps.reverse()), handlers];
|
|
184
3479
|
}
|
|
185
3480
|
static fromEvent(e, rNode, maxDepth, comps, stopOnNoEvent = true) {
|
|
186
|
-
const { type, target } = e;
|
|
187
|
-
return Path.fromNodeAndEventName(target,
|
|
3481
|
+
const { type: type3, target } = e;
|
|
3482
|
+
return Path.fromNodeAndEventName(target, type3, rNode, maxDepth, comps, stopOnNoEvent);
|
|
188
3483
|
}
|
|
189
3484
|
}
|
|
190
3485
|
var EMPTY_META = {};
|
|
@@ -457,8 +3752,8 @@ class AlterHandlerNameVal extends NameVal {
|
|
|
457
3752
|
return stack.getHandlerFor(this.name, "alter") ?? mk404Handler("alter", this.name);
|
|
458
3753
|
}
|
|
459
3754
|
}
|
|
460
|
-
var mk404Handler = (
|
|
461
|
-
console.warn("handler not found", { type, name, args }, this);
|
|
3755
|
+
var mk404Handler = (type3, name) => function(...args) {
|
|
3756
|
+
console.warn("handler not found", { type: type3, name, args }, this);
|
|
462
3757
|
return this;
|
|
463
3758
|
};
|
|
464
3759
|
|
|
@@ -1393,9 +4688,9 @@ var WRAPPER_NODES = {
|
|
|
1393
4688
|
};
|
|
1394
4689
|
|
|
1395
4690
|
class ParseContext {
|
|
1396
|
-
constructor(document2, Text, Comment, nodes,
|
|
4691
|
+
constructor(document2, Text, Comment, nodes, events2, macroNodes, frame, parent) {
|
|
1397
4692
|
this.nodes = nodes ?? [];
|
|
1398
|
-
this.events =
|
|
4693
|
+
this.events = events2 ?? [];
|
|
1399
4694
|
this.macroNodes = macroNodes ?? [];
|
|
1400
4695
|
this.parent = parent ?? null;
|
|
1401
4696
|
this.frame = frame ?? {};
|
|
@@ -1409,9 +4704,9 @@ class ParseContext {
|
|
|
1409
4704
|
return this.frame.macroName === name || this.parent?.isInsideMacro(name);
|
|
1410
4705
|
}
|
|
1411
4706
|
enterMacro(macroName, macroVars, macroSlots) {
|
|
1412
|
-
const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
|
|
4707
|
+
const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
|
|
1413
4708
|
const frame = { macroName, macroVars, macroSlots };
|
|
1414
|
-
return new ParseContext(document2, Text, Comment, nodes,
|
|
4709
|
+
return new ParseContext(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
|
|
1415
4710
|
}
|
|
1416
4711
|
parseHTML(html) {
|
|
1417
4712
|
const t = this.document.createElement("template");
|
|
@@ -1429,9 +4724,9 @@ class ParseContext {
|
|
|
1429
4724
|
}
|
|
1430
4725
|
registerEvents() {
|
|
1431
4726
|
const id = this.events.length;
|
|
1432
|
-
const
|
|
1433
|
-
this.events.push(
|
|
1434
|
-
return
|
|
4727
|
+
const events2 = new NodeEvents(id);
|
|
4728
|
+
this.events.push(events2);
|
|
4729
|
+
return events2;
|
|
1435
4730
|
}
|
|
1436
4731
|
newMacroNode(macroName, mAttrs, childs) {
|
|
1437
4732
|
const anySlot = [];
|
|
@@ -1599,9 +4894,9 @@ class ParseCtxClassSetCollector extends ParseContext {
|
|
|
1599
4894
|
}
|
|
1600
4895
|
}
|
|
1601
4896
|
enterMacro(macroName, macroVars, macroSlots) {
|
|
1602
|
-
const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
|
|
4897
|
+
const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
|
|
1603
4898
|
const frame = { macroName, macroVars, macroSlots };
|
|
1604
|
-
const v = new ParseCtxClassSetCollector(document2, Text, Comment, nodes,
|
|
4899
|
+
const v = new ParseCtxClassSetCollector(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
|
|
1605
4900
|
v.classes = this.classes;
|
|
1606
4901
|
return v;
|
|
1607
4902
|
}
|
|
@@ -3467,8 +6762,8 @@ class LinterCtx {
|
|
|
3467
6762
|
return this.startInBody(name, raw, selfClosing, start, endIndex);
|
|
3468
6763
|
}
|
|
3469
6764
|
if (name === "input") {
|
|
3470
|
-
const
|
|
3471
|
-
if (
|
|
6765
|
+
const type3 = (this.getAttr("type") ?? "").toLowerCase();
|
|
6766
|
+
if (type3 === "hidden")
|
|
3472
6767
|
return;
|
|
3473
6768
|
this.report(HTML_TAG_NOT_ALLOWED_IN_PARENT, LEVEL_WARN, start, {
|
|
3474
6769
|
tag: raw,
|
|
@@ -4349,6 +7644,432 @@ class LintParseContext extends ParseContext {
|
|
|
4349
7644
|
}
|
|
4350
7645
|
}
|
|
4351
7646
|
|
|
7647
|
+
// tools/core/test-console.js
|
|
7648
|
+
var PASS = "color: #0a0; font-weight: bold";
|
|
7649
|
+
var FAIL = "color: #c00; font-weight: bold";
|
|
7650
|
+
var SKIP = "color: #888";
|
|
7651
|
+
var DIM = "color: #888";
|
|
7652
|
+
var RESET = "color: inherit; font-weight: normal";
|
|
7653
|
+
function reportTestNode(node) {
|
|
7654
|
+
if (node.children) {
|
|
7655
|
+
const label = node.componentName ? `${node.title} [${node.componentName}]` : node.title;
|
|
7656
|
+
console.group(label);
|
|
7657
|
+
for (const child of node.children)
|
|
7658
|
+
reportTestNode(child);
|
|
7659
|
+
console.groupEnd();
|
|
7660
|
+
return;
|
|
7661
|
+
}
|
|
7662
|
+
const dur = node.status === "skip" ? "" : ` (${Math.round(node.durationMs)}ms)`;
|
|
7663
|
+
if (node.status === "pass") {
|
|
7664
|
+
console.log(`%c✓%c ${node.title}%c${dur}`, PASS, RESET, DIM);
|
|
7665
|
+
} else if (node.status === "skip") {
|
|
7666
|
+
console.log(`%c○ ${node.title}%c (skipped)`, SKIP, RESET);
|
|
7667
|
+
} else {
|
|
7668
|
+
console.group(`%c✗%c ${node.title}%c${dur}`, FAIL, RESET, DIM);
|
|
7669
|
+
console.error(node.error?.message ?? "(no error message)");
|
|
7670
|
+
if (node.error && (("expected" in node.error) || ("actual" in node.error))) {
|
|
7671
|
+
console.log("expected:", node.error.expected);
|
|
7672
|
+
console.log("actual: ", node.error.actual);
|
|
7673
|
+
}
|
|
7674
|
+
if (node.error?.stack)
|
|
7675
|
+
console.log(node.error.stack);
|
|
7676
|
+
console.groupEnd();
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
function reportTestReportToConsole(report) {
|
|
7680
|
+
for (const m of report.modules) {
|
|
7681
|
+
const label = `tutuca tests${m.path ? ` — ${m.path}` : ""}`;
|
|
7682
|
+
console.group(label);
|
|
7683
|
+
if (m.suites.length === 0) {
|
|
7684
|
+
console.log("(no tests)");
|
|
7685
|
+
} else {
|
|
7686
|
+
for (const s of m.suites)
|
|
7687
|
+
reportTestNode(s);
|
|
7688
|
+
}
|
|
7689
|
+
const c = m.counts;
|
|
7690
|
+
const summary = `${c.pass} passed, ${c.fail} failed, ${c.skip} skipped (${c.total} total)`;
|
|
7691
|
+
if (c.fail > 0)
|
|
7692
|
+
console.error(`%c${summary}`, FAIL);
|
|
7693
|
+
else if (c.total === 0)
|
|
7694
|
+
console.log(`%c${summary}`, DIM);
|
|
7695
|
+
else
|
|
7696
|
+
console.log(`%c${summary}`, PASS);
|
|
7697
|
+
console.groupEnd();
|
|
7698
|
+
}
|
|
7699
|
+
return report;
|
|
7700
|
+
}
|
|
7701
|
+
|
|
7702
|
+
// tools/core/results.js
|
|
7703
|
+
class ModuleInfo {
|
|
7704
|
+
constructor({ path = null, present = new Set, counts = {}, warnings = [] }) {
|
|
7705
|
+
this.path = path;
|
|
7706
|
+
this.present = present;
|
|
7707
|
+
this.counts = counts;
|
|
7708
|
+
this.warnings = warnings;
|
|
7709
|
+
}
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7712
|
+
class ComponentSummary {
|
|
7713
|
+
constructor({ name, views, fields }) {
|
|
7714
|
+
this.name = name;
|
|
7715
|
+
this.views = views;
|
|
7716
|
+
this.fields = fields;
|
|
7717
|
+
}
|
|
7718
|
+
}
|
|
7719
|
+
|
|
7720
|
+
class ComponentList {
|
|
7721
|
+
constructor({ items }) {
|
|
7722
|
+
this.items = items;
|
|
7723
|
+
}
|
|
7724
|
+
}
|
|
7725
|
+
|
|
7726
|
+
class ExampleIndex {
|
|
7727
|
+
constructor({ sections }) {
|
|
7728
|
+
this.sections = sections;
|
|
7729
|
+
}
|
|
7730
|
+
}
|
|
7731
|
+
|
|
7732
|
+
class ComponentDocs {
|
|
7733
|
+
constructor({ items }) {
|
|
7734
|
+
this.items = items;
|
|
7735
|
+
}
|
|
7736
|
+
}
|
|
7737
|
+
|
|
7738
|
+
class LintFinding {
|
|
7739
|
+
constructor({ id, level, info, context = {} }) {
|
|
7740
|
+
this.id = id;
|
|
7741
|
+
this.level = level;
|
|
7742
|
+
this.info = info;
|
|
7743
|
+
this.context = context;
|
|
7744
|
+
}
|
|
7745
|
+
}
|
|
7746
|
+
|
|
7747
|
+
class LintComponentResult {
|
|
7748
|
+
constructor({ componentName, findings }) {
|
|
7749
|
+
this.componentName = componentName;
|
|
7750
|
+
this.findings = findings;
|
|
7751
|
+
}
|
|
7752
|
+
get errorCount() {
|
|
7753
|
+
return this.findings.filter((f) => f.level === "error").length;
|
|
7754
|
+
}
|
|
7755
|
+
get warnCount() {
|
|
7756
|
+
return this.findings.filter((f) => f.level === "warn").length;
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
|
|
7760
|
+
class LintReport {
|
|
7761
|
+
constructor({ components }) {
|
|
7762
|
+
this.components = components;
|
|
7763
|
+
}
|
|
7764
|
+
get hasErrors() {
|
|
7765
|
+
return this.components.some((c) => c.errorCount > 0);
|
|
7766
|
+
}
|
|
7767
|
+
get totalErrors() {
|
|
7768
|
+
return this.components.reduce((n, c) => n + c.errorCount, 0);
|
|
7769
|
+
}
|
|
7770
|
+
get totalWarnings() {
|
|
7771
|
+
return this.components.reduce((n, c) => n + c.warnCount, 0);
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
|
|
7775
|
+
class RenderedExample {
|
|
7776
|
+
constructor({ title, description = null, componentName, view, html, error = null }) {
|
|
7777
|
+
this.title = title;
|
|
7778
|
+
this.description = description;
|
|
7779
|
+
this.componentName = componentName;
|
|
7780
|
+
this.view = view;
|
|
7781
|
+
this.html = html;
|
|
7782
|
+
this.error = error;
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
|
|
7786
|
+
class RenderedSection {
|
|
7787
|
+
constructor({ title, description = null, items }) {
|
|
7788
|
+
this.title = title;
|
|
7789
|
+
this.description = description;
|
|
7790
|
+
this.items = items;
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7794
|
+
class RenderBatch {
|
|
7795
|
+
constructor({ sections }) {
|
|
7796
|
+
this.sections = sections;
|
|
7797
|
+
}
|
|
7798
|
+
get hasErrors() {
|
|
7799
|
+
return this.sections.some((s) => s.items.some((i) => i.error !== null));
|
|
7800
|
+
}
|
|
7801
|
+
}
|
|
7802
|
+
|
|
7803
|
+
class TestResult {
|
|
7804
|
+
constructor({ title, fullPath, componentName = null, status, durationMs = 0, error = null }) {
|
|
7805
|
+
this.title = title;
|
|
7806
|
+
this.fullPath = fullPath;
|
|
7807
|
+
this.componentName = componentName;
|
|
7808
|
+
this.status = status;
|
|
7809
|
+
this.durationMs = durationMs;
|
|
7810
|
+
this.error = error;
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
|
|
7814
|
+
class DescribeResult {
|
|
7815
|
+
constructor({ title, componentName = null, children = [] }) {
|
|
7816
|
+
this.title = title;
|
|
7817
|
+
this.componentName = componentName;
|
|
7818
|
+
this.children = children;
|
|
7819
|
+
}
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
class ModuleTestReport {
|
|
7823
|
+
constructor({ path = null, suites = [], counts = { pass: 0, fail: 0, skip: 0, total: 0 } }) {
|
|
7824
|
+
this.path = path;
|
|
7825
|
+
this.suites = suites;
|
|
7826
|
+
this.counts = counts;
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
|
|
7830
|
+
class TestReport {
|
|
7831
|
+
constructor({ modules = [] }) {
|
|
7832
|
+
this.modules = modules;
|
|
7833
|
+
}
|
|
7834
|
+
get totals() {
|
|
7835
|
+
return this.modules.reduce((acc, m) => ({
|
|
7836
|
+
pass: acc.pass + m.counts.pass,
|
|
7837
|
+
fail: acc.fail + m.counts.fail,
|
|
7838
|
+
skip: acc.skip + m.counts.skip,
|
|
7839
|
+
total: acc.total + m.counts.total
|
|
7840
|
+
}), { pass: 0, fail: 0, skip: 0, total: 0 });
|
|
7841
|
+
}
|
|
7842
|
+
get hasFailures() {
|
|
7843
|
+
return this.modules.some((m) => m.counts.fail > 0);
|
|
7844
|
+
}
|
|
7845
|
+
}
|
|
7846
|
+
|
|
7847
|
+
// tools/core/tests.js
|
|
7848
|
+
class Describe {
|
|
7849
|
+
constructor({ title, componentName = null, parent = null }) {
|
|
7850
|
+
this.title = title;
|
|
7851
|
+
this.componentName = componentName;
|
|
7852
|
+
this.parent = parent;
|
|
7853
|
+
this.children = [];
|
|
7854
|
+
}
|
|
7855
|
+
}
|
|
7856
|
+
|
|
7857
|
+
class Test {
|
|
7858
|
+
constructor({ title, fn, componentName = null, parent = null }) {
|
|
7859
|
+
this.title = title;
|
|
7860
|
+
this.fn = fn;
|
|
7861
|
+
this.componentName = componentName;
|
|
7862
|
+
this.parent = parent;
|
|
7863
|
+
}
|
|
7864
|
+
}
|
|
7865
|
+
|
|
7866
|
+
class ModuleTests {
|
|
7867
|
+
constructor({ path = null, suites = [] } = {}) {
|
|
7868
|
+
this.path = path;
|
|
7869
|
+
this.suites = suites;
|
|
7870
|
+
}
|
|
7871
|
+
}
|
|
7872
|
+
|
|
7873
|
+
class TestIndex {
|
|
7874
|
+
constructor({ modules = [] } = {}) {
|
|
7875
|
+
this.modules = modules;
|
|
7876
|
+
}
|
|
7877
|
+
}
|
|
7878
|
+
function isComponentObject(x) {
|
|
7879
|
+
return x !== null && typeof x === "object" && typeof x.name === "string" && typeof x.Class === "function";
|
|
7880
|
+
}
|
|
7881
|
+
function resolveComponentName(arg, components) {
|
|
7882
|
+
if (isComponentObject(arg))
|
|
7883
|
+
return arg.name;
|
|
7884
|
+
if (typeof arg === "function") {
|
|
7885
|
+
for (const c of components)
|
|
7886
|
+
if (c.Class === arg)
|
|
7887
|
+
return c.name;
|
|
7888
|
+
}
|
|
7889
|
+
return null;
|
|
7890
|
+
}
|
|
7891
|
+
function titleFromArg(arg) {
|
|
7892
|
+
if (typeof arg === "string")
|
|
7893
|
+
return arg;
|
|
7894
|
+
if (isComponentObject(arg))
|
|
7895
|
+
return arg.name;
|
|
7896
|
+
if (typeof arg === "function")
|
|
7897
|
+
return arg.name || "(anonymous)";
|
|
7898
|
+
return String(arg);
|
|
7899
|
+
}
|
|
7900
|
+
function makeCollector({ path = null, components = [] } = {}) {
|
|
7901
|
+
const moduleTests = new ModuleTests({ path, suites: [] });
|
|
7902
|
+
const stack = [];
|
|
7903
|
+
function describe(...args) {
|
|
7904
|
+
let head;
|
|
7905
|
+
let options = null;
|
|
7906
|
+
let fn;
|
|
7907
|
+
if (args.length === 2) {
|
|
7908
|
+
[head, fn] = args;
|
|
7909
|
+
} else if (args.length === 3) {
|
|
7910
|
+
[head, options, fn] = args;
|
|
7911
|
+
} else {
|
|
7912
|
+
throw new Error(`describe() expects 2 or 3 arguments, got ${args.length}`);
|
|
7913
|
+
}
|
|
7914
|
+
if (typeof fn !== "function") {
|
|
7915
|
+
throw new Error(`describe(${JSON.stringify(titleFromArg(head))}): final argument must be a function`);
|
|
7916
|
+
}
|
|
7917
|
+
let componentName = null;
|
|
7918
|
+
if (typeof head !== "string") {
|
|
7919
|
+
componentName = resolveComponentName(head, components);
|
|
7920
|
+
}
|
|
7921
|
+
if (componentName === null && options && options.component != null) {
|
|
7922
|
+
componentName = resolveComponentName(options.component, components);
|
|
7923
|
+
}
|
|
7924
|
+
if (componentName === null) {
|
|
7925
|
+
const parent2 = stack.length ? stack[stack.length - 1] : null;
|
|
7926
|
+
if (parent2)
|
|
7927
|
+
componentName = parent2.componentName;
|
|
7928
|
+
}
|
|
7929
|
+
const parent = stack.length ? stack[stack.length - 1] : null;
|
|
7930
|
+
const node = new Describe({
|
|
7931
|
+
title: titleFromArg(head),
|
|
7932
|
+
componentName,
|
|
7933
|
+
parent
|
|
7934
|
+
});
|
|
7935
|
+
if (parent)
|
|
7936
|
+
parent.children.push(node);
|
|
7937
|
+
else
|
|
7938
|
+
moduleTests.suites.push(node);
|
|
7939
|
+
stack.push(node);
|
|
7940
|
+
try {
|
|
7941
|
+
fn();
|
|
7942
|
+
} finally {
|
|
7943
|
+
stack.pop();
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
function test2(title, fn) {
|
|
7947
|
+
if (typeof title !== "string") {
|
|
7948
|
+
throw new Error("test(title, fn): title must be a string");
|
|
7949
|
+
}
|
|
7950
|
+
if (typeof fn !== "function") {
|
|
7951
|
+
throw new Error(`test(${JSON.stringify(title)}): fn must be a function`);
|
|
7952
|
+
}
|
|
7953
|
+
const parent = stack.length ? stack[stack.length - 1] : null;
|
|
7954
|
+
if (!parent) {
|
|
7955
|
+
throw new Error(`test(${JSON.stringify(title)}) must be called inside a describe()`);
|
|
7956
|
+
}
|
|
7957
|
+
parent.children.push(new Test({
|
|
7958
|
+
title,
|
|
7959
|
+
fn,
|
|
7960
|
+
componentName: parent.componentName,
|
|
7961
|
+
parent
|
|
7962
|
+
}));
|
|
7963
|
+
}
|
|
7964
|
+
return { describe, test: test2, moduleTests };
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7967
|
+
// tools/core/test.js
|
|
7968
|
+
function buildPath(node) {
|
|
7969
|
+
const parts = [];
|
|
7970
|
+
let cur = node;
|
|
7971
|
+
while (cur) {
|
|
7972
|
+
parts.unshift(cur.title);
|
|
7973
|
+
cur = cur.parent;
|
|
7974
|
+
}
|
|
7975
|
+
return parts.join(" > ");
|
|
7976
|
+
}
|
|
7977
|
+
function captureError(e) {
|
|
7978
|
+
const out = { message: e.message, stack: e.stack };
|
|
7979
|
+
if ("expected" in e)
|
|
7980
|
+
out.expected = e.expected;
|
|
7981
|
+
if ("actual" in e)
|
|
7982
|
+
out.actual = e.actual;
|
|
7983
|
+
return out;
|
|
7984
|
+
}
|
|
7985
|
+
async function runTests({
|
|
7986
|
+
getTests,
|
|
7987
|
+
components = [],
|
|
7988
|
+
path = null,
|
|
7989
|
+
expect: expect2,
|
|
7990
|
+
name = null,
|
|
7991
|
+
grep = null,
|
|
7992
|
+
bail = false
|
|
7993
|
+
} = {}) {
|
|
7994
|
+
const counts = { pass: 0, fail: 0, skip: 0, total: 0 };
|
|
7995
|
+
if (typeof getTests !== "function") {
|
|
7996
|
+
return new TestReport({
|
|
7997
|
+
modules: [new ModuleTestReport({ path, suites: [], counts })]
|
|
7998
|
+
});
|
|
7999
|
+
}
|
|
8000
|
+
if (typeof expect2 !== "function") {
|
|
8001
|
+
throw new Error("runTests: expect must be provided (e.g. chai's expect)");
|
|
8002
|
+
}
|
|
8003
|
+
const { describe, test: test2, moduleTests } = makeCollector({ path, components });
|
|
8004
|
+
await getTests({ describe, test: test2, expect: expect2 });
|
|
8005
|
+
let bailed = false;
|
|
8006
|
+
async function visit(node) {
|
|
8007
|
+
if (node instanceof Test) {
|
|
8008
|
+
if (name !== null && node.componentName !== name)
|
|
8009
|
+
return null;
|
|
8010
|
+
const fullPath = buildPath(node);
|
|
8011
|
+
if (grep !== null && !fullPath.includes(grep))
|
|
8012
|
+
return null;
|
|
8013
|
+
counts.total++;
|
|
8014
|
+
if (bailed) {
|
|
8015
|
+
counts.skip++;
|
|
8016
|
+
return new TestResult({
|
|
8017
|
+
title: node.title,
|
|
8018
|
+
fullPath,
|
|
8019
|
+
componentName: node.componentName,
|
|
8020
|
+
status: "skip"
|
|
8021
|
+
});
|
|
8022
|
+
}
|
|
8023
|
+
const start = performance.now();
|
|
8024
|
+
try {
|
|
8025
|
+
await node.fn();
|
|
8026
|
+
counts.pass++;
|
|
8027
|
+
return new TestResult({
|
|
8028
|
+
title: node.title,
|
|
8029
|
+
fullPath,
|
|
8030
|
+
componentName: node.componentName,
|
|
8031
|
+
status: "pass",
|
|
8032
|
+
durationMs: performance.now() - start
|
|
8033
|
+
});
|
|
8034
|
+
} catch (e) {
|
|
8035
|
+
counts.fail++;
|
|
8036
|
+
if (bail)
|
|
8037
|
+
bailed = true;
|
|
8038
|
+
return new TestResult({
|
|
8039
|
+
title: node.title,
|
|
8040
|
+
fullPath,
|
|
8041
|
+
componentName: node.componentName,
|
|
8042
|
+
status: "fail",
|
|
8043
|
+
durationMs: performance.now() - start,
|
|
8044
|
+
error: captureError(e)
|
|
8045
|
+
});
|
|
8046
|
+
}
|
|
8047
|
+
}
|
|
8048
|
+
const childResults = [];
|
|
8049
|
+
for (const child of node.children) {
|
|
8050
|
+
const r = await visit(child);
|
|
8051
|
+
if (r !== null)
|
|
8052
|
+
childResults.push(r);
|
|
8053
|
+
}
|
|
8054
|
+
if (childResults.length === 0)
|
|
8055
|
+
return null;
|
|
8056
|
+
return new DescribeResult({
|
|
8057
|
+
title: node.title,
|
|
8058
|
+
componentName: node.componentName,
|
|
8059
|
+
children: childResults
|
|
8060
|
+
});
|
|
8061
|
+
}
|
|
8062
|
+
const suiteResults = [];
|
|
8063
|
+
for (const suite of moduleTests.suites) {
|
|
8064
|
+
const r = await visit(suite);
|
|
8065
|
+
if (r !== null)
|
|
8066
|
+
suiteResults.push(r);
|
|
8067
|
+
}
|
|
8068
|
+
return new TestReport({
|
|
8069
|
+
modules: [new ModuleTestReport({ path, suites: suiteResults, counts })]
|
|
8070
|
+
});
|
|
8071
|
+
}
|
|
8072
|
+
|
|
4352
8073
|
// tools/format/lint.js
|
|
4353
8074
|
function badValueMessage(info) {
|
|
4354
8075
|
const v = JSON.stringify(info.value);
|
|
@@ -4530,10 +8251,10 @@ class Components {
|
|
|
4530
8251
|
return comp ? comp.scope.lookupRequest(name) : null;
|
|
4531
8252
|
}
|
|
4532
8253
|
compileStyles() {
|
|
4533
|
-
const
|
|
8254
|
+
const styles2 = [];
|
|
4534
8255
|
for (const comp of this.byId.values())
|
|
4535
|
-
|
|
4536
|
-
return
|
|
8256
|
+
styles2.push(comp.compileStyle());
|
|
8257
|
+
return styles2.join(`
|
|
4537
8258
|
`);
|
|
4538
8259
|
}
|
|
4539
8260
|
}
|
|
@@ -4549,20 +8270,20 @@ class ComponentStack {
|
|
|
4549
8270
|
enter() {
|
|
4550
8271
|
return new ComponentStack(this.comps, this);
|
|
4551
8272
|
}
|
|
4552
|
-
registerComponents(comps,
|
|
8273
|
+
registerComponents(comps, aliases2 = {}) {
|
|
4553
8274
|
for (let i = 0;i < comps.length; i++) {
|
|
4554
8275
|
const comp = comps[i];
|
|
4555
8276
|
comp.scope = this.enter();
|
|
4556
8277
|
this.comps.registerComponent(comp);
|
|
4557
8278
|
this.byName[comp.name] = comp;
|
|
4558
8279
|
}
|
|
4559
|
-
for (const alias in
|
|
4560
|
-
const comp = this.byName[
|
|
8280
|
+
for (const alias in aliases2) {
|
|
8281
|
+
const comp = this.byName[aliases2[alias]];
|
|
4561
8282
|
console.assert(this.byName[alias] === undefined, "alias overrides component", alias);
|
|
4562
8283
|
if (comp !== undefined)
|
|
4563
8284
|
this.byName[alias] = comp;
|
|
4564
8285
|
else
|
|
4565
|
-
console.warn("alias", alias, "to inexistent component",
|
|
8286
|
+
console.warn("alias", alias, "to inexistent component", aliases2[alias]);
|
|
4566
8287
|
}
|
|
4567
8288
|
}
|
|
4568
8289
|
registerMacros(macros) {
|
|
@@ -4676,15 +8397,15 @@ class Component {
|
|
|
4676
8397
|
}
|
|
4677
8398
|
compileStyle() {
|
|
4678
8399
|
const { id, commonStyle, globalStyle, views } = this;
|
|
4679
|
-
const
|
|
8400
|
+
const styles2 = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
|
|
4680
8401
|
if (globalStyle !== "")
|
|
4681
|
-
|
|
8402
|
+
styles2.push(globalStyle);
|
|
4682
8403
|
for (const name in views) {
|
|
4683
8404
|
const { style } = views[name];
|
|
4684
8405
|
if (style !== "")
|
|
4685
|
-
|
|
8406
|
+
styles2.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
|
|
4686
8407
|
}
|
|
4687
|
-
return
|
|
8408
|
+
return styles2.join(`
|
|
4688
8409
|
`);
|
|
4689
8410
|
}
|
|
4690
8411
|
}
|
|
@@ -5337,13 +9058,13 @@ function diffProps(a, b) {
|
|
|
5337
9058
|
function morphNode(domNode, source, target, opts) {
|
|
5338
9059
|
if (source === target || source.isEqualTo(target))
|
|
5339
9060
|
return domNode;
|
|
5340
|
-
const
|
|
5341
|
-
if (
|
|
5342
|
-
if (
|
|
9061
|
+
const type3 = source.nodeType;
|
|
9062
|
+
if (type3 === target.nodeType) {
|
|
9063
|
+
if (type3 === 3 || type3 === 8) {
|
|
5343
9064
|
domNode.data = target.text;
|
|
5344
9065
|
return domNode;
|
|
5345
9066
|
}
|
|
5346
|
-
if (
|
|
9067
|
+
if (type3 === 1 && source.isSameKind(target)) {
|
|
5347
9068
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
5348
9069
|
const isSelect = source.tag === "SELECT";
|
|
5349
9070
|
if (propsDiff) {
|
|
@@ -5359,7 +9080,7 @@ function morphNode(domNode, source, target, opts) {
|
|
|
5359
9080
|
applyProperties(domNode, { value: target.attrs.value }, source.attrs);
|
|
5360
9081
|
return domNode;
|
|
5361
9082
|
}
|
|
5362
|
-
if (
|
|
9083
|
+
if (type3 === 11) {
|
|
5363
9084
|
morphChildren(domNode, source.childs, target.childs, opts);
|
|
5364
9085
|
return domNode;
|
|
5365
9086
|
}
|
|
@@ -5402,18 +9123,18 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
|
5402
9123
|
if (key != null)
|
|
5403
9124
|
oldKeyMap[key] = i;
|
|
5404
9125
|
}
|
|
5405
|
-
const
|
|
9126
|
+
const used2 = new Uint8Array(oldChilds.length);
|
|
5406
9127
|
let unkeyedCursor = 0;
|
|
5407
9128
|
for (let j = 0;j < newChilds.length; j++) {
|
|
5408
9129
|
const newChild = newChilds[j];
|
|
5409
9130
|
const newKey = getKey(newChild);
|
|
5410
9131
|
let oldIdx = -1;
|
|
5411
9132
|
if (newKey != null) {
|
|
5412
|
-
if (newKey in oldKeyMap && !
|
|
9133
|
+
if (newKey in oldKeyMap && !used2[oldKeyMap[newKey]])
|
|
5413
9134
|
oldIdx = oldKeyMap[newKey];
|
|
5414
9135
|
} else {
|
|
5415
9136
|
while (unkeyedCursor < oldChilds.length) {
|
|
5416
|
-
if (!
|
|
9137
|
+
if (!used2[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
|
|
5417
9138
|
oldIdx = unkeyedCursor++;
|
|
5418
9139
|
break;
|
|
5419
9140
|
}
|
|
@@ -5421,7 +9142,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
|
5421
9142
|
}
|
|
5422
9143
|
}
|
|
5423
9144
|
if (oldIdx >= 0) {
|
|
5424
|
-
|
|
9145
|
+
used2[oldIdx] = 1;
|
|
5425
9146
|
const newDom = morphNode(domNodes[oldIdx], oldChilds[oldIdx], newChild, opts);
|
|
5426
9147
|
const ref = parentDom.childNodes[j] ?? null;
|
|
5427
9148
|
if (newDom !== ref)
|
|
@@ -5432,7 +9153,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
|
5432
9153
|
}
|
|
5433
9154
|
}
|
|
5434
9155
|
for (let i = oldChilds.length - 1;i >= 0; i--)
|
|
5435
|
-
if (!
|
|
9156
|
+
if (!used2[i] && domNodes[i].parentNode === parentDom)
|
|
5436
9157
|
parentDom.removeChild(domNodes[i]);
|
|
5437
9158
|
}
|
|
5438
9159
|
function render(vnode, container, options, prev) {
|
|
@@ -5505,27 +9226,27 @@ class App {
|
|
|
5505
9226
|
return this.transactor.state;
|
|
5506
9227
|
}
|
|
5507
9228
|
handleEvent(e) {
|
|
5508
|
-
const { type } = e;
|
|
5509
|
-
if (
|
|
9229
|
+
const { type: type3 } = e;
|
|
9230
|
+
if (type3[0] === "t" && type3.startsWith("touch")) {
|
|
5510
9231
|
this._handleTouchEvent(e);
|
|
5511
9232
|
return;
|
|
5512
9233
|
}
|
|
5513
9234
|
this._dispatchEvent(e);
|
|
5514
9235
|
}
|
|
5515
9236
|
_dispatchEvent(e) {
|
|
5516
|
-
const { type } = e;
|
|
5517
|
-
const isDrag =
|
|
9237
|
+
const { type: type3 } = e;
|
|
9238
|
+
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend";
|
|
5518
9239
|
const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
|
|
5519
9240
|
const [path, handlers] = Path.fromEvent(e, root, maxDepth, comps, !isDrag);
|
|
5520
9241
|
if (isDrag)
|
|
5521
|
-
this._handleDragEvent(e,
|
|
9242
|
+
this._handleDragEvent(e, type3, path);
|
|
5522
9243
|
if (path !== null && handlers !== null)
|
|
5523
9244
|
for (const handler of handlers)
|
|
5524
9245
|
transactor.transactInputNow(path, e, handler, this.dragInfo);
|
|
5525
9246
|
}
|
|
5526
9247
|
_handleTouchEvent(e) {
|
|
5527
|
-
const { type } = e;
|
|
5528
|
-
if (
|
|
9248
|
+
const { type: type3 } = e;
|
|
9249
|
+
if (type3 === "touchstart") {
|
|
5529
9250
|
if (this._touch !== null || e.touches.length !== 1)
|
|
5530
9251
|
return;
|
|
5531
9252
|
const t = e.touches[0];
|
|
@@ -5542,11 +9263,11 @@ class App {
|
|
|
5542
9263
|
return;
|
|
5543
9264
|
const { rootNode, _touch } = this;
|
|
5544
9265
|
const { clientX, clientY } = touch;
|
|
5545
|
-
const fire = (
|
|
5546
|
-
const e2 = { type:
|
|
9266
|
+
const fire = (type4, target) => {
|
|
9267
|
+
const e2 = { type: type4, target, clientX, clientY, preventDefault: NOOP };
|
|
5547
9268
|
this._dispatchEvent(e2);
|
|
5548
9269
|
};
|
|
5549
|
-
if (
|
|
9270
|
+
if (type3 === "touchmove") {
|
|
5550
9271
|
if (!_touch.active) {
|
|
5551
9272
|
const dx = clientX - _touch.startX;
|
|
5552
9273
|
const dy = clientY - _touch.startY;
|
|
@@ -5561,17 +9282,17 @@ class App {
|
|
|
5561
9282
|
}
|
|
5562
9283
|
return;
|
|
5563
9284
|
}
|
|
5564
|
-
if (
|
|
9285
|
+
if (type3 === "touchend" || type3 === "touchcancel") {
|
|
5565
9286
|
if (_touch.active) {
|
|
5566
|
-
if (
|
|
9287
|
+
if (type3 === "touchend")
|
|
5567
9288
|
fire("drop", hitTest(rootNode, clientX, clientY));
|
|
5568
9289
|
fire("dragend", _touch.target);
|
|
5569
9290
|
}
|
|
5570
9291
|
this._touch = null;
|
|
5571
9292
|
}
|
|
5572
9293
|
}
|
|
5573
|
-
_handleDragEvent(e,
|
|
5574
|
-
if (
|
|
9294
|
+
_handleDragEvent(e, type3, path) {
|
|
9295
|
+
if (type3 === "dragover") {
|
|
5575
9296
|
const dropTarget = getClosestDropTarget(e.target, this.rootNode, 50);
|
|
5576
9297
|
if (dropTarget !== null) {
|
|
5577
9298
|
e.preventDefault();
|
|
@@ -5579,7 +9300,7 @@ class App {
|
|
|
5579
9300
|
this.curDragOver = dropTarget;
|
|
5580
9301
|
dropTarget.dataset.draggingover = this.dragInfo?.type ?? "_external";
|
|
5581
9302
|
}
|
|
5582
|
-
} else if (
|
|
9303
|
+
} else if (type3 === "dragstart") {
|
|
5583
9304
|
e.target.dataset.dragging = 1;
|
|
5584
9305
|
const rootValue = this.state.val;
|
|
5585
9306
|
const value = path.lookup(rootValue);
|
|
@@ -5647,9 +9368,9 @@ class App {
|
|
|
5647
9368
|
sendAtRoot(name, args, opts) {
|
|
5648
9369
|
this.transactor.pushSend(new Path([]), name, args, opts);
|
|
5649
9370
|
}
|
|
5650
|
-
registerComponents(comps,
|
|
9371
|
+
registerComponents(comps, aliases2) {
|
|
5651
9372
|
const scope = this.compStack.enter();
|
|
5652
|
-
scope.registerComponents(comps,
|
|
9373
|
+
scope.registerComponents(comps, aliases2);
|
|
5653
9374
|
return scope;
|
|
5654
9375
|
}
|
|
5655
9376
|
_transactNextBatch(maxRunTimeMs = 10) {
|
|
@@ -5719,12 +9440,12 @@ function getClosestDropTarget(target, rootNode, count) {
|
|
|
5719
9440
|
}
|
|
5720
9441
|
|
|
5721
9442
|
class DragInfo {
|
|
5722
|
-
constructor(path, stack, e, val,
|
|
9443
|
+
constructor(path, stack, e, val, type3, node) {
|
|
5723
9444
|
this.path = path;
|
|
5724
9445
|
this.stack = stack;
|
|
5725
9446
|
this.e = e;
|
|
5726
9447
|
this.val = val;
|
|
5727
|
-
this.type =
|
|
9448
|
+
this.type = type3;
|
|
5728
9449
|
this.node = node;
|
|
5729
9450
|
}
|
|
5730
9451
|
lookupBind(name) {
|
|
@@ -6190,14 +9911,14 @@ function coerceKeyPath(keyPath) {
|
|
|
6190
9911
|
throw new TypeError(`Invalid keyPath: expected Ordered Collection or Array: ${keyPath}`);
|
|
6191
9912
|
}
|
|
6192
9913
|
var has = (collection, key) => isImmutable(collection) ? collection.has(key) : isDataStructure(collection) && Object.hasOwn(collection, key);
|
|
6193
|
-
function
|
|
9914
|
+
function get2(collection, key, notSetValue) {
|
|
6194
9915
|
return isImmutable(collection) ? collection.get(key, notSetValue) : !has(collection, key) ? notSetValue : typeof collection.get === "function" ? collection.get(key) : collection[key];
|
|
6195
9916
|
}
|
|
6196
9917
|
function getIn$1(collection, searchKeyPath, notSetValue) {
|
|
6197
9918
|
const keyPath = coerceKeyPath(searchKeyPath);
|
|
6198
9919
|
let i = 0;
|
|
6199
9920
|
while (i !== keyPath.length) {
|
|
6200
|
-
collection =
|
|
9921
|
+
collection = get2(collection, keyPath[i++], NOT_SET);
|
|
6201
9922
|
if (collection === NOT_SET) {
|
|
6202
9923
|
return notSetValue;
|
|
6203
9924
|
}
|
|
@@ -6247,7 +9968,7 @@ function toJS(value) {
|
|
|
6247
9968
|
});
|
|
6248
9969
|
return result;
|
|
6249
9970
|
}
|
|
6250
|
-
function
|
|
9971
|
+
function deepEqual2(a, b) {
|
|
6251
9972
|
if (a === b) {
|
|
6252
9973
|
return true;
|
|
6253
9974
|
}
|
|
@@ -6438,7 +10159,7 @@ class CollectionImpl {
|
|
|
6438
10159
|
this.prototype.contains = this.prototype.includes;
|
|
6439
10160
|
}
|
|
6440
10161
|
equals(other) {
|
|
6441
|
-
return
|
|
10162
|
+
return deepEqual2(this, other);
|
|
6442
10163
|
}
|
|
6443
10164
|
hashCode() {
|
|
6444
10165
|
return this.__hash ?? (this.__hash = hashCollection(this));
|
|
@@ -8371,7 +12092,7 @@ function remove(collection, key) {
|
|
|
8371
12092
|
}
|
|
8372
12093
|
return collectionCopy;
|
|
8373
12094
|
}
|
|
8374
|
-
function
|
|
12095
|
+
function set2(collection, key, value) {
|
|
8375
12096
|
if (!isDataStructure(collection)) {
|
|
8376
12097
|
throw new TypeError(`Cannot update non-data-structure value: ${collection}`);
|
|
8377
12098
|
}
|
|
@@ -8407,7 +12128,7 @@ function updateInDeeply(inImmutable, existing, keyPath, i, notSetValue, updater)
|
|
|
8407
12128
|
throw new TypeError(`Cannot update within non-data-structure value in path [${Array.from(keyPath).slice(0, i).map(quoteString)}]: ${existing}`);
|
|
8408
12129
|
}
|
|
8409
12130
|
const key = keyPath[i];
|
|
8410
|
-
const nextExisting = wasNotSet ? NOT_SET :
|
|
12131
|
+
const nextExisting = wasNotSet ? NOT_SET : get2(existing, key, NOT_SET);
|
|
8411
12132
|
const nextUpdated = updateInDeeply(nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting), nextExisting, keyPath, i + 1, notSetValue, updater);
|
|
8412
12133
|
if (nextUpdated === nextExisting) {
|
|
8413
12134
|
return existing;
|
|
@@ -8416,7 +12137,7 @@ function updateInDeeply(inImmutable, existing, keyPath, i, notSetValue, updater)
|
|
|
8416
12137
|
return remove(existing, key);
|
|
8417
12138
|
}
|
|
8418
12139
|
const collection = wasNotSet ? inImmutable ? emptyMap() : {} : existing;
|
|
8419
|
-
return
|
|
12140
|
+
return set2(collection, key, nextUpdated);
|
|
8420
12141
|
}
|
|
8421
12142
|
var removeIn = (collection, keyPath) => updateIn$1(collection, keyPath, () => NOT_SET);
|
|
8422
12143
|
var setIn$1 = (collection, keyPath, value) => updateIn$1(collection, keyPath, NOT_SET, () => value);
|
|
@@ -9421,10 +13142,10 @@ function returnStack(stack, newSize, head) {
|
|
|
9421
13142
|
var makeStack = (size, head, ownerID, hash2) => new StackImpl(size, head, ownerID, hash2);
|
|
9422
13143
|
var EMPTY_STACK;
|
|
9423
13144
|
var emptyStack = () => EMPTY_STACK || (EMPTY_STACK = makeStack(0));
|
|
9424
|
-
var Set2 = (value) => value === undefined || value === null ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations((
|
|
13145
|
+
var Set2 = (value) => value === undefined || value === null ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations((set3) => {
|
|
9425
13146
|
const iter = SetCollection(value);
|
|
9426
13147
|
assertNotInfinite(iter.size);
|
|
9427
|
-
iter.forEach((v) =>
|
|
13148
|
+
iter.forEach((v) => set3.add(v));
|
|
9428
13149
|
});
|
|
9429
13150
|
Set2.of = (...values) => Set2(values);
|
|
9430
13151
|
Set2.fromKeys = (value) => Set2(KeyedCollection(value).keySeq());
|
|
@@ -9493,12 +13214,12 @@ class SetImpl extends SetCollectionImpl {
|
|
|
9493
13214
|
if (this.size === 0 && !this.__ownerID && iters.length === 1) {
|
|
9494
13215
|
return Set2(iters[0]);
|
|
9495
13216
|
}
|
|
9496
|
-
return this.withMutations((
|
|
13217
|
+
return this.withMutations((set3) => {
|
|
9497
13218
|
for (const iter of iters) {
|
|
9498
13219
|
if (typeof iter === "string") {
|
|
9499
|
-
|
|
13220
|
+
set3.add(iter);
|
|
9500
13221
|
} else {
|
|
9501
|
-
SetCollection(iter).forEach((value) =>
|
|
13222
|
+
SetCollection(iter).forEach((value) => set3.add(value));
|
|
9502
13223
|
}
|
|
9503
13224
|
}
|
|
9504
13225
|
});
|
|
@@ -9541,31 +13262,31 @@ Set2.isSet = isSet;
|
|
|
9541
13262
|
var makeSet = (map, ownerID) => new SetImpl(map, ownerID);
|
|
9542
13263
|
var EMPTY_SET;
|
|
9543
13264
|
var emptySet = () => EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
|
|
9544
|
-
function filterByIters(
|
|
13265
|
+
function filterByIters(set3, iters, shouldRemove) {
|
|
9545
13266
|
if (iters.length === 0) {
|
|
9546
|
-
return
|
|
13267
|
+
return set3;
|
|
9547
13268
|
}
|
|
9548
13269
|
iters = iters.map((iter) => SetCollection(iter));
|
|
9549
|
-
return
|
|
9550
|
-
|
|
13270
|
+
return set3.withMutations((s) => {
|
|
13271
|
+
set3.forEach((value) => {
|
|
9551
13272
|
if (shouldRemove(value, iters)) {
|
|
9552
13273
|
s.remove(value);
|
|
9553
13274
|
}
|
|
9554
13275
|
});
|
|
9555
13276
|
});
|
|
9556
13277
|
}
|
|
9557
|
-
function updateSet(
|
|
9558
|
-
if (
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
return
|
|
13278
|
+
function updateSet(set3, newMap) {
|
|
13279
|
+
if (set3.__ownerID) {
|
|
13280
|
+
set3.size = newMap.size;
|
|
13281
|
+
set3._map = newMap;
|
|
13282
|
+
return set3;
|
|
9562
13283
|
}
|
|
9563
|
-
return newMap ===
|
|
13284
|
+
return newMap === set3._map ? set3 : newMap.size === 0 ? set3.__empty() : set3.__make(newMap);
|
|
9564
13285
|
}
|
|
9565
|
-
var OrderedSet = (value) => value === undefined || value === null ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations((
|
|
13286
|
+
var OrderedSet = (value) => value === undefined || value === null ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations((set3) => {
|
|
9566
13287
|
const iter = SetCollection(value);
|
|
9567
13288
|
assertNotInfinite(iter.size);
|
|
9568
|
-
iter.forEach((v) =>
|
|
13289
|
+
iter.forEach((v) => set3.add(v));
|
|
9569
13290
|
});
|
|
9570
13291
|
OrderedSet.of = (...values) => OrderedSet(values);
|
|
9571
13292
|
OrderedSet.fromKeys = (value) => OrderedSet(KeyedCollection(value).keySeq());
|
|
@@ -9927,7 +13648,7 @@ class RangeImpl extends IndexedSeqImpl {
|
|
|
9927
13648
|
return makeIndexKeys(this.size);
|
|
9928
13649
|
}
|
|
9929
13650
|
equals(other) {
|
|
9930
|
-
return other instanceof RangeImpl ? this._start === other._start && this._end === other._end && this._step === other._step :
|
|
13651
|
+
return other instanceof RangeImpl ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual2(this, other);
|
|
9931
13652
|
}
|
|
9932
13653
|
static {
|
|
9933
13654
|
this.prototype[Symbol.iterator] = this.prototype.values;
|
|
@@ -10018,7 +13739,7 @@ class RepeatImpl extends IndexedSeqImpl {
|
|
|
10018
13739
|
return makeIndexKeys(this.size);
|
|
10019
13740
|
}
|
|
10020
13741
|
equals(other) {
|
|
10021
|
-
return other instanceof RepeatImpl ? this.size === other.size && is(this._value, other._value) :
|
|
13742
|
+
return other instanceof RepeatImpl ? this.size === other.size && is(this._value, other._value) : deepEqual2(this, other);
|
|
10022
13743
|
}
|
|
10023
13744
|
static {
|
|
10024
13745
|
this.prototype[Symbol.iterator] = this.prototype.values;
|
|
@@ -10113,8 +13834,8 @@ var BAD_VALUE2 = Symbol("BadValue");
|
|
|
10113
13834
|
var nullCoercer = (v) => v;
|
|
10114
13835
|
|
|
10115
13836
|
class Field {
|
|
10116
|
-
constructor(
|
|
10117
|
-
this.type =
|
|
13837
|
+
constructor(type3, name, typeCheck, coercer, defaultValue = null) {
|
|
13838
|
+
this.type = type3;
|
|
10118
13839
|
this.name = name;
|
|
10119
13840
|
this.typeCheck = typeCheck;
|
|
10120
13841
|
this.coercer = coercer;
|
|
@@ -10122,8 +13843,8 @@ class Field {
|
|
|
10122
13843
|
this.defaultValue = defaultValue;
|
|
10123
13844
|
}
|
|
10124
13845
|
toDataDef() {
|
|
10125
|
-
const { type, defaultValue: dv } = this;
|
|
10126
|
-
return { type, defaultValue: dv?.toJS ? dv.toJS() : dv };
|
|
13846
|
+
const { type: type3, defaultValue: dv } = this;
|
|
13847
|
+
return { type: type3, defaultValue: dv?.toJS ? dv.toJS() : dv };
|
|
10127
13848
|
}
|
|
10128
13849
|
getFirstFailingCheck(v) {
|
|
10129
13850
|
if (!this.typeCheck.isValid(v))
|
|
@@ -10231,8 +13952,8 @@ class FieldAny extends Field {
|
|
|
10231
13952
|
}
|
|
10232
13953
|
toDataDef() {
|
|
10233
13954
|
const { defaultValue: dv } = this;
|
|
10234
|
-
const
|
|
10235
|
-
return { type, defaultValue: dv?.toJS ? dv.toJS() : dv };
|
|
13955
|
+
const type3 = getTypeName(dv) ?? "any";
|
|
13956
|
+
return { type: type3, defaultValue: dv?.toJS ? dv.toJS() : dv };
|
|
10236
13957
|
}
|
|
10237
13958
|
extendProtoForType(proto, uname) {
|
|
10238
13959
|
extendProtoNullable(proto, this.name, uname);
|
|
@@ -10285,8 +14006,8 @@ class CheckTypeName {
|
|
|
10285
14006
|
}
|
|
10286
14007
|
|
|
10287
14008
|
class FieldComp extends Field {
|
|
10288
|
-
constructor(
|
|
10289
|
-
super(
|
|
14009
|
+
constructor(type3, name, args) {
|
|
14010
|
+
super(type3, name, new CheckTypeName(type3), nullCoercer, null);
|
|
10290
14011
|
this.args = args;
|
|
10291
14012
|
}
|
|
10292
14013
|
toDataDef() {
|
|
@@ -10475,8 +14196,8 @@ class ClassBuilder {
|
|
|
10475
14196
|
this.fields[name] = field;
|
|
10476
14197
|
return field;
|
|
10477
14198
|
}
|
|
10478
|
-
addCompField(name,
|
|
10479
|
-
const field = new FieldComp(
|
|
14199
|
+
addCompField(name, type3, args) {
|
|
14200
|
+
const field = new FieldComp(type3, name, args);
|
|
10480
14201
|
this.compFields.add(name);
|
|
10481
14202
|
this.fields[name] = field;
|
|
10482
14203
|
return field;
|
|
@@ -10498,12 +14219,12 @@ function classFromData(name, { fields = {}, methods, statics }) {
|
|
|
10498
14219
|
const b = new ClassBuilder(name);
|
|
10499
14220
|
for (const field in fields) {
|
|
10500
14221
|
const value = fields[field];
|
|
10501
|
-
const
|
|
10502
|
-
if (
|
|
14222
|
+
const type3 = typeof value;
|
|
14223
|
+
if (type3 === "string")
|
|
10503
14224
|
b.addField(field, value, FieldString);
|
|
10504
|
-
else if (
|
|
14225
|
+
else if (type3 === "number")
|
|
10505
14226
|
b.addField(field, value, FieldFloat);
|
|
10506
|
-
else if (
|
|
14227
|
+
else if (type3 === "boolean")
|
|
10507
14228
|
b.addField(field, value, FieldBool);
|
|
10508
14229
|
else if (List.isList(value) || Array.isArray(value))
|
|
10509
14230
|
b.addField(field, List(value), FieldList);
|
|
@@ -10858,13 +14579,6 @@ async function compileClassesToStyleText(app, compileClasses, extraCSSClasses, C
|
|
|
10858
14579
|
}
|
|
10859
14580
|
return await compileClasses(Array.from(classes));
|
|
10860
14581
|
}
|
|
10861
|
-
// tools/core/results.js
|
|
10862
|
-
class ComponentDocs {
|
|
10863
|
-
constructor({ items }) {
|
|
10864
|
-
this.items = items;
|
|
10865
|
-
}
|
|
10866
|
-
}
|
|
10867
|
-
|
|
10868
14582
|
// tools/core/docs.js
|
|
10869
14583
|
function getSignature(name, fn) {
|
|
10870
14584
|
const s = fn.toString();
|
|
@@ -10873,7 +14587,7 @@ function getSignature(name, fn) {
|
|
|
10873
14587
|
return `${name}(${params})`;
|
|
10874
14588
|
}
|
|
10875
14589
|
function getFieldMethods(field) {
|
|
10876
|
-
const { name, type } = field;
|
|
14590
|
+
const { name, type: type3 } = field;
|
|
10877
14591
|
const uname = name[0].toUpperCase() + name.slice(1);
|
|
10878
14592
|
const methods = [
|
|
10879
14593
|
{ name: `set${uname}`, sig: `set${uname}(v)`, desc: "Set value" },
|
|
@@ -10898,7 +14612,7 @@ function getFieldMethods(field) {
|
|
|
10898
14612
|
desc: "Check if not null/undefined"
|
|
10899
14613
|
}
|
|
10900
14614
|
];
|
|
10901
|
-
switch (
|
|
14615
|
+
switch (type3) {
|
|
10902
14616
|
case "bool":
|
|
10903
14617
|
methods[0].desc = "Set value (coerces to boolean)";
|
|
10904
14618
|
methods.push({
|
|
@@ -10951,7 +14665,7 @@ function getFieldMethods(field) {
|
|
|
10951
14665
|
break;
|
|
10952
14666
|
case "map":
|
|
10953
14667
|
case "omap": {
|
|
10954
|
-
const label =
|
|
14668
|
+
const label = type3 === "omap" ? "ordered map" : "map";
|
|
10955
14669
|
methods.push({
|
|
10956
14670
|
name: `is${uname}Empty`,
|
|
10957
14671
|
sig: `is${uname}Empty()`,
|
|
@@ -11053,6 +14767,11 @@ function docComponents(normalized, { name = null } = {}) {
|
|
|
11053
14767
|
}
|
|
11054
14768
|
|
|
11055
14769
|
// dev.js
|
|
14770
|
+
async function test3(opts = {}) {
|
|
14771
|
+
const report = await runTests({ expect, ...opts });
|
|
14772
|
+
reportTestReportToConsole(report);
|
|
14773
|
+
return report;
|
|
14774
|
+
}
|
|
11056
14775
|
function check(app) {
|
|
11057
14776
|
const counts = { error: 0, warn: 0, hint: 0 };
|
|
11058
14777
|
for (const Comp of app.comps.byId.values()) {
|
|
@@ -11094,9 +14813,9 @@ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
|
|
|
11094
14813
|
this.parseIssues = [];
|
|
11095
14814
|
}
|
|
11096
14815
|
enterMacro(macroName, macroVars, macroSlots) {
|
|
11097
|
-
const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
|
|
14816
|
+
const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
|
|
11098
14817
|
const frame = { macroName, macroVars, macroSlots };
|
|
11099
|
-
const v = new LintClassCollectorCtx(document2, Text, Comment, nodes,
|
|
14818
|
+
const v = new LintClassCollectorCtx(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
|
|
11100
14819
|
v.classes = this.classes;
|
|
11101
14820
|
v.attrs = this.attrs;
|
|
11102
14821
|
v.parseIssues = this.parseIssues;
|
|
@@ -11116,14 +14835,18 @@ export {
|
|
|
11116
14835
|
updateIn$1 as updateIn,
|
|
11117
14836
|
update$1 as update,
|
|
11118
14837
|
tutuca,
|
|
14838
|
+
test3 as test,
|
|
11119
14839
|
setIn$1 as setIn,
|
|
11120
|
-
set,
|
|
14840
|
+
set2 as set,
|
|
14841
|
+
runTests,
|
|
14842
|
+
reportTestReportToConsole,
|
|
11121
14843
|
removeIn,
|
|
11122
14844
|
remove,
|
|
11123
14845
|
mergeWith$1 as mergeWith,
|
|
11124
14846
|
mergeDeepWith$1 as mergeDeepWith,
|
|
11125
14847
|
mergeDeep$1 as mergeDeep,
|
|
11126
14848
|
merge$1 as merge,
|
|
14849
|
+
makeCollector,
|
|
11127
14850
|
macro,
|
|
11128
14851
|
lintIdToMessage,
|
|
11129
14852
|
isValueObject,
|
|
@@ -11152,7 +14875,7 @@ export {
|
|
|
11152
14875
|
has,
|
|
11153
14876
|
getIn$1 as getIn,
|
|
11154
14877
|
getComponentsDocs,
|
|
11155
|
-
get,
|
|
14878
|
+
get2 as get,
|
|
11156
14879
|
fromJS,
|
|
11157
14880
|
docComponents,
|
|
11158
14881
|
css,
|
|
@@ -11169,11 +14892,18 @@ export {
|
|
|
11169
14892
|
UNKNOWN_EVENT_MODIFIER,
|
|
11170
14893
|
UNKNOWN_DIRECTIVE,
|
|
11171
14894
|
UNKNOWN_COMPONENT_NAME,
|
|
14895
|
+
TestResult,
|
|
14896
|
+
TestReport,
|
|
14897
|
+
TestIndex,
|
|
14898
|
+
Test,
|
|
11172
14899
|
Stack2 as Stack,
|
|
11173
14900
|
Set2 as Set,
|
|
11174
14901
|
Seq,
|
|
11175
14902
|
SEQ_INFO,
|
|
11176
14903
|
Repeat,
|
|
14904
|
+
RenderedSection,
|
|
14905
|
+
RenderedExample,
|
|
14906
|
+
RenderBatch,
|
|
11177
14907
|
Record,
|
|
11178
14908
|
Range,
|
|
11179
14909
|
RENDER_IT_OUTSIDE_OF_LOOP,
|
|
@@ -11182,11 +14912,17 @@ export {
|
|
|
11182
14912
|
OrderedSet,
|
|
11183
14913
|
OrderedMap,
|
|
11184
14914
|
OrderedMap as OMap,
|
|
14915
|
+
ModuleTests,
|
|
14916
|
+
ModuleTestReport,
|
|
14917
|
+
ModuleInfo,
|
|
11185
14918
|
Map2 as Map,
|
|
11186
14919
|
MAYBE_DROP_AT_PREFIX,
|
|
11187
14920
|
List,
|
|
14921
|
+
LintReport,
|
|
11188
14922
|
LintParseContext,
|
|
14923
|
+
LintFinding,
|
|
11189
14924
|
LintContext,
|
|
14925
|
+
LintComponentResult,
|
|
11190
14926
|
LintClassCollectorCtx,
|
|
11191
14927
|
KList,
|
|
11192
14928
|
Set2 as ISet,
|
|
@@ -11199,7 +14935,13 @@ export {
|
|
|
11199
14935
|
IF_NO_BRANCH_SET,
|
|
11200
14936
|
FIELD_VAL_NOT_DEFINED,
|
|
11201
14937
|
FIELD_CLASS,
|
|
14938
|
+
ExampleIndex,
|
|
14939
|
+
DescribeResult,
|
|
14940
|
+
Describe,
|
|
11202
14941
|
DUPLICATE_ATTR_DEFINITION,
|
|
14942
|
+
ComponentSummary,
|
|
14943
|
+
ComponentList,
|
|
14944
|
+
ComponentDocs,
|
|
11203
14945
|
Collection,
|
|
11204
14946
|
BAD_VALUE,
|
|
11205
14947
|
ALT_HANDLER_NOT_REFERENCED,
|