docs: function parseException(exception, options = {}) {
      let basepath = isDefined(options.basepath) ? options.basepath : process.cwd();
  
      // Add a trailing '/' to the basepath if it doesn't have one, because `__dirname` doesn't
      // have one.  Don't add the trailing '/' if it's a regex, because that's crazy talk.  :)
      if (typeof basepath === 'string' && !basepath.endsWith(path.sep)) {
          basepath += path.sep;
      }
      const basepathReplacement = isDefined(options.basepathReplacement)
          ? options.basepathReplacement
          : `.${path.sep}`;
  
      const exceptionText =
          typeof exception === 'string'
              ? exception
              : isDefined(exception.stack)
              ? exception.stack
              : `${exception}`;
  
      const value = stripColors(exceptionText);
      const lines = value.split('\n');
  
      let endOfHeader = false;
      return lines.map(function(line) {
          let filename, type;
          let parsed = null;
  
          // Figure out what kind of line each line is.
          if (DIVIDERS.includes(line)) {
              endOfHeader = true;
              type = DIVIDER;
          } else {
              parsed = parseExceptionLine(line);
              if (parsed) {
                  ({ filename } = parsed);
                  endOfHeader = true;
                  type = SOURCE;
                  if (
                      filename.indexOf('node_modules') === -1 &&
                      filename[typeof basepath === 'string' ? 'indexOf' : 'search'](basepath) !== -1
                  ) {
                      type = OUR_SOURCE;
                  }
              }
          }
  
          if (!endOfHeader && !type) {
              // Treat all the lines up to the first source line as header
              type = HEADER;
          }
  
          if (!type) {
              type = UNKNOWN;
          }
  
          // Strip out path names
          if ([SOURCE, OUR_SOURCE].includes(type)) {
              line = line.replace(basepath, basepathReplacement);
              parsed.filename = parsed.filename.replace(basepath, basepathReplacement);
          }
  
          return { line, parsed, type };
      });
  }