From fb7b29d8a021151b352a6a90a89068d1146d6b4a Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sun, 21 Oct 2018 12:05:55 -0700 Subject: [PATCH] fix: address file:// issue with CJS --- lib/report.js | 2 ++ test/integration.js.snap | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/report.js b/lib/report.js index 18f46cd0..eff01778 100644 --- a/lib/report.js +++ b/lib/report.js @@ -112,6 +112,8 @@ class Report { _filterProcessCov (v8ProcessCov) { const result = [] for (const v8ScriptCov of v8ProcessCov.result) { + // TODO: implement real fix from https://github.com/nodejs/node/issues/23783 + v8ScriptCov.url = v8ScriptCov.url.replace(/^file:\/\//, '') if (this.exclude.shouldInstrument(v8ScriptCov.url) && (!this.omitRelative || isAbsolute(v8ScriptCov.url))) { result.push(v8ScriptCov) diff --git a/test/integration.js.snap b/test/integration.js.snap index c147625a..ebf19de2 100644 --- a/test/integration.js.snap +++ b/test/integration.js.snap @@ -8,12 +8,12 @@ second --------------------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | --------------------|----------|----------|----------|----------|-------------------| -All files | 94.97 | 72.22 | 0 | 94.97 | | +All files | 95 | 72.22 | 0 | 95 | | bin | 87.76 | 62.5 | 100 | 87.76 | | c8.js | 87.76 | 62.5 | 100 | 87.76 | 35,39,46,47,48,49 | - lib | 96.62 | 62.07 | 100 | 96.62 | | + lib | 96.65 | 62.07 | 100 | 96.65 | | parse-args.js | 97.47 | 44.44 | 100 | 97.47 | 55,56 | - report.js | 96.09 | 70 | 100 | 96.09 | 56,57,95,96,97 | + report.js | 96.15 | 70 | 100 | 96.15 | 56,57,95,96,97 | test/fixtures | 95.16 | 94.12 | 0 | 95.16 | | async.js | 100 | 100 | 100 | 100 | | multiple-spawn.js | 100 | 100 | 100 | 100 | |