Skip to content

Commit 5e18365

Browse files
authored
fix(refactor): remove stale check for createDynamicModule
The logic meant to correct coverage for createDynamicModule, such that it detected the wrapper inserted here https://github.com/nodejs/node/blob/2e81415d9a21756b7516cd3826482a152d1f8b02/lib/internal/modules/esm/create_dynamic_module.js#L51C7-L51C26 appears to have not been working. Removing for now. We can consider re-adding similar logic in the future with tests if appropriate.
1 parent 128bee2 commit 5e18365

File tree

3 files changed

+6
-33
lines changed

3 files changed

+6
-33
lines changed

lib/is-cjs-esm-bridge.js

-10
This file was deleted.

lib/report.js

+2-17
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const { pathToFileURL, fileURLToPath } = require('url')
1414
const getSourceMapFromFile = require('./source-map-from-file')
1515
// TODO: switch back to @c88/v8-coverage once patch is landed.
1616
const v8toIstanbul = require('v8-to-istanbul')
17-
const isCjsEsmBridgeCov = require('./is-cjs-esm-bridge')
1817
const util = require('util')
1918
const debuglog = util.debuglog('c8')
2019

@@ -106,7 +105,6 @@ class Report {
106105
v8ProcessCov = this._getMergedProcessCov()
107106
}
108107
const resultCountPerPath = new Map()
109-
const possibleCjsEsmBridges = new Map()
110108

111109
for (const v8ScriptCov of v8ProcessCov.result) {
112110
try {
@@ -125,26 +123,13 @@ class Report {
125123
resultCountPerPath.set(path, 0)
126124
}
127125

128-
if (isCjsEsmBridgeCov(v8ScriptCov)) {
129-
possibleCjsEsmBridges.set(converter, {
130-
path,
131-
functions: v8ScriptCov.functions
132-
})
133-
} else {
134-
converter.applyCoverage(v8ScriptCov.functions)
135-
map.merge(converter.toIstanbul())
136-
}
126+
converter.applyCoverage(v8ScriptCov.functions)
127+
map.merge(converter.toIstanbul())
137128
} catch (err) {
138129
debuglog(`file: ${v8ScriptCov.url} error: ${err.stack}`)
139130
}
140131
}
141132

142-
for (const [converter, { path, functions }] of possibleCjsEsmBridges) {
143-
if (resultCountPerPath.get(path) <= 1) {
144-
converter.applyCoverage(functions)
145-
map.merge(converter.toIstanbul())
146-
}
147-
}
148133
this._allCoverageFiles = map
149134
return this._allCoverageFiles
150135
}

test/integration.js.snap

+4-6
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ hey
156156
---------------------------------------|---------|----------|---------|---------|------------------------
157157
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
158158
---------------------------------------|---------|----------|---------|---------|------------------------
159-
All files | 3.47 | 12.24 | 6.38 | 3.47 |
159+
All files | 3.52 | 12.5 | 6.52 | 3.52 |
160160
c8 | 0 | 0 | 0 | 0 |
161161
index.js | 0 | 0 | 0 | 0 | 1
162162
c8/bin | 0 | 0 | 0 | 0 |
@@ -166,9 +166,8 @@ All files | 3.47 | 12.24 | 6.38 | 3.47
166166
prettify.js | 0 | 0 | 0 | 0 | 1-2
167167
sorter.js | 0 | 0 | 0 | 0 | 1-196
168168
c8/lib | 0 | 0 | 0 | 0 |
169-
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
170169
parse-args.js | 0 | 0 | 0 | 0 | 1-224
171-
report.js | 0 | 0 | 0 | 0 | 1-417
170+
report.js | 0 | 0 | 0 | 0 | 1-402
172171
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
173172
c8/lib/commands | 0 | 0 | 0 | 0 |
174173
check-coverage.js | 0 | 0 | 0 | 0 | 1-70
@@ -522,7 +521,7 @@ hey
522521
---------------------------------------|---------|----------|---------|---------|------------------------
523522
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
524523
---------------------------------------|---------|----------|---------|---------|------------------------
525-
All files | 3.47 | 12.24 | 6.38 | 3.47 |
524+
All files | 3.52 | 12.5 | 6.52 | 3.52 |
526525
c8 | 0 | 0 | 0 | 0 |
527526
index.js | 0 | 0 | 0 | 0 | 1
528527
c8/bin | 0 | 0 | 0 | 0 |
@@ -532,9 +531,8 @@ All files | 3.47 | 12.24 | 6.38 | 3.47
532531
prettify.js | 0 | 0 | 0 | 0 | 1-2
533532
sorter.js | 0 | 0 | 0 | 0 | 1-196
534533
c8/lib | 0 | 0 | 0 | 0 |
535-
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
536534
parse-args.js | 0 | 0 | 0 | 0 | 1-224
537-
report.js | 0 | 0 | 0 | 0 | 1-417
535+
report.js | 0 | 0 | 0 | 0 | 1-402
538536
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
539537
c8/lib/commands | 0 | 0 | 0 | 0 |
540538
check-coverage.js | 0 | 0 | 0 | 0 | 1-70

0 commit comments

Comments
 (0)