gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
2.03k stars 119 forks source link

Fix coverage detection for go1.20 #325

Closed dnephin closed 1 year ago

dnephin commented 1 year ago

Fix #322

In go versions 1.19 and earlier the coverage details were always on a separate line. As of go1.20 they are after a tab on the same line as the package name.

gtramontina commented 1 year ago

Hey there @dnephin! Thanks for the fix! Any idea fo when this can be merged?

dnephin commented 1 year ago

This can probably be merged, but I wasn't super happy with the logic, and I was hoping too make it a bit more robust to future changes. I could do that in a future PR. Have you been able to test this change? Does it work for you?

marco-m commented 1 year ago

It works fine for me:

> gotestsum -- -coverprofile=bin/coverage.out ./...
∅  examples/download
∅  examples/phonex8
✓  . (365ms) (coverage: 31.5% of statements)
dnephin commented 1 year ago

Sounds good! I'll try to do a bit more testing on this before a release. It's merged now so it should be possible to install from the main branch at least.

marco-m commented 1 year ago

Thanks @dnephin !

mitar commented 1 year ago

I can confirm main branch works for me on Go 1.20.