Skip to content

Commit

Permalink
make importSuites work with jscover
Browse files Browse the repository at this point in the history
jscover, unlike jscoverage puts another entry into the suites export which
obviously fails the suit run.
  • Loading branch information
Reno Reckling authored and indexzero committed Nov 22, 2014
1 parent a39d1b8 commit 01590ff
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -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];
})
);
}, [])
}

Expand Down

0 comments on commit 01590ff

Please sign in to comment.