From 781c126f32730ea79ef6ad3bd8bcfa8f311256b6 Mon Sep 17 00:00:00 2001 From: Wei Kin Huang Date: Tue, 7 Apr 2015 18:25:15 -0400 Subject: [PATCH 1/2] fix: reporter allow using a externally provided source cachere for reporters change `coverageReporter` options to allow for specifying `sourceStore`, this is an instance of `istanbul.Store` to look up source files. This allows using external coverage collectors like `browserify-istanbul` for instrumenting code. --- lib/reporter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/reporter.js b/lib/reporter.js index 9ccbe56..2883600 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -138,11 +138,12 @@ var CoverageReporter = function(rootConfig, helper, logger) { reporterConfig.dir || config.dir, reporterConfig.subdir || config.subdir))); var _ = helper._; - var options = helper.merge({}, config, reporterConfig, { - dir : outputDir, + var options = helper.merge({ sourceStore : _.isEmpty(sourceCache) ? null : new SourceCacheStore({ sourceCache: sourceCache }) + }, config, reporterConfig, { + dir : outputDir }); var reporter = istanbul.Report.create(reporterConfig.type || 'html', options); From 9b1517ff5ca6d1012572c99f25d925e931efdfcf Mon Sep 17 00:00:00 2001 From: Wei Kin Huang Date: Tue, 9 Jun 2015 10:05:35 -0400 Subject: [PATCH 2/2] Add documentation --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index f73dbc8..c6c290e 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,20 @@ coverageReporter: { } ``` +#### sourceStore +**Type:** istanbul.Store + +You can opt to specify a source store allowing for external coverage collectors access to the instrumented code. + +```javascript +coverageReporter: { + type : 'text', + dir : 'coverage/', + file : 'coverage.txt', + sourceStore : require('istanbul').Store.create('fslookup') +} +``` + #### multiple reporters You can use multiple reporters, by providing array of options.