Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed terrible FF / Opera stack traces

TJ Holowaychuk37c6b0027ae4
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index 5ca4ed72..7c439e46 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -101,6 +101,11 @@ function HTML(runner) {
var el = fragment('<div class="test fail"><h2>%e</h2></div>', test.title);
var str = test.err.stack || test.err;
+ // FF / Opera do not add the message
+ if (!~str.indexOf(test.err.message)) {
+ str = test.err.message + '\n' + str;
+ }
+
// <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
// check for the result of the stringifying.
if ('[object Error]' == str) str = test.err.message;