mix-test.watch icon indicating copy to clipboard operation
mix-test.watch copied to clipboard

Feature: Loop on failed

Open TheFirstAvenger opened this issue 6 years ago • 1 comments

A common pattern we use with mix-test.watch is to run mix tes.watcht, and if any errors are found run mix test.watch --failed, fixing errors until all the failed ones are clear, then run mix test.watch again, and if any new errors are found, run mix test.watch --failed, basically swapping between these two states of running a full mix test.watch and running mix test.watch --failed. Pseudocode:

def loop do
  case "mix test" do
    :errors ->
      loop_on_failed()
      loop()
    :no_errors ->
      wait_for_change()
      loop()
  end
end

def loop_on_failed do
  case "mix test --failed" do
    :errors ->
      wait_for_changes()
      loop_on_failed()
    :no_errors ->
      nil
  end
end

Would love to see a flag in mix test.watch that would mimic this. Something like mix test.watch --loop-failed

TheFirstAvenger avatar Oct 23 '18 22:10 TheFirstAvenger

@TheFirstAvenger : Adding something like this to your mix config would probably get you what you are looking for:

config :mix_test_watch,
  tasks: [
    "test --failed --exclude pending",
    "test --stale --exclude pending",
    "test --exclude pending"
  ]

jwilger avatar Mar 25 '20 22:03 jwilger