$ go version && go test ./... -coverprofile /tmp/cover.out
go version go1.20.2 linux/amd64
--- FAIL: Test (0.00s)
--- FAIL: Test/run-mycmd (0.01s)
testscript.go:429: > mycmd
[exit status 2]
FAIL: testdata/run-mycmd.txt:1: unexpected command failure
FAIL
coverage: [no statements]
2023/03/09 01:21:50 cannot merge cover profiles: cannot merge coverage profile from /tmp/testscript-main438601870/cover/mycmd-e2e42716620b: no lines found in profile: <nil>
FAIL example.com/profile/cmd/profile 0.012s
With Go 1.19 and earlier:
$ go version && go test ./... -coverprofile /tmp/cover.out
go version go1.19.4 linux/amd64
ok example.com/profile/cmd/profile 0.012s coverage: [no statements]
Also in Go 1.20 without -coverprofile:
$ go version && go test ./...
go version go1.20.2 linux/amd64
ok example.com/profile/cmd/profile 0.011s
This is happening in a larger application that has been using testscript for a few years with -coverprofile, not just in this simplified example.
I haven't had the time to look into the cause yet. I'm open to working on a PR if anyone knows the cause.
To reproduce, create the following structure:
profile_test.go
:run-mycmd.txt
:Then run with Go 1.20:
With Go 1.19 and earlier:
Also in Go 1.20 without
-coverprofile
:This is happening in a larger application that has been using
testscript
for a few years with-coverprofile
, not just in this simplified example.I haven't had the time to look into the cause yet. I'm open to working on a PR if anyone knows the cause.