var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; // (disabled):util var require_util = __commonJS({ "(disabled):util"() { } }); // lib/chai/utils/index.js var utils_exports = {}; __export(utils_exports, { addChainableMethod: () => addChainableMethod, addLengthGuard: () => addLengthGuard, addMethod: () => addMethod, addProperty: () => addProperty, checkError: () => check_error_exports, compareByInspect: () => compareByInspect, eql: () => deep_eql_default, expectTypes: () => expectTypes, flag: () => flag, getActual: () => getActual, getMessage: () => getMessage2, getName: () => getName, getOperator: () => getOperator, getOwnEnumerableProperties: () => getOwnEnumerableProperties, getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols, getPathInfo: () => getPathInfo, hasProperty: () => hasProperty, inspect: () => inspect2, isNaN: () => isNaN2, isNumeric: () => isNumeric, isProxyEnabled: () => isProxyEnabled, isRegExp: () => isRegExp2, objDisplay: () => objDisplay, overwriteChainableMethod: () => overwriteChainableMethod, overwriteMethod: () => overwriteMethod, overwriteProperty: () => overwriteProperty, proxify: () => proxify, test: () => test, transferFlags: () => transferFlags, type: () => type }); // node_modules/check-error/index.js var check_error_exports = {}; __export(check_error_exports, { compatibleConstructor: () => compatibleConstructor, compatibleInstance: () => compatibleInstance, compatibleMessage: () => compatibleMessage, getConstructorName: () => getConstructorName, getMessage: () => getMessage }); function isErrorInstance(obj) { return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]"; } __name(isErrorInstance, "isErrorInstance"); function isRegExp(obj) { return Object.prototype.toString.call(obj) === "[object RegExp]"; } __name(isRegExp, "isRegExp"); function compatibleInstance(thrown, errorLike) { return isErrorInstance(errorLike) && thrown === errorLike; } __name(compatibleInstance, "compatibleInstance"); function compatibleConstructor(thrown, errorLike) { if (isErrorInstance(errorLike)) { return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor; } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) { return thrown.constructor === errorLike || thrown instanceof errorLike; } return false; } __name(compatibleConstructor, "compatibleConstructor"); function compatibleMessage(thrown, errMatcher) { const comparisonString = typeof thrown === "string" ? thrown : thrown.message; if (isRegExp(errMatcher)) { return errMatcher.test(comparisonString); } else if (typeof errMatcher === "string") { return comparisonString.indexOf(errMatcher) !== -1; } return false; } __name(compatibleMessage, "compatibleMessage"); function getConstructorName(errorLike) { let constructorName = errorLike; if (isErrorInstance(errorLike)) { constructorName = errorLike.constructor.name; } else if (typeof errorLike === "function") { constructorName = errorLike.name; if (constructorName === "") { const newConstructorName = new errorLike().name; constructorName = newConstructorName || constructorName; } } return constructorName; } __name(getConstructorName, "getConstructorName"); function getMessage(errorLike) { let msg = ""; if (errorLike && errorLike.message) { msg = errorLike.message; } else if (typeof errorLike === "string") { msg = errorLike; } return msg; } __name(getMessage, "getMessage"); // lib/chai/utils/flag.js function flag(obj, key, value) { var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null)); if (arguments.length === 3) { flags[key] = value; } else { return flags[key]; } } __name(flag, "flag"); // lib/chai/utils/test.js function test(obj, args) { var negate = flag(obj, "negate"), expr = args[0]; return negate ? !expr : expr; } __name(test, "test"); // lib/chai/utils/type-detect.js function type(obj) { if (typeof obj === "undefined") { return "undefined"; } if (obj === null) { return "null"; } const stringTag = obj[Symbol.toStringTag]; if (typeof stringTag === "string") { return stringTag; } const type3 = Object.prototype.toString.call(obj).slice(8, -1); return type3; } __name(type, "type"); // node_modules/assertion-error/index.js var canElideFrames = "captureStackTrace" in Error; var AssertionError = class _AssertionError extends Error { static { __name(this, "AssertionError"); } message; get name() { return "AssertionError"; } get ok() { return false; } constructor(message = "Unspecified AssertionError", props, ssf) { super(message); this.message = message; if (canElideFrames) { Error.captureStackTrace(this, ssf || _AssertionError); } for (const key in props) { if (!(key in this)) { this[key] = props[key]; } } } toJSON(stack) { return { ...this, name: this.name, message: this.message, ok: false, stack: stack !== false ? this.stack : void 0 }; } }; // lib/chai/utils/expectTypes.js function expectTypes(obj, types) { var flagMsg = flag(obj, "message"); var ssfi = flag(obj, "ssfi"); flagMsg = flagMsg ? flagMsg + ": " : ""; obj = flag(obj, "object"); types = types.map(function(t) { return t.toLowerCase(); }); types.sort(); var str = types.map(function(t, index) { var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a"; var or = types.length > 1 && index === types.length - 1 ? "or " : ""; return or + art + " " + t; }).join(", "); var objType = type(obj).toLowerCase(); if (!types.some(function(expected) { return objType === expected; })) { throw new AssertionError( flagMsg + "object tested must be " + str + ", but " + objType + " given", void 0, ssfi ); } } __name(expectTypes, "expectTypes"); // lib/chai/utils/getActual.js function getActual(obj, args) { return args.length > 4 ? args[4] : obj._obj; } __name(getActual, "getActual"); // node_modules/loupe/lib/helpers.js var ansiColors = { bold: ["1", "22"], dim: ["2", "22"], italic: ["3", "23"], underline: ["4", "24"], // 5 & 6 are blinking inverse: ["7", "27"], hidden: ["8", "28"], strike: ["9", "29"], // 10-20 are fonts // 21-29 are resets for 1-9 black: ["30", "39"], red: ["31", "39"], green: ["32", "39"], yellow: ["33", "39"], blue: ["34", "39"], magenta: ["35", "39"], cyan: ["36", "39"], white: ["37", "39"], brightblack: ["30;1", "39"], brightred: ["31;1", "39"], brightgreen: ["32;1", "39"], brightyellow: ["33;1", "39"], brightblue: ["34;1", "39"], brightmagenta: ["35;1", "39"], brightcyan: ["36;1", "39"], brightwhite: ["37;1", "39"], grey: ["90", "39"] }; var styles = { special: "cyan", number: "yellow", bigint: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", symbol: "green", date: "magenta", regexp: "red" }; var truncator = "\u2026"; function colorise(value, styleType) { const color = ansiColors[styles[styleType]] || ansiColors[styleType] || ""; if (!color) { return String(value); } return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`; } __name(colorise, "colorise"); function normaliseOptions({ showHidden = false, depth = 2, colors = false, customInspect = true, showProxy = false, maxArrayLength = Infinity, breakLength = Infinity, seen = [], // eslint-disable-next-line no-shadow truncate: truncate2 = Infinity, stylize = String } = {}, inspect3) { const options = { showHidden: Boolean(showHidden), depth: Number(depth), colors: Boolean(colors), customInspect: Boolean(customInspect), showProxy: Boolean(showProxy), maxArrayLength: Number(maxArrayLength), breakLength: Number(breakLength), truncate: Number(truncate2), seen, inspect: inspect3, stylize }; if (options.colors) { options.stylize = colorise; } return options; } __name(normaliseOptions, "normaliseOptions"); function isHighSurrogate(char) { return char >= "\uD800" && char <= "\uDBFF"; } __name(isHighSurrogate, "isHighSurrogate"); function truncate(string, length, tail = truncator) { string = String(string); const tailLength = tail.length; const stringLength = string.length; if (tailLength > length && stringLength > tailLength) { return tail; } if (stringLength > length && stringLength > tailLength) { let end = length - tailLength; if (end > 0 && isHighSurrogate(string[end - 1])) { end = end - 1; } return `${string.slice(0, end)}${tail}`; } return string; } __name(truncate, "truncate"); function inspectList(list, options, inspectItem, separator = ", ") { inspectItem = inspectItem || options.inspect; const size = list.length; if (size === 0) return ""; const originalLength = options.truncate; let output = ""; let peek = ""; let truncated = ""; for (let i = 0; i < size; i += 1) { const last = i + 1 === list.length; const secondToLast = i + 2 === list.length; truncated = `${truncator}(${list.length - i})`; const value = list[i]; options.truncate = originalLength - output.length - (last ? 0 : separator.length); const string = peek || inspectItem(value, options) + (last ? "" : separator); const nextLength = output.length + string.length; const truncatedLength = nextLength + truncated.length; if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) { break; } if (!last && !secondToLast && truncatedLength > originalLength) { break; } peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator); if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) { break; } output += string; if (!last && !secondToLast && nextLength + peek.length >= originalLength) { truncated = `${truncator}(${list.length - i - 1})`; break; } truncated = ""; } return `${output}${truncated}`; } __name(inspectList, "inspectList"); function quoteComplexKey(key) { if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) { return key; } return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); } __name(quoteComplexKey, "quoteComplexKey"); function inspectProperty([key, value], options) { options.truncate -= 2; if (typeof key === "string") { key = quoteComplexKey(key); } else if (typeof key !== "number") { key = `[${options.inspect(key, options)}]`; } options.truncate -= key.length; value = options.inspect(value, options); return `${key}: ${value}`; } __name(inspectProperty, "inspectProperty"); // node_modules/loupe/lib/array.js function inspectArray(array, options) { const nonIndexProperties = Object.keys(array).slice(array.length); if (!array.length && !nonIndexProperties.length) return "[]"; options.truncate -= 4; const listContents = inspectList(array, options); options.truncate -= listContents.length; let propertyContents = ""; if (nonIndexProperties.length) { propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty); } return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`; } __name(inspectArray, "inspectArray"); // node_modules/loupe/lib/typedarray.js var getArrayName = /* @__PURE__ */ __name((array) => { if (typeof Buffer === "function" && array instanceof Buffer) { return "Buffer"; } if (array[Symbol.toStringTag]) { return array[Symbol.toStringTag]; } return array.constructor.name; }, "getArrayName"); function inspectTypedArray(array, options) { const name = getArrayName(array); options.truncate -= name.length + 4; const nonIndexProperties = Object.keys(array).slice(array.length); if (!array.length && !nonIndexProperties.length) return `${name}[]`; let output = ""; for (let i = 0; i < array.length; i++) { const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`; options.truncate -= string.length; if (array[i] !== array.length && options.truncate <= 3) { output += `${truncator}(${array.length - array[i] + 1})`; break; } output += string; } let propertyContents = ""; if (nonIndexProperties.length) { propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty); } return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`; } __name(inspectTypedArray, "inspectTypedArray"); // node_modules/loupe/lib/date.js function inspectDate(dateObject, options) { const stringRepresentation = dateObject.toJSON(); if (stringRepresentation === null) { return "Invalid Date"; } const split = stringRepresentation.split("T"); const date = split[0]; return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date"); } __name(inspectDate, "inspectDate"); // node_modules/loupe/lib/function.js function inspectFunction(func, options) { const functionType = func[Symbol.toStringTag] || "Function"; const name = func.name; if (!name) { return options.stylize(`[${functionType}]`, "special"); } return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special"); } __name(inspectFunction, "inspectFunction"); // node_modules/loupe/lib/map.js function inspectMapEntry([key, value], options) { options.truncate -= 4; key = options.inspect(key, options); options.truncate -= key.length; value = options.inspect(value, options); return `${key} => ${value}`; } __name(inspectMapEntry, "inspectMapEntry"); function mapToEntries(map) { const entries = []; map.forEach((value, key) => { entries.push([key, value]); }); return entries; } __name(mapToEntries, "mapToEntries"); function inspectMap(map, options) { const size = map.size - 1; if (size <= 0) { return "Map{}"; } options.truncate -= 7; return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`; } __name(inspectMap, "inspectMap"); // node_modules/loupe/lib/number.js var isNaN = Number.isNaN || ((i) => i !== i); function inspectNumber(number, options) { if (isNaN(number)) { return options.stylize("NaN", "number"); } if (number === Infinity) { return options.stylize("Infinity", "number"); } if (number === -Infinity) { return options.stylize("-Infinity", "number"); } if (number === 0) { return options.stylize(1 / number === Infinity ? "+0" : "-0", "number"); } return options.stylize(truncate(String(number), options.truncate), "number"); } __name(inspectNumber, "inspectNumber"); // node_modules/loupe/lib/bigint.js function inspectBigInt(number, options) { let nums = truncate(number.toString(), options.truncate - 1); if (nums !== truncator) nums += "n"; return options.stylize(nums, "bigint"); } __name(inspectBigInt, "inspectBigInt"); // node_modules/loupe/lib/regexp.js function inspectRegExp(value, options) { const flags = value.toString().split("/")[2]; const sourceLength = options.truncate - (2 + flags.length); const source = value.source; return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp"); } __name(inspectRegExp, "inspectRegExp"); // node_modules/loupe/lib/set.js function arrayFromSet(set2) { const values = []; set2.forEach((value) => { values.push(value); }); return values; } __name(arrayFromSet, "arrayFromSet"); function inspectSet(set2, options) { if (set2.size === 0) return "Set{}"; options.truncate -= 7; return `Set{ ${inspectList(arrayFromSet(set2), options)} }`; } __name(inspectSet, "inspectSet"); // node_modules/loupe/lib/string.js var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g"); var escapeCharacters = { "\b": "\\b", " ": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", "'": "\\'", "\\": "\\\\" }; var hex = 16; var unicodeLength = 4; function escape(char) { return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`; } __name(escape, "escape"); function inspectString(string, options) { if (stringEscapeChars.test(string)) { string = string.replace(stringEscapeChars, escape); } return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string"); } __name(inspectString, "inspectString"); // node_modules/loupe/lib/symbol.js function inspectSymbol(value) { if ("description" in Symbol.prototype) { return value.description ? `Symbol(${value.description})` : "Symbol()"; } return value.toString(); } __name(inspectSymbol, "inspectSymbol"); // node_modules/loupe/lib/promise.js var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue"); try { const { getPromiseDetails, kPending, kRejected } = process.binding("util"); if (Array.isArray(getPromiseDetails(Promise.resolve()))) { getPromiseValue = /* @__PURE__ */ __name((value, options) => { const [state, innerValue] = getPromiseDetails(value); if (state === kPending) { return "Promise{}"; } return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`; }, "getPromiseValue"); } } catch (notNode) { } var promise_default = getPromiseValue; // node_modules/loupe/lib/object.js function inspectObject(object, options) { const properties = Object.getOwnPropertyNames(object); const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []; if (properties.length === 0 && symbols.length === 0) { return "{}"; } options.truncate -= 4; options.seen = options.seen || []; if (options.seen.includes(object)) { return "[Circular]"; } options.seen.push(object); const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty); const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty); options.seen.pop(); let sep = ""; if (propertyContents && symbolContents) { sep = ", "; } return `{ ${propertyContents}${sep}${symbolContents} }`; } __name(inspectObject, "inspectObject"); // node_modules/loupe/lib/class.js var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false; function inspectClass(value, options) { let name = ""; if (toStringTag && toStringTag in value) { name = value[toStringTag]; } name = name || value.constructor.name; if (!name || name === "_class") { name = ""; } options.truncate -= name.length; return `${name}${inspectObject(value, options)}`; } __name(inspectClass, "inspectClass"); // node_modules/loupe/lib/arguments.js function inspectArguments(args, options) { if (args.length === 0) return "Arguments[]"; options.truncate -= 13; return `Arguments[ ${inspectList(args, options)} ]`; } __name(inspectArguments, "inspectArguments"); // node_modules/loupe/lib/error.js var errorKeys = [ "stack", "line", "column", "name", "message", "fileName", "lineNumber", "columnNumber", "number", "description", "cause" ]; function inspectObject2(error, options) { const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1); const name = error.name; options.truncate -= name.length; let message = ""; if (typeof error.message === "string") { message = truncate(error.message, options.truncate); } else { properties.unshift("message"); } message = message ? `: ${message}` : ""; options.truncate -= message.length + 5; options.seen = options.seen || []; if (options.seen.includes(error)) { return "[Circular]"; } options.seen.push(error); const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty); return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`; } __name(inspectObject2, "inspectObject"); // node_modules/loupe/lib/html.js function inspectAttribute([key, value], options) { options.truncate -= 3; if (!value) { return `${options.stylize(String(key), "yellow")}`; } return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`; } __name(inspectAttribute, "inspectAttribute"); function inspectHTMLCollection(collection, options) { return inspectList(collection, options, inspectHTML, "\n"); } __name(inspectHTMLCollection, "inspectHTMLCollection"); function inspectHTML(element, options) { const properties = element.getAttributeNames(); const name = element.tagName.toLowerCase(); const head = options.stylize(`<${name}`, "special"); const headClose = options.stylize(`>`, "special"); const tail = options.stylize(``, "special"); options.truncate -= name.length * 2 + 5; let propertyContents = ""; if (properties.length > 0) { propertyContents += " "; propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " "); } options.truncate -= propertyContents.length; const truncate2 = options.truncate; let children = inspectHTMLCollection(element.children, options); if (children && children.length > truncate2) { children = `${truncator}(${element.children.length})`; } return `${head}${propertyContents}${headClose}${children}${tail}`; } __name(inspectHTML, "inspectHTML"); // node_modules/loupe/lib/index.js var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function"; var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect"; var nodeInspect = false; try { const nodeUtil = require_util(); nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false; } catch (noNodeInspect) { nodeInspect = false; } var constructorMap = /* @__PURE__ */ new WeakMap(); var stringTagMap = {}; var baseTypesMap = { undefined: (value, options) => options.stylize("undefined", "undefined"), null: (value, options) => options.stylize("null", "null"), boolean: (value, options) => options.stylize(String(value), "boolean"), Boolean: (value, options) => options.stylize(String(value), "boolean"), number: inspectNumber, Number: inspectNumber, bigint: inspectBigInt, BigInt: inspectBigInt, string: inspectString, String: inspectString, function: inspectFunction, Function: inspectFunction, symbol: inspectSymbol, // A Symbol polyfill will return `Symbol` not `symbol` from typedetect Symbol: inspectSymbol, Array: inspectArray, Date: inspectDate, Map: inspectMap, Set: inspectSet, RegExp: inspectRegExp, Promise: promise_default, // WeakSet, WeakMap are totally opaque to us WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"), WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"), Arguments: inspectArguments, Int8Array: inspectTypedArray, Uint8Array: inspectTypedArray, Uint8ClampedArray: inspectTypedArray, Int16Array: inspectTypedArray, Uint16Array: inspectTypedArray, Int32Array: inspectTypedArray, Uint32Array: inspectTypedArray, Float32Array: inspectTypedArray, Float64Array: inspectTypedArray, Generator: () => "", DataView: () => "", ArrayBuffer: () => "", Error: inspectObject2, HTMLCollection: inspectHTMLCollection, NodeList: inspectHTMLCollection }; var inspectCustom = /* @__PURE__ */ __name((value, options, type3) => { if (chaiInspect in value && typeof value[chaiInspect] === "function") { return value[chaiInspect](options); } if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === "function") { return value[nodeInspect](options.depth, options); } if ("inspect" in value && typeof value.inspect === "function") { return value.inspect(options.depth, options); } if ("constructor" in value && constructorMap.has(value.constructor)) { return constructorMap.get(value.constructor)(value, options); } if (stringTagMap[type3]) { return stringTagMap[type3](value, options); } return ""; }, "inspectCustom"); var toString = Object.prototype.toString; function inspect(value, opts = {}) { const options = normaliseOptions(opts, inspect); const { customInspect } = options; let type3 = value === null ? "null" : typeof value; if (type3 === "object") { type3 = toString.call(value).slice(8, -1); } if (type3 in baseTypesMap) { return baseTypesMap[type3](value, options); } if (customInspect && value) { const output = inspectCustom(value, options, type3); if (output) { if (typeof output === "string") return output; return inspect(output, options); } } const proto = value ? Object.getPrototypeOf(value) : false; if (proto === Object.prototype || proto === null) { return inspectObject(value, options); } if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) { return inspectHTML(value, options); } if ("constructor" in value) { if (value.constructor !== Object) { return inspectClass(value, options); } return inspectObject(value, options); } if (value === Object(value)) { return inspectObject(value, options); } return options.stylize(String(value), type3); } __name(inspect, "inspect"); // lib/chai/config.js var config = { /** * ### config.includeStack * * User configurable property, influences whether stack trace * is included in Assertion error message. Default of false * suppresses stack trace in the error message. * * chai.config.includeStack = true; // enable stack on error * * @param {boolean} * @public */ includeStack: false, /** * ### config.showDiff * * User configurable property, influences whether or not * the `showDiff` flag should be included in the thrown * AssertionErrors. `false` will always be `false`; `true` * will be true when the assertion has requested a diff * be shown. * * @param {boolean} * @public */ showDiff: true, /** * ### config.truncateThreshold * * User configurable property, sets length threshold for actual and * expected values in assertion errors. If this threshold is exceeded, for * example for large data structures, the value is replaced with something * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. * * Set it to zero if you want to disable truncating altogether. * * This is especially userful when doing assertions on arrays: having this * set to a reasonable large value makes the failure messages readily * inspectable. * * chai.config.truncateThreshold = 0; // disable truncating * * @param {number} * @public */ truncateThreshold: 40, /** * ### config.useProxy * * User configurable property, defines if chai will use a Proxy to throw * an error when a non-existent property is read, which protects users * from typos when using property-based assertions. * * Set it to false if you want to disable this feature. * * chai.config.useProxy = false; // disable use of Proxy * * This feature is automatically disabled regardless of this config value * in environments that don't support proxies. * * @param {boolean} * @public */ useProxy: true, /** * ### config.proxyExcludedKeys * * User configurable property, defines which properties should be ignored * instead of throwing an error if they do not exist on the assertion. * This is only applied if the environment Chai is running in supports proxies and * if the `useProxy` configuration setting is enabled. * By default, `then` and `inspect` will not throw an error if they do not exist on the * assertion object because the `.inspect` property is read by `util.inspect` (for example, when * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking. * * // By default these keys will not throw an error if they do not exist on the assertion object * chai.config.proxyExcludedKeys = ['then', 'inspect']; * * @param {Array} * @public */ proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"], /** * ### config.deepEqual * * User configurable property, defines which a custom function to use for deepEqual * comparisons. * By default, the function used is the one from the `deep-eql` package without custom comparator. * * // use a custom comparator * chai.config.deepEqual = (expected, actual) => { * return chai.util.eql(expected, actual, { * comparator: (expected, actual) => { * // for non number comparison, use the default behavior * if(typeof expected !== 'number') return null; * // allow a difference of 10 between compared numbers * return typeof actual === 'number' && Math.abs(actual - expected) < 10 * } * }) * }; * * @param {Function} * @public */ deepEqual: null }; // lib/chai/utils/inspect.js function inspect2(obj, showHidden, depth, colors) { var options = { colors, depth: typeof depth === "undefined" ? 2 : depth, showHidden, truncate: config.truncateThreshold ? config.truncateThreshold : Infinity }; return inspect(obj, options); } __name(inspect2, "inspect"); // lib/chai/utils/objDisplay.js function objDisplay(obj) { var str = inspect2(obj), type3 = Object.prototype.toString.call(obj); if (config.truncateThreshold && str.length >= config.truncateThreshold) { if (type3 === "[object Function]") { return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]"; } else if (type3 === "[object Array]") { return "[ Array(" + obj.length + ") ]"; } else if (type3 === "[object Object]") { var keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", "); return "{ Object (" + kstr + ") }"; } else { return str; } } else { return str; } } __name(objDisplay, "objDisplay"); // lib/chai/utils/getMessage.js function getMessage2(obj, args) { var negate = flag(obj, "negate"), val = flag(obj, "object"), expected = args[3], actual = getActual(obj, args), msg = negate ? args[2] : args[1], flagMsg = flag(obj, "message"); if (typeof msg === "function") msg = msg(); msg = msg || ""; msg = msg.replace(/#\{this\}/g, function() { return objDisplay(val); }).replace(/#\{act\}/g, function() { return objDisplay(actual); }).replace(/#\{exp\}/g, function() { return objDisplay(expected); }); return flagMsg ? flagMsg + ": " + msg : msg; } __name(getMessage2, "getMessage"); // lib/chai/utils/transferFlags.js function transferFlags(assertion, object, includeAll) { var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null)); if (!object.__flags) { object.__flags = /* @__PURE__ */ Object.create(null); } includeAll = arguments.length === 3 ? includeAll : true; for (var flag3 in flags) { if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") { object.__flags[flag3] = flags[flag3]; } } } __name(transferFlags, "transferFlags"); // node_modules/deep-eql/index.js function type2(obj) { if (typeof obj === "undefined") { return "undefined"; } if (obj === null) { return "null"; } const stringTag = obj[Symbol.toStringTag]; if (typeof stringTag === "string") { return stringTag; } const sliceStart = 8; const sliceEnd = -1; return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd); } __name(type2, "type"); function FakeMap() { this._key = "chai/deep-eql__" + Math.random() + Date.now(); } __name(FakeMap, "FakeMap"); FakeMap.prototype = { get: /* @__PURE__ */ __name(function get(key) { return key[this._key]; }, "get"), set: /* @__PURE__ */ __name(function set(key, value) { if (Object.isExtensible(key)) { Object.defineProperty(key, this._key, { value, configurable: true }); } }, "set") }; var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap; function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) { if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { return null; } var leftHandMap = memoizeMap.get(leftHandOperand); if (leftHandMap) { var result = leftHandMap.get(rightHandOperand); if (typeof result === "boolean") { return result; } } return null; } __name(memoizeCompare, "memoizeCompare"); function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) { if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { return; } var leftHandMap = memoizeMap.get(leftHandOperand); if (leftHandMap) { leftHandMap.set(rightHandOperand, result); } else { leftHandMap = new MemoizeMap(); leftHandMap.set(rightHandOperand, result); memoizeMap.set(leftHandOperand, leftHandMap); } } __name(memoizeSet, "memoizeSet"); var deep_eql_default = deepEqual; function deepEqual(leftHandOperand, rightHandOperand, options) { if (options && options.comparator) { return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); } var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); if (simpleResult !== null) { return simpleResult; } return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); } __name(deepEqual, "deepEqual"); function simpleEqual(leftHandOperand, rightHandOperand) { if (leftHandOperand === rightHandOperand) { return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand; } if (leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare rightHandOperand !== rightHandOperand) { return true; } if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { return false; } return null; } __name(simpleEqual, "simpleEqual"); function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) { options = options || {}; options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap(); var comparator = options && options.comparator; var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize); if (memoizeResultLeft !== null) { return memoizeResultLeft; } var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize); if (memoizeResultRight !== null) { return memoizeResultRight; } if (comparator) { var comparatorResult = comparator(leftHandOperand, rightHandOperand); if (comparatorResult === false || comparatorResult === true) { memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult); return comparatorResult; } var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); if (simpleResult !== null) { return simpleResult; } } var leftHandType = type2(leftHandOperand); if (leftHandType !== type2(rightHandOperand)) { memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false); return false; } memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true); var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options); memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result); return result; } __name(extensiveDeepEqual, "extensiveDeepEqual"); function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) { switch (leftHandType) { case "String": case "Number": case "Boolean": case "Date": return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf()); case "Promise": case "Symbol": case "function": case "WeakMap": case "WeakSet": return leftHandOperand === rightHandOperand; case "Error": return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options); case "Arguments": case "Int8Array": case "Uint8Array": case "Uint8ClampedArray": case "Int16Array": case "Uint16Array": case "Int32Array": case "Uint32Array": case "Float32Array": case "Float64Array": case "Array": return iterableEqual(leftHandOperand, rightHandOperand, options); case "RegExp": return regexpEqual(leftHandOperand, rightHandOperand); case "Generator": return generatorEqual(leftHandOperand, rightHandOperand, options); case "DataView": return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options); case "ArrayBuffer": return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options); case "Set": return entriesEqual(leftHandOperand, rightHandOperand, options); case "Map": return entriesEqual(leftHandOperand, rightHandOperand, options); case "Temporal.PlainDate": case "Temporal.PlainTime": case "Temporal.PlainDateTime": case "Temporal.Instant": case "Temporal.ZonedDateTime": case "Temporal.PlainYearMonth": case "Temporal.PlainMonthDay": return leftHandOperand.equals(rightHandOperand); case "Temporal.Duration": return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds"); case "Temporal.TimeZone": case "Temporal.Calendar": return leftHandOperand.toString() === rightHandOperand.toString(); default: return objectEqual(leftHandOperand, rightHandOperand, options); } } __name(extensiveDeepEqualByType, "extensiveDeepEqualByType"); function regexpEqual(leftHandOperand, rightHandOperand) { return leftHandOperand.toString() === rightHandOperand.toString(); } __name(regexpEqual, "regexpEqual"); function entriesEqual(leftHandOperand, rightHandOperand, options) { try { if (leftHandOperand.size !== rightHandOperand.size) { return false; } if (leftHandOperand.size === 0) { return true; } } catch (sizeError) { return false; } var leftHandItems = []; var rightHandItems = []; leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) { leftHandItems.push([key, value]); }, "gatherEntries")); rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) { rightHandItems.push([key, value]); }, "gatherEntries")); return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options); } __name(entriesEqual, "entriesEqual"); function iterableEqual(leftHandOperand, rightHandOperand, options) { var length = leftHandOperand.length; if (length !== rightHandOperand.length) { return false; } if (length === 0) { return true; } var index = -1; while (++index < length) { if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) { return false; } } return true; } __name(iterableEqual, "iterableEqual"); function generatorEqual(leftHandOperand, rightHandOperand, options) { return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options); } __name(generatorEqual, "generatorEqual"); function hasIteratorFunction(target) { return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function"; } __name(hasIteratorFunction, "hasIteratorFunction"); function getIteratorEntries(target) { if (hasIteratorFunction(target)) { try { return getGeneratorEntries(target[Symbol.iterator]()); } catch (iteratorError) { return []; } } return []; } __name(getIteratorEntries, "getIteratorEntries"); function getGeneratorEntries(generator) { var generatorResult = generator.next(); var accumulator = [generatorResult.value]; while (generatorResult.done === false) { generatorResult = generator.next(); accumulator.push(generatorResult.value); } return accumulator; } __name(getGeneratorEntries, "getGeneratorEntries"); function getEnumerableKeys(target) { var keys = []; for (var key in target) { keys.push(key); } return keys; } __name(getEnumerableKeys, "getEnumerableKeys"); function getEnumerableSymbols(target) { var keys = []; var allKeys = Object.getOwnPropertySymbols(target); for (var i = 0; i < allKeys.length; i += 1) { var key = allKeys[i]; if (Object.getOwnPropertyDescriptor(target, key).enumerable) { keys.push(key); } } return keys; } __name(getEnumerableSymbols, "getEnumerableSymbols"); function keysEqual(leftHandOperand, rightHandOperand, keys, options) { var length = keys.length; if (length === 0) { return true; } for (var i = 0; i < length; i += 1) { if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) { return false; } } return true; } __name(keysEqual, "keysEqual"); function objectEqual(leftHandOperand, rightHandOperand, options) { var leftHandKeys = getEnumerableKeys(leftHandOperand); var rightHandKeys = getEnumerableKeys(rightHandOperand); var leftHandSymbols = getEnumerableSymbols(leftHandOperand); var rightHandSymbols = getEnumerableSymbols(rightHandOperand); leftHandKeys = leftHandKeys.concat(leftHandSymbols); rightHandKeys = rightHandKeys.concat(rightHandSymbols); if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) { if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) { return false; } return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options); } var leftHandEntries = getIteratorEntries(leftHandOperand); var rightHandEntries = getIteratorEntries(rightHandOperand); if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) { leftHandEntries.sort(); rightHandEntries.sort(); return iterableEqual(leftHandEntries, rightHandEntries, options); } if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) { return true; } return false; } __name(objectEqual, "objectEqual"); function isPrimitive(value) { return value === null || typeof value !== "object"; } __name(isPrimitive, "isPrimitive"); function mapSymbols(arr) { return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) { if (typeof entry === "symbol") { return entry.toString(); } return entry; }, "mapSymbol")); } __name(mapSymbols, "mapSymbols"); // node_modules/pathval/index.js function hasProperty(obj, name) { if (typeof obj === "undefined" || obj === null) { return false; } return name in Object(obj); } __name(hasProperty, "hasProperty"); function parsePath(path) { const str = path.replace(/([^\\])\[/g, "$1.["); const parts = str.match(/(\\\.|[^.]+?)+/g); return parts.map((value) => { if (value === "constructor" || value === "__proto__" || value === "prototype") { return {}; } const regexp = /^\[(\d+)\]$/; const mArr = regexp.exec(value); let parsed = null; if (mArr) { parsed = { i: parseFloat(mArr[1]) }; } else { parsed = { p: value.replace(/\\([.[\]])/g, "$1") }; } return parsed; }); } __name(parsePath, "parsePath"); function internalGetPathValue(obj, parsed, pathDepth) { let temporaryValue = obj; let res = null; pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth; for (let i = 0; i < pathDepth; i++) { const part = parsed[i]; if (temporaryValue) { if (typeof part.p === "undefined") { temporaryValue = temporaryValue[part.i]; } else { temporaryValue = temporaryValue[part.p]; } if (i === pathDepth - 1) { res = temporaryValue; } } } return res; } __name(internalGetPathValue, "internalGetPathValue"); function getPathInfo(obj, path) { const parsed = parsePath(path); const last = parsed[parsed.length - 1]; const info = { parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj, name: last.p || last.i, value: internalGetPathValue(obj, parsed) }; info.exists = hasProperty(info.parent, info.name); return info; } __name(getPathInfo, "getPathInfo"); // lib/chai/assertion.js function Assertion(obj, msg, ssfi, lockSsfi) { flag(this, "ssfi", ssfi || Assertion); flag(this, "lockSsfi", lockSsfi); flag(this, "object", obj); flag(this, "message", msg); flag(this, "eql", config.deepEqual || deep_eql_default); return proxify(this); } __name(Assertion, "Assertion"); Object.defineProperty(Assertion, "includeStack", { get: function() { console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."); return config.includeStack; }, set: function(value) { console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."); config.includeStack = value; } }); Object.defineProperty(Assertion, "showDiff", { get: function() { console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."); return config.showDiff; }, set: function(value) { console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."); config.showDiff = value; } }); Assertion.addProperty = function(name, fn) { addProperty(this.prototype, name, fn); }; Assertion.addMethod = function(name, fn) { addMethod(this.prototype, name, fn); }; Assertion.addChainableMethod = function(name, fn, chainingBehavior) { addChainableMethod(this.prototype, name, fn, chainingBehavior); }; Assertion.overwriteProperty = function(name, fn) { overwriteProperty(this.prototype, name, fn); }; Assertion.overwriteMethod = function(name, fn) { overwriteMethod(this.prototype, name, fn); }; Assertion.overwriteChainableMethod = function(name, fn, chainingBehavior) { overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); }; Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) { var ok = test(this, arguments); if (false !== showDiff) showDiff = true; if (void 0 === expected && void 0 === _actual) showDiff = false; if (true !== config.showDiff) showDiff = false; if (!ok) { msg = getMessage2(this, arguments); var actual = getActual(this, arguments); var assertionErrorObjectProperties = { actual, expected, showDiff }; var operator = getOperator(this, arguments); if (operator) { assertionErrorObjectProperties.operator = operator; } throw new AssertionError( msg, assertionErrorObjectProperties, config.includeStack ? this.assert : flag(this, "ssfi") ); } }; Object.defineProperty( Assertion.prototype, "_obj", { get: function() { return flag(this, "object"); }, set: function(val) { flag(this, "object", val); } } ); // lib/chai/utils/isProxyEnabled.js function isProxyEnabled() { return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined"; } __name(isProxyEnabled, "isProxyEnabled"); // lib/chai/utils/addProperty.js function addProperty(ctx, name, getter) { getter = getter === void 0 ? function() { } : getter; Object.defineProperty( ctx, name, { get: /* @__PURE__ */ __name(function propertyGetter() { if (!isProxyEnabled() && !flag(this, "lockSsfi")) { flag(this, "ssfi", propertyGetter); } var result = getter.call(this); if (result !== void 0) return result; var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "propertyGetter"), configurable: true } ); } __name(addProperty, "addProperty"); // lib/chai/utils/addLengthGuard.js var fnLengthDesc = Object.getOwnPropertyDescriptor(function() { }, "length"); function addLengthGuard(fn, assertionName, isChainable) { if (!fnLengthDesc.configurable) return fn; Object.defineProperty(fn, "length", { get: function() { if (isChainable) { throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.'); } throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".'); } }); return fn; } __name(addLengthGuard, "addLengthGuard"); // lib/chai/utils/getProperties.js function getProperties(object) { var result = Object.getOwnPropertyNames(object); function addProperty2(property) { if (result.indexOf(property) === -1) { result.push(property); } } __name(addProperty2, "addProperty"); var proto = Object.getPrototypeOf(object); while (proto !== null) { Object.getOwnPropertyNames(proto).forEach(addProperty2); proto = Object.getPrototypeOf(proto); } return result; } __name(getProperties, "getProperties"); // lib/chai/utils/proxify.js var builtins = ["__flags", "__methods", "_obj", "assert"]; function proxify(obj, nonChainableMethodName) { if (!isProxyEnabled()) return obj; return new Proxy(obj, { get: /* @__PURE__ */ __name(function proxyGetter(target, property) { if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) { if (nonChainableMethodName) { throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".'); } var suggestion = null; var suggestionDistance = 4; getProperties(target).forEach(function(prop) { if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) { var dist = stringDistanceCapped( property, prop, suggestionDistance ); if (dist < suggestionDistance) { suggestion = prop; suggestionDistance = dist; } } }); if (suggestion !== null) { throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?'); } else { throw Error("Invalid Chai property: " + property); } } if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) { flag(target, "ssfi", proxyGetter); } return Reflect.get(target, property); }, "proxyGetter") }); } __name(proxify, "proxify"); function stringDistanceCapped(strA, strB, cap) { if (Math.abs(strA.length - strB.length) >= cap) { return cap; } var memo = []; for (var i = 0; i <= strA.length; i++) { memo[i] = Array(strB.length + 1).fill(0); memo[i][0] = i; } for (var j = 0; j < strB.length; j++) { memo[0][j] = j; } for (var i = 1; i <= strA.length; i++) { var ch = strA.charCodeAt(i - 1); for (var j = 1; j <= strB.length; j++) { if (Math.abs(i - j) >= cap) { memo[i][j] = cap; continue; } 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) ); } } return memo[strA.length][strB.length]; } __name(stringDistanceCapped, "stringDistanceCapped"); // lib/chai/utils/addMethod.js function addMethod(ctx, name, method) { var methodWrapper = /* @__PURE__ */ __name(function() { if (!flag(this, "lockSsfi")) { flag(this, "ssfi", methodWrapper); } var result = method.apply(this, arguments); if (result !== void 0) return result; var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "methodWrapper"); addLengthGuard(methodWrapper, name, false); ctx[name] = proxify(methodWrapper, name); } __name(addMethod, "addMethod"); // lib/chai/utils/overwriteProperty.js function overwriteProperty(ctx, name, getter) { var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() { }, "_super"); if (_get && "function" === typeof _get.get) _super = _get.get; Object.defineProperty( ctx, name, { get: /* @__PURE__ */ __name(function overwritingPropertyGetter() { if (!isProxyEnabled() && !flag(this, "lockSsfi")) { flag(this, "ssfi", overwritingPropertyGetter); } var origLockSsfi = flag(this, "lockSsfi"); flag(this, "lockSsfi", true); var result = getter(_super).call(this); flag(this, "lockSsfi", origLockSsfi); if (result !== void 0) { return result; } var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "overwritingPropertyGetter"), configurable: true } ); } __name(overwriteProperty, "overwriteProperty"); // lib/chai/utils/overwriteMethod.js function overwriteMethod(ctx, name, method) { var _method = ctx[name], _super = /* @__PURE__ */ __name(function() { throw new Error(name + " is not a function"); }, "_super"); if (_method && "function" === typeof _method) _super = _method; var overwritingMethodWrapper = /* @__PURE__ */ __name(function() { if (!flag(this, "lockSsfi")) { flag(this, "ssfi", overwritingMethodWrapper); } var origLockSsfi = flag(this, "lockSsfi"); flag(this, "lockSsfi", true); var result = method(_super).apply(this, arguments); flag(this, "lockSsfi", origLockSsfi); if (result !== void 0) { return result; } var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "overwritingMethodWrapper"); addLengthGuard(overwritingMethodWrapper, name, false); ctx[name] = proxify(overwritingMethodWrapper, name); } __name(overwriteMethod, "overwriteMethod"); // lib/chai/utils/addChainableMethod.js var canSetPrototype = typeof Object.setPrototypeOf === "function"; var testFn = /* @__PURE__ */ __name(function() { }, "testFn"); var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) { var propDesc = Object.getOwnPropertyDescriptor(testFn, name); if (typeof propDesc !== "object") return true; return !propDesc.configurable; }); var call = Function.prototype.call; var apply = Function.prototype.apply; function addChainableMethod(ctx, name, method, chainingBehavior) { if (typeof chainingBehavior !== "function") { chainingBehavior = /* @__PURE__ */ __name(function() { }, "chainingBehavior"); } var chainableBehavior = { method, chainingBehavior }; if (!ctx.__methods) { ctx.__methods = {}; } ctx.__methods[name] = chainableBehavior; Object.defineProperty( ctx, name, { get: /* @__PURE__ */ __name(function chainableMethodGetter() { chainableBehavior.chainingBehavior.call(this); var chainableMethodWrapper = /* @__PURE__ */ __name(function() { if (!flag(this, "lockSsfi")) { flag(this, "ssfi", chainableMethodWrapper); } var result = chainableBehavior.method.apply(this, arguments); if (result !== void 0) { return result; } var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "chainableMethodWrapper"); addLengthGuard(chainableMethodWrapper, name, true); if (canSetPrototype) { var prototype = Object.create(this); prototype.call = call; prototype.apply = apply; Object.setPrototypeOf(chainableMethodWrapper, prototype); } else { var asserterNames = Object.getOwnPropertyNames(ctx); asserterNames.forEach(function(asserterName) { if (excludeNames.indexOf(asserterName) !== -1) { return; } var pd = Object.getOwnPropertyDescriptor(ctx, asserterName); Object.defineProperty(chainableMethodWrapper, asserterName, pd); }); } transferFlags(this, chainableMethodWrapper); return proxify(chainableMethodWrapper); }, "chainableMethodGetter"), configurable: true } ); } __name(addChainableMethod, "addChainableMethod"); // lib/chai/utils/overwriteChainableMethod.js function overwriteChainableMethod(ctx, name, method, chainingBehavior) { var chainableBehavior = ctx.__methods[name]; var _chainingBehavior = chainableBehavior.chainingBehavior; chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() { var result = chainingBehavior(_chainingBehavior).call(this); if (result !== void 0) { return result; } var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "overwritingChainableMethodGetter"); var _method = chainableBehavior.method; chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() { var result = method(_method).apply(this, arguments); if (result !== void 0) { return result; } var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }, "overwritingChainableMethodWrapper"); } __name(overwriteChainableMethod, "overwriteChainableMethod"); // lib/chai/utils/compareByInspect.js function compareByInspect(a, b) { return inspect2(a) < inspect2(b) ? -1 : 1; } __name(compareByInspect, "compareByInspect"); // lib/chai/utils/getOwnEnumerablePropertySymbols.js function getOwnEnumerablePropertySymbols(obj) { if (typeof Object.getOwnPropertySymbols !== "function") return []; return Object.getOwnPropertySymbols(obj).filter(function(sym) { return Object.getOwnPropertyDescriptor(obj, sym).enumerable; }); } __name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols"); // lib/chai/utils/getOwnEnumerableProperties.js function getOwnEnumerableProperties(obj) { return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); } __name(getOwnEnumerableProperties, "getOwnEnumerableProperties"); // lib/chai/utils/isNaN.js function _isNaN(value) { return value !== value; } __name(_isNaN, "_isNaN"); var isNaN2 = Number.isNaN || _isNaN; // lib/chai/utils/getOperator.js function isObjectType(obj) { var objectType = type(obj); var objectTypes = ["Array", "Object", "Function"]; return objectTypes.indexOf(objectType) !== -1; } __name(isObjectType, "isObjectType"); function getOperator(obj, args) { var operator = flag(obj, "operator"); var negate = flag(obj, "negate"); var expected = args[3]; var msg = negate ? args[2] : args[1]; if (operator) { return operator; } if (typeof msg === "function") msg = msg(); msg = msg || ""; if (!msg) { return void 0; } if (/\shave\s/.test(msg)) { return void 0; } var isObject = isObjectType(expected); if (/\snot\s/.test(msg)) { return isObject ? "notDeepStrictEqual" : "notStrictEqual"; } return isObject ? "deepStrictEqual" : "strictEqual"; } __name(getOperator, "getOperator"); // lib/chai/utils/index.js function getName(fn) { return fn.name; } __name(getName, "getName"); function isRegExp2(obj) { return Object.prototype.toString.call(obj) === "[object RegExp]"; } __name(isRegExp2, "isRegExp"); function isNumeric(obj) { return ["Number", "BigInt"].includes(type(obj)); } __name(isNumeric, "isNumeric"); // lib/chai/core/assertions.js var { flag: flag2 } = utils_exports; [ "to", "be", "been", "is", "and", "has", "have", "with", "that", "which", "at", "of", "same", "but", "does", "still", "also" ].forEach(function(chain) { Assertion.addProperty(chain); }); Assertion.addProperty("not", function() { flag2(this, "negate", true); }); Assertion.addProperty("deep", function() { flag2(this, "deep", true); }); Assertion.addProperty("nested", function() { flag2(this, "nested", true); }); Assertion.addProperty("own", function() { flag2(this, "own", true); }); Assertion.addProperty("ordered", function() { flag2(this, "ordered", true); }); Assertion.addProperty("any", function() { flag2(this, "any", true); flag2(this, "all", false); }); Assertion.addProperty("all", function() { flag2(this, "all", true); flag2(this, "any", false); }); var functionTypes = { "function": ["function", "asyncfunction", "generatorfunction", "asyncgeneratorfunction"], "asyncfunction": ["asyncfunction", "asyncgeneratorfunction"], "generatorfunction": ["generatorfunction", "asyncgeneratorfunction"], "asyncgeneratorfunction": ["asyncgeneratorfunction"] }; function an(type3, msg) { if (msg) flag2(this, "message", msg); type3 = type3.toLowerCase(); var obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a "; const detectedType = type(obj).toLowerCase(); if (functionTypes["function"].includes(type3)) { this.assert( functionTypes[type3].includes(detectedType), "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3 ); } else { this.assert( type3 === detectedType, "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3 ); } } __name(an, "an"); Assertion.addChainableMethod("an", an); Assertion.addChainableMethod("a", an); function SameValueZero(a, b) { return isNaN2(a) && isNaN2(b) || a === b; } __name(SameValueZero, "SameValueZero"); function includeChainingBehavior() { flag2(this, "contains", true); } __name(includeChainingBehavior, "includeChainingBehavior"); function include(val, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero; flagMsg = flagMsg ? flagMsg + ": " : ""; var included = false; switch (objType) { case "string": included = obj.indexOf(val) !== -1; break; case "weakset": if (isDeep) { throw new AssertionError( flagMsg + "unable to use .deep.include with WeakSet", void 0, ssfi ); } included = obj.has(val); break; case "map": obj.forEach(function(item) { included = included || isEql(item, val); }); break; case "set": if (isDeep) { obj.forEach(function(item) { included = included || isEql(item, val); }); } else { included = obj.has(val); } break; case "array": if (isDeep) { included = obj.some(function(item) { return isEql(item, val); }); } else { included = obj.indexOf(val) !== -1; } break; default: if (val !== Object(val)) { 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(), void 0, ssfi ); } var props = Object.keys(val), firstErr = null, numErrs = 0; props.forEach(function(prop) { var propAssertion = new Assertion(obj); transferFlags(this, propAssertion, true); flag2(propAssertion, "lockSsfi", true); if (!negate || props.length === 1) { propAssertion.property(prop, val[prop]); return; } try { propAssertion.property(prop, val[prop]); } catch (err) { if (!check_error_exports.compatibleConstructor(err, AssertionError)) { throw err; } if (firstErr === null) firstErr = err; numErrs++; } }, this); if (negate && props.length > 1 && numErrs === props.length) { throw firstErr; } return; } this.assert( included, "expected #{this} to " + descriptor + "include " + inspect2(val), "expected #{this} to not " + descriptor + "include " + inspect2(val) ); } __name(include, "include"); Assertion.addChainableMethod("include", include, includeChainingBehavior); Assertion.addChainableMethod("contain", include, includeChainingBehavior); Assertion.addChainableMethod("contains", include, includeChainingBehavior); Assertion.addChainableMethod("includes", include, includeChainingBehavior); Assertion.addProperty("ok", function() { this.assert( flag2(this, "object"), "expected #{this} to be truthy", "expected #{this} to be falsy" ); }); Assertion.addProperty("true", function() { this.assert( true === flag2(this, "object"), "expected #{this} to be true", "expected #{this} to be false", flag2(this, "negate") ? false : true ); }); Assertion.addProperty("numeric", function() { const object = flag2(this, "object"); this.assert( ["Number", "BigInt"].includes(type(object)), "expected #{this} to be numeric", "expected #{this} to not be numeric", flag2(this, "negate") ? false : true ); }); Assertion.addProperty("callable", function() { const val = flag2(this, "object"); const ssfi = flag2(this, "ssfi"); const message = flag2(this, "message"); const msg = message ? `${message}: ` : ""; const negate = flag2(this, "negate"); const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`; const isCallable = ["Function", "AsyncFunction", "GeneratorFunction", "AsyncGeneratorFunction"].includes(type(val)); if (isCallable && negate || !isCallable && !negate) { throw new AssertionError( assertionMessage, void 0, ssfi ); } }); Assertion.addProperty("false", function() { this.assert( false === flag2(this, "object"), "expected #{this} to be false", "expected #{this} to be true", flag2(this, "negate") ? true : false ); }); Assertion.addProperty("null", function() { this.assert( null === flag2(this, "object"), "expected #{this} to be null", "expected #{this} not to be null" ); }); Assertion.addProperty("undefined", function() { this.assert( void 0 === flag2(this, "object"), "expected #{this} to be undefined", "expected #{this} not to be undefined" ); }); Assertion.addProperty("NaN", function() { this.assert( isNaN2(flag2(this, "object")), "expected #{this} to be NaN", "expected #{this} not to be NaN" ); }); function assertExist() { var val = flag2(this, "object"); this.assert( val !== null && val !== void 0, "expected #{this} to exist", "expected #{this} to not exist" ); } __name(assertExist, "assertExist"); Assertion.addProperty("exist", assertExist); Assertion.addProperty("exists", assertExist); Assertion.addProperty("empty", function() { var val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount; flagMsg = flagMsg ? flagMsg + ": " : ""; switch (type(val).toLowerCase()) { case "array": case "string": itemsCount = val.length; break; case "map": case "set": itemsCount = val.size; break; case "weakmap": case "weakset": throw new AssertionError( flagMsg + ".empty was passed a weak collection", void 0, ssfi ); case "function": var msg = flagMsg + ".empty was passed a function " + getName(val); throw new AssertionError(msg.trim(), void 0, ssfi); default: if (val !== Object(val)) { throw new AssertionError( flagMsg + ".empty was passed non-string primitive " + inspect2(val), void 0, ssfi ); } itemsCount = Object.keys(val).length; } this.assert( 0 === itemsCount, "expected #{this} to be empty", "expected #{this} not to be empty" ); }); function checkArguments() { var obj = flag2(this, "object"), type3 = type(obj); this.assert( "Arguments" === type3, "expected #{this} to be arguments but got " + type3, "expected #{this} to not be arguments" ); } __name(checkArguments, "checkArguments"); Assertion.addProperty("arguments", checkArguments); Assertion.addProperty("Arguments", checkArguments); function assertEqual(val, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"); if (flag2(this, "deep")) { var prevLockSsfi = flag2(this, "lockSsfi"); flag2(this, "lockSsfi", true); this.eql(val); flag2(this, "lockSsfi", prevLockSsfi); } else { this.assert( val === obj, "expected #{this} to equal #{exp}", "expected #{this} to not equal #{exp}", val, this._obj, true ); } } __name(assertEqual, "assertEqual"); Assertion.addMethod("equal", assertEqual); Assertion.addMethod("equals", assertEqual); Assertion.addMethod("eq", assertEqual); function assertEql(obj, msg) { if (msg) flag2(this, "message", msg); var eql = flag2(this, "eql"); this.assert( eql(obj, flag2(this, "object")), "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", obj, this._obj, true ); } __name(assertEql, "assertEql"); Assertion.addMethod("eql", assertEql); Assertion.addMethod("eqls", assertEql); function assertAbove(n, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(); if (doLength && objType !== "map" && objType !== "set") { new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); } if (!doLength && (objType === "date" && nType !== "date")) { throw new AssertionError(msgPrefix + "the argument to above must be a date", void 0, ssfi); } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { throw new AssertionError(msgPrefix + "the argument to above must be a number", void 0, ssfi); } else if (!doLength && (objType !== "date" && !isNumeric(obj))) { var printObj = objType === "string" ? "'" + obj + "'" : obj; throw new AssertionError(msgPrefix + "expected " + printObj + " to be a number or a date", void 0, ssfi); } if (doLength) { var descriptor = "length", itemsCount; if (objType === "map" || objType === "set") { descriptor = "size"; itemsCount = obj.size; } else { itemsCount = obj.length; } 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 ); } else { this.assert( obj > n, "expected #{this} to be above #{exp}", "expected #{this} to be at most #{exp}", n ); } } __name(assertAbove, "assertAbove"); Assertion.addMethod("above", assertAbove); Assertion.addMethod("gt", assertAbove); Assertion.addMethod("greaterThan", assertAbove); function assertLeast(n, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; if (doLength && objType !== "map" && objType !== "set") { new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); } if (!doLength && (objType === "date" && nType !== "date")) { errorMessage = msgPrefix + "the argument to least must be a date"; } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { errorMessage = msgPrefix + "the argument to least must be a number"; } else if (!doLength && (objType !== "date" && !isNumeric(obj))) { var printObj = objType === "string" ? "'" + obj + "'" : obj; errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; } else { shouldThrow = false; } if (shouldThrow) { throw new AssertionError(errorMessage, void 0, ssfi); } if (doLength) { var descriptor = "length", itemsCount; if (objType === "map" || objType === "set") { descriptor = "size"; itemsCount = obj.size; } else { itemsCount = obj.length; } 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 ); } else { this.assert( obj >= n, "expected #{this} to be at least #{exp}", "expected #{this} to be below #{exp}", n ); } } __name(assertLeast, "assertLeast"); Assertion.addMethod("least", assertLeast); Assertion.addMethod("gte", assertLeast); Assertion.addMethod("greaterThanOrEqual", assertLeast); function assertBelow(n, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; if (doLength && objType !== "map" && objType !== "set") { new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); } if (!doLength && (objType === "date" && nType !== "date")) { errorMessage = msgPrefix + "the argument to below must be a date"; } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { errorMessage = msgPrefix + "the argument to below must be a number"; } else if (!doLength && (objType !== "date" && !isNumeric(obj))) { var printObj = objType === "string" ? "'" + obj + "'" : obj; errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; } else { shouldThrow = false; } if (shouldThrow) { throw new AssertionError(errorMessage, void 0, ssfi); } if (doLength) { var descriptor = "length", itemsCount; if (objType === "map" || objType === "set") { descriptor = "size"; itemsCount = obj.size; } else { itemsCount = obj.length; } 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 ); } else { this.assert( obj < n, "expected #{this} to be below #{exp}", "expected #{this} to be at least #{exp}", n ); } } __name(assertBelow, "assertBelow"); Assertion.addMethod("below", assertBelow); Assertion.addMethod("lt", assertBelow); Assertion.addMethod("lessThan", assertBelow); function assertMost(n, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; if (doLength && objType !== "map" && objType !== "set") { new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); } if (!doLength && (objType === "date" && nType !== "date")) { errorMessage = msgPrefix + "the argument to most must be a date"; } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { errorMessage = msgPrefix + "the argument to most must be a number"; } else if (!doLength && (objType !== "date" && !isNumeric(obj))) { var printObj = objType === "string" ? "'" + obj + "'" : obj; errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; } else { shouldThrow = false; } if (shouldThrow) { throw new AssertionError(errorMessage, void 0, ssfi); } if (doLength) { var descriptor = "length", itemsCount; if (objType === "map" || objType === "set") { descriptor = "size"; itemsCount = obj.size; } else { itemsCount = obj.length; } 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 ); } else { this.assert( obj <= n, "expected #{this} to be at most #{exp}", "expected #{this} to be above #{exp}", n ); } } __name(assertMost, "assertMost"); Assertion.addMethod("most", assertMost); Assertion.addMethod("lte", assertMost); Assertion.addMethod("lessThanOrEqual", assertMost); Assertion.addMethod("within", function(start, finish, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish; if (doLength && objType !== "map" && objType !== "set") { new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); } if (!doLength && (objType === "date" && (startType !== "date" || finishType !== "date"))) { errorMessage = msgPrefix + "the arguments to within must be dates"; } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) { errorMessage = msgPrefix + "the arguments to within must be numbers"; } else if (!doLength && (objType !== "date" && !isNumeric(obj))) { var printObj = objType === "string" ? "'" + obj + "'" : obj; errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; } else { shouldThrow = false; } if (shouldThrow) { throw new AssertionError(errorMessage, void 0, ssfi); } if (doLength) { var descriptor = "length", itemsCount; if (objType === "map" || objType === "set") { descriptor = "size"; itemsCount = obj.size; } else { itemsCount = obj.length; } this.assert( itemsCount >= start && itemsCount <= finish, "expected #{this} to have a " + descriptor + " within " + range, "expected #{this} to not have a " + descriptor + " within " + range ); } else { this.assert( obj >= start && obj <= finish, "expected #{this} to be within " + range, "expected #{this} to not be within " + range ); } }); function assertInstanceOf(constructor, msg) { if (msg) flag2(this, "message", msg); var target = flag2(this, "object"); var ssfi = flag2(this, "ssfi"); var flagMsg = flag2(this, "message"); try { var isInstanceOf = target instanceof constructor; } catch (err) { if (err instanceof TypeError) { flagMsg = flagMsg ? flagMsg + ": " : ""; throw new AssertionError( flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.", void 0, ssfi ); } throw err; } var name = getName(constructor); if (name == null) { name = "an unnamed constructor"; } this.assert( isInstanceOf, "expected #{this} to be an instance of " + name, "expected #{this} to not be an instance of " + name ); } __name(assertInstanceOf, "assertInstanceOf"); Assertion.addMethod("instanceof", assertInstanceOf); Assertion.addMethod("instanceOf", assertInstanceOf); function assertProperty(name, val, msg) { if (msg) flag2(this, "message", msg); var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name; flagMsg = flagMsg ? flagMsg + ": " : ""; if (isNested) { if (nameType !== "string") { throw new AssertionError( flagMsg + "the argument to property must be a string when using nested syntax", void 0, ssfi ); } } else { if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") { throw new AssertionError( flagMsg + "the argument to property must be a string, number, or symbol", void 0, ssfi ); } } if (isNested && isOwn) { throw new AssertionError( flagMsg + 'The "nested" and "own" flags cannot be combined.', void 0, ssfi ); } if (obj === null || obj === void 0) { throw new AssertionError( flagMsg + "Target cannot be null or undefined.", void 0, ssfi ); } var isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2; var descriptor = ""; if (isDeep) descriptor += "deep "; if (isOwn) descriptor += "own "; if (isNested) descriptor += "nested "; descriptor += "property "; var hasProperty2; if (isOwn) hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name); else if (isNested) hasProperty2 = pathInfo.exists; else hasProperty2 = hasProperty(obj, name); if (!negate || arguments.length === 1) { this.assert( hasProperty2, "expected #{this} to have " + descriptor + inspect2(name), "expected #{this} to not have " + descriptor + inspect2(name) ); } if (arguments.length > 1) { 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 ); } flag2(this, "object", value); } __name(assertProperty, "assertProperty"); Assertion.addMethod("property", assertProperty); function assertOwnProperty(name, value, msg) { flag2(this, "own", true); assertProperty.apply(this, arguments); } __name(assertOwnProperty, "assertOwnProperty"); Assertion.addMethod("ownProperty", assertOwnProperty); Assertion.addMethod("haveOwnProperty", assertOwnProperty); function assertOwnPropertyDescriptor(name, descriptor, msg) { if (typeof descriptor === "string") { msg = descriptor; descriptor = null; } if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"); var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); var eql = flag2(this, "eql"); if (actualDescriptor && descriptor) { 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 ); } else { 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) ); } flag2(this, "object", actualDescriptor); } __name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor"); Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor); Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor); function assertLengthChain() { flag2(this, "doLength", true); } __name(assertLengthChain, "assertLengthChain"); function assertLength(n, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount; switch (objType) { case "map": case "set": descriptor = "size"; itemsCount = obj.size; break; default: new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); itemsCount = obj.length; } 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 ); } __name(assertLength, "assertLength"); Assertion.addChainableMethod("length", assertLength, assertLengthChain); Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain); function assertMatch(re, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"); this.assert( re.exec(obj), "expected #{this} to match " + re, "expected #{this} not to match " + re ); } __name(assertMatch, "assertMatch"); Assertion.addMethod("match", assertMatch); Assertion.addMethod("matches", assertMatch); Assertion.addMethod("string", function(str, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(obj, flagMsg, ssfi, true).is.a("string"); this.assert( ~obj.indexOf(str), "expected #{this} to contain " + inspect2(str), "expected #{this} to not contain " + inspect2(str) ); }); function assertKeys(keys) { var obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message"); flagMsg = flagMsg ? flagMsg + ": " : ""; var mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments"; if (objType === "Map" || objType === "Set") { deepStr = isDeep ? "deeply " : ""; actual = []; obj.forEach(function(val, key) { actual.push(key); }); if (keysType !== "Array") { keys = Array.prototype.slice.call(arguments); } } else { actual = getOwnEnumerableProperties(obj); switch (keysType) { case "Array": if (arguments.length > 1) { throw new AssertionError(mixedArgsMsg, void 0, ssfi); } break; case "Object": if (arguments.length > 1) { throw new AssertionError(mixedArgsMsg, void 0, ssfi); } keys = Object.keys(keys); break; default: keys = Array.prototype.slice.call(arguments); } keys = keys.map(function(val) { return typeof val === "symbol" ? val : String(val); }); } if (!keys.length) { throw new AssertionError(flagMsg + "keys required", void 0, ssfi); } var len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2; if (!any && !all) { all = true; } if (any) { ok = expected.some(function(expectedKey) { return actual.some(function(actualKey) { return isEql(expectedKey, actualKey); }); }); } if (all) { ok = expected.every(function(expectedKey) { return actual.some(function(actualKey) { return isEql(expectedKey, actualKey); }); }); if (!flag2(this, "contains")) { ok = ok && keys.length == actual.length; } } if (len > 1) { keys = keys.map(function(key) { return inspect2(key); }); var last = keys.pop(); if (all) { str = keys.join(", ") + ", and " + last; } if (any) { str = keys.join(", ") + ", or " + last; } } else { str = inspect2(keys[0]); } str = (len > 1 ? "keys " : "key ") + str; str = (flag2(this, "contains") ? "contain " : "have ") + str; this.assert( ok, "expected #{this} to " + deepStr + str, "expected #{this} to not " + deepStr + str, expected.slice(0).sort(compareByInspect), actual.sort(compareByInspect), true ); } __name(assertKeys, "assertKeys"); Assertion.addMethod("keys", assertKeys); Assertion.addMethod("key", assertKeys); function assertThrows(errorLike, errMsgMatcher, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false; new Assertion(obj, flagMsg, ssfi, true).is.a("function"); if (isRegExp2(errorLike) || typeof errorLike === "string") { errMsgMatcher = errorLike; errorLike = null; } let caughtErr; let errorWasThrown = false; try { obj(); } catch (err) { errorWasThrown = true; caughtErr = err; } var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0; var everyArgIsDefined = Boolean(errorLike && errMsgMatcher); var errorLikeFail = false; var errMsgMatcherFail = false; if (everyArgIsUndefined || !everyArgIsUndefined && !negate) { var errorLikeString = "an error"; if (errorLike instanceof Error) { errorLikeString = "#{exp}"; } else if (errorLike) { errorLikeString = check_error_exports.getConstructorName(errorLike); } let actual = caughtErr; if (caughtErr instanceof Error) { actual = caughtErr.toString(); } else if (typeof caughtErr === "string") { actual = caughtErr; } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) { try { actual = check_error_exports.getConstructorName(caughtErr); } catch (_err) { } } this.assert( errorWasThrown, "expected #{this} to throw " + errorLikeString, "expected #{this} to not throw an error but #{act} was thrown", errorLike && errorLike.toString(), actual ); } if (errorLike && caughtErr) { if (errorLike instanceof Error) { var isCompatibleInstance = check_error_exports.compatibleInstance(caughtErr, errorLike); if (isCompatibleInstance === negate) { if (everyArgIsDefined && negate) { errorLikeFail = true; } else { 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() ); } } } var isCompatibleConstructor = check_error_exports.compatibleConstructor(caughtErr, errorLike); if (isCompatibleConstructor === negate) { if (everyArgIsDefined && negate) { errorLikeFail = true; } else { 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) ); } } } if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) { var placeholder = "including"; if (isRegExp2(errMsgMatcher)) { placeholder = "matching"; } var isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher); if (isCompatibleMessage === negate) { if (everyArgIsDefined && negate) { errMsgMatcherFail = true; } else { 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) ); } } } if (errorLikeFail && errMsgMatcherFail) { 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) ); } flag2(this, "object", caughtErr); } __name(assertThrows, "assertThrows"); Assertion.addMethod("throw", assertThrows); Assertion.addMethod("throws", assertThrows); Assertion.addMethod("Throw", assertThrows); function respondTo(method, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method]; this.assert( "function" === typeof context, "expected #{this} to respond to " + inspect2(method), "expected #{this} to not respond to " + inspect2(method) ); } __name(respondTo, "respondTo"); Assertion.addMethod("respondTo", respondTo); Assertion.addMethod("respondsTo", respondTo); Assertion.addProperty("itself", function() { flag2(this, "itself", true); }); function satisfy(matcher, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"); var result = matcher(obj); this.assert( result, "expected #{this} to satisfy " + objDisplay(matcher), "expected #{this} to not satisfy" + objDisplay(matcher), flag2(this, "negate") ? false : true, result ); } __name(satisfy, "satisfy"); Assertion.addMethod("satisfy", satisfy); Assertion.addMethod("satisfies", satisfy); function closeTo(expected, delta, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(obj, flagMsg, ssfi, true).is.numeric; let message = "A `delta` value is required for `closeTo`"; if (delta == void 0) throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, void 0, ssfi); new Assertion(delta, flagMsg, ssfi, true).is.numeric; message = "A `expected` value is required for `closeTo`"; if (expected == void 0) throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, void 0, ssfi); new Assertion(expected, flagMsg, ssfi, true).is.numeric; const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs"); this.assert( abs(obj - expected) <= delta, "expected #{this} to be close to " + expected + " +/- " + delta, "expected #{this} not to be close to " + expected + " +/- " + delta ); } __name(closeTo, "closeTo"); Assertion.addMethod("closeTo", closeTo); Assertion.addMethod("approximately", closeTo); function isSubsetOf(_subset, _superset, cmp, contains, ordered) { let superset = Array.from(_superset); let subset = Array.from(_subset); if (!contains) { if (subset.length !== superset.length) return false; superset = superset.slice(); } return subset.every(function(elem, idx) { if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx]; if (!cmp) { var matchIdx = superset.indexOf(elem); if (matchIdx === -1) return false; if (!contains) superset.splice(matchIdx, 1); return true; } return superset.some(function(elem2, matchIdx2) { if (!cmp(elem, elem2)) return false; if (!contains) superset.splice(matchIdx2, 1); return true; }); }); } __name(isSubsetOf, "isSubsetOf"); Assertion.addMethod("members", function(subset, msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(obj, flagMsg, ssfi, true).to.be.iterable; new Assertion(subset, flagMsg, ssfi, true).to.be.iterable; var contains = flag2(this, "contains"); var ordered = flag2(this, "ordered"); var subject, failMsg, failNegateMsg; if (contains) { subject = ordered ? "an ordered superset" : "a superset"; failMsg = "expected #{this} to be " + subject + " of #{exp}"; failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}"; } else { subject = ordered ? "ordered members" : "members"; failMsg = "expected #{this} to have the same " + subject + " as #{exp}"; failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}"; } var cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0; this.assert( isSubsetOf(subset, obj, cmp, contains, ordered), failMsg, failNegateMsg, subset, obj, true ); }); Assertion.addProperty("iterable", function(msg) { if (msg) flag2(this, "message", msg); var obj = flag2(this, "object"); this.assert( obj != void 0 && obj[Symbol.iterator], "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj ); }); function oneOf(list, msg) { if (msg) flag2(this, "message", msg); var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql"); new Assertion(list, flagMsg, ssfi, true).to.be.an("array"); if (contains) { this.assert( list.some(function(possibility) { return expected.indexOf(possibility) > -1; }), "expected #{this} to contain one of #{exp}", "expected #{this} to not contain one of #{exp}", list, expected ); } else { if (isDeep) { this.assert( list.some(function(possibility) { return eql(expected, possibility); }), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected ); } else { this.assert( list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected ); } } } __name(oneOf, "oneOf"); Assertion.addMethod("oneOf", oneOf); function assertChanges(subject, prop, msg) { if (msg) flag2(this, "message", msg); var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(fn, flagMsg, ssfi, true).is.a("function"); var initial; if (!prop) { new Assertion(subject, flagMsg, ssfi, true).is.a("function"); initial = subject(); } else { new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); initial = subject[prop]; } fn(); var final = prop === void 0 || prop === null ? subject() : subject[prop]; var msgObj = prop === void 0 || prop === null ? initial : "." + prop; flag2(this, "deltaMsgObj", msgObj); flag2(this, "initialDeltaValue", initial); flag2(this, "finalDeltaValue", final); flag2(this, "deltaBehavior", "change"); flag2(this, "realDelta", final !== initial); this.assert( initial !== final, "expected " + msgObj + " to change", "expected " + msgObj + " to not change" ); } __name(assertChanges, "assertChanges"); Assertion.addMethod("change", assertChanges); Assertion.addMethod("changes", assertChanges); function assertIncreases(subject, prop, msg) { if (msg) flag2(this, "message", msg); var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(fn, flagMsg, ssfi, true).is.a("function"); var initial; if (!prop) { new Assertion(subject, flagMsg, ssfi, true).is.a("function"); initial = subject(); } else { new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); initial = subject[prop]; } new Assertion(initial, flagMsg, ssfi, true).is.a("number"); fn(); var final = prop === void 0 || prop === null ? subject() : subject[prop]; var msgObj = prop === void 0 || prop === null ? initial : "." + prop; flag2(this, "deltaMsgObj", msgObj); flag2(this, "initialDeltaValue", initial); flag2(this, "finalDeltaValue", final); flag2(this, "deltaBehavior", "increase"); flag2(this, "realDelta", final - initial); this.assert( final - initial > 0, "expected " + msgObj + " to increase", "expected " + msgObj + " to not increase" ); } __name(assertIncreases, "assertIncreases"); Assertion.addMethod("increase", assertIncreases); Assertion.addMethod("increases", assertIncreases); function assertDecreases(subject, prop, msg) { if (msg) flag2(this, "message", msg); var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); new Assertion(fn, flagMsg, ssfi, true).is.a("function"); var initial; if (!prop) { new Assertion(subject, flagMsg, ssfi, true).is.a("function"); initial = subject(); } else { new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); initial = subject[prop]; } new Assertion(initial, flagMsg, ssfi, true).is.a("number"); fn(); var final = prop === void 0 || prop === null ? subject() : subject[prop]; var msgObj = prop === void 0 || prop === null ? initial : "." + prop; flag2(this, "deltaMsgObj", msgObj); flag2(this, "initialDeltaValue", initial); flag2(this, "finalDeltaValue", final); flag2(this, "deltaBehavior", "decrease"); flag2(this, "realDelta", initial - final); this.assert( final - initial < 0, "expected " + msgObj + " to decrease", "expected " + msgObj + " to not decrease" ); } __name(assertDecreases, "assertDecreases"); Assertion.addMethod("decrease", assertDecreases); Assertion.addMethod("decreases", assertDecreases); function assertDelta(delta, msg) { if (msg) flag2(this, "message", msg); var msgObj = flag2(this, "deltaMsgObj"); var initial = flag2(this, "initialDeltaValue"); var final = flag2(this, "finalDeltaValue"); var behavior = flag2(this, "deltaBehavior"); var realDelta = flag2(this, "realDelta"); var expression; if (behavior === "change") { expression = Math.abs(final - initial) === Math.abs(delta); } else { expression = realDelta === Math.abs(delta); } this.assert( expression, "expected " + msgObj + " to " + behavior + " by " + delta, "expected " + msgObj + " to not " + behavior + " by " + delta ); } __name(assertDelta, "assertDelta"); Assertion.addMethod("by", assertDelta); Assertion.addProperty("extensible", function() { var obj = flag2(this, "object"); var isExtensible = obj === Object(obj) && Object.isExtensible(obj); this.assert( isExtensible, "expected #{this} to be extensible", "expected #{this} to not be extensible" ); }); Assertion.addProperty("sealed", function() { var obj = flag2(this, "object"); var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true; this.assert( isSealed, "expected #{this} to be sealed", "expected #{this} to not be sealed" ); }); Assertion.addProperty("frozen", function() { var obj = flag2(this, "object"); var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true; this.assert( isFrozen, "expected #{this} to be frozen", "expected #{this} to not be frozen" ); }); Assertion.addProperty("finite", function(msg) { var obj = flag2(this, "object"); this.assert( typeof obj === "number" && isFinite(obj), "expected #{this} to be a finite number", "expected #{this} to not be a finite number" ); }); // lib/chai/interface/expect.js function expect(val, message) { return new Assertion(val, message); } __name(expect, "expect"); expect.fail = function(actual, expected, message, operator) { if (arguments.length < 2) { message = actual; actual = void 0; } message = message || "expect.fail()"; throw new AssertionError(message, { actual, expected, operator }, expect.fail); }; // lib/chai/interface/should.js var should_exports = {}; __export(should_exports, { Should: () => Should, should: () => should }); function loadShould() { function shouldGetter() { if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) { return new Assertion(this.valueOf(), null, shouldGetter); } return new Assertion(this, null, shouldGetter); } __name(shouldGetter, "shouldGetter"); function shouldSetter(value) { Object.defineProperty(this, "should", { value, enumerable: true, configurable: true, writable: true }); } __name(shouldSetter, "shouldSetter"); Object.defineProperty(Object.prototype, "should", { set: shouldSetter, get: shouldGetter, configurable: true }); var should2 = {}; should2.fail = function(actual, expected, message, operator) { if (arguments.length < 2) { message = actual; actual = void 0; } message = message || "should.fail()"; throw new AssertionError(message, { actual, expected, operator }, should2.fail); }; should2.equal = function(actual, expected, message) { new Assertion(actual, message).to.equal(expected); }; should2.Throw = function(fn, errt, errs, msg) { new Assertion(fn, msg).to.Throw(errt, errs); }; should2.exist = function(val, msg) { new Assertion(val, msg).to.exist; }; should2.not = {}; should2.not.equal = function(actual, expected, msg) { new Assertion(actual, msg).to.not.equal(expected); }; should2.not.Throw = function(fn, errt, errs, msg) { new Assertion(fn, msg).to.not.Throw(errt, errs); }; should2.not.exist = function(val, msg) { new Assertion(val, msg).to.not.exist; }; should2["throw"] = should2["Throw"]; should2.not["throw"] = should2.not["Throw"]; return should2; } __name(loadShould, "loadShould"); var should = loadShould; var Should = loadShould; // lib/chai/interface/assert.js function assert(express, errmsg) { var test2 = new Assertion(null, null, assert, true); test2.assert( express, errmsg, "[ negation message unavailable ]" ); } __name(assert, "assert"); assert.fail = function(actual, expected, message, operator) { if (arguments.length < 2) { message = actual; actual = void 0; } message = message || "assert.fail()"; throw new AssertionError(message, { actual, expected, operator }, assert.fail); }; assert.isOk = function(val, msg) { new Assertion(val, msg, assert.isOk, true).is.ok; }; assert.isNotOk = function(val, msg) { new Assertion(val, msg, assert.isNotOk, true).is.not.ok; }; assert.equal = function(act, exp, msg) { var test2 = new Assertion(act, msg, assert.equal, true); test2.assert( exp == flag(test2, "object"), "expected #{this} to equal #{exp}", "expected #{this} to not equal #{act}", exp, act, true ); }; assert.notEqual = function(act, exp, msg) { var test2 = new Assertion(act, msg, assert.notEqual, true); test2.assert( exp != flag(test2, "object"), "expected #{this} to not equal #{exp}", "expected #{this} to equal #{act}", exp, act, true ); }; assert.strictEqual = function(act, exp, msg) { new Assertion(act, msg, assert.strictEqual, true).to.equal(exp); }; assert.notStrictEqual = function(act, exp, msg) { new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp); }; assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) { new Assertion(act, msg, assert.deepEqual, true).to.eql(exp); }; assert.notDeepEqual = function(act, exp, msg) { new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); }; assert.isAbove = function(val, abv, msg) { new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); }; assert.isAtLeast = function(val, atlst, msg) { new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); }; assert.isBelow = function(val, blw, msg) { new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); }; assert.isAtMost = function(val, atmst, msg) { new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst); }; assert.isTrue = function(val, msg) { new Assertion(val, msg, assert.isTrue, true).is["true"]; }; assert.isNotTrue = function(val, msg) { new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true); }; assert.isFalse = function(val, msg) { new Assertion(val, msg, assert.isFalse, true).is["false"]; }; assert.isNotFalse = function(val, msg) { new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false); }; assert.isNull = function(val, msg) { new Assertion(val, msg, assert.isNull, true).to.equal(null); }; assert.isNotNull = function(val, msg) { new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null); }; assert.isNaN = function(val, msg) { new Assertion(val, msg, assert.isNaN, true).to.be.NaN; }; assert.isNotNaN = function(value, message) { new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN; }; assert.exists = function(val, msg) { new Assertion(val, msg, assert.exists, true).to.exist; }; assert.notExists = function(val, msg) { new Assertion(val, msg, assert.notExists, true).to.not.exist; }; assert.isUndefined = function(val, msg) { new Assertion(val, msg, assert.isUndefined, true).to.equal(void 0); }; assert.isDefined = function(val, msg) { new Assertion(val, msg, assert.isDefined, true).to.not.equal(void 0); }; assert.isCallable = function(value, message) { new Assertion(value, message, assert.isCallable, true).is.callable; }; assert.isNotCallable = function(value, message) { new Assertion(value, message, assert.isNotCallable, true).is.not.callable; }; assert.isObject = function(val, msg) { new Assertion(val, msg, assert.isObject, true).to.be.a("object"); }; assert.isNotObject = function(val, msg) { new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object"); }; assert.isArray = function(val, msg) { new Assertion(val, msg, assert.isArray, true).to.be.an("array"); }; assert.isNotArray = function(val, msg) { new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array"); }; assert.isString = function(val, msg) { new Assertion(val, msg, assert.isString, true).to.be.a("string"); }; assert.isNotString = function(val, msg) { new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string"); }; assert.isNumber = function(val, msg) { new Assertion(val, msg, assert.isNumber, true).to.be.a("number"); }; assert.isNotNumber = function(val, msg) { new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number"); }; assert.isNumeric = function(val, msg) { new Assertion(val, msg, assert.isNumeric, true).is.numeric; }; assert.isNotNumeric = function(val, msg) { new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric; }; assert.isFinite = function(val, msg) { new Assertion(val, msg, assert.isFinite, true).to.be.finite; }; assert.isBoolean = function(val, msg) { new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean"); }; assert.isNotBoolean = function(val, msg) { new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean"); }; assert.typeOf = function(val, type3, msg) { new Assertion(val, msg, assert.typeOf, true).to.be.a(type3); }; assert.notTypeOf = function(value, type3, message) { new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3); }; assert.instanceOf = function(val, type3, msg) { new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3); }; assert.notInstanceOf = function(val, type3, msg) { new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(type3); }; assert.include = function(exp, inc, msg) { new Assertion(exp, msg, assert.include, true).include(inc); }; assert.notInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notInclude, true).not.include(inc); }; assert.deepInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc); }; assert.notDeepInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc); }; assert.nestedInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); }; assert.notNestedInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(inc); }; assert.deepNestedInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(inc); }; assert.notDeepNestedInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notDeepNestedInclude, true).not.deep.nested.include(inc); }; assert.ownInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.ownInclude, true).own.include(inc); }; assert.notOwnInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc); }; assert.deepOwnInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc); }; assert.notDeepOwnInclude = function(exp, inc, msg) { new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(inc); }; assert.match = function(exp, re, msg) { new Assertion(exp, msg, assert.match, true).to.match(re); }; assert.notMatch = function(exp, re, msg) { new Assertion(exp, msg, assert.notMatch, true).to.not.match(re); }; assert.property = function(obj, prop, msg) { new Assertion(obj, msg, assert.property, true).to.have.property(prop); }; assert.notProperty = function(obj, prop, msg) { new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop); }; assert.propertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val); }; assert.notPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(prop, val); }; assert.deepPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(prop, val); }; assert.notDeepPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.notDeepPropertyVal, true).to.not.have.deep.property(prop, val); }; assert.ownProperty = function(obj, prop, msg) { new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop); }; assert.notOwnProperty = function(obj, prop, msg) { new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(prop); }; assert.ownPropertyVal = function(obj, prop, value, msg) { new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(prop, value); }; assert.notOwnPropertyVal = function(obj, prop, value, msg) { new Assertion(obj, msg, assert.notOwnPropertyVal, true).to.not.have.own.property(prop, value); }; assert.deepOwnPropertyVal = function(obj, prop, value, msg) { new Assertion(obj, msg, assert.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value); }; assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) { new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value); }; assert.nestedProperty = function(obj, prop, msg) { new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(prop); }; assert.notNestedProperty = function(obj, prop, msg) { new Assertion(obj, msg, assert.notNestedProperty, true).to.not.have.nested.property(prop); }; assert.nestedPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.nestedPropertyVal, true).to.have.nested.property(prop, val); }; assert.notNestedPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.notNestedPropertyVal, true).to.not.have.nested.property(prop, val); }; assert.deepNestedPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val); }; assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) { new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val); }; assert.lengthOf = function(exp, len, msg) { new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len); }; assert.hasAnyKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys); }; assert.hasAllKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys); }; assert.containsAllKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(keys); }; assert.doesNotHaveAnyKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys); }; assert.doesNotHaveAllKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(keys); }; assert.hasAnyDeepKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(keys); }; assert.hasAllDeepKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(keys); }; assert.containsAllDeepKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.containsAllDeepKeys, true).to.contain.all.deep.keys(keys); }; assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys); }; assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) { new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys); }; assert.throws = function(fn, errorLike, errMsgMatcher, msg) { if ("string" === typeof errorLike || errorLike instanceof RegExp) { errMsgMatcher = errorLike; errorLike = null; } var assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher); return flag(assertErr, "object"); }; assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) { if ("string" === typeof errorLike || errorLike instanceof RegExp) { errMsgMatcher = errorLike; errorLike = null; } new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher); }; assert.operator = function(val, operator, val2, msg) { var ok; switch (operator) { case "==": ok = val == val2; break; case "===": ok = val === val2; break; case ">": ok = val > val2; break; case ">=": ok = val >= val2; break; case "<": ok = val < val2; break; case "<=": ok = val <= val2; break; case "!=": ok = val != val2; break; case "!==": ok = val !== val2; break; default: msg = msg ? msg + ": " : msg; throw new AssertionError( msg + 'Invalid operator "' + operator + '"', void 0, assert.operator ); } var test2 = new Assertion(ok, msg, assert.operator, true); test2.assert( true === flag(test2, "object"), "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2), "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2) ); }; assert.closeTo = function(act, exp, delta, msg) { new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta); }; assert.approximately = function(act, exp, delta, msg) { new Assertion(act, msg, assert.approximately, true).to.be.approximately(exp, delta); }; assert.sameMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2); }; assert.notSameMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.notSameMembers, true).to.not.have.same.members(set2); }; assert.sameDeepMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.sameDeepMembers, true).to.have.same.deep.members(set2); }; assert.notSameDeepMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.notSameDeepMembers, true).to.not.have.same.deep.members(set2); }; assert.sameOrderedMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.sameOrderedMembers, true).to.have.same.ordered.members(set2); }; assert.notSameOrderedMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2); }; assert.sameDeepOrderedMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2); }; assert.notSameDeepOrderedMembers = function(set1, set2, msg) { new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2); }; assert.includeMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.includeMembers, true).to.include.members(subset); }; assert.notIncludeMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.notIncludeMembers, true).to.not.include.members(subset); }; assert.includeDeepMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.includeDeepMembers, true).to.include.deep.members(subset); }; assert.notIncludeDeepMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.notIncludeDeepMembers, true).to.not.include.deep.members(subset); }; assert.includeOrderedMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.includeOrderedMembers, true).to.include.ordered.members(subset); }; assert.notIncludeOrderedMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset); }; assert.includeDeepOrderedMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset); }; assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) { new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset); }; assert.oneOf = function(inList, list, msg) { new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list); }; assert.isIterable = function(obj, msg) { if (obj == void 0 || !obj[Symbol.iterator]) { msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`; throw new AssertionError( msg, void 0, assert.isIterable ); } }; assert.changes = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); }; assert.changesBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta); }; assert.doesNotChange = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(obj, prop); }; assert.changesButNotBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta); }; assert.increases = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop); }; assert.increasesBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta); }; assert.doesNotIncrease = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(obj, prop); }; assert.increasesButNotBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta); }; assert.decreases = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop); }; assert.decreasesBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta); }; assert.doesNotDecrease = function(fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === "function") { msg = prop; prop = null; } return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(obj, prop); }; assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta); }; assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === "function") { var tmpMsg = delta; delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; } new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta); }; assert.ifError = function(val) { if (val) { throw val; } }; assert.isExtensible = function(obj, msg) { new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible; }; assert.isNotExtensible = function(obj, msg) { new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible; }; assert.isSealed = function(obj, msg) { new Assertion(obj, msg, assert.isSealed, true).to.be.sealed; }; assert.isNotSealed = function(obj, msg) { new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed; }; assert.isFrozen = function(obj, msg) { new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen; }; assert.isNotFrozen = function(obj, msg) { new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen; }; assert.isEmpty = function(val, msg) { new Assertion(val, msg, assert.isEmpty, true).to.be.empty; }; assert.isNotEmpty = function(val, msg) { new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty; }; (/* @__PURE__ */ __name(function alias(name, as) { assert[as] = assert[name]; return alias; }, "alias"))("isOk", "ok")("isNotOk", "notOk")("throws", "throw")("throws", "Throw")("isExtensible", "extensible")("isNotExtensible", "notExtensible")("isSealed", "sealed")("isNotSealed", "notSealed")("isFrozen", "frozen")("isNotFrozen", "notFrozen")("isEmpty", "empty")("isNotEmpty", "notEmpty")("isCallable", "isFunction")("isNotCallable", "isNotFunction"); // lib/chai.js var used = []; function use(fn) { const exports = { AssertionError, util: utils_exports, config, expect, assert, Assertion, ...should_exports }; if (!~used.indexOf(fn)) { fn(exports, utils_exports); used.push(fn); } return exports; } __name(use, "use"); export { Assertion, AssertionError, Should, assert, config, expect, should, use, utils_exports as util }; /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - test utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - expectTypes utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - getActual utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - message composition utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - transferFlags utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * chai * http://chaijs.com * Copyright(c) 2011-2014 Jake Luer * MIT Licensed */ /*! * Chai - isProxyEnabled helper * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - addProperty utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - addLengthGuard utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - getProperties utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - proxify utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - addMethod utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - overwriteProperty utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - overwriteMethod utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - addChainingMethod utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - overwriteChainableMethod utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /*! * Chai - compareByInspect utility * Copyright(c) 2011-2016 Jake Luer * MIT Licensed */ /*! * Chai - getOwnEnumerablePropertySymbols utility * Copyright(c) 2011-2016 Jake Luer * MIT Licensed */ /*! * Chai - getOwnEnumerableProperties utility * Copyright(c) 2011-2016 Jake Luer * MIT Licensed */ /*! * Chai - isNaN utility * Copyright(c) 2012-2015 Sakthipriyan Vairamani * MIT Licensed */ /*! * chai * Copyright(c) 2011 Jake Luer * MIT Licensed */ /*! * chai * Copyright(c) 2011-2014 Jake Luer * MIT Licensed */ /*! Bundled license information: deep-eql/index.js: (*! * deep-eql * Copyright(c) 2013 Jake Luer * MIT Licensed *) (*! * Check to see if the MemoizeMap has recorded a result of the two operands * * @param {Mixed} leftHandOperand * @param {Mixed} rightHandOperand * @param {MemoizeMap} memoizeMap * @returns {Boolean|null} result *) (*! * Set the result of the equality into the MemoizeMap * * @param {Mixed} leftHandOperand * @param {Mixed} rightHandOperand * @param {MemoizeMap} memoizeMap * @param {Boolean} result *) (*! * Primary Export *) (*! * The main logic of the `deepEqual` function. * * @param {Mixed} leftHandOperand * @param {Mixed} rightHandOperand * @param {Object} [options] (optional) Additional options * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality. * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular references to blow the stack. * @return {Boolean} equal match *) (*! * Compare two Regular Expressions for equality. * * @param {RegExp} leftHandOperand * @param {RegExp} rightHandOperand * @return {Boolean} result *) (*! * Compare two Sets/Maps for equality. Faster than other equality functions. * * @param {Set} leftHandOperand * @param {Set} rightHandOperand * @param {Object} [options] (Optional) * @return {Boolean} result *) (*! * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers. * * @param {Iterable} leftHandOperand * @param {Iterable} rightHandOperand * @param {Object} [options] (Optional) * @return {Boolean} result *) (*! * Simple equality for generator objects such as those returned by generator functions. * * @param {Iterable} leftHandOperand * @param {Iterable} rightHandOperand * @param {Object} [options] (Optional) * @return {Boolean} result *) (*! * Determine if the given object has an @@iterator function. * * @param {Object} target * @return {Boolean} `true` if the object has an @@iterator function. *) (*! * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array. * This will consume the iterator - which could have side effects depending on the @@iterator implementation. * * @param {Object} target * @returns {Array} an array of entries from the @@iterator function *) (*! * Gets all entries from a Generator. This will consume the generator - which could have side effects. * * @param {Generator} target * @returns {Array} an array of entries from the Generator. *) (*! * Gets all own and inherited enumerable keys from a target. * * @param {Object} target * @returns {Array} an array of own and inherited enumerable keys from the target. *) (*! * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of * each key. If any value of the given key is not equal, the function will return false (early). * * @param {Mixed} leftHandOperand * @param {Mixed} rightHandOperand * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against * @param {Object} [options] (Optional) * @return {Boolean} result *) (*! * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual` * for each enumerable key in the object. * * @param {Mixed} leftHandOperand * @param {Mixed} rightHandOperand * @param {Object} [options] (Optional) * @return {Boolean} result *) (*! * Returns true if the argument is a primitive. * * This intentionally returns true for all objects that can be compared by reference, * including functions and symbols. * * @param {Mixed} value * @return {Boolean} result *) */