Specifying pending via options #204

Closed
wants to merge 1 commit into
from
View
@@ -79,8 +79,8 @@ module.exports = function(suite){
* acting as a thunk.
*/
- context.it = function(title, fn){
- suites[0].addTest(new Test(title, fn));
+ context.it = function(title, fn, options){
+ suites[0].addTest(new Test(title, fn, options));
};
});
};
View
@@ -87,8 +87,8 @@ module.exports = function(suite){
* acting as a thunk.
*/
- context.test = function(title, fn){
- suites[0].addTest(new Test(title, fn));
+ context.test = function(title, fn, options){
+ suites[0].addTest(new Test(title, fn, options));
};
});
};
View
@@ -19,9 +19,11 @@ module.exports = Test;
* @api private
*/
-function Test(title, fn) {
+function Test(title, fn, options) {
+ options = options || {};
+ var pending = options.pending;
Runnable.call(this, title, fn);
- this.pending = !fn;
+ this.pending = pending || !fn;
this.type = 'test';
}
View
@@ -1,4 +1,3 @@
-
suite('Array', function(){
suite('#indexOf()', function(){
var initialValue = 32;
@@ -13,17 +12,22 @@ suite('Array', function(){
initialValue.should.eql(42);
[1,2,3].indexOf(5).should.equal(-1);
[1,2,3].indexOf(0).should.equal(-1);
- })
+ });
test('should return the correct index when the value is present', function(){
initialValue.should.eql(42);
[1,2,3].indexOf(1).should.equal(0);
[1,2,3].indexOf(2).should.equal(1);
[1,2,3].indexOf(3).should.equal(2);
- })
+ });
+
suiteTeardown(function(done){
initialValue.should.eql(42);
done();
});
- })
-})
+ });
+});
+
+test('should recognize options.pending', function(){
+ throw new Error('should not be called');
+}, {pending: true});
View
@@ -1,4 +1,10 @@
describe('pending', function(){
it('should be allowed')
-})
+})
+
+describe('with options.pending = true', function() {
+ it('should not invoke the callback', function(done){
+ throw new Error('should not be called');
+ }, {pending: true})
+})
View
@@ -177,4 +177,4 @@ describe('Runnable(title, fn)', function(){
})
})
-})
+})