Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Strip commas from the JSON.stringify output before diffing

Andreas Lind Petersenb4c5443452bb
diff --git a/lib/utils.js b/lib/utils.js
index f9902968..bd840835 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -312,7 +312,7 @@ exports.highlightTags = function(name) {
exports.stringify = function(obj) {
if (obj instanceof RegExp) return obj.toString();
- return JSON.stringify(exports.canonicalize(obj), null, 2);
+ return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1');
}
/**