Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

4 participants

Romain osher Dan Jenkins Charlie Robbins
Romain

I am quite agree with #165, but I would prefer an other syntax :

{
 '// foo': function (result) {
    assert.equal(result, 'good');
 },

}

Every vow containing // (the space is important) will be in pending state.

Every topic under a pending context will 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.');
  }
}
osher

+1

Charlie Robbins
Owner

:+1: very simple feature addition. Will land in 0.9.0

Charlie Robbins indexzero added the v0.9.0 label
Charlie Robbins
Owner

Thanks. This is merged into the v0.9.x branch.

Charlie Robbins indexzero closed this
Charlie Robbins indexzero referenced this pull request
Merged

v0.9.0-rc1 #328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 46 additions and 2 deletions.
  1. +3 −1 lib/vows.js
  2. +2 −1  lib/vows/suite.js
  3. +41 −0 test/vows-test.js
4 lib/vows.js
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');
}
3  lib/vows/suite.js
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;
41 test/vows-test.js
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);
Something went wrong with that request. Please try again.