Skip to content

Commit

Permalink
keep hierarchy for skipped suites w/o a callback
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris authored and boneskull committed Mar 18, 2018
1 parent 39df783 commit 0060884
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/interfaces/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ module.exports = function (suites, context, mocha) {
suites.shift();
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
} else if (!opts.fn && suite.pending) {
suites.shift();
}

return suite;
Expand Down
9 changes: 9 additions & 0 deletions test/integration/fixtures/pending/skip-hierarchy.fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

describe('a suite', function(){
describe.skip('skipped suite 1');
describe.skip('skipped suite 2');
describe('another suite', function(){
it('a test', function(){})
})
});
15 changes: 15 additions & 0 deletions test/integration/pending.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ describe('pending', function () {
done();
});
});
it('should keep hierarchies of suites', function (done) {
run('pending/skip-hierarchy.fixture.js', args, function (err, res) {
if (err) {
done(err);
return;
}
assert.equal(res.stats.suites, 2);
assert.equal(res.stats.pending, 0);
assert.equal(res.stats.passes, 1);
assert.equal(res.stats.failures, 0);
assert.equal(res.code, 0);
assert.equal(res.passes[0].fullTitle, 'a suite another suite a test');
done();
});
});
});

describe('synchronous skip()', function () {
Expand Down

0 comments on commit 0060884

Please sign in to comment.