Skip to content

Commit

Permalink
deprecate this.skip for after/-Each hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Feb 7, 2019
1 parent 52b9a5f commit c033cc6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/runner.js
Expand Up @@ -379,6 +379,13 @@ Runner.prototype.hook = function(name, fn) {
if (err instanceof Pending) {
if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
self.test.pending = true;
if (name === HOOK_TYPE_AFTER_EACH) {
utils.deprecate(
'this.skip() in "' +
HOOK_TYPE_AFTER_EACH +
'()" hooks is DEPRECATED and will be removed from a future version of Mocha.'
);
}
} else {
suite.tests.forEach(function(test) {
test.pending = true;
Expand All @@ -388,6 +395,13 @@ Runner.prototype.hook = function(name, fn) {
});
// a pending hook won't be executed twice.
hook.pending = true;
if (name === HOOK_TYPE_AFTER_ALL) {
utils.deprecate(
'this.skip() in "' +
HOOK_TYPE_AFTER_ALL +
'()" hooks is DEPRECATED and will be removed from a future version of Mocha.'
);
}
}
} else {
self.failHook(hook, err);
Expand Down

0 comments on commit c033cc6

Please sign in to comment.