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

Collecting Coverage for Multiple Pages #45

Open
Neuroforge opened this issue Feb 13, 2020 · 5 comments
Open

Collecting Coverage for Multiple Pages #45

Neuroforge opened this issue Feb 13, 2020 · 5 comments

Comments

@Neuroforge
Copy link

Hello,

I am running a number of tests that need me to refresh the page.

When i run one test i get a single nyc_output file as expected. When i create a new test, with a new page object, the code coverage collection needs to be restarted.

Can i aggregate code coverage results for many pages?
Can code coverage persist between page refreshes?

Kind regards,

Daniel

@SanterreJo
Copy link
Collaborator

@Neuroforge
Puppeteer has an option to reset coverage on navigation which is on by default.
https://github.com/puppeteer/puppeteer/blob/v2.1.1/docs/api.md#coveragestartjscoverageoptions
Disabling this option will probably solve your problem.

@arienkock
Copy link

Setting resetOnNavigation does work but because puppeteer-to-istanbul creates unique filenames for the source files, the generated reports show many instances of the same files instead of a combined coverage which is the most common use case.

My workaround is that I vendored in puppeteer-to-istanbul and made modifications so that it creates multiple out.json files and I removed the unique filename feature. That did the trick for me.

@dimanech
Copy link

Hi there!
The issue is still actual, we trigger reload on each test and result not very nice

Screenshot from 2020-05-31 09-45-37

Would be grate to have some solution OOB

@lidongxue
Copy link

Setting resetOnNavigation does work but because puppeteer-to-istanbul creates unique filenames for the source files, the generated reports show many instances of the same files instead of a combined coverage which is the most common use case.

My workaround is that I vendored in puppeteer-to-istanbul and made modifications so that it creates multiple out.json files and I removed the unique filename feature. That did the trick for me.

Can I see your revised code

@arienkock
Copy link

Sure. Here's an attempt. It's been a while.

v1.2.2...arienkock:master

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

No branches or pull requests

5 participants