☕️ Classic, reliable, trusted test framework for Node.js and the browser
Add failing test: after hook not run if beforeEach skipped test
David da Silva2c9966c950f5
diff --git a/test/integration/fixtures/regression/issue-2286.js b/test/integration/fixtures/regression/issue-2286.jsnew file mode 100644index 00000000..e912d938--- /dev/null+++ b/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 () {})+})diff --git a/test/integration/regression.js b/test/integration/regression.jsindex f20f601e..2edec801 100644--- a/test/integration/regression.js+++ b/test/integration/regression.js@@ -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();+ });+ })});