Add ResetGlobal function#692
Conversation
|
Thanks @nogates - and cool use case you have going :) I can't think of an alternative approach. My only hesitation is including |
|
Hey @onsi ! Thanks for the quick reply :)
Yeah, that could work! Happy to move it there!
well, I think |
Fair enough - would you be up for adding documentation explaining the original use-case? Within the context of an actual test suite running |
this package can be used to reset the global state of ginkgo
08daa2b to
f2cd6a3
Compare
Definitely! I forced pushed the branch and moved the Also, I added a long description to the beginning of that package explaining what is the purpose of it, and I did emphasize this functionality is not intended for normal ginkgo setups. Let me know if all of this makes sense! Thanks a lot for the time reviewing this @onsi ! 🙇 |
|
Great! lgtm! |
|
Thank you! |
Hello! First of all, thank you for this amazing project!! ❤️
We are currently using Ginkgo to dynamically generate some tests (depending on some configuration) and it works great. However, we are having some troubles to test different scenarios where different
describeorcontextgroups will be created. Since ginkgo stores everything under one globalSuitestruct and there is currently no way to reset that variable, it's very hard for us to test this logic (we are testing the tester, I know! :)In this PR, I am adding a
ResetGlobalsfunction that is exposed as part of the ginkgo DSL, which just resets the globals variables to the original state, and I wanted to get some feedback before spending more time adding tests (I was going to open an Issue first, but given that little amount of code that's needed to show how this could be implemented, I decided to went ahead and open a PR instead, I hope this is ok!)What do you think about this? Do you think we should do this in a different way?
Thank you!