@vitest/coverage-istanbul 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/provider.js +7 -5
  2. package/package.json +4 -4
package/dist/provider.js CHANGED
@@ -272,14 +272,16 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
272
272
  this.coverageFiles = /* @__PURE__ */ new Map();
273
273
  }
274
274
  async getCoverageMapForUncoveredFiles(coveredFiles) {
275
- const includedFiles = await this.testExclude.glob(this.ctx.config.root);
276
- const uncoveredFiles = includedFiles.map((file) => resolve(this.ctx.config.root, file)).filter((file) => !coveredFiles.includes(file));
275
+ const allFiles = await this.testExclude.glob(this.ctx.config.root);
276
+ let includedFiles = allFiles.map((file) => resolve(this.ctx.config.root, file));
277
+ if (this.ctx.config.changed)
278
+ includedFiles = (this.ctx.config.related || []).filter((file) => includedFiles.includes(file));
279
+ const uncoveredFiles = includedFiles.filter((file) => !coveredFiles.includes(file));
280
+ const cacheKey = (/* @__PURE__ */ new Date()).getTime();
277
281
  const coverageMap = libCoverage.createCoverageMap({});
278
282
  for (const [index, filename] of uncoveredFiles.entries()) {
279
283
  debug("Uncovered file %s %d/%d", filename, index, uncoveredFiles.length);
280
- if (this.ctx.vitenode.fetchCache.has(filename))
281
- this.ctx.vitenode.fetchCache.delete(filename);
282
- await this.ctx.vitenode.transformRequest(filename);
284
+ await this.ctx.vitenode.transformRequest(`${filename}?v=${cacheKey}`);
283
285
  const lastCoverage = this.instrumenter.lastFileCoverage();
284
286
  coverageMap.addFileCoverage(lastCoverage);
285
287
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/coverage-istanbul",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.4.0",
5
5
  "description": "Istanbul coverage provider for Vitest",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -37,14 +37,14 @@
37
37
  "dist"
38
38
  ],
39
39
  "peerDependencies": {
40
- "vitest": "1.3.1"
40
+ "vitest": "1.4.0"
41
41
  },
42
42
  "dependencies": {
43
43
  "debug": "^4.3.4",
44
44
  "istanbul-lib-coverage": "^3.2.2",
45
45
  "istanbul-lib-instrument": "^6.0.1",
46
46
  "istanbul-lib-report": "^3.0.1",
47
- "istanbul-lib-source-maps": "^4.0.1",
47
+ "istanbul-lib-source-maps": "^5.0.4",
48
48
  "istanbul-reports": "^3.1.6",
49
49
  "magicast": "^0.3.3",
50
50
  "picocolors": "^1.0.0",
@@ -58,7 +58,7 @@
58
58
  "@types/istanbul-lib-source-maps": "^4.0.4",
59
59
  "@types/istanbul-reports": "^3.0.4",
60
60
  "pathe": "^1.1.1",
61
- "vitest": "1.3.1"
61
+ "vitest": "1.4.0"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "rimraf dist && rollup -c",