aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nyc/lib/config-util.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/nyc/lib/config-util.js')
-rw-r--r--node_modules/nyc/lib/config-util.js30
1 files changed, 25 insertions, 5 deletions
diff --git a/node_modules/nyc/lib/config-util.js b/node_modules/nyc/lib/config-util.js
index 2c55a3a11..b202ab445 100644
--- a/node_modules/nyc/lib/config-util.js
+++ b/node_modules/nyc/lib/config-util.js
@@ -18,8 +18,8 @@ function guessCWD (cwd) {
return cwd
}
-function loadConfig (argv, cwd) {
- const rcPath = findUp.sync(['.nycrc', '.nycrc.json'], {cwd: cwd})
+Config.loadConfig = function (argv, cwd) {
+ const rcPath = findUp.sync([argv.nycrcPath || '.nycrc', '.nycrc.json'], {cwd: guessCWD(cwd)})
let config = {}
if (rcPath) {
@@ -40,7 +40,6 @@ function loadConfig (argv, cwd) {
// that would cause the application to exit early.
Config.buildYargs = function (cwd) {
cwd = guessCWD(cwd)
- const config = loadConfig()
return Yargs([])
.usage('$0 [command] [options]')
.usage('$0 [options] [bin-to-instrument]')
@@ -48,7 +47,7 @@ Config.buildYargs = function (cwd) {
alias: 'r',
describe: 'coverage reporter(s) to use',
default: 'text',
- globa: false
+ global: false
})
.option('report-dir', {
describe: 'directory to output coverage reports in',
@@ -166,6 +165,16 @@ Config.buildYargs = function (cwd) {
description: "should nyc's instrumenter produce source maps?",
global: false
})
+ .option('compact', {
+ default: true,
+ type: 'boolean',
+ description: 'should the output be compacted?'
+ })
+ .option('preserve-comments', {
+ default: true,
+ type: 'boolean',
+ description: 'should comments be preserved in the output?'
+ })
.option('instrument', {
default: true,
type: 'boolean',
@@ -196,11 +205,22 @@ Config.buildYargs = function (cwd) {
type: 'boolean',
global: false
})
+ .option('nycrc-path', {
+ default: '.nycrc',
+ description: 'specify a different .nycrc path',
+ global: false
+ })
.option('temp-directory', {
describe: 'directory to output raw coverage information to',
default: './.nyc_output',
global: false
})
+ .option('skip-empty', {
+ describe: 'don\'t show empty files (no lines of code) in report',
+ default: false,
+ type: 'boolean',
+ global: false
+ })
.pkgConf('nyc', cwd)
.example('$0 npm test', 'instrument your tests with coverage')
.example('$0 --require babel-core/register npm test', 'instrument your tests with coverage and transpile with Babel')
@@ -208,7 +228,6 @@ Config.buildYargs = function (cwd) {
.epilog('visit https://git.io/vHysA for list of available reporters')
.boolean('h')
.boolean('version')
- .config(config)
.help(false)
.version(false)
}
@@ -224,6 +243,7 @@ Config.addCommandsAndHelp = function (yargs) {
.command(require('../lib/commands/check-coverage'))
.command(require('../lib/commands/instrument'))
.command(require('../lib/commands/report'))
+ .command(require('../lib/commands/merge'))
}
module.exports = Config