-
Notifications
You must be signed in to change notification settings - Fork 28
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 debug methods to mocks #41
Comments
It would be awesome to have these called automatically when a
|
@lkysow Agree, that would be very helpful. Will see if I can make some time to add this. I'm happy to take this as a PR as well of course :-). |
@lkysow Is this satisfying your request? |
yes! It's definitely better. Only way I could see to improve it would be to format the output in a more readable way. This is what I saw before:
After your changes it's much better
But it's still hard to read the invocations. If I change to
Which is nice. I like this improvement. I then wanted to see what it would look like formatted. I used https://github.com/davecgh/go-spew but it looks too busy now I think.
|
@lkysow Agree, I think it also makes sense to change it in the For your idea to further format the parameters including line breaks etc. I start to wonder if that should be addressed differently. E.g. in your case I'm wondering if this formatted output is mostly desirable while writing tests and implementation, more or less to make that process less painful. Once it works, and only occasionally fails when making future code changes, it might be acceptable to get the less formatted output. And if the above is true, then it might be more pragmatic to use Would that work for you? Another idea I had was to introduce a debug mode in which mocks would simply print out whenever they're invoked from somewhere, including file and line numbers and the parameters. I'm tracking ideas in #32. |
You're right that the formatted output is probably only worth using during debugging tests. Good call on using And yes :) I know I should just submit this as a PR but ⌛️ is always the issue! Thanks for your work here, I think your library can become the best mocking library. |
@lkysow I've just pushed a change which now actually uses
Good point. I will try to write something up.
Thank you for these kind words. Would love to see that! |
ListInvocations
or similarListStubbing
or similar.These methods are only meant to be used to debug tests, not for any assertions or similar.
The text was updated successfully, but these errors were encountered: