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

Commit 22c8347

Browse files
antovalboneskull
authored andcommitted
Fix an issue and add relevant tests when describe and xdescribe fail when not supplied with a callback (issue mochajs#1744).
1 parent 924a19b commit 22c8347

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
describe('a suite without a callback');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xdescribe('a pending suite without a callback');

test/integration/suite.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var assert = require('assert');
2+
var run = require('./helpers').runMocha;
3+
var args = [];
4+
5+
describe('.describe()', function() {
6+
this.timeout(1000);
7+
it('should throw a helpful error message when a callback for describe is not supplied', function(done) {
8+
run('suite/describe.callback.js', args, function(err, res) {
9+
assert(!err);
10+
pattern = new RegExp('TypeError: a callback is not supplied', 'g');
11+
var result = res.output.match(pattern) || [];
12+
assert.equal(result.length, 1);
13+
done();
14+
});
15+
});
16+
});
17+
18+
describe('.xdescribe()', function() {
19+
this.timeout(1000);
20+
it('should not throw an error when a callback for xdescribe is not supplied', function(done) {
21+
run('suite/xdescribe.callback.js', args, function(err, res) {
22+
assert(!err);
23+
pattern = new RegExp("Error", 'g');
24+
var result = res.output.match(pattern) || [];
25+
assert.equal(result.length, 0);
26+
done();
27+
});
28+
});
29+
});

0 commit comments

Comments
 (0)