Skip to content

Commit

Permalink
Use writeFile instead of start/end pair to make the writer interface …
Browse files Browse the repository at this point in the history
…narrower
  • Loading branch information
gotwarlost committed Nov 5, 2012
1 parent 4653aec commit 906a0ba
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/report/lcovonly.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var path = require('path'),
function LcovOnlyReport(opts) {
this.opts = opts || {};
this.opts.dir = this.opts.dir || process.cwd();
this.opts.writer = this.opts.writer || null;
}
LcovOnlyReport.TYPE = 'lcovonly';
util.inherits(LcovOnlyReport, Report);
Expand Down Expand Up @@ -71,13 +72,13 @@ Report.mix(LcovOnlyReport, {

writeReport: function (collector, sync) {
var outputFile = path.resolve(this.opts.dir, 'lcov.info'),
writer = new Writer(sync),
writer = this.opts.writer || new Writer(sync),
that = this;
writer.start(outputFile);
collector.files().forEach(function (key) {
that.writeFileCoverage(writer, collector.fileCoverageFor(key));
writer.writeFile(outputFile, function () {
collector.files().forEach(function (key) {
that.writeFileCoverage(writer, collector.fileCoverageFor(key));
});
});
writer.end();
}
});

Expand Down

0 comments on commit 906a0ba

Please sign in to comment.