diff --git a/integration_tests/__tests__/__snapshots__/failures.test.js.snap b/integration_tests/__tests__/__snapshots__/failures.test.js.snap index 98e588e7107f..bf9554f627e8 100644 --- a/integration_tests/__tests__/__snapshots__/failures.test.js.snap +++ b/integration_tests/__tests__/__snapshots__/failures.test.js.snap @@ -150,7 +150,7 @@ exports[`works with node assert 1`] = ` - Expected + Received - Object { + Object { \\"a\\": Object { \\"b\\": Object { - \\"c\\": 6, @@ -178,7 +178,7 @@ exports[`works with node assert 1`] = ` - Expected + Received - Object { + Object { \\"a\\": Object { \\"b\\": Object { - \\"c\\": 7, @@ -247,7 +247,7 @@ exports[`works with node assert 1`] = ` - Expected + Received - Object { + Object { - \\"a\\": 2, + \\"a\\": 1, } diff --git a/packages/jest-diff/src/diff_strings.js b/packages/jest-diff/src/diff_strings.js index 50da0c69b30f..56fbe03e3d52 100644 --- a/packages/jest-diff/src/diff_strings.js +++ b/packages/jest-diff/src/diff_strings.js @@ -71,12 +71,11 @@ const diffLines = (a: string, b: string): Diff => { .map(line => { const highlightedLine = highlightTrailingWhitespace(line, bgColor); const mark = color(part.added ? '+' : part.removed ? '-' : ' '); - return mark + ' ' + color(highlightedLine) + '\n'; + return mark + ' ' + color(highlightedLine); }) - .join(''); + .join('\n'); }) - .join('') - .trim(), + .join('\n'), isDifferent, }; }; @@ -125,17 +124,16 @@ const structuredPatch = (a: string, b: string, contextLines?: number): Diff => { const bgColor = getBgColor(added, removed); const highlightedLine = highlightTrailingWhitespace(line, bgColor); - return color(highlightedLine) + '\n'; + return color(highlightedLine); }) - .join(''); + .join('\n'); isDifferent = true; return shouldShowPatchMarks(hunk, oldLinesCount) ? createPatchMark(hunk) + lines : lines; }) - .join('') - .trim(), + .join('\n'), isDifferent, }; };