Skip to content

Commit

Permalink
only use background color for inline diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brade committed Jun 9, 2020
1 parent a01b05e commit 166ff91
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/reporters/base.js
Expand Up @@ -68,8 +68,10 @@ exports.colors = {
green: 32,
light: 90,
'diff gutter': 90,
'diff added': '30;42',
'diff removed': '30;41'
'diff added': 32,
'diff removed': 31,
'diff added inline': '30;42',
'diff removed inline': '30;41'
};

/**
Expand Down Expand Up @@ -189,9 +191,9 @@ var generateDiff = (exports.generateDiff = function(actual, expected) {
} catch (err) {
var msg =
'\n ' +
color('diff added', '+ expected') +
color('diff added' + (exports.inlineDiffs ? " inline" : ""), '+ expected') +
' ' +
color('diff removed', '- actual: failed to generate Mocha diff') +
color('diff removed' + (exports.inlineDiffs ? " inline" : ""), '- actual: failed to generate Mocha diff') +
'\n';
return msg;
}
Expand Down Expand Up @@ -406,9 +408,9 @@ function inlineDiff(actual, expected) {
// legend
msg =
'\n' +
color('diff removed', 'actual') +
color('diff removed inline', 'actual') +
' ' +
color('diff added', 'expected') +
color('diff added inline', 'expected') +
'\n\n' +
msg +
'\n';
Expand Down Expand Up @@ -474,10 +476,10 @@ function errorDiff(actual, expected) {
.diffWordsWithSpace(actual, expected)
.map(function(str) {
if (str.added) {
return colorLines('diff added', str.value);
return colorLines('diff added inline', str.value);
}
if (str.removed) {
return colorLines('diff removed', str.value);
return colorLines('diff removed inline', str.value);
}
return str.value;
})
Expand Down

0 comments on commit 166ff91

Please sign in to comment.