-
Notifications
You must be signed in to change notification settings - Fork 272
Generate coverage value for both unit and E2E tests #6690
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
Conversation
It seems like we are not allowed to use Codecov on this repository, which makes exclude the tests from GHA. I had no problem to use that configuration on my fork and PR. |
04ec511
to
932d250
Compare
Action added to the repository and PR can be now reviewed. |
Codecov Report
@@ Coverage Diff @@
## master #6690 +/- ##
=========================================
Coverage ? 16.50%
=========================================
Files ? 1094
Lines ? 41821
Branches ? 10044
=========================================
Hits ? 6902
Misses ? 34919
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
85e0832
to
ccde634
Compare
I take the chance to correct the (very!) latest changes about testing in the documentation. |
ccde634
to
4ac6940
Compare
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.
One question and a couple of minor comments.
I looked at https://app.codecov.io/gh/rancher/dashboard and couldn't see anything in coverage
, will that start displaying when things get in to master? I noticed there was an entry in https://app.codecov.io/gh/rancher/dashboard/pulls, though clicking on that gives some kind of 404 page
@richard-cox commits diff can be seen only after merge. PR are not working probably due the checkout in the GHA. I'm going to disable it to see if it changes, as that caused problems also somewhere else, e.g. Sorry Cypress. |
I'd to merge the conflicts for |
78f4cad
to
4ddb126
Compare
I took the chance to upload separated coverage, so they can be analyzed separately. |
@richard-cox the 404 for the PR is due to the lack of coverage on master. It's explained here that to generate PR dashboards it requires a In my fork you can see that a second PR is actually working fine. |
4ddb126
to
c0a8674
Compare
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.
Regarding the sum of coverage being lower than the sum of e2e and unit test coverage (https://app.codecov.io/gh/cnotv/dashboard/compare/4/overview .. e2e 43.11% + unit 3.61% = 16.48%)
- Looking at the e2e (
cypress,config.ts
) and unit test ('jest.config.js) config it looks like the
codeCoverageand
collectCoverageFromvalues should be pretty similar .. except that
cypress//.and
/tests/**/.` are not explicitly ignored in jest. I don't think this though would account for the @20% drop - above both config's there's a line that might disable the codeCoverage/collectCoverageFrom config
coverage: false,
collectCoverage: false,
- it's super hard to tell from the json output, but is there anything obvious in the unit test one (like cypress or shell/scripts) that is there that shouldn't be?
- Could nyc config like from https://github.com/cypress-io/code-coverage#exclude-files-and-folders help solve the problem?
I think is computed with the weight of tests we have. Also if you check the configuration it is actually ignored for searching tests, based on your previous suggestion. On top of that, the configuration uses an allowing list, instead of an blocking list. modulePathIgnorePatterns: [
'<rootDir>/cypress/',
'<rootDir>/scripts/',
'<rootDir>/docusaurus/',
'<rootDir>/stories/',
'<rootDir>/shell/scripts/',
],
This is intended and should stay like this, otherwise it generates coverage at every test even locally.
Based on the HTML output and the configuration, there's nothing else as far as I am aware of.
Which problem? I think we may use the same configuration of Jest and Cypress, as we already do. |
c0a8674
to
5fbf95b
Compare
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.
There are still merge conflicts in yarn.lock
. Interestingly the e2e tests pass still
yarn install v1.22.19
info Merge conflict detected in yarn.lock and successfully merged.
https://github.com/rancher/dashboard/runs/8119029734?check_suite_focus=true#step:4:2
I may finish the |
…lback for commits
5fbf95b
to
d288161
Compare
@richard-cox Generated new |
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
* Correct Jest coverage configuration * Add coverage upload * Exclude operationsl scripts from linting * Rephrase title based on pull request title, run and attempt, with fallback for commits * Add instrumentation for E2E coverage report * Add merge logic to the coverage files * Add instrumentalization for Cypress to generate coverage for E2E * Download artifacts before merge coverage in CI * Merge fix * Copy coverage files before artifact upload * Add summary after running tests * Change restriction rules about coverage for pull_request and push * Add documentation for the coverage * Correct test documentation folder restructuring * Add inclusion list for Cypress coverage; add scripts as exclusion * Extend ignored path to be parsed for Jest to improve performances * Workflow cleanup * Checkout current branch head on test runs * Submit separated coverage with different flags
* Correct Jest coverage configuration * Add coverage upload * Exclude operationsl scripts from linting * Rephrase title based on pull request title, run and attempt, with fallback for commits * Add instrumentation for E2E coverage report * Add merge logic to the coverage files * Add instrumentalization for Cypress to generate coverage for E2E * Download artifacts before merge coverage in CI * Merge fix * Copy coverage files before artifact upload * Add summary after running tests * Change restriction rules about coverage for pull_request and push * Add documentation for the coverage * Correct test documentation folder restructuring * Add inclusion list for Cypress coverage; add scripts as exclusion * Extend ignored path to be parsed for Jest to improve performances * Workflow cleanup * Checkout current branch head on test runs * Submit separated coverage with different flags
Summary
Fixes #6501
Add coverage report for Rancher Dashboard using Codecov.
Occurred changes and/or fixed issues
Technical notes summary
.nycrc
to increase visibility and simplify reviews/shell/scripts/
folder not excluded from tests and generating non breaking errors in the logs@cypress/code-coverage
library for integrating coverage with Cypressbabel-plugin-istanbul
library for transpiling code to generate instrumentation through BabelNotes
Areas or cases that should be tested
Values should be displayed on Rancher Dashboard Codecov page.
Example on my fork with already merged branch.
Areas which could experience regressions
Existing pipeline, no actual check is needed.
Screenshot/Video
https://app.codecov.io/gh/rancher/dashboard/pulls