Skip to content

Commit

Permalink
Use background color in an inline-diffs (#4287)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brade committed Jun 22, 2020
1 parent 61cbb85 commit a1d3984
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/reporters/base.js
Expand Up @@ -69,7 +69,9 @@ exports.colors = {
light: 90,
'diff gutter': 90,
'diff added': 32,
'diff removed': 31
'diff removed': 31,
'diff added inline': '30;42',
'diff removed inline': '30;41'
};

/**
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 a1d3984

Please sign in to comment.