Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Update built mocha.js file

Justin DuJardind1332acbd8ab
diff --git a/mocha.js b/mocha.js
index 2e40cae6..0ec5d06f 100644
--- a/mocha.js
+++ b/mocha.js
@@ -4544,16 +4544,17 @@ Runner.prototype.uncaught = function(err){
Runner.prototype.run = function(fn){
var self = this
- , fn = fn || function(){};
+ , fn = fn || function(){}
+ , uncaught = function(err){
+ self.uncaught(err);
+ };
debug('start');
// callback
this.on('end', function(){
debug('end');
- process.removeListener('uncaughtException', function(err){
- self.uncaught(err);
- });
+ process.removeListener('uncaughtException', uncaught);
fn(self.failures);
});
@@ -4565,9 +4566,7 @@ Runner.prototype.run = function(fn){
});
// uncaught exception
- process.on('uncaughtException', function(err){
- self.uncaught(err);
- });
+ process.on('uncaughtException', uncaught);
return this;
};