-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue and add relevant tests when describe and xdescribe fail …
…when not supplied with a callback (issue #1744).
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
describe('a suite without a callback'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
xdescribe('a pending suite without a callback'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); | ||
}); | ||
}); |