☕️ Classic, reliable, trusted test framework for Node.js and the browser
fix regexps in diffs. Closes #890
TJ Holowaychuk042d71317b57
diff --git a/lib/reporters/base.js b/lib/reporters/base.jsindex 215be456..1ce2e75e 100644--- a/lib/reporters/base.js+++ b/lib/reporters/base.js@@ -169,8 +169,8 @@ exports.list = function(failures){// explicitly show diffif (err.showDiff) {escape = false;- err.actual = actual = JSON.stringify(actual, null, 2);- err.expected = expected = JSON.stringify(expected, null, 2);+ err.actual = actual = stringify(actual);+ err.expected = expected = stringify(expected);}// actual / expected diff@@ -371,3 +371,16 @@ function colorLines(name, str) {return color(name, str);}).join('\n');}++/**+ * Stringify `obj`.+ *+ * @param {Mixed} obj+ * @return {String}+ * @api private+ */++function stringify(obj) {+ if (obj instanceof RegExp) return obj.toString();+ return JSON.stringify(obj, null, 2);+}