Skip to content

Commit

Permalink
better vow counting
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 5, 2010
1 parent 7beb71d commit a2e15a2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ this.Suite.prototype = new(function () {
// so we know when the tests are over.
// We match the keys against `matcher`, to decide
// whether or not they should be included in the test.
(function count(tests) {
(function count(tests, _match) {
var match = false;
batch.remaining ++;

Object.keys(tests).filter(function (k) {
return k !== 'topic';
}).forEach(function (key) {
if (typeof(tests[key]) === "object") {
if (! (match = count(tests[key]) ||
match || vows.options.matcher.test(key))) {
delete tests[key];
batch.remaining --;
}
match = _match || matcher.test(key);

if (typeof(tests[key]) === 'object') {
match = count(tests[key], match);
}
});

if (match) { batch.remaining ++ }
else { tests._skip = true }

return match;
})(tests);
})(tests, false);
}
batch._remaining = batch.remaining;
};
Expand Down

0 comments on commit a2e15a2

Please sign in to comment.