@vitest/coverage-istanbul
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
@@ -1,2 +0,2 @@ | ||
import { C as COVERAGE_STORE_KEY } from './constants-758a8358.js'; | ||
import { C as COVERAGE_STORE_KEY } from './constants-DBqnqzn-.js'; | ||
@@ -3,0 +3,0 @@ async function getProvider() { |
@@ -1,5 +0,6 @@ | ||
import { existsSync, promises } from 'node:fs'; | ||
import { existsSync, promises, writeFileSync } from 'node:fs'; | ||
import { coverageConfigDefaults, defaultExclude, defaultInclude } from 'vitest/config'; | ||
import { BaseCoverageProvider } from 'vitest/coverage'; | ||
import c from 'picocolors'; | ||
import { parseModule } from 'magicast'; | ||
import libReport from 'istanbul-lib-report'; | ||
@@ -11,3 +12,3 @@ import reports from 'istanbul-reports'; | ||
import _TestExclude from 'test-exclude'; | ||
import { C as COVERAGE_STORE_KEY } from './constants-758a8358.js'; | ||
import { C as COVERAGE_STORE_KEY } from './constants-DBqnqzn-.js'; | ||
@@ -133,6 +134,9 @@ function normalizeWindowsPath(input = "") { | ||
reporter: this.resolveReporters(config.reporter || coverageConfigDefaults.reporter), | ||
lines: config["100"] ? 100 : config.lines, | ||
functions: config["100"] ? 100 : config.functions, | ||
branches: config["100"] ? 100 : config.branches, | ||
statements: config["100"] ? 100 : config.statements | ||
thresholds: config.thresholds && { | ||
...config.thresholds, | ||
lines: config.thresholds["100"] ? 100 : config.thresholds.lines, | ||
branches: config.thresholds["100"] ? 100 : config.thresholds.branches, | ||
functions: config.thresholds["100"] ? 100 : config.thresholds.functions, | ||
statements: config.thresholds["100"] ? 100 : config.thresholds.statements | ||
} | ||
}; | ||
@@ -218,26 +222,26 @@ this.instrumenter = createInstrumenter({ | ||
} | ||
if (this.options.branches || this.options.functions || this.options.lines || this.options.statements) { | ||
this.checkThresholds({ | ||
if (this.options.thresholds) { | ||
const resolvedThresholds = this.resolveThresholds({ | ||
coverageMap, | ||
thresholds: { | ||
branches: this.options.branches, | ||
functions: this.options.functions, | ||
lines: this.options.lines, | ||
statements: this.options.statements | ||
}, | ||
perFile: this.options.perFile | ||
thresholds: this.options.thresholds, | ||
createCoverageMap: () => libCoverage.createCoverageMap({}) | ||
}); | ||
} | ||
if (this.options.thresholdAutoUpdate && allTestsRun) { | ||
this.updateThresholds({ | ||
coverageMap, | ||
thresholds: { | ||
branches: this.options.branches, | ||
functions: this.options.functions, | ||
lines: this.options.lines, | ||
statements: this.options.statements | ||
}, | ||
perFile: this.options.perFile, | ||
configurationFile: this.ctx.server.config.configFile | ||
this.checkThresholds({ | ||
thresholds: resolvedThresholds, | ||
perFile: this.options.thresholds.perFile | ||
}); | ||
if (this.options.thresholds.autoUpdate && allTestsRun) { | ||
if (!this.ctx.server.config.configFile) | ||
throw new Error('Missing configurationFile. The "coverage.thresholds.autoUpdate" can only be enabled when configuration file is used.'); | ||
const configFilePath = this.ctx.server.config.configFile; | ||
const configModule = parseModule(await promises.readFile(configFilePath, "utf8")); | ||
this.updateThresholds({ | ||
thresholds: resolvedThresholds, | ||
perFile: this.options.thresholds.perFile, | ||
configurationFile: { | ||
write: () => writeFileSync(configFilePath, configModule.generate().code, "utf-8"), | ||
read: () => configModule.exports.default.$type === "function-call" ? configModule.exports.default.$args[0] : configModule.exports.default | ||
} | ||
}); | ||
} | ||
} | ||
@@ -244,0 +248,0 @@ } |
{ | ||
"name": "@vitest/coverage-istanbul", | ||
"type": "module", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"description": "Istanbul coverage provider for Vitest", | ||
@@ -29,3 +29,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js" | ||
"default": "./dist/index.js" | ||
}, | ||
@@ -44,7 +44,8 @@ "./*": "./*" | ||
"dependencies": { | ||
"istanbul-lib-coverage": "^3.2.0", | ||
"istanbul-lib-instrument": "^6.0.0", | ||
"istanbul-lib-coverage": "^3.2.2", | ||
"istanbul-lib-instrument": "^6.0.1", | ||
"istanbul-lib-report": "^3.0.1", | ||
"istanbul-lib-source-maps": "^4.0.1", | ||
"istanbul-reports": "^3.1.5", | ||
"istanbul-reports": "^3.1.6", | ||
"magicast": "^0.3.2", | ||
"picocolors": "^1.0.0", | ||
@@ -54,9 +55,9 @@ "test-exclude": "^6.0.0" | ||
"devDependencies": { | ||
"@types/istanbul-lib-coverage": "^2.0.4", | ||
"@types/istanbul-lib-instrument": "^1.7.4", | ||
"@types/istanbul-lib-report": "^3.0.0", | ||
"@types/istanbul-lib-source-maps": "^4.0.1", | ||
"@types/istanbul-reports": "^3.0.1", | ||
"@types/istanbul-lib-coverage": "^2.0.6", | ||
"@types/istanbul-lib-instrument": "^1.7.7", | ||
"@types/istanbul-lib-report": "^3.0.3", | ||
"@types/istanbul-lib-source-maps": "^4.0.4", | ||
"@types/istanbul-reports": "^3.0.4", | ||
"pathe": "^1.1.1", | ||
"vitest": "1.0.0-beta.4" | ||
"vitest": "1.0.0-beta.5" | ||
}, | ||
@@ -63,0 +64,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18054
9
7
384
+ Addedmagicast@^0.3.2
+ Addedmagicast@0.3.5(transitive)
Updatedistanbul-lib-coverage@^3.2.2
Updatedistanbul-reports@^3.1.6