☕️ Classic, reliable, trusted test framework for Node.js and the browser
simplify asyncOnly logic
Aaron Heckmann0717e8a55a3b
diff --git a/lib/runnable.js b/lib/runnable.jsindex 9c4c6f6a..4682e512 100644--- a/lib/runnable.js+++ b/lib/runnable.js@@ -186,11 +186,6 @@ Runnable.prototype.run = function(fn){// asyncif (this.async) {-- if (this.asyncOnly && !(this.fn && this.fn.length)) {- return done(new Error('asyncOnly option in use without declaring `done()`'));- }-try {this.fn.call(ctx, function(err){if (err instanceof Error) return done(err);@@ -203,6 +198,9 @@ Runnable.prototype.run = function(fn){return;}+ if (this.asyncOnly)+ return done(new Error('--async-only option in use without declaring `done()`'));+// synctry {if (!this.pending) this.fn.call(ctx);diff --git a/lib/runner.js b/lib/runner.jsindex 20994433..ce2b5044 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -332,8 +332,7 @@ Runner.prototype.runTest = function(fn){var test = this.test, self = this;- if (this.asyncOnly)- test.async = test.asyncOnly = true;+ if (this.asyncOnly) test.asyncOnly = true;try {test.on('error', function(err){