Skip to content
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: map paths back to original file paths #64

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dword-design
Copy link

Hey folks,

I like this package and it solves a lot of my code coverage problems in frontend testing!

One problem with the current implementation is that the coverage is actually measured on different files than the original ones. This works rather fine when you only measure coverage over visited files. However, it leads to problems when you e.g. work with the nyc --all option and you want to be precise with the covered files.

While it is necessary to write the generated webpack files to disk for v8-to-istanbul, we actually do not need to pass the coverage data on as-is. We can convert them back to their original paths and have nice and consistent coverage data.

The current proposal is kinda the idea, there are failing tests and I need some feedback from contributors who are deeper into the topic. Also, the implementation with the for loops is a bit error prone, I'd prefer a non-mutating solution here.

Would love to have this integrated. For me it's working fine!

@dword-design
Copy link
Author

I added a commit that also applies source maps, so now we have coverage that matches the original file's lines.

@bcoe
Copy link
Member

bcoe commented Apr 7, 2021

@dword-design hey 👋 sorry for the slow review, got a bit behind on GitHub.

I don't do much frontend coding these days I'm afraid, so I'm willing to defer to your expertise (as an active user of the module). If we can get tests passing, I'm open to your proposal.

@dword-design
Copy link
Author

@bcoe Alright. I think it needs some more work, also regarding the tests. I'll keep pushing stuff in here and if it has a stable state, I'll write it here. I'm not (or wasn't) a big expert in code coverage, so I'm getting into the topic by this. Would be great to have a library that reflects covered code in puppeteer back to the original source files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants