Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Create pending tests by prefixing your tests name or context by '// ' #211

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+46 −2
Split
View
@@ -111,7 +111,9 @@ function addVow(vow) {
return this;
function runTest(args, ctx) {
- if (vow.callback instanceof String) {
+ if (vow.callback instanceof String
+ || vow.description.indexOf('// ') === 0
+ || vow.binding.context.title.indexOf('// ') !== -1) {
return output('pending');
}
View
@@ -131,7 +131,8 @@ this.Suite.prototype = new(function () {
// Run the topic, passing the previous context topics
// If topic `throw`s an exception, pass it down as a value
try {
- topic = topic.apply(ctx.env, ctx.topics);
+ if(ctx.title.indexOf('// ') === -1)
+ topic = topic.apply(ctx.env, ctx.topics);
}
catch (ex) {
topic = ex;
View
@@ -520,3 +520,44 @@ vows.describe('Async topic is passed to vows with topic-less subcontext').addBat
}
}
})['export'](module);
+
+vows.describe('Pending tests with // prefix').addBatch({
+ 'Given an honorable topic': {
+ topic: function () {
+ var callback = this.callback;
+ process.nextTick(function () {
+ callback(null, 42);
+ });
+ },
+ 'Then honorable vows are executed': function (topic) {
+ assert.equal(topic, 42);
+ },
+ '// and pending vows are not executed': function (topic) {
+ throw new Error('Should not be executed.');
+ },
+ '// and given a pending context': {
+ 'then every sub context are pending': function (topic) {
+ throw new Error('Should not be executed.');
+ }
+ },
+ 'given an honorable sub context': {
+ 'then honorable vows are executed': function (topic) {
+ assert.equal(topic, 42);
+ },
+ '// and pending vows are not executed': function (topic) {
+ throw new Error('Should not be executed.');
+ }
+ },
+ '// given a pending sub context with an inner topic': {
+ topic: function (parenttopic) {
+ process.nextTick(function(){
+ throw new Error('Should not be executed.');
+ })
+ return parenttopic + 1;
+ },
+ 'then both sub-topics and sub-vows are not executed': function (topic) {
+ throw new Error('Should not be executed.');
+ }
+ }
+ }
+})['export'](module);