-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Adding code coverage to Cypress (AngularX) #14465
Conversation
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.
This PR is interesting and you did a great job.
We should make it more modular and simplify it.
@mshima thank you for the code reviews ans suggestions. |
@mshima thank once again you for your code review. After adding and testing your commit, I can't seem to get the instrumented code:
The code doesn't seem to be instrumented: I wanted to let you know first (am I missing something obvious?) before I investigate further later. |
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.
The loader is inside if (targetOptions.target === 'serve' || config.watch)
but target is build
.
Rebase against main for webpack needle support.
generators/cypress/templates/src/test/javascript/cypress/cypress_coverage.ts.ejs
Outdated
Show resolved
Hide resolved
generators/client/templates/angular/webpack/webpack.custom.js.ejs
Outdated
Show resolved
Hide resolved
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
@mshima it's working now. Thanks! |
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
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.
LGTM.
@jidma can you add an option to generator/app/index.js please?
See #14465 (comment).
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
@jidma congratulations on your first contribution. |
Hi,
Can you help me? Thank you very much :-) |
PR description
The PR adds code coverage to Cypress e2e Testing (AngularX front end).
When the option is selected, two new npm scripts are added:
The first command allows the user to start the Angular dev server with instrumented code (using istanbul). The dev server is started without
ghostMode
:The second command runs the e2e tests and generates a coverage report:
Cypress will then run against the dev server on port 9000 (started with npm run start-insrt)
After the tests are finished, a report is generated under
./coverage/lcov-report/
Known issue
If running against a non instrumented code (ie. started with
npm run e2e:cypress
), Cypress will issue a warning complaining about the code not being instrumented.Readme added section:
(...)
Code Coverage
When using Cypress with AngularX, you can generate code coverage report by running your dev server with instrumented code:
Start your backend (option
-P-webapp
to skip compiling the Angular Front):Start your Angular dev server with instrumented code:
Start your Cypress end to end testing:
The coverage report is generated under
./coverage/lcov-report/
(...)
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.