From 01590ff86967a3922e7e10e65320e242fc1a6b74 Mon Sep 17 00:00:00 2001 From: Reno Reckling Date: Sat, 16 Mar 2013 20:51:21 +0100 Subject: [PATCH] make importSuites work with jscover jscover, unlike jscoverage puts another entry into the suites export which obviously fails the suit run. --- bin/vows | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/bin/vows b/bin/vows index 54acd6d..3a82f82 100755 --- a/bin/vows +++ b/bin/vows @@ -567,23 +567,27 @@ function importSuites(files) { } : function (suites, f) { //f = path.join(process.cwd(), path.relative(process.cwd(),f)); var obj = require(f); - return suites.concat(Object.keys(obj).map(function (s) { - try { - obj[s]._filename = cwdname(f); - } catch (e) { - if (e instanceof TypeError && typeof(obj[s]) === 'undefined') { - abort("runner", - "Caught a TypeError while trying to import " + - "suites: a suite is undefined." + - "Check your exports; are you doing something like " + - "exports.suite = vows.describe('foo')." + - "addBatch({}).run()? If so, remove '.run()'"); - } else { - throw e; - } - } - return obj[s]; - })); + return suites.concat( + Object.keys(obj) + .filter(function(s) { return s !== '_$jscoverage'; }) + .map(function (s) { + try { + obj[s]._filename = cwdname(f); + } catch (e) { + if (e instanceof TypeError && typeof(obj[s]) === 'undefined') { + abort("runner", + "Caught a TypeError while trying to import " + + "suites: a suite is undefined." + + "Check your exports; are you doing something like " + + "exports.suite = vows.describe('foo')." + + "addBatch({}).run()? If so, remove '.run()'"); + } else { + throw e; + } + } + return obj[s]; + }) + ); }, []) }