question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

task "combineCoverage" times out for big projects

See original GitHub issue

I have a project with 424 instrumented source files.

The task “combineCoverage” allways runs into a timeout (even after waiting for 2h30).

cypress1

After some digging:

I added some debug in the following code:

https://github.com/cypress-io/code-coverage/blob/40a602d4b26a22b28ced552e7829a27f38a2cebc/support.js#L17-L29

  • 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:

cypress2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bahmutovcommented, Nov 14, 2019

🎉 This issue has been resolved in version 1.10.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

1reaction
lynchemcommented, Oct 31, 2019

Thanks for that. I was able to follow that commit and get ours working much quicker now as well.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found