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.3 to 2.10.4

15

lib/converter/converter.js

@@ -871,4 +871,4 @@ /**

decodedList.forEach((segments, generatedLine) => {
let info = null;
segments.forEach((segment) => {
const lastIndex = segments.length - 1;
segments.forEach((segment, i) => {

@@ -893,3 +893,3 @@ // const COLUMN = 0;

info = {
const info = {
generatedOffset,

@@ -905,2 +905,10 @@ generatedLine,

// first and last column
if (i === 0) {
info.first = true;
}
if (i === lastIndex) {
info.last = true;
}
allDecodedMappings.push(info);

@@ -912,2 +920,3 @@

});

@@ -914,0 +923,0 @@

43

lib/converter/find-original-range.js

@@ -410,5 +410,5 @@ const { diffSequence } = require('../packages/monocart-coverage-vendor.js');

const getOriginalEndOffset = (m, cache) => {
const getOriginalEndOffset = (m, originalState) => {
if (!m.originalEndOffset) {
const line = cache.originalState.locator.getLine(m.originalLine + 1);
const line = originalState.locator.getLine(m.originalLine + 1);
m.originalEndOffset = line ? line.end : m.originalOffset;

@@ -419,4 +419,4 @@ }

const getOriginalText = (m1, m2, cache) => {
const originalLocator = cache.originalState.locator;
const getOriginalText = (m1, m2, originalState, startNextLine) => {
const originalLocator = originalState.locator;

@@ -447,6 +447,18 @@ const o1 = m1.originalOffset;

// start from next line
if (startNextLine) {
const nextLine = originalState.locator.getLine(m1.originalLine + 2);
if (nextLine) {
// console.log(nextLine);
return {
originalOffset: nextLine.start + nextLine.indent,
originalText: nextLine.text.slice(nextLine.indent)
};
}
}
// could be multiple lines for original text
return {
originalOffset: o1,
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, cache))
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, originalState))
};

@@ -460,3 +472,3 @@ }

originalOffset: o1,
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, cache))
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, originalState))
};

@@ -484,3 +496,3 @@ }

originalOffset: o1,
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, cache))
originalText: originalLocator.getSlice(o1, getOriginalEndOffset(m1, originalState))
};

@@ -561,4 +573,15 @@

// skip last mapping
let startNextLine = false;
if (m1.last) {
const locStart = state.locator.offsetToLocation(start);
// 1-base
const lineIndex = locStart.line - 1;
if (lineIndex > m1.generatedLine) {
startNextLine = true;
// console.log(originalState.sourcePath, start, m1, m2);
}
}
const { originalText, originalOffset } = getOriginalText(m1, m2, cache);
const { originalText, originalOffset } = getOriginalText(m1, m2, originalState, startNextLine);
const { generatedText, generatedPos } = getGeneratedText(m1, m2, state, start);

@@ -601,3 +624,3 @@ const direction = 'start';

if (crossEnd) {
const originalEndOffset = getOriginalEndOffset(m1, cache);
const originalEndOffset = getOriginalEndOffset(m1, originalState);
return {

@@ -618,3 +641,3 @@ originalEnd: originalEndOffset

const { originalText, originalOffset } = getOriginalText(m1, m2, cache);
const { originalText, originalOffset } = getOriginalText(m1, m2, originalState);
const { generatedText, generatedPos } = getGeneratedText(m1, m2, state, end);

@@ -621,0 +644,0 @@ const direction = 'end';

@@ -0,0 +0,0 @@ const { pathToFileURL } = require('url');

@@ -0,0 +0,0 @@ const path = require('path');

@@ -0,0 +0,0 @@ const path = require('path');

@@ -196,6 +196,7 @@ const EC = require('eight-colors');

// https://evanw.github.io/source-map-visualization
// if (sourceData.sourceMap) {
// await Util.writeFile(`${sourcePath}.js`, sourceData.source);
// await Util.writeFile(`${sourcePath}.js.map`, JSON.stringify(sourceData.sourceMap));
// }
if (options.sourceMap && sourceData.sourceMap) {
const filePath = cachePath.slice(0, -5);
await Util.writeFile(`${filePath}.js`, sourceData.source);
await Util.writeFile(`${filePath}.js.map`, JSON.stringify(sourceData.sourceMap));
}
}

@@ -202,0 +203,0 @@

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

@@ -13,9 +13,7 @@ "main": "./lib/index.js",

"import": "./lib/index.mjs",
"require": "./lib/index.js",
"default": "./lib/index.js"
"require": "./lib/index.js"
},
"./register": {
"import": "./lib/register/register.mjs",
"require": "./lib/register/register.js",
"default": "./lib/register/register.js"
"require": "./lib/register/register.js"
},

@@ -83,3 +81,3 @@ "./converter": "./lib/converter/converter.js",

"acorn-loose": "^8.4.0",
"acorn-walk": "^8.3.3",
"acorn-walk": "^8.3.4",
"commander": "^12.1.0",

@@ -99,7 +97,7 @@ "console-grid": "^2.2.2",

"diff-sequences": "^29.6.3",
"esbuild": "^0.23.0",
"eslint": "~9.9.0",
"esbuild": "^0.23.1",
"eslint": "~9.10.0",
"eslint-config-plus": "^2.0.2",
"eslint-plugin-html": "^8.1.1",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-vue": "^9.28.0",
"find-up": "^7.0.0",

@@ -109,8 +107,8 @@ "minimatch": "^9.0.5",

"monocart-formatter": "^3.0.0",
"postcss": "^8.4.41",
"postcss": "^8.4.45",
"starfall-cli": "^2.0.20",
"stylelint": "^16.8.1",
"stylelint-config-plus": "^1.1.2",
"stylelint": "^16.9.0",
"stylelint-config-plus": "^1.1.3",
"supports-color": "^9.4.0",
"tsx": "^4.17.0",
"tsx": "^4.19.0",
"turbogrid": "^3.2.0",

@@ -117,0 +115,0 @@ "vine-ui": "^3.1.16",

@@ -48,2 +48,3 @@ # Monocart Coverage Reports

- [Vitest](#vitest)
- [Node Test Runner](#node-test-runner)
- [Puppeteer](#puppeteer)

@@ -298,2 +299,3 @@ - [Cypress](#cypress)

```
Collect coverage with `@playwright/test` [`Automatic fixtures`](https://playwright.dev/docs/test-fixtures#automatic-fixtures), see example: [fixtures.ts](https://github.com/cenfun/playwright-coverage/blob/main/fixtures.ts)
For more examples, see [./test/test-v8.js](./test/test-v8.js), and [anonymous](./test/test-anonymous.js), [css](./test/test-css.js)

@@ -992,2 +994,5 @@

### [Node Test Runner](https://nodejs.org/docs/latest/api/test.html)
- [node-monocart-coverage](https://github.com/cenfun/node-monocart-coverage) - Custom reporter for Node test runner for coverage
### [Puppeteer](https://github.com/puppeteer/puppeteer/)

@@ -994,0 +999,0 @@ - [jest-puppeteer-coverage](https://github.com/cenfun/jest-puppeteer-coverage) - Example for Jest puppeteer coverage

@@ -48,2 +48,3 @@ # Monocart Coverage Reports

- [Vitest](#vitest)
- [Node Test Runner](#node-test-runner)
- [Puppeteer](#puppeteer)

@@ -121,6 +122,7 @@ - [Cypress](#cypress)

- `v8-json`
- 保存 `CoverageResults` 到一个json文件
- 保存 `CoverageResults` 到一个json文件 (默认是 [`coverage-report.json`](https://cenfun.github.io/monocart-coverage-reports/v8-and-istanbul/coverage-report.json))
- 用于VSCode扩展来显示原生V8代码覆盖率: [Monocart Coverage for VSCode](https://github.com/cenfun/monocart-coverage-vscode)
![](./assets/mcv.gif)
> 内置Istanbul报告 (V8和Istanbul格式数据都支持):

@@ -300,2 +302,3 @@

```
使用 `@playwright/test` 的 [`Automatic fixtures`](https://playwright.dev/docs/test-fixtures#automatic-fixtures)收集覆盖率数据, 见例子: [fixtures.ts](https://github.com/cenfun/playwright-coverage/blob/main/fixtures.ts)
参见例子 [./test/test-v8.js](./test/test-v8.js), and [anonymous](./test/test-anonymous.js), [css](./test/test-css.js)

@@ -996,2 +999,5 @@

### [Node Test Runner](https://nodejs.org/docs/latest/api/test.html)
- [node-monocart-coverage](https://github.com/cenfun/node-monocart-coverage) - Custom reporter for Node test runner for coverage
### [Puppeteer](https://github.com/puppeteer/puppeteer/)

@@ -1051,3 +1057,3 @@ - [jest-puppeteer-coverage](https://github.com/cenfun/jest-puppeteer-coverage) - Example for Jest puppeteer coverage

```
- Github actions example:
- Github actions:
```yml

@@ -1088,3 +1094,3 @@ - name: Codecov

```
- Github actions example:
- Github actions:
```yml

@@ -1091,0 +1097,0 @@ - name: Coveralls

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