Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.2...istanbul-lib-coverage@3.0.0) (2019-12-20)
**Note:** Version bump only for package istanbul-lib-coverage
# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.1...istanbul-lib-coverage@3.0.0-alpha.2) (2019-12-07)
**Note:** Version bump only for package istanbul-lib-coverage
# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.0...istanbul-lib-coverage@3.0.0-alpha.1) (2019-10-06)
### Bug Fixes
* Drop unneeded coverage data from `nyc --all` ([#456](https://github.com/istanbuljs/istanbuljs/issues/456)) ([f6bb0b4](https://github.com/istanbuljs/istanbuljs/commit/f6bb0b4)), closes [#123](https://github.com/istanbuljs/istanbuljs/issues/123) [#224](https://github.com/istanbuljs/istanbuljs/issues/224) [#260](https://github.com/istanbuljs/istanbuljs/issues/260) [#322](https://github.com/istanbuljs/istanbuljs/issues/322) [#413](https://github.com/istanbuljs/istanbuljs/issues/413)
# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.5...istanbul-lib-coverage@3.0.0-alpha.0) (2019-06-19)
### Features
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
### BREAKING CHANGES
* Node.js 8 is now required
## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.4...istanbul-lib-coverage@2.0.5) (2019-04-24)
**Note:** Version bump only for package istanbul-lib-coverage

View File

@@ -12,9 +12,9 @@
*
* @module Exports
*/
const CoverageSummary = require('./lib/file').CoverageSummary;
const FileCoverage = require('./lib/file').FileCoverage;
const CoverageMap = require('./lib/coverage-map').CoverageMap;
const { FileCoverage } = require('./lib/file-coverage');
const { CoverageMap } = require('./lib/coverage-map');
const { CoverageSummary } = require('./lib/coverage-summary');
module.exports = {
/**

View File

@@ -4,123 +4,130 @@
*/
'use strict';
const FileCoverage = require('./file').FileCoverage;
const CoverageSummary = require('./file').CoverageSummary;
const { FileCoverage } = require('./file-coverage');
const { CoverageSummary } = require('./coverage-summary');
function maybeConstruct(obj, klass) {
if (obj instanceof klass) {
return obj;
}
return new klass(obj);
}
function loadMap(source) {
const data = Object.create(null);
Object.keys(source).forEach(k => {
const cov = source[k];
if (cov instanceof FileCoverage) {
data[k] = cov;
} else {
data[k] = new FileCoverage(cov);
}
if (!source) {
return data;
}
Object.entries(source).forEach(([k, cov]) => {
data[k] = maybeConstruct(cov, FileCoverage);
});
return data;
}
/**
* CoverageMap is a map of `FileCoverage` objects keyed by file paths.
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
* map's contents. This can be the raw global coverage object.
* @constructor
*/
function CoverageMap(obj) {
if (!obj) {
this.data = Object.create(null);
} else if (obj instanceof CoverageMap) {
this.data = obj.data;
} else {
this.data = loadMap(obj);
/** CoverageMap is a map of `FileCoverage` objects keyed by file paths. */
class CoverageMap {
/**
* @constructor
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
* map's contents. This can be the raw global coverage object.
*/
constructor(obj) {
if (obj instanceof CoverageMap) {
this.data = obj.data;
} else {
this.data = loadMap(obj);
}
}
/**
* merges a second coverage map into this one
* @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged
* correctly for the same files and additional file coverage keys are created
* as needed.
*/
merge(obj) {
const other = maybeConstruct(obj, CoverageMap);
Object.values(other.data).forEach(fc => {
this.addFileCoverage(fc);
});
}
/**
* filter the coveragemap based on the callback provided
* @param {Function (filename)} callback - Returns true if the path
* should be included in the coveragemap. False if it should be
* removed.
*/
filter(callback) {
Object.keys(this.data).forEach(k => {
if (!callback(k)) {
delete this.data[k];
}
});
}
/**
* returns a JSON-serializable POJO for this coverage map
* @returns {Object}
*/
toJSON() {
return this.data;
}
/**
* returns an array for file paths for which this map has coverage
* @returns {Array{string}} - array of files
*/
files() {
return Object.keys(this.data);
}
/**
* returns the file coverage for the specified file.
* @param {String} file
* @returns {FileCoverage}
*/
fileCoverageFor(file) {
const fc = this.data[file];
if (!fc) {
throw new Error(`No file coverage available for: ${file}`);
}
return fc;
}
/**
* adds a file coverage object to this map. If the path for the object,
* already exists in the map, it is merged with the existing coverage
* otherwise a new key is added to the map.
* @param {FileCoverage} fc the file coverage to add
*/
addFileCoverage(fc) {
const cov = new FileCoverage(fc);
const { path } = cov;
if (this.data[path]) {
this.data[path].merge(cov);
} else {
this.data[path] = cov;
}
}
/**
* returns the coverage summary for all the file coverage objects in this map.
* @returns {CoverageSummary}
*/
getCoverageSummary() {
const ret = new CoverageSummary();
Object.values(this.data).forEach(fc => {
ret.merge(fc.toSummary());
});
return ret;
}
}
/**
* merges a second coverage map into this one
* @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged
* correctly for the same files and additional file coverage keys are created
* as needed.
*/
CoverageMap.prototype.merge = function(obj) {
let other;
if (obj instanceof CoverageMap) {
other = obj;
} else {
other = new CoverageMap(obj);
}
Object.keys(other.data).forEach(k => {
const fc = other.data[k];
if (this.data[k]) {
this.data[k].merge(fc);
} else {
this.data[k] = fc;
}
});
};
/**
* filter the coveragemap based on the callback provided
* @param {Function (filename)} callback - Returns true if the path
* should be included in the coveragemap. False if it should be
* removed.
*/
CoverageMap.prototype.filter = function(callback) {
Object.keys(this.data).forEach(k => {
if (!callback(k)) {
delete this.data[k];
}
});
};
/**
* returns a JSON-serializable POJO for this coverage map
* @returns {Object}
*/
CoverageMap.prototype.toJSON = function() {
return this.data;
};
/**
* returns an array for file paths for which this map has coverage
* @returns {Array{string}} - array of files
*/
CoverageMap.prototype.files = function() {
return Object.keys(this.data);
};
/**
* returns the file coverage for the specified file.
* @param {String} file
* @returns {FileCoverage}
*/
CoverageMap.prototype.fileCoverageFor = function(file) {
const fc = this.data[file];
if (!fc) {
throw new Error('No file coverage available for: ' + file);
}
return fc;
};
/**
* adds a file coverage object to this map. If the path for the object,
* already exists in the map, it is merged with the existing coverage
* otherwise a new key is added to the map.
* @param {FileCoverage} fc the file coverage to add
*/
CoverageMap.prototype.addFileCoverage = function(fc) {
const cov = new FileCoverage(fc);
const path = cov.path;
if (this.data[path]) {
this.data[path].merge(cov);
} else {
this.data[path] = cov;
}
};
/**
* returns the coverage summary for all the file coverage objects in this map.
* @returns {CoverageSummary}
*/
CoverageMap.prototype.getCoverageSummary = function() {
const ret = new CoverageSummary();
this.files().forEach(key => {
ret.merge(this.fileCoverageFor(key).toSummary());
});
return ret;
};
module.exports = {
CoverageMap

View File

@@ -0,0 +1,102 @@
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
const percent = require('./percent');
const dataProperties = require('./data-properties');
function blankSummary() {
const empty = () => ({
total: 0,
covered: 0,
skipped: 0,
pct: 'Unknown'
});
return {
lines: empty(),
statements: empty(),
functions: empty(),
branches: empty()
};
}
// asserts that a data object "looks like" a summary coverage object
function assertValidSummary(obj) {
const valid =
obj && obj.lines && obj.statements && obj.functions && obj.branches;
if (!valid) {
throw new Error(
'Invalid summary coverage object, missing keys, found:' +
Object.keys(obj).join(',')
);
}
}
/**
* CoverageSummary provides a summary of code coverage . It exposes 4 properties,
* `lines`, `statements`, `branches`, and `functions`. Each of these properties
* is an object that has 4 keys `total`, `covered`, `skipped` and `pct`.
* `pct` is a percentage number (0-100).
*/
class CoverageSummary {
/**
* @constructor
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
* another coverage summary to initialize this object with.
*/
constructor(obj) {
if (!obj) {
this.data = blankSummary();
} else if (obj instanceof CoverageSummary) {
this.data = obj.data;
} else {
this.data = obj;
}
assertValidSummary(this.data);
}
/**
* merges a second summary coverage object into this one
* @param {CoverageSummary} obj - another coverage summary object
*/
merge(obj) {
const keys = ['lines', 'statements', 'branches', 'functions'];
keys.forEach(key => {
this[key].total += obj[key].total;
this[key].covered += obj[key].covered;
this[key].skipped += obj[key].skipped;
this[key].pct = percent(this[key].covered, this[key].total);
});
return this;
}
/**
* returns a POJO that is JSON serializable. May be used to get the raw
* summary object.
*/
toJSON() {
return this.data;
}
/**
* return true if summary has no lines of code
*/
isEmpty() {
return this.lines.total === 0;
}
}
dataProperties(CoverageSummary, [
'lines',
'statements',
'functions',
'branches'
]);
module.exports = {
CoverageSummary
};

View File

@@ -0,0 +1,12 @@
'use strict';
module.exports = function dataProperties(klass, properties) {
properties.forEach(p => {
Object.defineProperty(klass.prototype, p, {
enumerable: true,
get() {
return this.data[p];
}
});
});
};

264
node_modules/istanbul-lib-coverage/lib/file-coverage.js generated vendored Normal file
View File

@@ -0,0 +1,264 @@
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
const percent = require('./percent');
const dataProperties = require('./data-properties');
const { CoverageSummary } = require('./coverage-summary');
// returns a data object that represents empty coverage
function emptyCoverage(filePath) {
return {
path: filePath,
statementMap: {},
fnMap: {},
branchMap: {},
s: {},
f: {},
b: {}
};
}
// asserts that a data object "looks like" a coverage object
function assertValidObject(obj) {
const valid =
obj &&
obj.path &&
obj.statementMap &&
obj.fnMap &&
obj.branchMap &&
obj.s &&
obj.f &&
obj.b;
if (!valid) {
throw new Error(
'Invalid file coverage object, missing keys, found:' +
Object.keys(obj).join(',')
);
}
}
/**
* provides a read-only view of coverage for a single file.
* The deep structure of this object is documented elsewhere. It has the following
* properties:
*
* * `path` - the file path for which coverage is being tracked
* * `statementMap` - map of statement locations keyed by statement index
* * `fnMap` - map of function metadata keyed by function index
* * `branchMap` - map of branch metadata keyed by branch index
* * `s` - hit counts for statements
* * `f` - hit count for functions
* * `b` - hit count for branches
*/
class FileCoverage {
/**
* @constructor
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
* and empty coverage object with the specified file path or a data object that
* has all the required properties for a file coverage object.
*/
constructor(pathOrObj) {
if (!pathOrObj) {
throw new Error(
'Coverage must be initialized with a path or an object'
);
}
if (typeof pathOrObj === 'string') {
this.data = emptyCoverage(pathOrObj);
} else if (pathOrObj instanceof FileCoverage) {
this.data = pathOrObj.data;
} else if (typeof pathOrObj === 'object') {
this.data = pathOrObj;
} else {
throw new Error('Invalid argument to coverage constructor');
}
assertValidObject(this.data);
}
/**
* returns computed line coverage from statement coverage.
* This is a map of hits keyed by line number in the source.
*/
getLineCoverage() {
const statementMap = this.data.statementMap;
const statements = this.data.s;
const lineMap = Object.create(null);
Object.entries(statements).forEach(([st, count]) => {
/* istanbul ignore if: is this even possible? */
if (!statementMap[st]) {
return;
}
const { line } = statementMap[st].start;
const prevVal = lineMap[line];
if (prevVal === undefined || prevVal < count) {
lineMap[line] = count;
}
});
return lineMap;
}
/**
* returns an array of uncovered line numbers.
* @returns {Array} an array of line numbers for which no hits have been
* collected.
*/
getUncoveredLines() {
const lc = this.getLineCoverage();
const ret = [];
Object.entries(lc).forEach(([l, hits]) => {
if (hits === 0) {
ret.push(l);
}
});
return ret;
}
/**
* returns a map of branch coverage by source line number.
* @returns {Object} an object keyed by line number. Each object
* has a `covered`, `total` and `coverage` (percentage) property.
*/
getBranchCoverageByLine() {
const branchMap = this.branchMap;
const branches = this.b;
const ret = {};
Object.entries(branchMap).forEach(([k, map]) => {
const line = map.line || map.loc.start.line;
const branchData = branches[k];
ret[line] = ret[line] || [];
ret[line].push(...branchData);
});
Object.entries(ret).forEach(([k, dataArray]) => {
const covered = dataArray.filter(item => item > 0);
const coverage = (covered.length / dataArray.length) * 100;
ret[k] = {
covered: covered.length,
total: dataArray.length,
coverage
};
});
return ret;
}
/**
* return a JSON-serializable POJO for this file coverage object
*/
toJSON() {
return this.data;
}
/**
* merges a second coverage object into this one, updating hit counts
* @param {FileCoverage} other - the coverage object to be merged into this one.
* Note that the other object should have the same structure as this one (same file).
*/
merge(other) {
if (other.all === true) {
return;
}
if (this.all === true) {
this.data = other.data;
return;
}
Object.entries(other.s).forEach(([k, v]) => {
this.data.s[k] += v;
});
Object.entries(other.f).forEach(([k, v]) => {
this.data.f[k] += v;
});
Object.entries(other.b).forEach(([k, v]) => {
let i;
const retArray = this.data.b[k];
/* istanbul ignore if: is this even possible? */
if (!retArray) {
this.data.b[k] = v;
return;
}
for (i = 0; i < retArray.length; i += 1) {
retArray[i] += v[i];
}
});
}
computeSimpleTotals(property) {
let stats = this[property];
if (typeof stats === 'function') {
stats = stats.call(this);
}
const ret = {
total: Object.keys(stats).length,
covered: Object.values(stats).filter(v => !!v).length,
skipped: 0
};
ret.pct = percent(ret.covered, ret.total);
return ret;
}
computeBranchTotals() {
const stats = this.b;
const ret = { total: 0, covered: 0, skipped: 0 };
Object.values(stats).forEach(branches => {
ret.covered += branches.filter(hits => hits > 0).length;
ret.total += branches.length;
});
ret.pct = percent(ret.covered, ret.total);
return ret;
}
/**
* resets hit counts for all statements, functions and branches
* in this coverage object resulting in zero coverage.
*/
resetHits() {
const statements = this.s;
const functions = this.f;
const branches = this.b;
Object.keys(statements).forEach(s => {
statements[s] = 0;
});
Object.keys(functions).forEach(f => {
functions[f] = 0;
});
Object.keys(branches).forEach(b => {
branches[b].fill(0);
});
}
/**
* returns a CoverageSummary for this file coverage object
* @returns {CoverageSummary}
*/
toSummary() {
const ret = {};
ret.lines = this.computeSimpleTotals('getLineCoverage');
ret.functions = this.computeSimpleTotals('f', 'fnMap');
ret.statements = this.computeSimpleTotals('s', 'statementMap');
ret.branches = this.computeBranchTotals();
return new CoverageSummary(ret);
}
}
// expose coverage data attributes
dataProperties(FileCoverage, [
'path',
'statementMap',
'fnMap',
'branchMap',
's',
'f',
'b',
'all'
]);
module.exports = {
FileCoverage
};

View File

@@ -1,348 +0,0 @@
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
function percent(covered, total) {
let tmp;
if (total > 0) {
tmp = (1000 * 100 * covered) / total + 5;
return Math.floor(tmp / 10) / 100;
} else {
return 100.0;
}
}
function blankSummary() {
const empty = function() {
return {
total: 0,
covered: 0,
skipped: 0,
pct: 'Unknown'
};
};
return {
lines: empty(),
statements: empty(),
functions: empty(),
branches: empty()
};
}
// asserts that a data object "looks like" a summary coverage object
function assertValidSummary(obj) {
const valid =
obj && obj.lines && obj.statements && obj.functions && obj.branches;
if (!valid) {
throw new Error(
'Invalid summary coverage object, missing keys, found:' +
Object.keys(obj).join(',')
);
}
}
/**
* CoverageSummary provides a summary of code coverage . It exposes 4 properties,
* `lines`, `statements`, `branches`, and `functions`. Each of these properties
* is an object that has 4 keys `total`, `covered`, `skipped` and `pct`.
* `pct` is a percentage number (0-100).
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
* another coverage summary to initialize this object with.
* @constructor
*/
function CoverageSummary(obj) {
if (!obj) {
this.data = blankSummary();
} else if (obj instanceof CoverageSummary) {
this.data = obj.data;
} else {
this.data = obj;
}
assertValidSummary(this.data);
}
['lines', 'statements', 'functions', 'branches'].forEach(p => {
Object.defineProperty(CoverageSummary.prototype, p, {
enumerable: true,
get() {
return this.data[p];
}
});
});
/**
* merges a second summary coverage object into this one
* @param {CoverageSummary} obj - another coverage summary object
*/
CoverageSummary.prototype.merge = function(obj) {
const keys = ['lines', 'statements', 'branches', 'functions'];
keys.forEach(key => {
this[key].total += obj[key].total;
this[key].covered += obj[key].covered;
this[key].skipped += obj[key].skipped;
this[key].pct = percent(this[key].covered, this[key].total);
});
return this;
};
/**
* returns a POJO that is JSON serializable. May be used to get the raw
* summary object.
*/
CoverageSummary.prototype.toJSON = function() {
return this.data;
};
/**
* return true if summary has no lines of code
*/
CoverageSummary.prototype.isEmpty = function() {
return this.lines.total === 0;
};
// returns a data object that represents empty coverage
function emptyCoverage(filePath) {
return {
path: filePath,
statementMap: {},
fnMap: {},
branchMap: {},
s: {},
f: {},
b: {}
};
}
// asserts that a data object "looks like" a coverage object
function assertValidObject(obj) {
const valid =
obj &&
obj.path &&
obj.statementMap &&
obj.fnMap &&
obj.branchMap &&
obj.s &&
obj.f &&
obj.b;
if (!valid) {
throw new Error(
'Invalid file coverage object, missing keys, found:' +
Object.keys(obj).join(',')
);
}
}
/**
* provides a read-only view of coverage for a single file.
* The deep structure of this object is documented elsewhere. It has the following
* properties:
*
* * `path` - the file path for which coverage is being tracked
* * `statementMap` - map of statement locations keyed by statement index
* * `fnMap` - map of function metadata keyed by function index
* * `branchMap` - map of branch metadata keyed by branch index
* * `s` - hit counts for statements
* * `f` - hit count for functions
* * `b` - hit count for branches
*
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
* and empty coverage object with the specified file path or a data object that
* has all the required properties for a file coverage object.
* @constructor
*/
function FileCoverage(pathOrObj) {
if (!pathOrObj) {
throw new Error(
'Coverage must be initialized with a path or an object'
);
}
if (typeof pathOrObj === 'string') {
this.data = emptyCoverage(pathOrObj);
} else if (pathOrObj instanceof FileCoverage) {
this.data = pathOrObj.data;
} else if (typeof pathOrObj === 'object') {
this.data = pathOrObj;
} else {
throw new Error('Invalid argument to coverage constructor');
}
assertValidObject(this.data);
}
/**
* returns computed line coverage from statement coverage.
* This is a map of hits keyed by line number in the source.
*/
FileCoverage.prototype.getLineCoverage = function() {
const statementMap = this.data.statementMap;
const statements = this.data.s;
const lineMap = Object.create(null);
Object.keys(statements).forEach(st => {
if (!statementMap[st]) {
return;
}
const line = statementMap[st].start.line;
const count = statements[st];
const prevVal = lineMap[line];
if (prevVal === undefined || prevVal < count) {
lineMap[line] = count;
}
});
return lineMap;
};
/**
* returns an array of uncovered line numbers.
* @returns {Array} an array of line numbers for which no hits have been
* collected.
*/
FileCoverage.prototype.getUncoveredLines = function() {
const lc = this.getLineCoverage();
const ret = [];
Object.keys(lc).forEach(l => {
const hits = lc[l];
if (hits === 0) {
ret.push(l);
}
});
return ret;
};
/**
* returns a map of branch coverage by source line number.
* @returns {Object} an object keyed by line number. Each object
* has a `covered`, `total` and `coverage` (percentage) property.
*/
FileCoverage.prototype.getBranchCoverageByLine = function() {
const branchMap = this.branchMap;
const branches = this.b;
const ret = {};
Object.keys(branchMap).forEach(k => {
const line = branchMap[k].line || branchMap[k].loc.start.line;
const branchData = branches[k];
ret[line] = ret[line] || [];
ret[line].push(...branchData);
});
Object.keys(ret).forEach(k => {
const dataArray = ret[k];
const covered = dataArray.filter(item => item > 0);
const coverage = (covered.length / dataArray.length) * 100;
ret[k] = {
covered: covered.length,
total: dataArray.length,
coverage
};
});
return ret;
};
// expose coverage data attributes
['path', 'statementMap', 'fnMap', 'branchMap', 's', 'f', 'b'].forEach(p => {
Object.defineProperty(FileCoverage.prototype, p, {
enumerable: true,
get() {
return this.data[p];
}
});
});
/**
* return a JSON-serializable POJO for this file coverage object
*/
FileCoverage.prototype.toJSON = function() {
return this.data;
};
/**
* merges a second coverage object into this one, updating hit counts
* @param {FileCoverage} other - the coverage object to be merged into this one.
* Note that the other object should have the same structure as this one (same file).
*/
FileCoverage.prototype.merge = function(other) {
Object.keys(other.s).forEach(k => {
this.data.s[k] += other.s[k];
});
Object.keys(other.f).forEach(k => {
this.data.f[k] += other.f[k];
});
Object.keys(other.b).forEach(k => {
let i;
const retArray = this.data.b[k];
const secondArray = other.b[k];
if (!retArray) {
this.data.b[k] = secondArray;
return;
}
for (i = 0; i < retArray.length; i += 1) {
retArray[i] += secondArray[i];
}
});
};
FileCoverage.prototype.computeSimpleTotals = function(property) {
let stats = this[property];
const ret = { total: 0, covered: 0, skipped: 0 };
if (typeof stats === 'function') {
stats = stats.call(this);
}
Object.keys(stats).forEach(key => {
const covered = !!stats[key];
ret.total += 1;
if (covered) {
ret.covered += 1;
}
});
ret.pct = percent(ret.covered, ret.total);
return ret;
};
FileCoverage.prototype.computeBranchTotals = function() {
const stats = this.b;
const ret = { total: 0, covered: 0, skipped: 0 };
Object.keys(stats).forEach(key => {
const branches = stats[key];
let covered;
branches.forEach(branchHits => {
covered = branchHits > 0;
if (covered) {
ret.covered += 1;
}
});
ret.total += branches.length;
});
ret.pct = percent(ret.covered, ret.total);
return ret;
};
/**
* resets hit counts for all statements, functions and branches
* in this coverage object resulting in zero coverage.
*/
FileCoverage.prototype.resetHits = function() {
const statements = this.s;
const functions = this.f;
const branches = this.b;
Object.keys(statements).forEach(s => {
statements[s] = 0;
});
Object.keys(functions).forEach(f => {
functions[f] = 0;
});
Object.keys(branches).forEach(b => {
const hits = branches[b];
branches[b] = hits.map(() => 0);
});
};
/**
* returns a CoverageSummary for this file coverage object
* @returns {CoverageSummary}
*/
FileCoverage.prototype.toSummary = function() {
const ret = {};
ret.lines = this.computeSimpleTotals('getLineCoverage');
ret.functions = this.computeSimpleTotals('f', 'fnMap');
ret.statements = this.computeSimpleTotals('s', 'statementMap');
ret.branches = this.computeBranchTotals();
return new CoverageSummary(ret);
};
module.exports = {
CoverageSummary,
FileCoverage
};

15
node_modules/istanbul-lib-coverage/lib/percent.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
module.exports = function percent(covered, total) {
let tmp;
if (total > 0) {
tmp = (1000 * 100 * covered) / total + 5;
return Math.floor(tmp / 10) / 100;
} else {
return 100.0;
}
};

View File

@@ -1,26 +1,19 @@
{
"_args": [
[
"istanbul-lib-coverage@2.0.5",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "istanbul-lib-coverage@2.0.5",
"_id": "istanbul-lib-coverage@2.0.5",
"_from": "istanbul-lib-coverage@^3.0.0",
"_id": "istanbul-lib-coverage@3.0.0",
"_inBundle": false,
"_integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==",
"_integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==",
"_location": "/istanbul-lib-coverage",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "istanbul-lib-coverage@2.0.5",
"raw": "istanbul-lib-coverage@^3.0.0",
"name": "istanbul-lib-coverage",
"escapedName": "istanbul-lib-coverage",
"rawSpec": "2.0.5",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "2.0.5"
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/@jest/reporters",
@@ -28,9 +21,10 @@
"/istanbul-lib-report",
"/istanbul-lib-source-maps"
],
"_resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
"_spec": "2.0.5",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play",
"_resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz",
"_shasum": "f5944a37c70b550b02a78a5c3b2055b280cec8ec",
"_spec": "istanbul-lib-coverage@^3.0.0",
"_where": "/home/codespace/workspace/upload-google-play/node_modules/@jest/reporters",
"author": {
"name": "Krishnan Anantheswaran",
"email": "kananthmail-github@yahoo.com"
@@ -38,15 +32,22 @@
"bugs": {
"url": "https://github.com/istanbuljs/istanbuljs/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Data library for istanbul coverage objects",
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.2",
"nyc": "^15.0.0-beta.2"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"files": [
"lib",
"index.js"
],
"gitHead": "90e60cc47833bb780680f916488ca24f0be36ca2",
"gitHead": "5319df684b508ff6fb19fe8b9a6147a3c5924e4b",
"homepage": "https://istanbul.js.org/",
"karmaDeps": {
"browserify-istanbul": "^0.2.1",
@@ -68,10 +69,11 @@
"name": "istanbul-lib-coverage",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git"
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
"directory": "packages/istanbul-lib-coverage"
},
"scripts": {
"test": "mocha"
"test": "nyc --nycrc-path=../../monorepo-per-package-full.js mocha"
},
"version": "2.0.5"
"version": "3.0.0"
}