Skip to content

Commit

Permalink
adds support for individual configuration per reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Miranda committed May 23, 2015
1 parent bff20ce commit 7242ee3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ plugin.writeReports = function (opts) {
}

reporters = reporters.map(function (r) {
return Report.create(r, _.clone(opts.reportOpts));
var reportOpts = opts.reportOpts[r] || opts.reportOpts;
return Report.create(r, _.clone(reportOpts));
});

var cover = through();
Expand Down
24 changes: 24 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,30 @@ describe('gulp-istanbul', function () {
});
});

it('allow specifying configuration per report', function (done) {
process.stdout.write = function () {};
var opts = {
reporters: ['lcovonly', 'json'],
reportOpts: {
lcovonly: { dir: 'lcovonly', file: 'lcov-test.info' },
json: { dir: 'json', file: 'json-test.info' }
}
};

gulp.src(['test/fixtures/test/*.js'])
.pipe(mocha())
.pipe(istanbul.writeReports(opts))
.on('end', function() {
process.stdout.write = out;
assert(fs.existsSync('./lcovonly'));
assert(fs.existsSync('./lcovonly/lcov-test.info'));
assert(fs.existsSync('./json'));
assert(fs.existsSync('./json/json-test.info'));
process.stdout.write = out;
done();
});
});

it('allows specifying custom reporters', function (done) {
var ExampleReport = function() {};
ExampleReport.TYPE = 'example';
Expand Down

0 comments on commit 7242ee3

Please sign in to comment.