diff --git a/lib/is-cjs-esm-bridge.js b/lib/is-cjs-esm-bridge.js deleted file mode 100644 index a7dd3093..00000000 --- a/lib/is-cjs-esm-bridge.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = ({ functions }) => { - // https://github.com/nodejs/node/blob/v12.1.0/lib/internal/modules/esm/create_dynamic_module.js#L11-L19 - return functions.length === 3 && - functions[0].functionName === '' && - functions[0].isBlockCoverage === true && - functions[1].functionName === 'get' && - functions[1].isBlockCoverage === false && - functions[2].functionName === 'set' && - functions[2].isBlockCoverage === true -} diff --git a/lib/report.js b/lib/report.js index e1671ca0..a69a5595 100644 --- a/lib/report.js +++ b/lib/report.js @@ -14,7 +14,6 @@ const { pathToFileURL, fileURLToPath } = require('url') const getSourceMapFromFile = require('./source-map-from-file') // TODO: switch back to @c88/v8-coverage once patch is landed. const v8toIstanbul = require('v8-to-istanbul') -const isCjsEsmBridgeCov = require('./is-cjs-esm-bridge') const util = require('util') const debuglog = util.debuglog('c8') @@ -106,7 +105,6 @@ class Report { v8ProcessCov = this._getMergedProcessCov() } const resultCountPerPath = new Map() - const possibleCjsEsmBridges = new Map() for (const v8ScriptCov of v8ProcessCov.result) { try { @@ -125,26 +123,13 @@ class Report { resultCountPerPath.set(path, 0) } - if (isCjsEsmBridgeCov(v8ScriptCov)) { - possibleCjsEsmBridges.set(converter, { - path, - functions: v8ScriptCov.functions - }) - } else { - converter.applyCoverage(v8ScriptCov.functions) - map.merge(converter.toIstanbul()) - } + converter.applyCoverage(v8ScriptCov.functions) + map.merge(converter.toIstanbul()) } catch (err) { debuglog(`file: ${v8ScriptCov.url} error: ${err.stack}`) } } - for (const [converter, { path, functions }] of possibleCjsEsmBridges) { - if (resultCountPerPath.get(path) <= 1) { - converter.applyCoverage(functions) - map.merge(converter.toIstanbul()) - } - } this._allCoverageFiles = map return this._allCoverageFiles } diff --git a/test/integration.js.snap b/test/integration.js.snap index 08cb2402..bd6c8fa5 100644 --- a/test/integration.js.snap +++ b/test/integration.js.snap @@ -156,7 +156,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.47 | 12.24 | 6.38 | 3.47 | +All files | 3.52 | 12.5 | 6.52 | 3.52 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -166,9 +166,8 @@ All files | 3.47 | 12.24 | 6.38 | 3.47 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10 parse-args.js | 0 | 0 | 0 | 0 | 1-224 - report.js | 0 | 0 | 0 | 0 | 1-417 + report.js | 0 | 0 | 0 | 0 | 1-402 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 | check-coverage.js | 0 | 0 | 0 | 0 | 1-70 @@ -522,7 +521,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.47 | 12.24 | 6.38 | 3.47 | +All files | 3.52 | 12.5 | 6.52 | 3.52 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -532,9 +531,8 @@ All files | 3.47 | 12.24 | 6.38 | 3.47 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10 parse-args.js | 0 | 0 | 0 | 0 | 1-224 - report.js | 0 | 0 | 0 | 0 | 1-417 + report.js | 0 | 0 | 0 | 0 | 1-402 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 | check-coverage.js | 0 | 0 | 0 | 0 | 1-70