Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the use of calling testing.M.Run() in TestMain? #351

Closed
hansbogert opened this issue Oct 13, 2020 · 2 comments · Fixed by #353
Closed

What is the use of calling testing.M.Run() in TestMain? #351

hansbogert opened this issue Oct 13, 2020 · 2 comments · Fixed by #353
Milestone

Comments

@hansbogert
Copy link
Contributor

hansbogert commented Oct 13, 2020

in the faq there is an example of TestMain

However it calls testing.M.Run(), I'm not sure this adds anything useful, in our case it's even detrimental as it does not handle the situation well when running with Go's -race option in combination with the env variable GORACE=exitcode=0.
Also it always seems to cause warning of :

...
testing: warning: no tests to run
...

For now I've removed it in our case, is there any side-effect to this?

@lonnblad
Copy link
Member

Hey @hansbogert

Good question, to be honest, I'm not sure why that is in the FAQ.

testing.M.Run() would execute all tests in your pkg, so I would assume it was added to the FAQ to show how you can execute godog next to your normal tests.

Maybe we should add a more describing text?

@hansbogert
Copy link
Contributor Author

I am far from a good comment writer, but see

#353

We could also opt for just mentioning it somewhere once as a code snippet and removing it at all the current places.

@lonnblad lonnblad linked a pull request Oct 13, 2020 that will close this issue
@lonnblad lonnblad added this to the v0.11.0 milestone Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants