-
Notifications
You must be signed in to change notification settings - Fork 111
Save coverage for each page in a test #70
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
Save coverage for each page in a test #70
Conversation
Hmm, @grantbdev I love it. I just need an example site showing this in action. |
@bahmutov I can do that. Do you have any preferences on what I base it on or is any minimum repo that has different JS (be it jQuery, React, etc.) loaded/executed across windows sufficient? |
@bahmutov clarification on what you need for an example site would be appreciated 😄 |
very interesting, let go! |
@grantbdev as an example I would love to see a simple site with 2 pages, each loading its own code. The test could open the first page, then click on a link to go to the second page. The collected coverage object should show coverage for the code loaded on the first page and the code loaded on the second page |
Save coverage for each page visited in a test by keeping a reference to the coverage for each app window loaded and then saving the coverage at the end after coverage is calculated. An additional page is added to the example test app and the page test navigates to the new page. Without this coverage change, coverage is lost for `app.js` due to the last page not loading it. With this coverage change, coverage is kept for `app.js` along with coverage for `about.js`.
@bahmutov PR rebased and updated with testing sample code in this package's test suite if that is OK with you. |
Any updates on when this could potentially be released? |
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.
Looks good, I will merge this, test locally and will release it.
🎉 This PR is included in version 1.11.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm not sure this is the right place, but i found out the bug might be related to the following lines for
If i have a test file with multiple tests
What happens is that |
@windmaomao It's been a long time since I worked on this, but I believe the intended behavior is to give the total counts/coverage of all the tests run at once. I think that is also consistent with coverage tracking in other testing libraries where it typically shows the totals for a testing session. If you want to see the coverage from a specific test you would have to run it in isolation. |
thanks @grantbdev , i appreciate your time. Actually i'm asking the opposite. The I think i know exactly what i want to get. I want the test 2 results gets merged at the end of this entire unit, but not after test 1 is finished. |
Save coverage for each page visited in a test by keeping a reference to the coverage for each app window loaded and then saving the coverage at the end after coverage is calculated.
The implementation in the PR keeps the behavior of saving coverage after each test since that is the current behavior and I believe it would be necessary for #4. However, I think it would also be possible to initialize the array and event listener in
before()
and only save coverage inafter()
if that is desired instead.Closes #69