☕️ Classic, reliable, trusted test framework for Node.js and the browser
Include assertion message as context (close #993)
Brian Lalor34116d5d67b7
diff --git a/lib/reporters/base.js b/lib/reporters/base.jsindex b21fefa2..d8687c72 100644--- a/lib/reporters/base.js+++ b/lib/reporters/base.js@@ -182,10 +182,13 @@ exports.list = function(failures){// actual / expected diffif ('string' == typeof actual && 'string' == typeof expected) {fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');+ var match = message.match(/^([^:]+): expected/);+ msg = match ? '\n ' + color('error message', match[1]) : '';+if (exports.inlineDiffs) {- msg = inlineDiff(err, escape);+ msg += inlineDiff(err, escape);} else {- msg = unifiedDiff(err, escape);+ msg += unifiedDiff(err, escape);}}@@ -462,3 +465,5 @@ function sameType(a, b) {b = Object.prototype.toString.call(b);return a == b;}++