diff --git a/lib/internal/assert.js b/lib/internal/assert.js index 74f7e3f7c053c4..b6dd61b657d153 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -57,7 +57,7 @@ function createErrDiff(actual, expected, operator) { const actualLines = inspectValue(actual); const expectedLines = inspectValue(expected); const msg = READABLE_OPERATOR[operator] + - `:\n${green}+ expected${white} ${red}- actual${white}`; + `:\n${green}- expected${white} ${red}+ actual${white}`; const skippedMsg = ` ${blue}...${white} Lines skipped`; // Remove all ending lines that match (this optimizes the output for @@ -106,7 +106,7 @@ function createErrDiff(actual, expected, operator) { printedLines++; } lastPos = i; - other += `\n${green}+${white} ${expectedLines[i]}`; + other += `\n${green}-${white} ${expectedLines[i]}`; printedLines++; // Only extra actual lines exist } else if (expectedLines.length < i + 1) { @@ -122,7 +122,7 @@ function createErrDiff(actual, expected, operator) { printedLines++; } lastPos = i; - res += `\n${red}-${white} ${actualLines[i]}`; + res += `\n${red}+${white} ${actualLines[i]}`; printedLines++; // Lines diverge } else if (actualLines[i] !== expectedLines[i]) { @@ -138,8 +138,8 @@ function createErrDiff(actual, expected, operator) { printedLines++; } lastPos = i; - res += `\n${red}-${white} ${actualLines[i]}`; - other += `\n${green}+${white} ${expectedLines[i]}`; + res += `\n${red}+${white} ${actualLines[i]}`; + other += `\n${green}-${white} ${expectedLines[i]}`; printedLines += 2; // Lines are identical } else {