/
report.js
49 lines (45 loc) · 1.18 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
45
46
47
48
49
var NYC
try {
NYC = require('../../index.covered.js')
} catch (e) {
NYC = require('../../index.js')
}
exports.command = 'report'
exports.describe = 'run coverage report for .nyc_output'
exports.builder = function (yargs) {
return yargs
.option('reporter', {
alias: 'r',
describe: 'coverage reporter(s) to use',
default: 'text'
})
.option('report-dir', {
describe: 'directory to output coverage reports in',
default: 'coverage'
})
.option('temp-dir', {
alias: 't',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
})
.option('temp-directory', {
hidden: true
})
.option('show-process-tree', {
describe: 'display the tree of spawned processes',
default: false,
type: 'boolean'
})
.option('skip-empty', {
describe: 'don\'t show empty files (no lines of code) in report',
default: false,
type: 'boolean',
global: false
})
.example('$0 report --reporter=lcov', 'output an HTML lcov report to ./coverage')
}
exports.handler = function (argv) {
process.env.NYC_CWD = process.cwd()
var nyc = new NYC(argv)
nyc.report()
}