Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

adding test.skip()

Bryan Donovanb74621dc1df1
diff --git a/lib/interfaces/tdd.js b/lib/interfaces/tdd.js
index 0a17cd27..a252afcd 100644
--- a/lib/interfaces/tdd.js
+++ b/lib/interfaces/tdd.js
@@ -111,5 +111,13 @@ module.exports = function(suite){
var test = context.test(title, fn);
mocha.grep(test.fullTitle());
};
+
+ /**
+ * Pending test case.
+ */
+
+ context.test.skip = function(title){
+ context.test(title);
+ };
});
};
diff --git a/test/acceptance/interfaces/tdd.js b/test/acceptance/interfaces/tdd.js
index d63f500b..674dafaa 100644
--- a/test/acceptance/interfaces/tdd.js
+++ b/test/acceptance/interfaces/tdd.js
@@ -13,17 +13,23 @@ 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);
- })
+ });
+
+ test.skip('should skip this test', function(){
+ var zero = 0;
+ zero.should.equal(1, 'this test should have been skipped');
+ });
+
suiteTeardown(function(done){
initialValue.should.eql(42);
done();
});
- })
-})
+ });
+});