-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Source map remapping has issues on files with no branches or functions #121
Comments
We've been seeing this as well. Any clue on how we could fix this? |
@LarsDenBakker it basically seems to be that the reporting logic is unhappy if there a file contains no branches or functions, is my theory. Interestingly, this only seems to crop up when we're applying source maps, and trying to convert from JavaScript to TypeScript. What makes this problem so sticky, is that the AST from V8 doesn't necessarily match the AST that TypeScript used to build its source maps. |
To address the issue, someone needs to dig into the output that |
I dug into it a while ago, but wasn't able to figure it out at the time :( |
@LarsDenBakker are you still able to reproduce this, I did put a few fixes in place related to this bug a month ago. |
It looks like we're still on v5, so I'll update and ask if users are still seeing this error. |
This definitely intersects with what's going on in here: istanbuljs/istanbuljs#207, as while I get this issue in a handful of places, I can move it around by changing the use of exported fat arrow functions or not in various test contexts...even if those fat arrow methods are leveraged in non-covered files... 🤔 |
@mario-aleo @LarsDenBakker if you could provide a minimal reproduction, that would be super helpful 👍 |
@bcoe @mario-aleo @LarsDenBakker I ran into this issue today with @web/test-runner. I was able to narrow it down to one class file and two test files. If any of these characteristics are changed, the coverage report works properly:
export class MyClass {
fn() {
this._ = function () {};
}
}
https://github.com/stephenwade/coverage-issue-repro To reproduce, run |
@stephenwade thank you for the reproduction. |
I have a minimal repro repository here: https://github.com/Stuk/wtr-coverage-repro. The details of what I believe causes this issue are listed in the readme. To summarize, metadata for functions in a file is only collected the first time that file is loaded, however some methods might only be defined when more code executed. Hence the above error when trying to access metadata for a covered function that doesn't always exist. |
@Stuk thank you for the reproduction, not sure when I'll have cycles for OSS in the immediate term, but this will help the fix be quick when I can sit down to look. |
@bcoe I have a fix for this that I was able to find in the https://github.com/modernweb-dev/web repo that I'll be sending a PR for tomorrow. Unfortunately as I was skimming the code I wasn't able to work out how to fix it in this repo. |
Collect and merge function definitions from all runs in coverage mapping Fixes modernweb-dev#689 See also istanbuljs/v8-to-istanbul#121
…ts (#1436) Collect and merge function definitions from all runs in coverage mapping Fixes #689 See also istanbuljs/v8-to-istanbul#121
The fix from @Stuk fixes our logic of merging coverage of different test runs on different browsers. I'm not sure if that was the same scenario as originally reported in this issue, it might still occur without merging involved. |
I noticed this error cropping up for HTML reports:
The text was updated successfully, but these errors were encountered: