src/utils.js
function createUnifiedDiff({ actual, expected }) {
  return diff.createPatch('string', actual, expected)
    .split('\n')
    .splice(4)
    .map(line => {
      if (line.match(/@@/)) {
        return null;
      }
      if (line.match(/\\ No newline/)) {
        return null;
      }
      return line.replace(/^(-|\+)/, '$1 ');
    })
    .filter(line => typeof line !== 'undefined' && line !== null)
    .join('\n');
}
function createUnifiedDiff({ actual, expected }) {
  return diff.createPatch('string', actual, expected)
    .split('\n')
    .splice(4)
    .map(line => {
      if (line.match(/@@/)) {
        return null;
      }
      if (line.match(/\\ No newline/)) {
        return null;
      }
      return line.replace(/^(-|\+)/, '$1 ');
    })
    .filter(line => typeof line !== 'undefined' && line !== null)
    .join('\n');
}
function createUnifiedDiff ( { actual , expected } ) { return diff . createPatch ( 'string' , actual , expected ) . split ( '\n' ) . splice ( 4 ) . map ( line => { if ( line . match ( / @@ / ) ) { return null ; } if ( line . match ( / \\ No newline / ) ) { return null ; } return line . replace ( / ^(-|\+) / , '$1 ' ) ; } ) . filter ( line => typeof line !== 'undefined' && line !== null ) . join ( '\n' ) ; }
Create a unified diff between two strings

@param {Error}  err          Error object
@param {string} err.actual   Actual result returned
@param {string} err.expected Result expected

@return {string} diff
Create a unified diff between two strings