Skip to content

Commit

Permalink
add lcov
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Dec 6, 2023
1 parent 8a1619c commit 8fddc54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/default/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ module.exports = {

// [Istanbul only] defaultSummarizer, sourceFinder

// (Boolean) Quickly add lcovonly report. Defaults to false.
lcov: false,

// (Function) source path handler.
// sourcePath: (filePath) => `wwwroot/${filePath}`,
sourcePath: null,
Expand Down
9 changes: 7 additions & 2 deletions lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ const generateV8ListReports = async (v8list, coverageData, fileSources, options)

// ========================================================================================================

const getReportGroup = (reports, dataType) => {
const getReportGroup = (reports, lcov, dataType) => {

const reportMap = {};

// Quickly add lcovonly report
if (lcov) {
reportMap.lcovonly = {};
}

const defaultReport = dataType === 'v8' ? 'v8' : 'html';

if (Util.isList(reports)) {
Expand Down Expand Up @@ -83,7 +88,7 @@ const generateCoverageReports = async (dataList, options) => {
// console.log('data type', dataType);

// init reports
options.reportGroup = getReportGroup(options.reports, dataType);
options.reportGroup = getReportGroup(options.reports, options.lcov, dataType);
// console.log('reportGroup', options.reportGroup);

// v8list
Expand Down
3 changes: 3 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export type CoverageReportOptions = {

// [Istanbul only] defaultSummarizer, sourceFinder

// (Boolean) Quickly add lcovonly report. Defaults to false.
lcov?: boolean,

// (Function) source path handler.
sourcePath?: (filePath: string) => string,

Expand Down

0 comments on commit 8fddc54

Please sign in to comment.