Closed zachallaun closed 1 year ago
I'm fine with the small setup-fee
of 1 line config in test_helper. So honestly, I would try to keep dev UX as simple as possible, and current flow seems good enough for me. Running another mix task to run my tests might mess with muscle memory for many devs, I do not want to think whether I should run mix mneme
or mix test
. Also, alternatives require maintenance and more code and more documentation. Maybe keep it simple?
Just my 2 cents.
Thanks for sharing your thoughts @mindreframer! Thinking about this more over the last week, I think I'm going to incorporate some of the proposed changes, but not the default way to run tests with Mneme:
Mneme.start()
-- currently you get a "process is not alive" error.mix test
, you can remove Mneme.start()
from your test_helper.exs
and make a custom mix mneme
alias that starts Mneme before running your tests.
I've been thinking that it may be worth introducing a
mix mneme
task instead of modifying the behavior ofmix test
, which is what currently happens. I'll lay out the proposed changes and then some pros/cons as I see them.Proposed changes
Mneme.start/1
has been called. In non-interactive mode, new/changed auto-assertions will simply fail the test.mix mneme
would become the recommended way to use the library. It would essentially callMneme.start/1
and then delegate all arguments to themix test
task.Mneme.start()
intest/test_helper.exs
. This means that Mneme would be in non-interactive mode when runningmix test
.Mneme.start()
in your test helper, in which casemix test
would work as it does with Mneme today, prompting for new/changed assertions. This makes this proposal backwards-compatible with existing workflows.Advantages
test/test_helper.exs
required.mix test
. This may give people more confidence to try it out.mix test
will be slightly faster when Mneme is run in non-interactive mode. Currently auto-assertions may have to wait for a small amount of time for messages fromExUnit
containing information about the active test to come in.CI=true
is set, and it would continue to do that in interactive mode, but this would side-step the issue altogether as CI runners would be runningmix test
and notmix mneme
.Disadvantages
mix mneme
.mix test
quite a few times, see an error, sigh, then runmix mneme
which is what I meant to do in the first place.Any thoughts/reactions to this, positive or negative, would be most welcome!