Skip to content
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

magefile: added combined test coverage support for mage test:all #2235

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kartikaysaxena
Copy link
Contributor

Fixes #1348 mage test:all now generates combined coverprofile aggregated into coverage.txt

Signed-off-by: Kartikay <[email protected]>
@kartikaysaxena kartikaysaxena requested a review from a team as a code owner February 4, 2025 21:19
testArgs := append([]string{
"test",
"-covermode=atomic",
"-coverprofile=coverage.txt",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this overwrite the coverage.txt file when each individual test suite runs? Can you try running mage test:all and ensure it combines the coverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the approach, now each test writes to a different file and removes those files in the end, go tool cover -html=coverage.txt now shows
Screenshot 2025-02-06 at 12 25 43 AM

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.

mage test:all should produce a combined code coverage result
2 participants