Skip to content

Commit

Permalink
only count vows if passing an object to addVows()
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 11, 2010
1 parent 0dd8387 commit 4fc5b9c
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,26 @@ function addVows(tests) {

vows.promises.push(promise);

// Count the number of vows/promises expected to fire,
// 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) {
var match = false;
remaining++;
Object.keys(tests).forEach(function (key) {
if (typeof(tests[key]) === "object" && !Array.isArray(tests[key])) {
if (! (match = count(tests[key]) ||
match || vows.options.matcher.test(key))) {
delete tests[key];
remaining--;
if (typeof(tests) === 'object') {
// Count the number of vows/promises expected to fire,
// 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) {
var match = false;
remaining++;
Object.keys(tests).forEach(function (key) {
if (typeof(tests[key]) === "object" && !Array.isArray(tests[key])) {
if (! (match = count(tests[key]) ||
match || vows.options.matcher.test(key))) {
delete tests[key];
remaining--;
}
}
}
});
return match;
})(tests);
});
return match;
})(tests);
}

this.addListener("end", function () {
var topic, vow, env;
Expand Down

0 comments on commit 4fc5b9c

Please sign in to comment.