Permalink
Browse files

Use writeFile instead of start/end pair to make the writer interface …

…narrower
  • Loading branch information...
1 parent 4653aec commit 906a0ba9af83912d4692db8f50a0e9fdad75e557 @gotwarlost gotwarlost committed Nov 5, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/report/lcovonly.js
@@ -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);
@@ -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();
}
});

0 comments on commit 906a0ba

Please sign in to comment.