docs: function formatError (error, intend) {
    var message
  
    // Get the error message based on the error
    var errorMessage = 'NO ERROR MESSAGE FOUND'
    if (error.message && typeof error.message.toString === 'function') {
      errorMessage = error.message + ''
    }
    if (typeof error.inspect === 'function') {
      errorMessage = error.inspect() + ''
    }
    message = errorMessage
  
    // Build a clean stack trace (and extract the error message out of it,
    // if it is included in the stack trace, since it's usually better)
    var stack = error.stack || errorMessage
    var index = stack.indexOf(errorMessage)
    if (index !== -1) {
      index += errorMessage.length
      message = stack.slice(0, index)
      stack = stack.slice(index + 1)
    }
  
    // Add extra text for uncaught errors
    if (error.uncaught) {
      message = 'Uncaught ' + message
    }
  
    // Show diffs for assertion errors
    var actual = error.actual
    var expected = error.expected
    if (error.showDiff !== false && sameType(actual, expected) && expected !== undefined) {
      // Try and get a better message ouf of the assertion error
      // (this is when the user supplied his own description to "expect")
      var match = errorMessage.match(/^([^:]+): expected/)
      message = match ? match[1].red + '\n\n' : ''
  
      // Add the diff
      message += inlineDiff(error.actual, error.expected)
    } else {
      message = message.red
    }
  
    return {
      message: intendLines(message, false, intend),
      stack: intendLines(stack, true, intend)
    }
  }