code: function normalizeErr(err, config) {
    const { name, message, actual, expected, stack, showDiff } = err;
    let errMessage;
    let errDiff;
  
    /**
     * Check that a / b have the same type.
     */
    function sameType(a, b) {
      const objToString = Object.prototype.toString;
      return objToString.call(a) === objToString.call(b);
    }
  
    // Format actual/expected for creating diff
    if (showDiff !== false && sameType(actual, expected) && expected !== undefined) {
      /* istanbul ignore if */
      if (!(_.isString(actual) && _.isString(expected))) {
        err.actual = mochaUtils.stringify(actual);
        err.expected = mochaUtils.stringify(expected);
      }
      errDiff = config.useInlineDiffs ? createInlineDiff(err) : createUnifiedDiff(err);
    }
  
    // Assertion libraries do not output consitent error objects so in order to
    // get a consistent message object we need to create it ourselves
    if (name && message) {
      errMessage = `${name}: ${stripAnsi(message)}`;
    } else if (stack) {
      errMessage = stack.replace(/\n.*/g, '');
    }
  
    return {
      message: errMessage,
      estack: stack && stripAnsi(stack),
      diff: errDiff
    };
  }
docs: Return a normalized error object
  
  @param {Error} err Error object
  
  @return {Object} normalized error