☕️ Classic, reliable, trusted test framework for Node.js and the browser
Modified asyncronous errors to provide some level of context.
Merrick Christensen7e99af037539
diff --git a/lib/reporters/html.js b/lib/reporters/html.jsindex edbb188b..7bdac333 100644--- a/lib/reporters/html.js+++ b/lib/reporters/html.js@@ -116,7 +116,7 @@ function HTML(runner, root) {});runner.on('fail', function(test, err){- if ('hook' == test.type || err.uncaught) runner.emit('test end', test);+ if ('hook' == test.type) runner.emit('test end', test);});runner.on('test end', function(test){diff --git a/lib/runner.js b/lib/runner.jsindex 44b61a2f..9354d2e9 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -181,9 +181,10 @@ Runner.prototype.checkGlobals = function(test){Runner.prototype.fail = function(test, err){++this.failures;test.state = 'failed';- if ('string' == typeof err) {+ if ('string' == typeof err && ! err.uncaught) {err = new Error('the string "' + err + '" was thrown, throw an Error :)');}+this.emit('fail', test, err);};@@ -486,8 +487,8 @@ Runner.prototype.run = function(fn){debug('start');// uncaught callback- function uncaught(err) {- self.uncaught(err);+ function uncaught(err, url, line) {+ self.uncaught(new Error(err + '(' + url + ':' + line + ')'));}// callback