Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

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 authored and boneskull committed Sep 19, 2016
1 parent 924a19b commit 22c8347
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/integration/fixtures/suite/describe.callback.js
@@ -0,0 +1 @@
describe('a suite without a callback');
1 change: 1 addition & 0 deletions test/integration/fixtures/suite/xdescribe.callback.js
@@ -0,0 +1 @@
xdescribe('a pending suite without a callback');
29 changes: 29 additions & 0 deletions test/integration/suite.js
@@ -0,0 +1,29 @@
var assert = require('assert');
var run = require('./helpers').runMocha;
var args = [];

describe('.describe()', function() {
this.timeout(1000);
it('should throw a helpful error message when a callback for describe is not supplied', function(done) {
run('suite/describe.callback.js', args, function(err, res) {
assert(!err);
pattern = new RegExp('TypeError: a callback is not supplied', 'g');
var result = res.output.match(pattern) || [];
assert.equal(result.length, 1);
done();
});
});
});

describe('.xdescribe()', function() {
this.timeout(1000);
it('should not throw an error when a callback for xdescribe is not supplied', function(done) {
run('suite/xdescribe.callback.js', args, function(err, res) {
assert(!err);
pattern = new RegExp("Error", 'g');
var result = res.output.match(pattern) || [];
assert.equal(result.length, 0);
done();
});
});
});

0 comments on commit 22c8347

Please sign in to comment.