Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed string diff newlines

TJ Holowaychukf5f45104d7a1
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index 2fe294a9..d4f63493 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -322,6 +322,7 @@ function pad(str, len) {
function errorDiff(err, type) {
return diff['diff' + type](err.actual, err.expected).map(function(str){
+ if (str.value == '\n') str.value = '<newline>\n';
if (str.added) return colorLines('diff added', str.value);
if (str.removed) return colorLines('diff removed', str.value);
return str.value;