Data persisting between tests

Whoa, I never in a million years would have expected that to be the default behavior. Now that I inspect the output, I indeed see that the first call to them returns :ok, and after that they return :noop.

So a couple followups:

  1. How do you “re-enable” tasks so that you can call them as often as needed?
  2. Where is this behavior documented?
  3. Why is that the default behavior?

Thanks for your input on this – it’s saving my sanity.

  1. https://hexdocs.pm/mix/Mix.Task.html#reenable/1
  2. It is mentioned within https://hexdocs.pm/mix/Mix.html although it could probably be more prominent
  3. Because tasks can define tasks that they depend on. For example if you run two tasks a and b, that both depend on the compile being run, mix run do a, b should compile your app once not twice.
1 Like

I might make a PR to help make this a bit more prominent. I have to think about the dependencies… I feel like one could make the argument that each task should check whether or not it should be (re)run, but clearly I don’t know much about the use-cases that this feature was built to deal with.

Thanks again!

2 Likes

I know how frustrating things like this can be, glad we could sort it out!

1 Like