Socket
Socket
Sign inDemoInstall

@vitest/coverage-v8

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/coverage-v8 - npm Package Compare versions

Comparing version 0.32.2 to 0.32.4

25

dist/provider.js

@@ -146,7 +146,7 @@ import { existsSync, promises } from 'fs';

class V8CoverageProvider extends BaseCoverageProvider {
constructor() {
super(...arguments);
this.name = "v8";
this.coverages = [];
}
name = "v8";
ctx;
options;
testExclude;
coverages = [];
initialize(ctx) {

@@ -198,3 +198,3 @@ const config = ctx.config.coverage;

const converted = await Promise.all(scriptCoverages.map(async ({ url, functions }) => {
const sources = await this.getSources(url);
const sources = await this.getSources(url, functions);
const wrapperLength = sources.sourceMap ? WRAPPER_LENGTH : 0;

@@ -274,3 +274,3 @@ const converter = v8ToIstanbul(url, wrapperLength, sources);

}
async getSources(url) {
async getSources(url, functions = []) {
var _a;

@@ -284,3 +284,6 @@ const filePath = normalize(fileURLToPath(url));

const code = transformResult == null ? void 0 : transformResult.code;
const sourcesContent = ((_a = map == null ? void 0 : map.sourcesContent) == null ? void 0 : _a[0]) || await promises.readFile(filePath, "utf-8");
const sourcesContent = ((_a = map == null ? void 0 : map.sourcesContent) == null ? void 0 : _a[0]) || await promises.readFile(filePath, "utf-8").catch(() => {
const length = findLongestFunctionLength(functions);
return ".".repeat(length);
});
if (!map)

@@ -316,3 +319,9 @@ return { source: code || sourcesContent };

}
function findLongestFunctionLength(functions) {
return functions.reduce((previous, current) => {
const maxEndOffset = current.ranges.reduce((endOffset, range) => Math.max(endOffset, range.endOffset), 0);
return Math.max(previous, maxEndOffset);
}, 0);
}
export { V8CoverageProvider };
{
"name": "@vitest/coverage-v8",
"type": "module",
"version": "0.32.2",
"version": "0.32.4",
"description": "V8 coverage provider for Vitest",

@@ -51,3 +51,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"picocolors": "^1.0.0",
"std-env": "^3.3.2",
"std-env": "^3.3.3",
"test-exclude": "^6.0.0",

@@ -61,5 +61,5 @@ "v8-to-istanbul": "^9.1.0"

"@types/istanbul-reports": "^3.0.1",
"pathe": "^1.1.0",
"vitest": "0.32.2",
"vite-node": "0.32.2"
"pathe": "^1.1.1",
"vitest": "0.32.4",
"vite-node": "0.32.4"
},

@@ -66,0 +66,0 @@ "scripts": {

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