istanbul-lib-coverage
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
@@ -8,5 +8,9 @@ /* | ||
/** | ||
* @module AllExports | ||
* istanbul-lib-coverage exports an API that allows you to create and manipulate | ||
* file coverage, coverage maps (a set of file coverage objects) and summary | ||
* coverage objects. File coverage for the same file can be merged as can | ||
* entire coverage maps. | ||
* | ||
* @module Exports | ||
*/ | ||
var CoverageSummary = require('./lib/file').CoverageSummary, | ||
@@ -13,0 +17,0 @@ FileCoverage = require('./lib/file').FileCoverage, |
@@ -22,5 +22,4 @@ /* | ||
} | ||
/** | ||
* CoverageMap is a map of `BaseCoverage` objects keyed by file paths. | ||
* CoverageMap is a map of `FileCoverage` objects keyed by file paths. | ||
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this | ||
@@ -39,3 +38,2 @@ * map's contents. This can be the raw global coverage object. | ||
} | ||
/** | ||
@@ -64,9 +62,11 @@ * merges a second coverage map into this one | ||
}; | ||
/** | ||
* returns a JSON-serializable POJO for this coverage map | ||
* @returns {Object} | ||
*/ | ||
CoverageMap.prototype.toJSON = function () { | ||
return this.data; | ||
}; | ||
/** | ||
* returns an array for files for which this map has coverage | ||
* returns an array for file paths for which this map has coverage | ||
* @returns {Array{string}} - array of files | ||
@@ -77,7 +77,6 @@ */ | ||
}; | ||
/** | ||
* returns the file coverage for the specified file. | ||
* @param {String} file | ||
* @returns {BaseCoverage} | ||
* @returns {FileCoverage} | ||
*/ | ||
@@ -95,3 +94,3 @@ CoverageMap.prototype.fileCoverageFor = function (file) { | ||
* otherwise a new key is added to the map. | ||
* @param {BaseCoverage} fc the file coverage to add | ||
* @param {FileCoverage} fc the file coverage to add | ||
*/ | ||
@@ -107,3 +106,6 @@ CoverageMap.prototype.addFileCoverage = function (fc) { | ||
}; | ||
/** | ||
* returns the coverage summary for all the file coverage objects in this map. | ||
* @returns {CoverageSummary} | ||
*/ | ||
CoverageMap.prototype.getCoverageSummary = function () { | ||
@@ -110,0 +112,0 @@ var that = this, |
@@ -227,19 +227,8 @@ /* | ||
}); | ||
// expose a synthetic `l` property for line coverage that computes | ||
// line coverage on the fly | ||
Object.defineProperty(FileCoverage.prototype, 'l', { | ||
enumerable: true, | ||
get: function () { | ||
return this.getLineCoverage(); | ||
} | ||
}); | ||
// returns the data associated with this coverage object | ||
FileCoverage.prototype.getData = function () { | ||
/** | ||
* return a JSON-serializable POJO for this file coverage object | ||
*/ | ||
FileCoverage.prototype.toJSON = function () { | ||
return this.data; | ||
}; | ||
// override toJSON to export just the data | ||
FileCoverage.prototype.toJSON = function () { | ||
return this.getData(); | ||
}; | ||
/** | ||
@@ -272,2 +261,5 @@ * merges a second coverage object into this one, updating hit counts | ||
if (typeof stats === 'function') { | ||
stats = stats.call(this); | ||
} | ||
Object.keys(stats).forEach(function (key) { | ||
@@ -302,3 +294,6 @@ var covered = !!stats[key]; | ||
}; | ||
/** | ||
* resets hit counts for all statements, functions and branches | ||
* in this coverage object resulting in zero coverage. | ||
*/ | ||
FileCoverage.prototype.resetHits = function () { | ||
@@ -326,3 +321,3 @@ var statements = this.s, | ||
var ret = {}; | ||
ret.lines = this.computeSimpleTotals('l'); | ||
ret.lines = this.computeSimpleTotals('getLineCoverage'); | ||
ret.functions = this.computeSimpleTotals('f', 'fnMap'); | ||
@@ -329,0 +324,0 @@ ret.statements = this.computeSimpleTotals('s', 'statementMap'); |
{ | ||
"name": "istanbul-lib-coverage", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"description": "Data library for istanbul coverage objects", | ||
@@ -10,3 +10,3 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", | ||
"pretest": "jshint index.js lib/ test/", | ||
"test": "istanbul cover --include-all-sources --print=both _mocha -- test/", | ||
"test": "istanbul cover -x 'docs/**' --include-all-sources --print=both _mocha -- test/", | ||
"posttest": "istanbul check-coverage --statements 95 --branches 80" | ||
@@ -13,0 +13,0 @@ }, |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
78082
13
1549
1