Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed <=IE7 error messages

Guillermo Rauch5f155a8ef9de
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index fc564ac8..16628feb 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -100,6 +100,13 @@ function HTML(runner) {
} else {
var el = $('<div class="test fail"><h2>' + test.title + '</h2></div>');
var str = test.err.stack || test.err;
+
+ // <=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;
+ }
+
var err = $('<pre class="error">' + str + '</pre>');
el.append(err);
}