Skip to content

Commit d4f9cab

Browse files
authored
fix: address file:// issue with CJS (#39)
1 parent 67959b4 commit d4f9cab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/report.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class Report {
112112
_filterProcessCov (v8ProcessCov) {
113113
const result = []
114114
for (const v8ScriptCov of v8ProcessCov.result) {
115+
// TODO: implement real fix from https://github.com/nodejs/node/issues/23783
116+
v8ScriptCov.url = v8ScriptCov.url.replace(/^file:\/\//, '')
115117
if (this.exclude.shouldInstrument(v8ScriptCov.url) &&
116118
(!this.omitRelative || isAbsolute(v8ScriptCov.url))) {
117119
result.push(v8ScriptCov)

test/integration.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ second
88
--------------------|----------|----------|----------|----------|-------------------|
99
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
1010
--------------------|----------|----------|----------|----------|-------------------|
11-
All files | 94.97 | 72.22 | 0 | 94.97 | |
11+
All files | 95 | 72.22 | 0 | 95 | |
1212
bin | 87.76 | 62.5 | 100 | 87.76 | |
1313
c8.js | 87.76 | 62.5 | 100 | 87.76 | 35,39,46,47,48,49 |
14-
lib | 96.62 | 62.07 | 100 | 96.62 | |
14+
lib | 96.65 | 62.07 | 100 | 96.65 | |
1515
parse-args.js | 97.47 | 44.44 | 100 | 97.47 | 55,56 |
16-
report.js | 96.09 | 70 | 100 | 96.09 | 56,57,95,96,97 |
16+
report.js | 96.15 | 70 | 100 | 96.15 | 56,57,95,96,97 |
1717
test/fixtures | 95.16 | 94.12 | 0 | 95.16 | |
1818
async.js | 100 | 100 | 100 | 100 | |
1919
multiple-spawn.js | 100 | 100 | 100 | 100 | |

0 commit comments

Comments
 (0)