Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep hierarchy for skipped suites w/o a callback #3242

Merged
merged 1 commit into from Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/interfaces/common.js
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
@@ -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
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