From 5ae1f40f42f38b8c3dbafdb492e0e64c6e02a59e Mon Sep 17 00:00:00 2001 From: Moos Date: Wed, 8 Jul 2020 14:11:37 -0700 Subject: [PATCH] Fix lcov relative path reporting --- lib/command/report.js | 7 +++++-- lib/config.js | 5 +++-- lib/reporter.js | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/command/report.js b/lib/command/report.js index ad01a786..66e5eefd 100644 --- a/lib/command/report.js +++ b/lib/command/report.js @@ -46,6 +46,7 @@ Command.mix(ReportCommand, { formatOption('--include ', 'The glob pattern to select one or more coverage files, defaults to **/coverage*.json'), formatOption('--depth ', 'depth to show for detail reports (0 unlimited)'), formatOption('--match ', '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')); @@ -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', @@ -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, diff --git a/lib/config.js b/lib/config.js index 355eb004..8623659d 100644 --- a/lib/config.js +++ b/lib/config.js @@ -34,7 +34,8 @@ function defaultConfig(includeBackCompatAttrs) { reports: [ 'lcov' ], dir: './coverage', depth: 0, - match: '' + match: '', + relative: false }, hooks: { 'hook-run-in-context': false, @@ -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 + '] :'; diff --git a/lib/reporter.js b/lib/reporter.js index 18bc8c0f..8f3bffcc 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -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);