☕️ Classic, reliable, trusted test framework for Node.js and the browser
report uncaught exceptions
Tj Holowaychukf93676be8e50
diff --git a/lib/runner.js b/lib/runner.jsindex 7e70a8b5..517ed9ad 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -186,9 +186,18 @@ Runner.prototype.runSuite = function(suite, fn){Runner.prototype.run = function(){var self = this;++ // run suitesthis.emit('start');this.runSuite(this.suite, function(){self.emit('end');});++ // uncaught exception+ process.on('uncaughtException', function(err){+ self.test.failed = true;+ self.emit('fail', self.test, err);+ });+return this;};diff --git a/test/unit/uncaught.js b/test/unit/uncaught.jsnew file mode 100644index 00000000..817a0141--- /dev/null+++ b/test/unit/uncaught.js@@ -0,0 +1,9 @@++describe('uncaught', function(){+ it('should report properly', function(test, done){+ // if you uncomment this :)+ process.nextTick(function(){+ throw new Error("I'm uncaught!");+ });+ });+});\ No newline at end of file