Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Use background color in an inline-diffs (#4287)

Michael Bradea1d39845510d
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index cdf77a28..aeca18f3 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -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'
};
/**
@@ -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';
@@ -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;
})