Skip to content

Commit

Permalink
feat: support coverage per spec
Browse files Browse the repository at this point in the history
Coverage reporter now listens after each spec end for coverage objects. If such is found it is merged using istanbul collector. At the browser end, the merged object is written into the report file.
Added handleling of no coverage on run complete - this is necessary,
because e2e scenario adapter sends the coverage objects on each spec
complete and does not send anything on run complete.
  • Loading branch information
manevpe authored and vojtajina committed Jun 13, 2013
1 parent 0329e02 commit 385b6e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ var CoverageReporter = function(rootConfig, emitter, helper, logger) {
var collector = collectors[browser.id];
if (cov && collector) {
collector.add(cov);
}
if (collector) {
pendingFileWritings++;
helper.mkdirIfNotExists(path.resolve(outDir), function() {
var now = dateformat(new Date(), 'yyyymmdd_HHMMss');
Expand All @@ -81,6 +83,12 @@ var CoverageReporter = function(rootConfig, emitter, helper, logger) {
}
};

this.onSpecComplete = function(browser, result) {
if (result.coverage) {
collectors[browser.id].add(result.coverage);
}
};

this.onRunComplete = function(browsers, results) {
browsers.forEach(function(browser) {
var collector = collectors[browser.id];
Expand Down

0 comments on commit 385b6e1

Please sign in to comment.