SBoudrias / gulp-istanbul

Istanbul unit test coverage plugin for gulp.
MIT License
186 stars 87 forks source link

Fix override default reporters #101

Closed chernando closed 8 years ago

chernando commented 8 years ago

Hi!

Trying to limit the istanbul reporters to JSON with

.pipe(istanbul.writeReports({ reporters: ['json'] }));

I observed that other reporters were called too.

The problem is _.defaultsDeep doesn't work as expected in this situation.

var opts = {reporters: ['json']}

var opts = _.defaultsDeep(opts,
{reporters: [ 'lcov', 'json', 'text', 'text-summary' ]}
)

console.log(opts)

returns

{
  reporters: ["json", "json", "text", "text-summary"]
}

As a quick fix, I'm using

.pipe(istanbul.writeReports({ reporters: ['json', 'json', 'json', 'json'] }));

;-)

Moving reporters out of _.defaultsDeep does the trick.

SBoudrias commented 8 years ago

Thanks for sending a fix! Sorry for the slow reaction, I'm in vacation right now with limited access to internet :(