Replies: 1 comment 4 replies
|
I think it all depends crucially on whether or not assertions can happen in parallel outside of the helper - in which case overriding the shared global Fail for the duration of the helper will lead to surprising behavior. You could conceivably handle this but I suspect you might not have all the information you need to handle it correctly in all cases. Ginkgo bends over backwards (too far, perhaps!) to avoid the "noise" of injecting things into each node function. This works in general and is quite convenient - but cases like the one you are working through become tricky. The best bet might be to bite the bullet and inject |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
With
GinkgoHelperGoin place (thanks again for merging!) I've now stumbled on my old nemesis, Ginkgo'sFail: in the past I had to refactor my testing support to use Gomega assertions instead, in order to leverageInterceptGomegaFailurein testing the test helpers. WithGinkgoHelperGothis does not work anymore, unless I'm overlooking something.One important aspect of
GinkgoHelperGothat it depends onglobal.Failer.GetState()as well asglobal.Failer.Drain()to work its "magic", as well as the usualFail(which in turn depends onglobal.Failer.Fail()).Please note that test code for test helpers using
GinkgoHelperGowill be outside the Ginkgo package, so types such asinternal.Failerare out of their reach. Since the default Gomaga is usually wired intoFailand that uses whicheverglobal.Faileris set ... would it make sense to temporarily replace theglobal.Failer, calling a spec-supplied func, and upon returning then returning thetypes.Failure(which is exported unless I overlooked an "internal") if any?Or is this a terrible idea and it can hopefully be done much better?
Which unspoken assumptions about
global.Failerdo I fail, especially regarding potential concurrency?All reactions