Skip to content

Commit 01590ff

Browse files
Reno Recklingindexzero
Reno Reckling
authored andcommitted
make importSuites work with jscover
jscover, unlike jscoverage puts another entry into the suites export which obviously fails the suit run.
1 parent a39d1b8 commit 01590ff

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

bin/vows

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -567,23 +567,27 @@ function importSuites(files) {
567567
} : function (suites, f) {
568568
//f = path.join(process.cwd(), path.relative(process.cwd(),f));
569569
var obj = require(f);
570-
return suites.concat(Object.keys(obj).map(function (s) {
571-
try {
572-
obj[s]._filename = cwdname(f);
573-
} catch (e) {
574-
if (e instanceof TypeError && typeof(obj[s]) === 'undefined') {
575-
abort("runner",
576-
"Caught a TypeError while trying to import " +
577-
"suites: a suite is undefined." +
578-
"Check your exports; are you doing something like " +
579-
"exports.suite = vows.describe('foo')." +
580-
"addBatch({}).run()? If so, remove '.run()'");
581-
} else {
582-
throw e;
583-
}
584-
}
585-
return obj[s];
586-
}));
570+
return suites.concat(
571+
Object.keys(obj)
572+
.filter(function(s) { return s !== '_$jscoverage'; })
573+
.map(function (s) {
574+
try {
575+
obj[s]._filename = cwdname(f);
576+
} catch (e) {
577+
if (e instanceof TypeError && typeof(obj[s]) === 'undefined') {
578+
abort("runner",
579+
"Caught a TypeError while trying to import " +
580+
"suites: a suite is undefined." +
581+
"Check your exports; are you doing something like " +
582+
"exports.suite = vows.describe('foo')." +
583+
"addBatch({}).run()? If so, remove '.run()'");
584+
} else {
585+
throw e;
586+
}
587+
}
588+
return obj[s];
589+
})
590+
);
587591
}, [])
588592
}
589593

0 commit comments

Comments
 (0)