Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Nested suites for meta test

ScottFreeCoded165c82fa94d
diff --git a/test/integration/fixtures/regression/issue-2286.js b/test/integration/fixtures/regression/issue-2286.js
deleted file mode 100644
index 8a3c1ac4..00000000
--- a/test/integration/fixtures/regression/issue-2286.js
+++ /dev/null
@@ -1,5 +0,0 @@
-describe('testception for issue 2286 meta test', function () {
- beforeEach('skips tests', function () { this.skip() })
- after('should run', function () { console.log('after in suite') })
- it('skipped by beforeEach', function () {})
-})
diff --git a/test/integration/regression.js b/test/integration/regression.js
index 2edec801..b8c64b84 100644
--- a/test/integration/regression.js
+++ b/test/integration/regression.js
@@ -1,4 +1,4 @@
-var assert = require('assert');
+var assert = require('assert');
var fs = require('fs');
var path = require('path');
var run = require('./helpers').runMocha;
@@ -51,17 +51,15 @@ describe('regressions', function() {
});
})
- 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();
+ describe('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function () {
+ var afterWasRun = false;
+ describe('suite with skipped test for meta test', function () {
+ beforeEach(function () { this.skip(); });
+ after(function () { afterWasRun = true; });
+ it('should be pending', function () {});
+ })
+ after('meta test', function () {
+ afterWasRun.should.be.ok();
});
- })
+ });
});