You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an issue with sourcemaps, which leads to inflated coverage in my project. When dealing with large chunks, the file is considered fully covered after conversion in Istanbul while in v8 report code is not covered.
The problem lies in this magical code inside the v8-to-istanbul
// The source maps generated by https://github.com/istanbuljs/istanbuljs
// (using @babel/core 7.7.5) have behavior, such that a mapping
// mid-way through a line maps to an earlier line than a mapping
// at position 0. Using the line at positon 0 seems to provide better reports:
//
// if (true) {
// cov_y5divc6zu().b[1][0]++;
// cov_y5divc6zu().s[3]++;
// console.info('reachable');
// } else { ... }
// ^ ^
// l5 l3
const min = originalPositionFor(sourceMap, {
line,
column: 0,
bias: GREATEST_LOWER_BOUND
})
if (min.line > original.line) {
original = min
}
Due to this in the method _maybeRemapStartColEndCol program can't find covSource for some of my project files.
For example, a path for code located in ./lib/test.ts is assigned to some ./node_modules/lib-name
I resolved this by forking and removing this magical code. It looks like it breaks the coverage.
Can you please explain the purpose of this code?
Is there a way to fix this behavior without fork?
This will generate a result.json file where you can see that all files are considered fully covered in the Istanbul format, even though v8 shows that they are not.
Environment:
node: v20.11.1
npm: 10.2.4
OS: macOS 14.5
The text was updated successfully, but these errors were encountered:
Hi!
I've encountered an issue with sourcemaps, which leads to inflated coverage in my project. When dealing with large chunks, the file is considered fully covered after conversion in Istanbul while in v8 report code is not covered.
The problem lies in this magical code inside the v8-to-istanbul
Due to this in the method _maybeRemapStartColEndCol program can't find covSource for some of my project files.
For example, a path for code located in ./lib/test.ts is assigned to some ./node_modules/lib-name
I resolved this by forking and removing this magical code. It looks like it breaks the coverage.
Can you please explain the purpose of this code?
Is there a way to fix this behavior without fork?
Reproduction steps:
git clone https://github.com/Neemsigo/v8-to-istanbul-source-map-problem.git
cd v8-to-istanbul-source-map-problem
npm i
node test.js
This will generate a result.json file where you can see that all files are considered fully covered in the Istanbul format, even though v8 shows that they are not.
Environment:
The text was updated successfully, but these errors were encountered: