Socket
Socket
Sign inDemoInstall

istanbul-lib-coverage

Package Overview
Dependencies
0
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.1.0

7

CHANGELOG.md

@@ -49,2 +49,9 @@ # Change Log

## [3.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.2...istanbul-lib-coverage-v3.1.0) (2021-10-17)
### Features
* support tracking Logic Truthiness as additional metric in coverage API ([#639](https://www.github.com/istanbuljs/istanbuljs/issues/639)) ([0967c80](https://www.github.com/istanbuljs/istanbuljs/commit/0967c80b905c3c17675ff2185b2325784e8dc0a2))
### [3.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.1...istanbul-lib-coverage-v3.0.2) (2021-10-11)

@@ -51,0 +58,0 @@

24

lib/coverage-summary.js

@@ -22,3 +22,4 @@ /*

functions: empty(),
branches: empty()
branches: empty(),
branchesTrue: empty()
};

@@ -67,8 +68,16 @@ }

merge(obj) {
const keys = ['lines', 'statements', 'branches', 'functions'];
const keys = [
'lines',
'statements',
'branches',
'functions',
'branchesTrue'
];
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);
if (obj[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);
}
});

@@ -99,3 +108,4 @@

'functions',
'branches'
'branches',
'branchesTrue'
]);

@@ -102,0 +112,0 @@

@@ -239,2 +239,15 @@ /*

this.data.branchMap = map;
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (this.bT && other.bT) {
[hits, map] = mergeProp(
this.bT,
this.branchMap,
other.bT,
other.branchMap,
keyFromLocationsProp
);
this.data.bT = hits;
}
}

@@ -258,4 +271,4 @@

computeBranchTotals() {
const stats = this.b;
computeBranchTotals(property) {
const stats = this[property];
const ret = { total: 0, covered: 0, skipped: 0 };

@@ -279,2 +292,3 @@

const branches = this.b;
const branchesTrue = this.bT;
Object.keys(statements).forEach(s => {

@@ -289,2 +303,9 @@ statements[s] = 0;

});
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (branchesTrue) {
Object.keys(branchesTrue).forEach(bT => {
branchesTrue[bT].fill(0);
});
}
}

@@ -301,3 +322,8 @@

ret.statements = this.computeSimpleTotals('s', 'statementMap');
ret.branches = this.computeBranchTotals();
ret.branches = this.computeBranchTotals('b');
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (this['bt']) {
ret.branchesTrue = this.computeBranchTotals('bT');
}
return new CoverageSummary(ret);

@@ -316,2 +342,3 @@ }

'b',
'bT',
'all'

@@ -318,0 +345,0 @@ ]);

{
"name": "istanbul-lib-coverage",
"version": "3.0.2",
"version": "3.1.0",
"description": "Data library for istanbul coverage objects",

@@ -5,0 +5,0 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc