Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build

  • Loading branch information...
commit 750b66910cf487a4f492985fcf478712f07cb947 1 parent d1debba
@tj tj authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 mocha.js
View
9 mocha.js
@@ -1642,7 +1642,7 @@ function HTML(runner) {
var el = fragment('<div class="test pass pending"><h2>%e</h2></div>', test.title);
} else {
var el = fragment('<div class="test fail"><h2>%e</h2></div>', test.title);
- var str = test.err.stack || test.err;
+ var str = test.err.stack || test.err.toString();
// FF / Opera do not add the message
if (!~str.indexOf(test.err.message)) {
@@ -1653,6 +1653,11 @@ function HTML(runner) {
// check for the result of the stringifying.
if ('[object Error]' == str) str = test.err.message;
+ // Safari doesn't give you a stack. Let's at least provide a source line.
+ if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {
+ str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
+ }
+
el.appendChild(fragment('<pre class="error">%e</pre>', str));
}
@@ -4028,7 +4033,7 @@ window.mocha = require('mocha');
}
/**
- * Setup mocha with the give setting options.
+ * Setup mocha with the given setting options.
*/
mocha.setup = function(opts){
Please sign in to comment.
Something went wrong with that request. Please try again.