function AssertionError2()

in src/js/node/assert.ts [655:781]


      function AssertionError2(options) {
        var _this;
        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,
          stackStartFn = options.stackStartFn,
          actual = options.actual,
          expected = options.expected,
          limit = Error.stackTraceLimit;
        if (((Error.stackTraceLimit = 0), message != null))
          _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
              ? ((blue = ""), (green = ""), (white = ""), (red = ""))
              : ((blue = ""), (green = ""), (white = ""), (red = ""))),
          _typeof(actual) === "object" &&
            actual !== null &&
            _typeof(expected) === "object" &&
            expected !== null &&
            "stack" in actual &&
            actual instanceof Error &&
            "stack" in expected &&
            expected instanceof Error &&
            ((actual = copyError(actual)), (expected = copyError(expected))),
          operator === "deepStrictEqual" || operator === "strictEqual")
        )
          _this = _possibleConstructorReturn(
            this,
            _getPrototypeOf(AssertionError2).$call(this, createErrDiff(actual, expected, operator)),
          );
        else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") {
          var base = kReadableOperator[operator],
            res = inspectValue(actual).split(`
`);
          if (
            (operator === "notStrictEqual" &&
              _typeof(actual) === "object" &&
              actual !== null &&
              (base = kReadableOperator.notStrictEqualObject),
            res.length > 30)
          )
            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])),
              ))
            : (_this = _possibleConstructorReturn(
                this,
                _getPrototypeOf(AssertionError2).$call(
                  this,
                  ""
                    .concat(
                      base,
                      `

`,
                    )
                    .concat(
                      res.join(`
`),
                      `
`,
                    ),
                ),
              ));
        } else {
          var _res = inspectValue(actual),
            other = "",
            knownOperators = kReadableOperator[operator];
          operator === "notDeepEqual" || operator === "notEqual"
            ? ((_res = ""
                .concat(
                  kReadableOperator[operator],
                  `

`,
                )
                .concat(_res)),
              _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), "...")),
              operator === "deepEqual" || operator === "equal"
                ? (_res = ""
                    .concat(
                      knownOperators,
                      `

`,
                    )
                    .concat(
                      _res,
                      `

should equal

`,
                    ))
                : (other = " ".concat(operator, " ").concat(other))),
            (_this = _possibleConstructorReturn(
              this,
              _getPrototypeOf(AssertionError2).$call(this, "".concat(_res).concat(other)),
            ));
        }
        return (
          (Error.stackTraceLimit = limit),
          (_this.generatedMessage = !message),
          Object.defineProperty(_assertThisInitialized(_this), "name", {
            value: "AssertionError [ERR_ASSERTION]",
            enumerable: !1,
            writable: !0,
            configurable: !0,
          }),
          (_this.code = "ERR_ASSERTION"),
          (_this.actual = actual),
          (_this.expected = expected),
          (_this.operator = operator),
          Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn),
          _this.stack,
          (_this.name = "AssertionError"),
          _possibleConstructorReturn(_this)
        );
      }