franela/goblin

Regexp test selector does not seem to work.

snobb opened this issue · 4 comments

snobb commented

I cannot see the regexp flag -goblin.run working unless I comment out the flag.Parsed() check in the Goblin constructor. In my tests it seems to always be true even though I do not see where else the flag.Parse() is called.

func Goblin(t *testing.T, arguments ...string) *G {
	// if !flag.Parsed() {
	parseFlags()
	// }

Removing the check seems to work well though.

The command I run is as follows:

$ go test ./pkg/... -v -goblin.run="regexp"

OR

$ go test ./pkg/... -v -args -goblin.run="regexp"

EDIT: I am using go1.11

Interesting. Maybe something changed in the latest versions of Go which changed this behavior. It's also strange that you changed the code and tests are still passing. I'll check it out in the weekend.

snobb commented

Any update on this? Thanks.

I've migrated from go1.9 to go1.13 and since then I've the same issue. Would appreciate any input or workaround regarding this issue

This ^ fixed the issue for me, but lmk if you think there's a better solution @marcosnils