fix - Store the stack for a when creation, so we can know which one isn't complete. 🪧 #238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
IN DEVELOPMENT
Breaking Changes
NO
Description
A WhenCall that hasn't completed yet can be a real pain to track down, unless you know to just keep scrolling up past all the cascading failures - the failures happen at the next time
when()
is called, which could be in a different test. (I suppose that one could make the case that the tests should resetMocktailState, but we came over from Mockito, so lots of places do not.) This change stores the current stack during WhenCall creation, so this error can show that stack, making it trivial to find the problematic mock/test.I didn't add any until testing, because, after thinking about it, the test would have basically tested if stack actually got set, thus testing StackTrace.current by proxy. That didn't seem valuable to me. I'm happy to add something like that though, if desired.
Before Error:
After Error:
Type of Change