Comparing version 7.7.1 to 7.7.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [7.7.2](https://www.github.com/bcoe/c8/compare/v7.7.1...v7.7.2) (2021-05-02) | ||
### Bug Fixes | ||
* address bugs with source remapping on Windows ([#301](https://www.github.com/bcoe/c8/issues/301)) ([c817902](https://www.github.com/bcoe/c8/commit/c81790262f843c01b3d14390fde81dbdbcf2226f)) | ||
### [7.7.1](https://www.github.com/bcoe/c8/compare/v7.7.0...v7.7.1) (2021-04-07) | ||
@@ -7,0 +14,0 @@ |
const Exclude = require('test-exclude') | ||
const furi = require('furi') | ||
const libCoverage = require('istanbul-lib-coverage') | ||
@@ -8,2 +7,3 @@ const libReport = require('istanbul-lib-report') | ||
const { isAbsolute, resolve, extname } = require('path') | ||
const { pathToFileURL, fileURLToPath } = require('url') | ||
const getSourceMapFromFile = require('./source-map-from-file') | ||
@@ -143,4 +143,4 @@ // TODO: switch back to @c88/v8-coverage once patch is landed. | ||
const sources = {} | ||
if (this.sourceMapCache[`file://${v8ScriptCov.url}`]) { | ||
const sourceMapAndLineLengths = this.sourceMapCache[`file://${v8ScriptCov.url}`] | ||
const sourceMapAndLineLengths = this.sourceMapCache[pathToFileURL(v8ScriptCov.url).href] | ||
if (sourceMapAndLineLengths) { | ||
// See: https://github.com/nodejs/node/pull/34305 | ||
@@ -178,3 +178,3 @@ if (!sourceMapAndLineLengths.data) return | ||
if (v8ProcessCov['source-map-cache']) { | ||
Object.assign(this.sourceMapCache, v8ProcessCov['source-map-cache']) | ||
Object.assign(this.sourceMapCache, this._normalizeSourceMapCache(v8ProcessCov['source-map-cache'])) | ||
} | ||
@@ -200,3 +200,3 @@ v8ProcessCovs.push(this._normalizeProcessCov(v8ProcessCov, fileIndex)) | ||
if (sourceMap) { | ||
this.sourceMapCache[`file://${fullPath}`] = { data: sourceMap } | ||
this.sourceMapCache[pathToFileURL(fullPath)] = { data: sourceMap } | ||
} | ||
@@ -282,3 +282,3 @@ emptyReports.push({ | ||
try { | ||
v8ScriptCov.url = furi.toSysPath(v8ScriptCov.url) | ||
v8ScriptCov.url = fileURLToPath(v8ScriptCov.url) | ||
fileIndex.add(v8ScriptCov.url) | ||
@@ -298,2 +298,19 @@ } catch (err) { | ||
} | ||
/** | ||
* Normalizes a V8 source map cache. | ||
* | ||
* This function normalizes file URLs to a system-independent format. | ||
* | ||
* @param v8SourceMapCache V8 source map cache to normalize. | ||
* @return {v8SourceMapCache} Normalized V8 source map cache. | ||
* @private | ||
*/ | ||
_normalizeSourceMapCache (v8SourceMapCache) { | ||
const cache = {} | ||
for (const fileURL of Object.keys(v8SourceMapCache)) { | ||
cache[pathToFileURL(fileURLToPath(fileURL)).href] = v8SourceMapCache[fileURL] | ||
} | ||
return cache | ||
} | ||
} | ||
@@ -300,0 +317,0 @@ |
{ | ||
"name": "c8", | ||
"version": "7.7.1", | ||
"version": "7.7.2", | ||
"description": "output coverage reports using Node.js' built in coverage", | ||
@@ -40,3 +40,2 @@ "main": "./index.js", | ||
"foreground-child": "^2.0.0", | ||
"furi": "^2.0.0", | ||
"istanbul-lib-coverage": "^3.0.0", | ||
@@ -43,0 +42,0 @@ "istanbul-lib-report": "^3.0.0", |
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
47589
12
708
- Removedfuri@^2.0.0
- Removed@types/is-windows@1.0.2(transitive)
- Removedfuri@2.0.0(transitive)
- Removedis-windows@1.0.2(transitive)