Skip to content

Commit

Permalink
Fix an issue and add relevant tests when describe and xdescribe fail …
Browse files Browse the repository at this point in the history
…when not supplied with a callback (issue mochajs#1744).
  • Loading branch information
antoval committed Jul 22, 2015
1 parent 6d20329 commit 9da51db
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 79 deletions.
7 changes: 6 additions & 1 deletion lib/interfaces/bdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ module.exports = function(suite) {
*/

context.describe = context.context = function(title, fn) {
if (!fn) {
throw new TypeError('a callback is not supplied for the "' + title + '" suite');
}
var suite = Suite.create(suites[0], title);
suite.file = file;
suites.unshift(suite);
Expand All @@ -57,7 +60,9 @@ module.exports = function(suite) {
var suite = Suite.create(suites[0], title);
suite.pending = true;
suites.unshift(suite);
fn.call(suite);
if (fn) {
fn.call(suite);
}
suites.shift();
};

Expand Down
Loading

0 comments on commit 9da51db

Please sign in to comment.