puppeteer-to-istanbul
puppeteer-to-istanbul copied to clipboard
Collecting Coverage for Multiple Pages
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
@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.
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.
Hi there! The issue is still actual, we trigger reload on each test and result not very nice
Would be grate to have some solution OOB
Setting
resetOnNavigation
does work but becausepuppeteer-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 multipleout.json
files and I removed the unique filename feature. That did the trick for me.
Can I see your revised code
Sure. Here's an attempt. It's been a while.
https://github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.2.2...arienkock:master