Socket
Socket
Sign inDemoInstall

@vitest/coverage-v8

Package Overview
Dependencies
532
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.1 to 1.4.0

36

dist/provider.js

@@ -14,2 +14,3 @@ import { existsSync, promises, writeFileSync } from 'node:fs';

import { provider } from 'std-env';
import { stripLiteral } from 'strip-literal';
import createDebug from 'debug';

@@ -174,3 +175,3 @@ import { builtinModules } from 'node:module';

const VITE_EXPORTS_LINE_PATTERN = /Object\.defineProperty\(__vite_ssr_exports__.*\n/g;
const DECORATOR_METADATA_PATTERN = /_ts_metadata\("design:paramtypes"(\s|.)+?]\),/g;
const DECORATOR_METADATA_PATTERN = /_ts_metadata\("design:paramtypes", \[[^\]]*?\]\),*/g;
const DEFAULT_PROJECT = Symbol.for("default-project");

@@ -323,4 +324,7 @@ const debug = createDebug("vitest:coverage");

const transformResults = normalizeTransformResults(this.ctx.vitenode.fetchCache);
const includedFiles = await this.testExclude.glob(this.ctx.config.root);
const uncoveredFiles = includedFiles.map((file) => pathToFileURL(resolve(this.ctx.config.root, file))).filter((file) => !testedFiles.includes(file.pathname));
const allFiles = await this.testExclude.glob(this.ctx.config.root);
let includedFiles = allFiles.map((file) => resolve(this.ctx.config.root, file));
if (this.ctx.config.changed)
includedFiles = (this.ctx.config.related || []).filter((file) => includedFiles.includes(file));
const uncoveredFiles = includedFiles.map((file) => pathToFileURL(file)).filter((file) => !testedFiles.includes(file.pathname));
let merged = { result: [] };

@@ -334,3 +338,7 @@ let index = 0;

const coverages = await Promise.all(chunk.map(async (filename) => {
const { source } = await this.getSources(filename.href, transformResults);
const transformResult = await this.ctx.vitenode.transformRequest(filename.pathname).catch(() => {
});
if (transformResult && stripLiteral(transformResult.code).trim() === "")
return null;
const { originalSource } = await this.getSources(filename.href, transformResults);
const coverage = {

@@ -343,3 +351,3 @@ url: filename.href,

startOffset: 0,
endOffset: source.length,
endOffset: originalSource.length,
count: 0

@@ -354,3 +362,6 @@ }],

}));
merged = mergeProcessCovs([merged, ...coverages]);
merged = mergeProcessCovs([
merged,
...coverages.filter((cov) => cov != null)
]);
}

@@ -368,4 +379,11 @@ return merged;

});
if (!map)
return { source: code || sourcesContent };
if (!map) {
return {
source: code || sourcesContent,
originalSource: sourcesContent
};
}
const sources = [url];
if (map.sources && map.sources[0] && !url.endsWith(map.sources[0]))
sources[0] = new URL(map.sources[0], url).href;
return {

@@ -378,3 +396,3 @@ originalSource: sourcesContent,

version: 3,
sources: [url],
sources,
sourcesContent: [sourcesContent]

@@ -381,0 +399,0 @@ })

{
"name": "@vitest/coverage-v8",
"type": "module",
"version": "1.3.1",
"version": "1.4.0",
"description": "V8 coverage provider for Vitest",

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

"peerDependencies": {
"vitest": "1.3.1"
"vitest": "1.4.0"
},

@@ -49,3 +49,3 @@ "dependencies": {

"istanbul-lib-report": "^3.0.1",
"istanbul-lib-source-maps": "^4.0.1",
"istanbul-lib-source-maps": "^5.0.4",
"istanbul-reports": "^3.1.6",

@@ -56,2 +56,3 @@ "magic-string": "^0.30.5",

"std-env": "^3.5.0",
"strip-literal": "^2.0.0",
"test-exclude": "^6.0.0",

@@ -67,4 +68,4 @@ "v8-to-istanbul": "^9.2.0"

"pathe": "^1.1.1",
"vite-node": "1.3.1",
"vitest": "1.3.1"
"vite-node": "1.4.0",
"vitest": "1.4.0"
},

@@ -71,0 +72,0 @@ "scripts": {

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