-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathreport.js
44 lines (40 loc) · 1.44 KB
/
report.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { checkCoverages } = require('./check-coverage')
const Report = require('../report')
exports.command = 'report'
exports.describe = 'read V8 coverage data from temp and output report'
exports.handler = async function (argv) {
await exports.outputReport(argv)
}
exports.outputReport = async function (argv) {
// TODO: this is a workaround until yargs gets upgraded to v17, see https://github.com/bcoe/c8/pull/332#discussion_r721636191
if (argv['100']) {
argv.checkCoverage = 100
argv.lines = 100
argv.functions = 100
argv.branches = 100
argv.statements = 100
}
const report = Report({
include: argv.include,
exclude: argv.exclude,
extension: argv.extension,
excludeAfterRemap: argv.excludeAfterRemap,
reporter: Array.isArray(argv.reporter) ? argv.reporter : [argv.reporter],
reportsDirectory: argv['reports-dir'],
reporterOptions: argv.reporterOptions || {},
tempDirectory: argv.tempDirectory,
watermarks: argv.watermarks,
resolve: argv.resolve,
omitRelative: argv.omitRelative,
wrapperLength: argv.wrapperLength,
all: argv.all,
allowExternal: argv.allowExternal,
src: argv.src,
skipFull: argv.skipFull,
excludeNodeModules: argv.excludeNodeModules,
mergeAsync: argv.mergeAsync,
monocartArgv: (argv.experimentalMonocart || process.env.EXPERIMENTAL_MONOCART) ? argv : null
})
await report.run()
if (argv.checkCoverage) await checkCoverages(argv, report)
}