Skip to content

Commit 242323a

Browse files
author
Devin McIntyre
committed
feat: bcoe#547 add default-summary to report configurations
1 parent ff146b4 commit 242323a

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export declare class Report {
2323
src?: Array<string>,
2424
allowExternal?: boolean,
2525
skipFull?: boolean,
26-
excludeNodeModules?: boolean
26+
excludeNodeModules?: boolean,
27+
defaultSummarizer?: string
2728
})
2829
run(): Promise<void>;
2930
}

lib/commands/report.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ exports.outputReport = async function (argv) {
3737
skipFull: argv.skipFull,
3838
excludeNodeModules: argv.excludeNodeModules,
3939
mergeAsync: argv.mergeAsync,
40-
monocartArgv: (argv.experimentalMonocart || process.env.EXPERIMENTAL_MONOCART) ? argv : null
40+
monocartArgv: (argv.experimentalMonocart || process.env.EXPERIMENTAL_MONOCART) ? argv : null,
41+
defaultSummarizer: argv.defaultSummarizer
4142
})
4243
await report.run()
4344
if (argv.checkCoverage) await checkCoverages(argv, report)

lib/parse-args.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ function buildYargs (withCommands = false) {
163163
type: 'boolean',
164164
describe: 'Use Monocart coverage reports'
165165
})
166+
.option('default-summarizer', {
167+
default: 'pkg',
168+
type: 'string',
169+
describe: 'organization of HTML reports; choice of `pkg`, `nested`, or `flat`'
170+
})
166171
.pkgConf('c8')
167172
.demandCommand(1)
168173
.check((argv) => {

lib/report.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class Report {
3737
skipFull,
3838
excludeNodeModules,
3939
mergeAsync,
40-
monocartArgv
40+
monocartArgv,
41+
defaultSummarizer
4142
}) {
4243
this.reporter = reporter
4344
this.reporterOptions = reporterOptions || {}
@@ -62,6 +63,7 @@ class Report {
6263
this.skipFull = skipFull
6364
this.mergeAsync = mergeAsync
6465
this.monocartArgv = monocartArgv
66+
this.defaultSummarizer = defaultSummarizer;
6567
}
6668

6769
_getSrc (src) {
@@ -81,7 +83,8 @@ class Report {
8183
const context = libReport.createContext({
8284
dir: this.reportsDirectory,
8385
watermarks: this.watermarks,
84-
coverageMap: await this.getCoverageMapFromAllCoverageFiles()
86+
coverageMap: await this.getCoverageMapFromAllCoverageFiles(),
87+
defaultSummarizer: this.defaultSummarizer
8588
})
8689

8790
for (const _reporter of this.reporter) {
@@ -196,8 +199,7 @@ class Report {
196199

197200
clean: argv.clean,
198201

199-
// use default value for istanbul
200-
defaultSummarizer: 'pkg',
202+
defaultSummarizer: this.defaultSummarizer,
201203

202204
onEnd: (coverageResults) => {
203205
// for check coverage

0 commit comments

Comments
 (0)