Skip to content

Commit

Permalink
runner.js: this.skip() in beforeEach hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Feb 18, 2019
1 parent 52b5c42 commit 862d296
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,13 @@ Runner.prototype.hook = function(name, fn) {
}
if (err) {
if (err instanceof Pending) {
if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
if (name === HOOK_TYPE_AFTER_EACH) {
self.test.pending = true;
} else if (name === HOOK_TYPE_BEFORE_EACH) {
self.test.pending = true;
if (err.message === 'sync skip') {
return fn(err);
}
} else {
suite.tests.forEach(function(test) {
test.pending = true;
Expand Down Expand Up @@ -634,7 +639,9 @@ Runner.prototype.runTests = function(suite, fn) {
self.emit(constants.EVENT_TEST_PENDING, test);
}
self.emit(constants.EVENT_TEST_END, test);
return next();
self.suite = errSuite;
return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
// return next();
}
if (err) {
return hookErr(err, errSuite, false);
Expand Down

0 comments on commit 862d296

Please sign in to comment.