diff options
Diffstat (limited to 'src/bun.js/assert.exports.js')
-rw-r--r-- | src/bun.js/assert.exports.js | 456 |
1 files changed, 102 insertions, 354 deletions
diff --git a/src/bun.js/assert.exports.js b/src/bun.js/assert.exports.js index 179d8494d..82527610a 100644 --- a/src/bun.js/assert.exports.js +++ b/src/bun.js/assert.exports.js @@ -6,13 +6,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty; -var __markAsModule = (target) => __defProp(target, "__esModule", { value: !0 }); +var __markAsModule = target => __defProp(target, "__esModule", { value: !0 }); var __commonJS = (cb, mod) => function () { - return ( - mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), - mod.exports - ); + return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __reExport = (target, module2, desc) => { if ((module2 && typeof module2 == "object") || typeof module2 == "function") @@ -21,12 +18,11 @@ var __reExport = (target, module2, desc) => { key !== "default" && __defProp(target, key, { get: () => module2[key], - enumerable: - !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable, + enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable, }); return target; }, - __toModule = (module2) => + __toModule = module2 => __reExport( __markAsModule( __defProp( @@ -40,7 +36,7 @@ var __reExport = (target, module2, desc) => { module2, ); -var require = (path) => import.meta.require(path); +var require = path => import.meta.require(path); // assert/build/internal/errors.js var require_errors = __commonJS({ @@ -53,10 +49,7 @@ var require_errors = __commonJS({ return typeof obj2; }) : (_typeof = function (obj2) { - return obj2 && - typeof Symbol == "function" && - obj2.constructor === Symbol && - obj2 !== Symbol.prototype + return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }), @@ -64,19 +57,13 @@ var require_errors = __commonJS({ ); } function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) - throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn(self, call) { - return call && (_typeof(call) === "object" || typeof call == "function") - ? call - : _assertThisInitialized(self); + return call && (_typeof(call) === "object" || typeof call == "function") ? call : _assertThisInitialized(self); } function _assertThisInitialized(self) { - if (self === void 0) - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called", - ); + if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _getPrototypeOf(o) { @@ -91,9 +78,7 @@ var require_errors = __commonJS({ } function _inherits(subClass, superClass) { if (typeof superClass != "function" && superClass !== null) - throw new TypeError( - "Super expression must either be null or a function", - ); + throw new TypeError("Super expression must either be null or a function"); (subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: !0, configurable: !0 }, })), @@ -125,10 +110,7 @@ var require_errors = __commonJS({ _classCallCheck(this, NodeError2), (_this = _possibleConstructorReturn( this, - _getPrototypeOf(NodeError2).call( - this, - getMessage(arg1, arg2, arg3), - ), + _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3)), )), (_this.code = code), _this @@ -146,15 +128,9 @@ var require_errors = __commonJS({ return String(i); })), len > 2 - ? "one of " - .concat(thing, " ") - .concat(expected.slice(0, len - 1).join(", "), ", or ") + - expected[len - 1] + ? "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1] : len === 2 - ? "one of " - .concat(thing, " ") - .concat(expected[0], " or ") - .concat(expected[1]) + ? "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]) : "of ".concat(thing, " ").concat(expected[0]) ); } else return "of ".concat(thing, " ").concat(String(expected)); @@ -164,47 +140,31 @@ var require_errors = __commonJS({ } function endsWith(str, search, this_len) { return ( - (this_len === void 0 || this_len > str.length) && - (this_len = str.length), + (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search ); } function includes(str, search, start) { return ( typeof start != "number" && (start = 0), - start + search.length > str.length - ? !1 - : str.indexOf(search, start) !== -1 + start + search.length > str.length ? !1 : str.indexOf(search, start) !== -1 ); } - createErrorType( - "ERR_AMBIGUOUS_ARGUMENT", - 'The "%s" argument is ambiguous. %s', - TypeError, - ); + createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError); createErrorType( "ERR_INVALID_ARG_TYPE", function (name, expected, actual) { - assert === void 0 && (assert = require_assert()), - assert(typeof name == "string", "'name' must be a string"); + assert === void 0 && (assert = require_assert()), assert(typeof name == "string", "'name' must be a string"); var determiner; typeof expected == "string" && startsWith(expected, "not ") - ? ((determiner = "must not be"), - (expected = expected.replace(/^not /, ""))) + ? ((determiner = "must not be"), (expected = expected.replace(/^not /, ""))) : (determiner = "must be"); var msg; if (endsWith(name, " argument")) - msg = "The " - .concat(name, " ") - .concat(determiner, " ") - .concat(oneOf(expected, "type")); + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); else { var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "' - .concat(name, '" ') - .concat(type, " ") - .concat(determiner, " ") - .concat(oneOf(expected, "type")); + msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); } return (msg += ". Received type ".concat(_typeof(actual))), msg; }, @@ -213,19 +173,12 @@ var require_errors = __commonJS({ createErrorType( "ERR_INVALID_ARG_VALUE", function (name, value) { - var reason = - arguments.length > 2 && arguments[2] !== void 0 - ? arguments[2] - : "is invalid"; + var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid"; util === void 0 && (util = require("util")); var inspected = util.inspect(value); return ( - inspected.length > 128 && - (inspected = "".concat(inspected.slice(0, 128), "...")), - "The argument '" - .concat(name, "' ") - .concat(reason, ". Received ") - .concat(inspected) + inspected.length > 128 && (inspected = "".concat(inspected.slice(0, 128), "...")), + "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected) ); }, TypeError, @@ -239,9 +192,8 @@ var require_errors = __commonJS({ value && value.constructor && value.constructor.name ? (type = "instance of ".concat(value.constructor.name)) : (type = "type ".concat(_typeof(value))), - "Expected " - .concat(input, ' to be returned from the "') - .concat(name, '"') + " function but got ".concat(type, ".") + "Expected ".concat(input, ' to be returned from the "').concat(name, '"') + + " function but got ".concat(type, ".") ); }, TypeError, @@ -249,11 +201,7 @@ var require_errors = __commonJS({ createErrorType( "ERR_MISSING_ARGS", function () { - for ( - var _len = arguments.length, args = new Array(_len), _key = 0; - _key < _len; - _key++ - ) + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; assert === void 0 && (assert = require_assert()), assert(args.length > 0, "At least one arg needs to be specified"); @@ -272,8 +220,7 @@ var require_errors = __commonJS({ msg += "".concat(args[0], " and ").concat(args[1], " arguments"); break; default: - (msg += args.slice(0, len - 1).join(", ")), - (msg += ", and ".concat(args[len - 1], " arguments")); + (msg += args.slice(0, len - 1).join(", ")), (msg += ", and ".concat(args[len - 1], " arguments")); break; } return "".concat(msg, " must be specified"); @@ -318,8 +265,7 @@ var require_assertion_error = __commonJS({ ); } function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) - throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { @@ -338,22 +284,15 @@ var require_assertion_error = __commonJS({ ); } function _possibleConstructorReturn(self, call) { - return call && (_typeof(call) === "object" || typeof call == "function") - ? call - : _assertThisInitialized(self); + return call && (_typeof(call) === "object" || typeof call == "function") ? call : _assertThisInitialized(self); } function _assertThisInitialized(self) { - if (self === void 0) - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called", - ); + if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _inherits(subClass, superClass) { if (typeof superClass != "function" && superClass !== null) - throw new TypeError( - "Super expression must either be null or a function", - ); + throw new TypeError("Super expression must either be null or a function"); (subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: !0, configurable: !0 }, })), @@ -364,20 +303,13 @@ var require_assertion_error = __commonJS({ return ( (_wrapNativeSuper = function (Class2) { if (Class2 === null || !_isNativeFunction(Class2)) return Class2; - if (typeof Class2 != "function") - throw new TypeError( - "Super expression must either be null or a function", - ); + if (typeof Class2 != "function") throw new TypeError("Super expression must either be null or a function"); if (typeof _cache != "undefined") { if (_cache.has(Class2)) return _cache.get(Class2); _cache.set(Class2, Wrapper); } function Wrapper() { - return _construct( - Class2, - arguments, - _getPrototypeOf(this).constructor, - ); + return _construct(Class2, arguments, _getPrototypeOf(this).constructor); } return ( (Wrapper.prototype = Object.create(Class2.prototype, { @@ -395,20 +327,10 @@ var require_assertion_error = __commonJS({ ); } function isNativeReflectConstruct() { - if ( - typeof Reflect == "undefined" || - !Reflect.construct || - Reflect.construct.sham - ) - return !1; + if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { - return ( - Date.prototype.toString.call( - Reflect.construct(Date, [], function () {}), - ), - !0 - ); + return Date.prototype.toString.call(Reflect.construct(Date, [], function () {})), !0; } catch { return !1; } @@ -422,9 +344,7 @@ var require_assertion_error = __commonJS({ a.push.apply(a, args2); var Constructor = Function.bind.apply(Parent2, a), instance = new Constructor(); - return ( - Class2 && _setPrototypeOf(instance, Class2.prototype), instance - ); + return Class2 && _setPrototypeOf(instance, Class2.prototype), instance; }), _construct.apply(null, arguments) ); @@ -459,10 +379,7 @@ var require_assertion_error = __commonJS({ return typeof obj2; }) : (_typeof = function (obj2) { - return obj2 && - typeof Symbol == "function" && - obj2.constructor === Symbol && - obj2 !== Symbol.prototype + return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }), @@ -475,17 +392,14 @@ var require_assertion_error = __commonJS({ ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; function endsWith(str, search, this_len) { return ( - (this_len === void 0 || this_len > str.length) && - (this_len = str.length), + (this_len === void 0 || this_len > str.length) && (this_len = str.length), str.substring(this_len - search.length, this_len) === search ); } function repeat(str, count) { - if (((count = Math.floor(count)), str.length == 0 || count == 0)) - return ""; + if (((count = Math.floor(count)), str.length == 0 || count == 0)) return ""; var maxCount = str.length * count; - for (count = Math.floor(Math.log(count) / Math.log(2)); count; ) - (str += str), count--; + for (count = Math.floor(Math.log(count) / Math.log(2)); count; ) (str += str), count--; return (str += str.substring(0, maxCount - str.length)), str; } var blue = "", @@ -495,15 +409,12 @@ var require_assertion_error = __commonJS({ kReadableOperator = { deepStrictEqual: "Expected values to be strictly deep-equal:", strictEqual: "Expected values to be strictly equal:", - strictEqualObject: - 'Expected "actual" to be reference-equal to "expected":', + strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', deepEqual: "Expected values to be loosely deep-equal:", equal: "Expected values to be loosely equal:", - notDeepStrictEqual: - 'Expected "actual" not to be strictly deep-equal to:', + notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', notStrictEqual: 'Expected "actual" to be strictly unequal to:', - notStrictEqualObject: - 'Expected "actual" not to be reference-equal to "expected":', + notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', notEqual: 'Expected "actual" to be loosely unequal to:', notIdentical: "Values identical but not reference-equal:", @@ -555,9 +466,7 @@ var require_assertion_error = __commonJS({ actual !== null && expected !== null && (operator = "strictEqualObject"), - actualLines.length === 1 && - expectedLines.length === 1 && - actualLines[0] !== expectedLines[0]) + actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) ) { var inputLength = actualLines[0].length + expectedLines[0].length; if (inputLength <= kMaxShortLength) { @@ -580,10 +489,7 @@ var require_assertion_error = __commonJS({ ) ); } else if (operator !== "strictEqualObject") { - var maxLength = - process.stderr && process.stderr.isTTY - ? process.stderr.columns - : 80; + var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; if (inputLength < maxLength) { for (; actualLines[0][i] === expectedLines[0][i]; ) i++; i > 2 && @@ -594,8 +500,7 @@ var require_assertion_error = __commonJS({ } } for ( - var a = actualLines[actualLines.length - 1], - b = expectedLines[expectedLines.length - 1]; + var a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1]; a === b && (i++ < 2 ? (end = ` @@ -608,19 +513,13 @@ var require_assertion_error = __commonJS({ !(actualLines.length === 0 || expectedLines.length === 0)); ) - (a = actualLines[actualLines.length - 1]), - (b = expectedLines[expectedLines.length - 1]); + (a = actualLines[actualLines.length - 1]), (b = expectedLines[expectedLines.length - 1]); var maxLines = Math.max(actualLines.length, expectedLines.length); if (maxLines === 0) { var _actualLines = actualInspected.split(` `); if (_actualLines.length > 30) - for ( - _actualLines[26] = "".concat(blue, "...").concat(white); - _actualLines.length > 27; - - ) - _actualLines.pop(); + for (_actualLines[26] = "".concat(blue, "...").concat(white); _actualLines.length > 27; ) _actualLines.pop(); return "" .concat( kReadableOperator.notIdentical, @@ -710,9 +609,7 @@ var require_assertion_error = __commonJS({ var expectedLine = expectedLines[i], actualLine = actualLines[i], divergingLines = - actualLine !== expectedLine && - (!endsWith(actualLine, ",") || - actualLine.slice(0, -1) !== expectedLine); + actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine); divergingLines && endsWith(expectedLine, ",") && expectedLine.slice(0, -1) === actualLine && @@ -791,10 +688,7 @@ var require_assertion_error = __commonJS({ _inherits(AssertionError2, _Error); function AssertionError2(options) { var _this; - if ( - (_classCallCheck(this, AssertionError2), - _typeof(options) !== "object" || options === null) - ) + if ((_classCallCheck(this, AssertionError2), _typeof(options) !== "object" || options === null)) throw new ERR_INVALID_ARG_TYPE("options", "Object", options); var message = options.message, operator = options.operator, @@ -803,16 +697,11 @@ var require_assertion_error = __commonJS({ expected = options.expected, limit = Error.stackTraceLimit; if (((Error.stackTraceLimit = 0), message != null)) - _this = _possibleConstructorReturn( - this, - _getPrototypeOf(AssertionError2).call(this, String(message)), - ); + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message))); else if ( (process.stderr && process.stderr.isTTY && - (process.stderr && - process.stderr.getColorDepth && - process.stderr.getColorDepth() !== 1 + (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1 ? ((blue = "[34m"), (green = "[32m"), (white = "[39m"), (red = "[31m")) : ((blue = ""), (green = ""), (white = ""), (red = ""))), _typeof(actual) === "object" && @@ -828,15 +717,9 @@ var require_assertion_error = __commonJS({ ) _this = _possibleConstructorReturn( this, - _getPrototypeOf(AssertionError2).call( - this, - createErrDiff(actual, expected, operator), - ), + _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator)), ); - else if ( - operator === "notDeepStrictEqual" || - operator === "notStrictEqual" - ) { + else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") { var base = kReadableOperator[operator], res = inspectValue(actual).split(` `); @@ -847,19 +730,11 @@ var require_assertion_error = __commonJS({ (base = kReadableOperator.notStrictEqualObject), res.length > 30) ) - for ( - res[26] = "".concat(blue, "...").concat(white); - res.length > 27; - - ) - res.pop(); + for (res[26] = "".concat(blue, "...").concat(white); res.length > 27; ) res.pop(); res.length === 1 ? (_this = _possibleConstructorReturn( this, - _getPrototypeOf(AssertionError2).call( - this, - "".concat(base, " ").concat(res[0]), - ), + _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0])), )) : (_this = _possibleConstructorReturn( this, @@ -893,13 +768,10 @@ var require_assertion_error = __commonJS({ `, ) .concat(_res)), - _res.length > 1024 && - (_res = "".concat(_res.slice(0, 1021), "..."))) + _res.length > 1024 && (_res = "".concat(_res.slice(0, 1021), "..."))) : ((other = "".concat(inspectValue(expected))), - _res.length > 512 && - (_res = "".concat(_res.slice(0, 509), "...")), - other.length > 512 && - (other = "".concat(other.slice(0, 509), "...")), + _res.length > 512 && (_res = "".concat(_res.slice(0, 509), "...")), + other.length > 512 && (other = "".concat(other.slice(0, 509), "...")), operator === "deepEqual" || operator === "equal" ? (_res = "" .concat( @@ -919,10 +791,7 @@ should equal : (other = " ".concat(operator, " ").concat(other))), (_this = _possibleConstructorReturn( this, - _getPrototypeOf(AssertionError2).call( - this, - "".concat(_res).concat(other), - ), + _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other)), )); } return ( @@ -938,11 +807,7 @@ should equal (_this.actual = actual), (_this.expected = expected), (_this.operator = operator), - Error.captureStackTrace && - Error.captureStackTrace( - _assertThisInitialized(_this), - stackStartFn, - ), + Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn), _this.stack, (_this.name = "AssertionError"), _possibleConstructorReturn(_this) @@ -953,10 +818,7 @@ should equal { key: "toString", value: function () { - return "" - .concat(this.name, " [") - .concat(this.code, "]: ") - .concat(this.message); + return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); }, }, { @@ -990,10 +852,7 @@ var require_assert = __commonJS({ return typeof obj2; }) : (_typeof = function (obj2) { - return obj2 && - typeof Symbol == "function" && - obj2.constructor === Symbol && - obj2 !== Symbol.prototype + return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }), @@ -1001,8 +860,7 @@ var require_assert = __commonJS({ ); } function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) - throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } var _require = require_errors(), _require$codes = _require.codes, @@ -1025,9 +883,7 @@ var require_assert = __commonJS({ assert = (module2.exports = ok), NO_EXCEPTION_SENTINEL = {}; function innerFail(obj) { - throw obj.message instanceof Error - ? obj.message - : new AssertionError(obj); + throw obj.message instanceof Error ? obj.message : new AssertionError(obj); } function fail(actual, expected, message, operator, stackStartFn) { var argsLen = arguments.length, @@ -1037,9 +893,7 @@ var require_assert = __commonJS({ else { if (warned === !1) { warned = !0; - var warn = process.emitWarning - ? process.emitWarning - : console.warn.bind(console); + var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console); warn( "assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", @@ -1057,20 +911,14 @@ var require_assert = __commonJS({ }; message !== void 0 && (errArgs.message = message); var err = new AssertionError(errArgs); - throw ( - (internalMessage && - ((err.message = internalMessage), (err.generatedMessage = !0)), - err) - ); + throw (internalMessage && ((err.message = internalMessage), (err.generatedMessage = !0)), err); } assert.fail = fail; assert.AssertionError = AssertionError; function innerOk(fn, argLen, value, message) { if (!value) { var generatedMessage = !1; - if (argLen === 0) - (generatedMessage = !0), - (message = "No value argument passed to `assert.ok()`"); + if (argLen === 0) (generatedMessage = !0), (message = "No value argument passed to `assert.ok()`"); else if (message instanceof Error) throw message; var err = new AssertionError({ actual: value, @@ -1083,18 +931,13 @@ var require_assert = __commonJS({ } } function ok() { - for ( - var _len = arguments.length, args = new Array(_len), _key = 0; - _key < _len; - _key++ - ) + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; innerOk.apply(void 0, [ok, args.length].concat(args)); } assert.ok = ok; assert.equal = function equal(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); actual != expected && innerFail({ actual, @@ -1105,8 +948,7 @@ var require_assert = __commonJS({ }); }; assert.notEqual = function notEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); actual == expected && innerFail({ actual, @@ -1117,8 +959,7 @@ var require_assert = __commonJS({ }); }; assert.deepEqual = function deepEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); isDeepEqual(actual, expected, false) || innerFail({ actual, @@ -1129,8 +970,7 @@ var require_assert = __commonJS({ }); }; assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); isDeepEqual(actual, expected, false) && innerFail({ actual, @@ -1140,13 +980,8 @@ var require_assert = __commonJS({ stackStartFn: notDeepEqual, }); }; - assert.deepStrictEqual = function deepStrictEqual( - actual, - expected, - message, - ) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); isDeepEqual(actual, expected, true) || innerFail({ @@ -1159,8 +994,7 @@ var require_assert = __commonJS({ }; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); isDeepEqual(actual, expected, true) && innerFail({ @@ -1172,8 +1006,7 @@ var require_assert = __commonJS({ }); } assert.strictEqual = function strictEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); objectIs(actual, expected) || innerFail({ actual, @@ -1184,8 +1017,7 @@ var require_assert = __commonJS({ }); }; assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); objectIs(actual, expected) && innerFail({ actual, @@ -1196,10 +1028,8 @@ var require_assert = __commonJS({ }); }; assert.match = function match(actual, expected, message) { - if (arguments.length < 2) - throw new ERR_MISSING_ARGS("actual", "expected"); - if (!isRegExp(expected)) - throw new ERR_INVALID_ARG_TYPE("expected", "RegExp", expected); + if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected"); + if (!isRegExp(expected)) throw new ERR_INVALID_ARG_TYPE("expected", "RegExp", expected); expected.test(actual) || innerFail({ actual, @@ -1214,10 +1044,7 @@ var require_assert = __commonJS({ _classCallCheck(this, Comparison2), keys.forEach(function (key) { key in obj && - (actual !== void 0 && - typeof actual[key] == "string" && - isRegExp(obj[key]) && - obj[key].test(actual[key]) + (actual !== void 0 && typeof actual[key] == "string" && isRegExp(obj[key]) && obj[key].test(actual[key]) ? (_this[key] = actual[key]) : (_this[key] = obj[key])); }); @@ -1233,12 +1060,7 @@ var require_assert = __commonJS({ operator: "deepStrictEqual", stackStartFn: fn, }); - throw ( - ((err.actual = actual), - (err.expected = expected), - (err.operator = fn.name), - err) - ); + throw ((err.actual = actual), (err.expected = expected), (err.operator = fn.name), err); } innerFail({ actual, @@ -1252,12 +1074,7 @@ var require_assert = __commonJS({ function expectedException(actual, expected, msg, fn) { if (typeof expected != "function") { if (isRegExp(expected)) return expected.test(actual); - if (arguments.length === 2) - throw new ERR_INVALID_ARG_TYPE( - "expected", - ["Function", "RegExp"], - expected, - ); + if (arguments.length === 2) throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected); if (_typeof(actual) !== "object" || actual === null) { var err = new AssertionError({ actual, @@ -1270,18 +1087,11 @@ var require_assert = __commonJS({ } var keys = Object.keys(expected); if (expected instanceof Error) keys.push("name", "message"); - else if (keys.length === 0) - throw new ERR_INVALID_ARG_VALUE( - "error", - expected, - "may not be an empty object", - ); + else if (keys.length === 0) throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object"); return ( keys.forEach(function (key) { return ( - (typeof actual[key] == "string" && - isRegExp(expected[key]) && - expected[key].test(actual[key])) || + (typeof actual[key] == "string" && isRegExp(expected[key]) && expected[key].test(actual[key])) || compareExceptionKey(actual, expected, key, msg, keys, fn) ); }), @@ -1295,8 +1105,7 @@ var require_assert = __commonJS({ : expected.call({}, actual) === !0; } function getActual(fn) { - if (typeof fn != "function") - throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); + if (typeof fn != "function") throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); try { fn(); } catch (e) { @@ -1307,10 +1116,7 @@ var require_assert = __commonJS({ function checkIsPromise(obj) { return ( isPromise(obj) || - (obj !== null && - _typeof(obj) === "object" && - typeof obj.then == "function" && - typeof obj.catch == "function") + (obj !== null && _typeof(obj) === "object" && typeof obj.then == "function" && typeof obj.catch == "function") ); } function waitForActual(promiseFn) { @@ -1318,18 +1124,9 @@ var require_assert = __commonJS({ var resultPromise; if (typeof promiseFn == "function") { if (((resultPromise = promiseFn()), !checkIsPromise(resultPromise))) - throw new ERR_INVALID_RETURN_VALUE( - "instance of Promise", - "promiseFn", - resultPromise, - ); + throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise); } else if (checkIsPromise(promiseFn)) resultPromise = promiseFn; - else - throw new ERR_INVALID_ARG_TYPE( - "promiseFn", - ["Function", "Promise"], - promiseFn, - ); + else throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn); return Promise.resolve() .then(function () { return resultPromise; @@ -1345,19 +1142,12 @@ var require_assert = __commonJS({ function expectsError(stackStartFn, actual, error, message) { if (typeof error == "string") { if (arguments.length === 4) - throw new ERR_INVALID_ARG_TYPE( - "error", - ["Object", "Error", "Function", "RegExp"], - error, - ); + throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); if (_typeof(actual) === "object" && actual !== null) { if (actual.message === error) throw new ERR_AMBIGUOUS_ARGUMENT( "error/message", - 'The error message "'.concat( - actual.message, - '" is identical to the message.', - ), + 'The error message "'.concat(actual.message, '" is identical to the message.'), ); } else if (actual === error) throw new ERR_AMBIGUOUS_ARGUMENT( @@ -1365,22 +1155,13 @@ var require_assert = __commonJS({ 'The error "'.concat(actual, '" is identical to the message.'), ); (message = error), (error = void 0); - } else if ( - error != null && - _typeof(error) !== "object" && - typeof error != "function" - ) - throw new ERR_INVALID_ARG_TYPE( - "error", - ["Object", "Error", "Function", "RegExp"], - error, - ); + } else if (error != null && _typeof(error) !== "object" && typeof error != "function") + throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); if (actual === NO_EXCEPTION_SENTINEL) { var details = ""; error && error.name && (details += " (".concat(error.name, ")")), (details += message ? ": ".concat(message) : "."); - var fnType = - stackStartFn.name === "rejects" ? "rejection" : "exception"; + var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception"; innerFail({ actual: void 0, expected: error, @@ -1389,8 +1170,7 @@ var require_assert = __commonJS({ stackStartFn, }); } - if (error && !expectedException(actual, error, message, stackStartFn)) - throw actual; + if (error && !expectedException(actual, error, message, stackStartFn)) throw actual; } function expectsNoError(stackStartFn, actual, error, message) { if (actual !== NO_EXCEPTION_SENTINEL) { @@ -1399,8 +1179,7 @@ var require_assert = __commonJS({ !error || expectedException(actual, error)) ) { var details = message ? ": ".concat(message) : ".", - fnType = - stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; + fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; innerFail({ actual, expected: error, @@ -1418,54 +1197,27 @@ var require_assert = __commonJS({ } } assert.throws = function throws(promiseFn) { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2]; expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); }; assert.rejects = function rejects(promiseFn) { - for ( - var _len3 = arguments.length, - args = new Array(_len3 > 1 ? _len3 - 1 : 0), - _key3 = 1; - _key3 < _len3; - _key3++ - ) + for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3]; return waitForActual(promiseFn).then(function (result) { return expectsError.apply(void 0, [rejects, result].concat(args)); }); }; assert.doesNotThrow = function doesNotThrow(fn) { - for ( - var _len4 = arguments.length, - args = new Array(_len4 > 1 ? _len4 - 1 : 0), - _key4 = 1; - _key4 < _len4; - _key4++ - ) + for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) args[_key4 - 1] = arguments[_key4]; expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); }; assert.doesNotReject = function doesNotReject(fn) { - for ( - var _len5 = arguments.length, - args = new Array(_len5 > 1 ? _len5 - 1 : 0), - _key5 = 1; - _key5 < _len5; - _key5++ - ) + for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) args[_key5 - 1] = arguments[_key5]; return waitForActual(fn).then(function (result) { - return expectsNoError.apply( - void 0, - [doesNotReject, result].concat(args), - ); + return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); }); }; assert.ifError = function ifError(err) { @@ -1517,11 +1269,7 @@ var require_assert = __commonJS({ } }; function strict() { - for ( - var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; - _key6 < _len6; - _key6++ - ) + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) args[_key6] = arguments[_key6]; innerOk.apply(void 0, [strict, args.length].concat(args)); } |