Post

Great post and I agree with most points! One thing though: the example where DateTime.utc_now() is used as a default argument is unfortunate: default arguments are evaluated at compile time, so the default „now“ argument will reflect the same „wall clock build time“ on every invocation.

I never thought of using the optional arguments or the default stuff to be able to do dependency injection that easily. Really nice :) I think one of the mocking library was able to run with async: true though, but iirc there was another issue (maybe test coverage was falsely set to 0?)

Also thank you for the work with the logger reimplementation, I had to create a new logger backend for work some years ago and it was way easier to understand/do thanks to that!

(Ham)Mox, Mimic and Efx are the ones I know that can work with async: true. Out of which Mimic is the closest to Ruby-like ad-hoc mocking anywhere (the other two require you to write the code in a specific way). I'm not sure about the coverage issue you mentioned though.

I think the test coverage issue was/is with Patch! I really liked that one. I don’t even know if it supports async: true tho, it’s been a few years now 😅 (and in any case the projects where async: true would be useful couldn’t use it due to how we built our tests in the first place)