Comparing version 11.7.3 to 11.8.0
@@ -26,8 +26,6 @@ #!/usr/bin/env node | ||
if (argv._[0] === 'report') { | ||
// look in lib/commands/report.js for logic. | ||
} else if (argv._[0] === 'check-coverage') { | ||
// look in lib/commands/check-coverage.js for logic. | ||
} else if (argv._[0] === 'instrument') { | ||
// look in lib/commands/instrument.js for logic. | ||
if ([ | ||
'check-coverage', 'report', 'instrument', 'merge' | ||
].indexOf(argv._[0]) !== -1) { | ||
// look in lib/commands for logic. | ||
} else if (argv._.length) { | ||
@@ -34,0 +32,0 @@ // if instrument is set to false, |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="11.8.0"></a> | ||
# [11.8.0](https://github.com/istanbuljs/nyc/compare/v11.7.3...v11.8.0) (2018-05-14) | ||
### Features | ||
* merge together multiple istanbul format reports ([#840](https://github.com/istanbuljs/nyc/issues/840)) ([9def3eb](https://github.com/istanbuljs/nyc/commit/9def3eb)) | ||
<a name="11.7.3"></a> | ||
@@ -7,0 +17,0 @@ ## [11.7.3](https://github.com/istanbuljs/nyc/compare/v11.7.2...v11.7.3) (2018-05-10) |
20
index.js
@@ -424,9 +424,9 @@ /* global __coverage__ */ | ||
NYC.prototype._getCoverageMapFromAllCoverageFiles = function () { | ||
NYC.prototype.getCoverageMapFromAllCoverageFiles = function (baseDirectory) { | ||
var _this = this | ||
var map = libCoverage.createCoverageMap({}) | ||
this.eachReport(function (report) { | ||
this.eachReport(undefined, (report) => { | ||
map.merge(report) | ||
}) | ||
}, baseDirectory) | ||
// depending on whether source-code is pre-instrumented | ||
@@ -447,3 +447,3 @@ // or instrumented using a JIT plugin like babel-require | ||
var tree | ||
var map = this._getCoverageMapFromAllCoverageFiles() | ||
var map = this.getCoverageMapFromAllCoverageFiles() | ||
var context = libReport.createContext({ | ||
@@ -474,3 +474,3 @@ dir: this.reportDirectory(), | ||
NYC.prototype.checkCoverage = function (thresholds, perFile) { | ||
var map = this._getCoverageMapFromAllCoverageFiles() | ||
var map = this.getCoverageMapFromAllCoverageFiles() | ||
var nyc = this | ||
@@ -522,3 +522,5 @@ | ||
NYC.prototype.eachReport = function (filenames, iterator) { | ||
NYC.prototype.eachReport = function (filenames, iterator, baseDirectory) { | ||
baseDirectory = baseDirectory || this.tempDirectory() | ||
if (typeof filenames === 'function') { | ||
@@ -530,3 +532,3 @@ iterator = filenames | ||
var _this = this | ||
var files = filenames || fs.readdirSync(this.tempDirectory()) | ||
var files = filenames || fs.readdirSync(baseDirectory) | ||
@@ -537,3 +539,3 @@ files.forEach(function (f) { | ||
report = JSON.parse(fs.readFileSync( | ||
path.resolve(_this.tempDirectory(), f), | ||
path.resolve(baseDirectory, f), | ||
'utf-8' | ||
@@ -554,3 +556,3 @@ )) | ||
this.eachReport(filenames, function (report) { | ||
this.eachReport(filenames, (report) => { | ||
reports.push(report) | ||
@@ -557,0 +559,0 @@ }) |
@@ -246,4 +246,5 @@ 'use strict' | ||
.command(require('../lib/commands/report')) | ||
.command(require('../lib/commands/merge')) | ||
} | ||
module.exports = Config |
@@ -5,3 +5,4 @@ const parser = require('yargs-parser') | ||
'check-coverage', | ||
'instrument' | ||
'instrument', | ||
'merge' | ||
] | ||
@@ -8,0 +9,0 @@ |
{ | ||
"name": "nyc", | ||
"version": "11.7.3", | ||
"version": "11.8.0", | ||
"description": "the Istanbul command line interface", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14134680
4743
222059
201