-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Coverage does not work for Go tests #1104
Comments
hey! sorry this isn't Just Working™ - i've managed to reproduce it locally and will take a look and circle back today/tomorrow. |
I'm happy to work on a patch if you're open to that, would just like a little guidance on which of the suggested paths to take |
that would be great! my instinct is to fix the go test args that are being generated and not to change the finalize. i think the main things to check are that things work for the various combinations of -output-dir (or no output-dir) and (-keep-separate-coverprofile) thanks! |
Looks like when running serial this problem is being solved by Lines 85 to 87 in 49fab7a
So I've raised a PR which basically does the same for the go test version. Manually tested it with various combinations and it seems to work as I'd expect |
hey thanks for this! i've pulled the PR in and will need to cut a release next - i'd like to play with the changes a bit first and see if there's an integration test i could backfill as i clearly don't have enough coverage for standard go tests. |
We've been trying to unify our tooling to use the Gingko cli to run all of our test suites as we are migrating towards it for as many of our tests as we can.
As part of this, we are expecting to be able to include cover profiles from the tests, even if there are some Go tests still to be run.
The issue is, if you include
--cover --coverprofile=<something>
, we get to the following line to start the go test:ginkgo/ginkgo/internal/run.go
Line 34 in 143d208
Which then calls
GenerateGoTestRunArgs
:ginkgo/ginkgo/internal/run.go
Line 66 in 143d208
Which for the Go test, will now return
--test.coverprofile=<something>
. Issue is, when running the Go test, Ginkgo runs it from the directory of the suite, so the coverprofile ends up in the test suite directory with the value of the Ginkgocoverprofile
as its name.Next up, is the clean up phase,
FinalizeProfilesAndReportsForSuites
which observes the suite and says, yep, this should have a coverprofile.So it calculates the location of the file to pick the coverage up from:
ginkgo/ginkgo/internal/profiles_and_reports.go
Line 38 in 143d208
Which is a combination of the suite package name and the output directory - which does not align with where the file actually is.
So I see two solutions:
Have I followed this right? Any thoughts on a preferred direction?
An example of the error output:
The text was updated successfully, but these errors were encountered: