New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: istanbul-lib-source-maps
to preserve implicit else
when sourcemaps are used
#706
base: main
Are you sure you want to change the base?
fix: istanbul-lib-source-maps
to preserve implicit else
when sourcemaps are used
#706
Conversation
istanbul-lib-source-maps
to preserve implicit else when sourceps are used
// Check if this is an implicit else | ||
else if ( | ||
branchMeta.type === 'if' && | ||
i > 0 && | ||
loc.start.line === undefined && | ||
loc.start.end === undefined && | ||
loc.end.line === undefined && | ||
loc.end.end === undefined | ||
) { | ||
locs.push(loc); | ||
mappedHits.push(hits[i]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference:
Line 49 in fb8cb4b
- `locations[index].start` **[Object][1]** the branch component start location object. (`{}` for if branch without else) |
Line 52 in fb8cb4b
- `locations[index].end` **[Object][1]** the branch component end location object. (`{}` for if branch without else) |
istanbuljs/packages/istanbul-reports/lib/html/annotator.js
Lines 147 to 154 in fb8cb4b
// Check if the branch is a conditional if branch. | |
branchMeta[branchName].type === 'if' && | |
// Check if the branch has an implicit else. | |
branchArray.length === 2 && | |
// Check if the implicit else branch is unnacounted for. | |
metaArray.length === 1 && | |
// Check if the implicit else branch is uncovered. | |
branchArray[1] === 0 |
istanbul-lib-source-maps
to preserve implicit else when sourceps are usedistanbul-lib-source-maps
to preserve implicit else
when sourcemaps are used
@AriPerkkio |
Hello! Is there a timeline for this to be merged? We're hitting this issue as well with cypress code coverage on instrumented code with source maps. Thanks! |
Istanbul projects are not that active anymore so updates may take long time - if ever. If you have access to |
istanbul-lib-source-maps
does not preserve implicitelse
#705Tested the fix with reproduction case from downstream (vitest-dev/vitest#2239) by modifying
./node_modules/istanbul-lib-source-maps/lib/transformer.js
on the fly.