Skip to content

Commit

Permalink
Fix lcov relative path reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
moos committed Jul 8, 2020
1 parent 0a6ff5b commit 5ae1f40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/command/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Command.mix(ReportCommand, {
formatOption('--include <glob>', 'The glob pattern to select one or more coverage files, defaults to **/coverage*.json'),
formatOption('--depth <depth>', 'depth to show for detail reports (0 unlimited)'),
formatOption('--match <string>', 'pattern to match path to show for detail reports'),
formatOption('--relative', 'Use relative path in lcov report (default: false)'),
formatOption('--verbose, -v', 'verbose mode')
].join('\n\n'));

Expand All @@ -72,7 +73,8 @@ Command.mix(ReportCommand, {
include: String,
verbose: Boolean,
depth: Number,
match: String
match: String,
relative: Boolean
},
opts = nopt(template, { v : '--verbose' }, args, 0),
includePattern = opts.include || '**/coverage*.json',
Expand All @@ -83,7 +85,8 @@ Command.mix(ReportCommand, {
reporting: {
dir: opts.dir,
depth: opts.depth,
match: opts.match
match: opts.match,
relative: opts.relative
}
}),
formats = opts.argv.remain,
Expand Down
5 changes: 3 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function defaultConfig(includeBackCompatAttrs) {
reports: [ 'lcov' ],
dir: './coverage',
depth: 0,
match: ''
match: '',
relative: false
},
hooks: {
'hook-run-in-context': false,
Expand Down Expand Up @@ -263,7 +264,7 @@ function ReportingOptions(config) {
* @method reportConfig
* @return {Object} detailed report configuration per report format.
*/
addMethods(ReportingOptions, 'print', 'reports', 'dir', 'reportConfig','depth', 'match');
addMethods(ReportingOptions, 'print', 'reports', 'dir', 'reportConfig','depth', 'match', 'relative');

function isInvalidMark(v, key) {
var prefix = 'Watermark for [' + key + '] :';
Expand Down
1 change: 1 addition & 0 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Reporter.prototype = {
rptConfig.watermarks = config.reporting.watermarks();
rptConfig.depth = config.reporting.depth();
rptConfig.match = config.reporting.match();
rptConfig.relative = config.reporting.relative();

try {
this.reports[fmt] = Report.create(fmt, rptConfig);
Expand Down

0 comments on commit 5ae1f40

Please sign in to comment.