copyist icon indicating copy to clipboard operation
copyist copied to clipboard

-record flag example

Open shaneHowearth opened this issue 3 years ago • 3 comments

Hi I was trying to record the output for a test and I got the following

$ go test -run TestDictWordList -record
Foo {} no recording exists with this name: TestDictWordList/Foo

PASS

I also tried with a double dash between

$ go test -run TestDictWordList -- -record
Foo {} no recording exists with this name: TestDictWordList/Foo

PASS

The only way I could get it to work was

COPYIST_RECORD=1 go test -run TestDictWordList

FTR

$ go version
go version go1.17.5 darwin/arm64

go.mod has

github.com/cockroachdb/copyist v1.4.1

shaneHowearth avatar Jan 12 '22 02:01 shaneHowearth

I'm not sure what might be happening here. We use -record all the time without seeing this issue. I'd need a repro to dig further, if you're able to post one (e.g. a Go test file that I can run on my machine).

andy-kimball avatar Feb 15 '22 17:02 andy-kimball

I suspect the problem is that the test code expects the init or TestMain functions to handle the -record

I didn't have an init or TestMain in my code, so perhaps experiment with that as a requirement?

shaneHowearth avatar Feb 15 '22 22:02 shaneHowearth

I've just ran into this issue after using copyist for a long time with no issue.

If I add a flag.Parse() statement before I call copyist.IsRecording() then everything works.

Not yet sure why it's happening to me now all of a sudden 🤔

dan-j avatar Jul 01 '22 09:07 dan-j