Skip to content

armgit / mocha

Public Imported from GitHub
0

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

refactor negated conditional with else branch

TJ Holowaychuk556d4e98a629
diff --git a/lib/runnable.js b/lib/runnable.js
index 1f10ae6d..22b62ba3 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -210,10 +210,10 @@ Runnable.prototype.run = function(fn){
// sync or promise-returning
try {
- if (!this.pending) {
- callFn(this.fn);
- } else {
+ if (this.pending) {
done();
+ } else {
+ callFn(this.fn);
}
} catch (err) {
done(err);