task "combineCoverage" times out for big projects
See original GitHub issueI have a project with 424 instrumented source files.
The task “combineCoverage” allways runs into a timeout (even after waiting for 2h30).
After some digging:
I added some debug in the following code:
-
I found out that my
win.__coverage__
contains a huge object (with 424 entries) that serializes to a 7.5MB string. -
The
combineCoverage
task is never reached (I added a debug at the beginning and it never prints). -
I created an empty task
testTask
which I called using the same object as parameter and it also got stuck. -
when I only instrument 3 files, it works fine.
my workaround
As a workaround, I’m currently ‘splitting’ my coverage object into smaller chunks (50 entries each). And it works fine.
afterEach(() => {
// save coverage after each test
// because the entire "window" object is about
// to be recycled by Cypress before next test
cy.window().then(win => {
// if application code has been instrumented, the app iframe "window" has an object
const applicationSourceCoverage = win.__coverage__
if (applicationSourceCoverage) {
let i = 0;
let tmpObj = {};
Object.keys(applicationSourceCoverage).forEach(key => {
let value = applicationSourceCoverage[key];
tmpObj[key] = value;
if (++i % 50 == 0) {
cy.log(i + ' - ' + JSON.stringify(tmpObj).length);
cy.task('combineCoverage', tmpObj)
tmpObj = {};
}
});
if (tmpObj !== {}) {
cy.log(i + ' - ' + JSON.stringify(tmpObj).length);
cy.task('combineCoverage', tmpObj)
}
}
})
})
it works fine as a temporary woraround:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
cypress-io/cypress - Gitter
Everything works fine but I get all the time when 'cypress open' - "Warning: Multiple attempts to register the following task(s): resetCoverage, combineCoverage...
Read more >Code Coverage for End-to-end Tests - Gleb Bahmutov
The object contains location of all statements, functions and branches in the original code, and the counters for how many times each item...
Read more >Cannot get code coverage with Cypress + Istanbul
I tried setting up code coverage in an Angular 8 project using ... you can see that the tasks are executed (resetCoverage, combineCoverage, ......
Read more >Complete Code Coverage with Cypress - YouTube
Are there parts of the application still untested? Are you running redundant tests that are wasting resources and time ? … Show more....
Read more >Task Analysis Guide Pdf [PDF] - web.folio3.com
If you ally infatuation such a referred task analysis guide pdf books that will pay for you ... AFIT, for the first time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🎉 This issue has been resolved in version 1.10.2 🎉
The release is available on:
Your semantic-release bot 📦🚀
Thanks for that. I was able to follow that commit and get ours working much quicker now as well.