Skip to content

Commit

Permalink
Merge pull request #19 from oNaiPs/master
Browse files Browse the repository at this point in the history
Added remap config options
  • Loading branch information
mattlewis92 authored Dec 20, 2016
2 parents 206a34b + f69e768 commit 85c29d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Add the plugin, reporter and reporter configuration in your `karma.conf.js`.
plugins: ['karma-remap-istanbul'],
reporters: ['progress', 'karma-remap-istanbul'],
remapIstanbulReporter: {
remapOptions: {}, //additional remap options
reports: {
lcovonly: 'path/to/output/coverage/lcov.info',
html: 'path/to/output/html/report'
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var istanbul = require('istanbul');
var remap = require('remap-istanbul/lib/remap').default;
var writeReport = require('remap-istanbul/lib/writeReport').default;
var assign = require('object.assign/polyfill')();

var KarmaRemapIstanbul = function (baseReporterDecorator, logger, config) {
baseReporterDecorator(this);
Expand All @@ -11,6 +12,7 @@ var KarmaRemapIstanbul = function (baseReporterDecorator, logger, config) {

var remapIstanbulReporterConfig = config.remapIstanbulReporter || {};
var reports = remapIstanbulReporterConfig.reports || {};
var remapOptions = remapIstanbulReporterConfig.remapOptions || {};

var coverageMap;

Expand Down Expand Up @@ -52,7 +54,10 @@ var KarmaRemapIstanbul = function (baseReporterDecorator, logger, config) {
})();

var sourceStore = istanbul.Store.create('memory');
var collector = remap(unmappedCoverage, {sources: sourceStore});

var collector = remap(unmappedCoverage, assign({
sources: sourceStore
}, remapOptions));

if (Object.keys(sourceStore.map).length === 0) {
sourceStore = undefined;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"homepage": "https://github.com/marcules/karma-remap-istanbul#readme",
"dependencies": {
"istanbul": "^0.4.3",
"object.assign": "^4.0.4",
"remap-istanbul": "^0.8.2"
},
"peerDependencies": {
Expand Down

0 comments on commit 85c29d6

Please sign in to comment.