Skip to content

Instantly share code, notes, and snippets.

@sompylasar
Created February 25, 2018 02:32
Show Gist options
  • Save sompylasar/95b87cf99644ef64d51e458bb33cfa34 to your computer and use it in GitHub Desktop.
Save sompylasar/95b87cf99644ef64d51e458bb33cfa34 to your computer and use it in GitHub Desktop.
jest-diff-multiline-vs-oneline created by sompylasar - https://repl.it/@sompylasar/jest-diff-multiline-vs-oneline
const jestDiff = require('jest-diff'); // should be [email protected]
function jestDiffAndPrint(a, b) {
console.log(
'----------- a:\n' +
a +
'\n----------- b:\n' +
b +
'\n----------- diff:\n' +
jestDiff(a, b) +
'\n-----------\n'
);
}
jestDiffAndPrint('foo\nbar\nbaz', 'foo\n');
jestDiffAndPrint('foo\nbar\nbaz', 'foo');
jestDiffAndPrint('foo', 'foo\n');
jestDiffAndPrint('foo', 'foo\nbar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment