-
Notifications
You must be signed in to change notification settings - Fork 55
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
Can we replace *testing T with an interface? #105
Comments
Hi @anthonyfong100. This sounds very useful. Would be happy to take a PR for this. Changes would need to be backwards compatible. For info, apitest uses testify under the hood. You can already override the Cheers |
Hey @steinfletcher i was thinking more along the lines of passing in an interface to replace the |
Hello @anthonyfong100. Sorry I wasn't clear. I also agree that there should be an interface I'll be removing testify in a future commit for a like-for-like solution, but that doesn't really affect your changes :) |
okay @steinfletcher that sounds wonderful i will go ahead with writing the PR then |
Looks great @anthonyfong100. Many thanks! |
Is your feature request related to a problem? Please describe.
When using apitest to do testing of api, the Expect method takes in a *testing T pointer which is a concrete type. This makes interacting with other third party testing library like Ginkgo difficult.
Describe the solution you'd like
Replace the reliance on *testing.T with an interface.
From the developer of ginkg:
It looks like testify uses (*testing.T) directly instead of an interface (which gomock does). Ginkgo can provide such frameworks with a Fail function that one can wrap in such a way to satisfy most interfaces (this is how we support go mock), but *testing.T refers to a concrete type and passing in the testing.T for the test that Ginkgo runs in would cause the entire suite to fail should one of your mock assertions fail...
Describe alternatives you've considered
As per the section above another way would to just pass in the testing.T but would cause the entire suite to fail if one of the assertions fail.
Additional context
Other libraries such as testify have changed this to support ginkgo integration
I would be happy to create a PR if this is possible
The text was updated successfully, but these errors were encountered: