Closed craig-dae closed 1 year ago
@craig-dae You're setting up code coverage on the exact project mentioned in the tutorial right? Not your own project that you're adding code coverage to? Just wondering if the tests (or amount of tests run) may be having some effect on this.
No, I'm applying it to an existing project that is very large. I have over 300 tests across 53 spec files.
The amount of tests are probably having an affect. When I tell it to run all the tests, it takes a LONG time to load all of them into memory before it begins to run.
This is why I think I get different results if I 1) let Angular handle running the tests, via ng e2e
vs 2) Running the app on its own and cypress on its own. When I do #1, I bump up the memory allocation to 8gb. When I do #2, I'm not sure how to bump memory allocation up on Cypress, and it fails before it runs the first test. Maybe I should try bumping it higher and doing #1 again to see what happens.
I've also added "numTestsKeptInMemory": 0,
to my cypress.json file, as I've seen recommended in at least one other thread.
Update: I'm currently running tests with memory bumped up to 10gb. However, we'll have to figure out how to get this working in cicd with github actions, which is limited to 7gb.
I ran it with 10gb like: coverage": "node --max_old_space_size=10240 node_modules/@angular/cli/bin/ng run myapp:coverage",
It failed on the same test. Note that if I directly run the test where it starts failing, the test succeeds.
1) An uncaught error was detected outside of a test:
Error: The following error originated from your test code, not from Cypress.
> Fetching resource at '/__cypress/tests?p=cypress/integration/outcomes/outcome-contributor.spec.ts' failed
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
at XMLHttpRequest.xhr.onerror (http://localhost.localdomain:8080/__cypress/runner/cypress_runner.js:174971:14)
WOOHOO!
Adding transpileOnly: true
allowed me to successfully run everything.
I don't understand what that does or why it helped, but it got all the way through!
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
If it continues to work, I'll close this ticket later today.
While transpileOnly
solution helps mitigate the problem when it first encountered, it seem to just hide the bigger problem.
During the initial load, cypress makes a lot of requests to url's such as http://127.0.0.1:8080/__cypress/tests?p=cypress/integration/qa/alerts.spec.ts
. Some of them pass, but quite a few get cancelled. Then it repeats same song and dance over and over trying to load them and eventually getting more and more of them loaded. At some point it either loads them all or fails with ERR_IPC_CHANNEL_CLOSED
.
It seems to me that Cypress does not account for the fact that code base can take a really long time to transpile or runs out of resources while doing it.
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.
Current behavior
After adding code coverage using the following walkthrough: https://dev.to/cssoldiervoif/code-coverage-with-cypress-angular-45pb
On the 39th test out of 53:
Desired behavior
I would like to be able to do an entire code coverage run.
Test code to reproduce
My plugins/index.js is:
Versions
Cypress: 5.4.0 Angular: 10 @cypress/code-coverage": "^3.8.2", AWS Workspaces
It has been a real struggle to get code coverage working. Please help!
If I run a test directly, it works fine.
If, instead of using angular.json to do both the web frontendand cypress, I run the web frontend in one terminal and cypress in another, I get an out of memory error. Can't figure out how to give more memory to Cypress.