Skip to content

Commit

Permalink
Add failing test: after hook not run if beforeEach skipped test
Browse files Browse the repository at this point in the history
Related to #2286.
  • Loading branch information
dasilvacontin committed May 29, 2016
1 parent e939d8e commit 2c9966c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/integration/fixtures/regression/issue-2286.js
@@ -0,0 +1,5 @@
describe('suite', function () {
beforeEach(function () { this.skip() })
after(function () { console.log('after in suite') })
it('test', function () {})
})
14 changes: 14 additions & 0 deletions test/integration/regression.js
Expand Up @@ -50,4 +50,18 @@ describe('regressions', function() {
done();
});
})

it('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function(done) {
var args = [];
run('regression/issue-2286.js', args, function(err, res) {
var occurences = function(str) {
var pattern = new RegExp(str, 'g');
return (res.output.match(pattern) || []).length;
};

assert(!err);
assert.equal(occurences('after in suite'), 1);
done();
});
})
});

0 comments on commit 2c9966c

Please sign in to comment.