You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
@searls Thanks for your quick response! Now that we know what we're looking for, we can make sure not to do a multiple replace()s on the same function any more. But for others, it might make sense to communicate that this can cause issues. 😄
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 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: