In my previous note Shorter feedback loops with Elixir tests I already described how to run tests in Elixir, where it only runs the failed tests. Below is what I put in my mix.exs file to have faster feedback loops when testing:

defp aliases do
    [
        ...
        "test.failed": ["test --failed --max-failures 1"],
    ]
end

# Make sure the alias runs in the test MIX_ENV environment.
def cli do
    [preferred_envs: ["test.failed": :test]]
end

This will create a new alias test.failed that will run only the failed tests and stop after the first failure. This is useful when you are working on a specific test and you want to run it quickly without running all the tests.

continue reading on petar.dev

⚠️ This post links to an external website. ⚠️