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

Ensure go test coverprofile outputs to the expected location #1105

Merged
merged 1 commit into from
Dec 23, 2022

Conversation

JoelSpeed
Copy link
Contributor

Fixes #1104

This PR updates the runGoTest function to set the coverprofile to the AbsPathForGeneratedAsset when the coverprofile isn't already absolute (that seems sensible but I note that isn't the case for the runSerial function just below which has the same sort of fix?)

This should resolve the issue described, where the coverprofile ends up in the test suite dir.

When outputDir is not set, the AbsPathForGeneratedAsset sets the output to the suite's abs path plus the asset name, which is the behaviour right now.

When outputDir is set, it sets the path to the suite name plus asset name within the output dir. This uses the same logic as is used within the finalize section so should mean things like the keep separate reports and output vs output should behave correctly.

Testing locally, if I have no outputDir, each suite gets their own coverprofile (both Go and ginkgo suites), if I have an outputDir, the error is gone and I get a single profile out which I believe is expected, combining that with -keep-separate-coverprofiles` gives me a folder of individual coverprofiles based on the suite names.

@onsi onsi merged commit b0bd77b into onsi:master Dec 23, 2022
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.

Coverage does not work for Go tests
2 participants