Skip to content

armgit / mocha

Public Imported from GitHub
0

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

revert uncaught "fix", breaks node

TJ Holowaychukd40df7a91b16
diff --git a/lib/runner.js b/lib/runner.js
index 73c320a8..854985a3 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -487,15 +487,10 @@ Runner.prototype.run = function(fn){
debug('start');
- // uncaught callback
- function uncaught(err, url, line) {
- self.uncaught(new Error(err + ' (' + url + ':' + line + ')'));
- }
-
// callback
this.on('end', function(){
debug('end');
- process.removeListener('uncaughtException', uncaught);
+ process.removeListener('uncaughtException', self.uncaught.bind(self));
fn(self.failures);
});
@@ -507,7 +502,7 @@ Runner.prototype.run = function(fn){
});
// uncaught exception
- process.on('uncaughtException', uncaught);
+ process.on('uncaughtException', this.uncaught.bind(this));
return this;
};