Open hansbogert opened 1 year ago
Please check https://github.com/cucumber/godog/pull/498 and https://github.com/cucumber/godog/discussions/495.
It seems, while godog.BindCommandLineFlags
has some ergonomic benefits, it is not great from perspective of stdlib/go test compatibility. Maybe it would even make sense to deprecate and phase it out in favor of godog.BindFlags
.
Godog.BindCommandLineFlags in init does not work for binaries
When using test flags like
-coverprofile
they are not honored when trying a godog application which has been created bygo test -c ... -o ...
happy case
Using the a test as suggested by the README:
Running this directly is working:
Running the compiled variant:
Notice that the help file does not show any
--test.coverprofile
as suggestion.✨ Do you have a proposal for making it better?
It seems not having
godog.BindCommandLineFlags("godog.", &opts)
in ainit()
function and placing it just beforepflag.Parse()
is enough. And seems to work for test binaries as well as with directly rango test
applicationsContinuing with the code given above
Rerunning:
Still not working, though notice the added
--test-....
options now.Simply using
--test.coverprofile
now works:📚 Any additional context?
I'm unsure if there was a good reason to have the above line in the
init()
in the first place (?)This text was originally generated from a template, then edited by hand. You can modify the template here.