Skip to content

Stop reporting test coverage locally #1266

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

Merged
merged 7 commits into from
Apr 28, 2025
Merged

Conversation

frankieroberto
Copy link
Contributor

@frankieroberto frankieroberto commented Apr 27, 2025

Outputting the test code coverage table at the end of each test run makes it harder to spot which tests actually failed, as you have to scroll up each time.

This stops the test coverage being reported locally when running npm test, but continues to report it to Sonar.

Outputting the test code coverage table at the end of each test run makes it harder to spot which tests actually failed, as you have to scroll up each time.

Our test coverage is also pretty bad right now, so the table is full of red, which shows that it’s not really working as a nudge to contributors.

Suggest we remove it for now, work on improving the test coverage separately, and maybe consider a separate tool in future which could check on each pull request whether test coverage has at least not gone down?
@colinrotherham
Copy link
Contributor

Does this URL load for you too (when signing in with GitHub)?
https://sonarcloud.io/component_measures?metric=coverage&view=list&id=nhsuk-frontend

Clearly it's not being collected properly but I would like to see the data gathered via GitHub Actions. It's great to check that URL over time and slowly see the numbers going up

There must be a way to remove the "Quality Gate passed" 0% spam though

@frankieroberto
Copy link
Contributor Author

frankieroberto commented Apr 28, 2025

Does this URL load for you too (when signing in with GitHub)? https://sonarcloud.io/component_measures?metric=coverage&view=list&id=nhsuk-frontend

404 for me.

@frankieroberto
Copy link
Contributor Author

@colinrotherham ah, it works after authorising it against GitHub. But the report is broken and showing 0% for everything:

Screenshot 2025-04-28 at 13 13 02

Feels like a good reason for disabling it for now? We could re-examine how best to report code coverage later?

@colinrotherham
Copy link
Contributor

colinrotherham commented Apr 28, 2025

Sorry yeah, that's what I meant by this bit 😔

Clearly it's not being collected properly…

I'd like to fix it one rainy day so the stats work again, but also solve your spam problem

That said, it's working correctly for the moved JavaScript files in #1261 (comment)

☝️ 90.9% coverage (because I added tests for module exports)

@frankieroberto
Copy link
Contributor Author

@colinrotherham ok updated the PR and description so that this only stops the report from happening when running the tests locally, but keeps the reports when reporting the tests to Sonar.

@colinrotherham colinrotherham self-requested a review April 28, 2025 13:43
@frankieroberto frankieroberto changed the title Stop reporting test coverage Stop reporting test coverage locally Apr 28, 2025
Copy link

@frankieroberto frankieroberto merged commit 9f5d719 into main Apr 28, 2025
11 checks passed
@frankieroberto frankieroberto deleted the stop-reporting-test-coverage branch April 28, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants