From a2e15a225185c8cfebe8d34695878d1caea73574 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Sat, 5 Jun 2010 16:46:34 -0400 Subject: [PATCH] better vow counting --- lib/vows/suite.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/vows/suite.js b/lib/vows/suite.js index 5191df2..b464380 100644 --- a/lib/vows/suite.js +++ b/lib/vows/suite.js @@ -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; };