diff --git a/lib/report.js b/lib/report.js index a69a5595..1fca11f0 100644 --- a/lib/report.js +++ b/lib/report.js @@ -109,7 +109,7 @@ class Report { for (const v8ScriptCov of v8ProcessCov.result) { try { const sources = this._getSourceMap(v8ScriptCov) - const path = resolve(this.resolve, v8ScriptCov.url) + const path = resolve(this.resolve, fileURLToPath(v8ScriptCov.url)) const converter = v8toIstanbul(path, this.wrapperLength, sources, (path) => { if (this.excludeAfterRemap) { return !this._shouldInstrument(path) @@ -146,7 +146,7 @@ class Report { */ _getSourceMap (v8ScriptCov) { const sources = {} - const sourceMapAndLineLengths = this.sourceMapCache[pathToFileURL(v8ScriptCov.url).href] + const sourceMapAndLineLengths = this.sourceMapCache[v8ScriptCov.url] if (sourceMapAndLineLengths) { // See: https://github.com/nodejs/node/pull/34305 if (!sourceMapAndLineLengths.data) return @@ -346,15 +346,15 @@ class Report { } if (/^file:\/\//.test(v8ScriptCov.url)) { try { - v8ScriptCov.url = fileURLToPath(v8ScriptCov.url) fileIndex.add(v8ScriptCov.url) } catch (err) { debuglog(`${err.stack}`) continue } } - if ((!this.omitRelative || isAbsolute(v8ScriptCov.url))) { - if (this.excludeAfterRemap || this._shouldInstrument(v8ScriptCov.url)) { + + if ((!this.omitRelative || /^file:\/\//.test(v8ScriptCov.url))) { + if (this.excludeAfterRemap || this.exclude.shouldInstrument(fileURLToPath(v8ScriptCov.url))) { result.push(v8ScriptCov) } } @@ -374,7 +374,7 @@ class Report { _normalizeSourceMapCache (v8SourceMapCache) { const cache = {} for (const fileURL of Object.keys(v8SourceMapCache)) { - cache[pathToFileURL(fileURLToPath(fileURL)).href] = v8SourceMapCache[fileURL] + cache[fileURL] = v8SourceMapCache[fileURL]; } return cache }