Closed rundef closed 8 years ago
What I normally do is run the unit coverage and drop it into a ./unit
directory and then run the bdd
tests and drop them into ./bdd
. Then use a script like this to generate the results for both:
var istanbul = require('istanbul'),
path = require('path'),
collector = new istanbul.Collector();
['unit', 'bdd'].forEach(function(item) {
var file = path.join(__dirname, item, 'coverage.json');
collector.add(JSON.parse(fs.readFileSync(file, 'utf8')));
});
['lcov', 'json'].forEach(function(type) {
var report = istanbul.Report.create(type, {
dir: path.join(__dirname, 'full')
});
report.writeReport(collector, true);
});
Works perfectly, thank you @davglass
Hi, I have a projects who has two test frameworks :
We're trying to use istanbul to calculate code coverage, but we aren't able to calculate both the unit tests coverage and bdd tests coverage at the same time.
istanbul cover ./node_modules/.bin/mocha works istanbul cover ./node_modules/.bin/cucumberjs works istanbul cover ./node_modules/.bin/mocha ./node_modules/.bin/cucumberjs doesn't work
From what I understand, the ./node_modules/.bin/cucumberjs part is sent as command line argument to mocha.
Is there any way to make this work ?
Thanks