Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

monocart-coverage-reports

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monocart-coverage-reports - npm Package Compare versions

Comparing version 2.10.2 to 2.10.3

53

lib/converter/ast-visitor.js

@@ -149,3 +149,5 @@ const Util = require('../utils/util.js');

const addBranch = (group, node, locationMap) => {
const { start, end } = node;
const {
start, end, type
} = node;

@@ -163,2 +165,20 @@ const branchKey = `${group.start}_${group.end}`;

if (type === 'SwitchCase') {
// console.log(node);
// check break
if (node.consequent) {
const breakItem = node.consequent.find((it) => it.type === 'BreakStatement');
if (breakItem) {
branchInfo.hasBreak = true;
}
}
// check default
if (!node.test) {
branchInfo.isDefault = true;
}
}
group.locations.push(branchInfo);

@@ -188,3 +208,3 @@

let blockCount = 0;
locations.forEach((item) => {
locations.forEach((item, i) => {
if (item.block) {

@@ -195,2 +215,4 @@ item.count = item.block.count;

}
// for calculate mo break branches
item.index = i;
noBlockList.push(item);

@@ -247,9 +269,30 @@ });

const SwitchStatement = (group, parentCount) => {
const { noBlockList, blockCount } = updateBlockLocations(group.locations);
const locations = group.locations;
const { noBlockList, blockCount } = updateBlockLocations(locations);
if (!noBlockList.length) {
return;
}
const count = parentCount - blockCount;
// calculate switch/case count
const countLeft = parentCount - blockCount;
noBlockList.forEach((item) => {
item.count = count;
let hasCount = false;
// check no break branches
for (let i = item.index - 1; i >= 0; i--) {
const b = locations[i];
if (b && !b.hasBreak && b.count > 0) {
item.count += b.count;
hasCount = true;
continue;
}
break;
}
if (!hasCount) {
item.count = countLeft;
}
});

@@ -256,0 +299,0 @@ };

8

package.json
{
"name": "monocart-coverage-reports",
"version": "2.10.2",
"version": "2.10.3",
"description": "A code coverage tool to generate native V8 reports or Istanbul reports.",

@@ -86,3 +86,3 @@ "main": "./lib/index.js",

"eight-colors": "^1.3.0",
"foreground-child": "^3.2.1",
"foreground-child": "^3.3.0",
"istanbul-lib-coverage": "^3.2.2",

@@ -99,3 +99,3 @@ "istanbul-lib-report": "^3.0.1",

"esbuild": "^0.23.0",
"eslint": "~9.8.0",
"eslint": "~9.9.0",
"eslint-config-plus": "^2.0.2",

@@ -113,3 +113,3 @@ "eslint-plugin-html": "^8.1.1",

"supports-color": "^9.4.0",
"tsx": "^4.16.5",
"tsx": "^4.17.0",
"turbogrid": "^3.2.0",

@@ -116,0 +116,0 @@ "vine-ui": "^3.1.16",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc