Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Correctly skip tests when skipping in a suites before()

Ryan Shawc97d03a164e2
diff --git a/lib/runner.js b/lib/runner.js
index 0979bbc2..9bb53441 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -507,8 +507,12 @@ Runner.prototype.runTests = function(suite, fn) {
return;
}
+ function parentPending(suite) {
+ return suite.pending || (suite.parent && parentPending(suite.parent));
+ }
+
// pending
- if (test.pending) {
+ if (test.pending || parentPending(test.parent)) {
self.emit('pending', test);
self.emit('test end', test);
return next();