☕️ Classic, reliable, trusted test framework for Node.js and the browser
fix allowUncaught in browser
Laurence Rowefb1e0830b5e2
diff --git a/lib/runnable.js b/lib/runnable.jsindex e7b6aa12..ee8c4a34 100644--- a/lib/runnable.js+++ b/lib/runnable.js@@ -324,8 +324,11 @@ Runnable.prototype.run = function (fn) {}if (this.allowUncaught) {- callFn(this.fn);- done();+ if (this.isPending()) {+ done();+ } else {+ callFn(this.fn);+ }return;}diff --git a/lib/runner.js b/lib/runner.jsindex 1d3dd959..b024e0dc 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -432,15 +432,14 @@ Runner.prototype.runTest = function (fn) {if (this.asyncOnly) {test.asyncOnly = true;}-+ test.on('error', function (err) {+ self.fail(test, err);+ });if (this.allowUncaught) {test.allowUncaught = true;return test.run(fn);}try {- test.on('error', function (err) {- self.fail(test, err);- });test.run(fn);} catch (err) {fn(err);