-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add a warning when trying to replace and already replaced function #281
Comments
Oh wow, this is a really bad thing and I had never run into it before, but I completely understand your point. I definitely think we should do this. |
@searls Thanks for your quick response! Now that we know what we're looking for, we can make sure not to do a multiple |
Instead of a warning, as the title suggests, I think it would be better to allow replacing the same method twice but still support reseting to the original method. |
I am struggling to imagine why someone would want to reset the same method twice. If there's a case for that, I feel like that a more narrowly td.func-scoped reset would probably be a better fit. In fact, as I've thought more about this, I feel like an error (as opposed to a warning) would be more appropriate, since the behavior folks will experience will be confusing at best and undefined at worst. |
We ran into this as well. It would be nice if |
We just ran into a strange issue where our tests accidentally replaced the same function twice where the second replace then replaced the testdouble function with yet another one. The
td.reset()
that is then run after each test only undid the second replace which left us still with with a replaced testdouble function for the next test.I think it would be great if testdouble could help prevent/fix this situation somehow as - to us - it was very non-obvious what was going on and took some time to debug.
The text was updated successfully, but these errors were encountered: