aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nyc/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/nyc/lib
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/nyc/lib')
-rw-r--r--node_modules/nyc/lib/commands/instrument.js28
-rw-r--r--node_modules/nyc/lib/commands/report.js6
-rw-r--r--node_modules/nyc/lib/config-util.js30
-rw-r--r--node_modules/nyc/lib/instrumenters/istanbul.js5
-rw-r--r--node_modules/nyc/lib/process-args.js3
-rw-r--r--node_modules/nyc/lib/process.js2
6 files changed, 62 insertions, 12 deletions
diff --git a/node_modules/nyc/lib/commands/instrument.js b/node_modules/nyc/lib/commands/instrument.js
index cf1e97461..b24c0bb56 100644
--- a/node_modules/nyc/lib/commands/instrument.js
+++ b/node_modules/nyc/lib/commands/instrument.js
@@ -31,11 +31,26 @@ exports.builder = function (yargs) {
type: 'boolean',
description: "should nyc's instrumenter produce source maps?"
})
+ .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',
description: 'should nyc handle instrumentation?'
})
+ .option('exit-on-error', {
+ default: false,
+ type: 'boolean',
+ description: 'should nyc exit when an instrumentation failure occurs?'
+ })
.example('$0 instrument ./lib ./output', 'instrument all .js files in ./lib with coverage and output in ./output')
}
@@ -50,11 +65,18 @@ exports.handler = function (argv) {
sourceMap: argv.sourceMap,
produceSourceMap: argv.produceSourceMap,
extension: argv.extension,
- require: argv.require
+ require: argv.require,
+ compact: argv.compact,
+ preserveComments: argv.preserveComments,
+ exitOnError: argv.exitOnError
})
nyc.instrumentAllFiles(argv.input, argv.output, function (err) {
- if (err) console.error(err.message)
- process.exit(1)
+ if (err) {
+ console.error(err.message)
+ process.exit(1)
+ } else {
+ process.exit(0)
+ }
})
}
diff --git a/node_modules/nyc/lib/commands/report.js b/node_modules/nyc/lib/commands/report.js
index 8289980b9..ff89da3f8 100644
--- a/node_modules/nyc/lib/commands/report.js
+++ b/node_modules/nyc/lib/commands/report.js
@@ -29,6 +29,12 @@ exports.builder = function (yargs) {
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')
}
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
diff --git a/node_modules/nyc/lib/instrumenters/istanbul.js b/node_modules/nyc/lib/instrumenters/istanbul.js
index 38e5315bc..2cc1209aa 100644
--- a/node_modules/nyc/lib/instrumenters/istanbul.js
+++ b/node_modules/nyc/lib/instrumenters/istanbul.js
@@ -9,9 +9,10 @@ function InstrumenterIstanbul (cwd, options) {
autoWrap: true,
coverageVariable: '__coverage__',
embedSource: true,
- noCompact: false,
- preserveComments: true,
+ compact: options.compact,
+ preserveComments: options.preserveComments,
produceSourceMap: options.produceSourceMap,
+ ignoreClassMethods: options.ignoreClassMethods,
esModules: true
})
diff --git a/node_modules/nyc/lib/process-args.js b/node_modules/nyc/lib/process-args.js
index df6bcaac1..695f8e62a 100644
--- a/node_modules/nyc/lib/process-args.js
+++ b/node_modules/nyc/lib/process-args.js
@@ -2,7 +2,8 @@ const parser = require('yargs-parser')
const commands = [
'report',
'check-coverage',
- 'instrument'
+ 'instrument',
+ 'merge'
]
module.exports = {
diff --git a/node_modules/nyc/lib/process.js b/node_modules/nyc/lib/process.js
index 3976f14ed..c77ca503f 100644
--- a/node_modules/nyc/lib/process.js
+++ b/node_modules/nyc/lib/process.js
@@ -81,7 +81,7 @@ ProcessInfo.prototype.render = function (nyc) {
this.getCoverageMap(function (filenames, maps) {
var map = libCoverage.createCoverageMap({})
- nyc.loadReports(filenames).forEach(function (report) {
+ nyc.eachReport(filenames, function (report) {
map.merge(report)
})