What is a good workflow for doing TDD with Elixir?

Hello there.

I’m wondering if people have any tips for doing TDD with Elixir.

I am specifically wondering if it is possible to configure mix test to only show which tests failed. I find the output to be very noisy (lots of warnings, also shows skipped tests, etc.).

Note that I am accustomed to JavaScript’s Vitest test runner which comes with a TUI that puts test results at the top of the window so you don’t have to search for it. See screenshot at top of https://vitest.dev/

Wonder if there is something similar for Elixir / mix test.

Both of these are good options, the first being closer to what you described:

3 Likes

Nothing fancy. When working on a file, mix test that/file_test.exs. Only run mix test once I’ve reached a good stopping point.

If I’m looking at a specific failure, mix test that/file_test.exs:5.

When I’m using vim, I dynamically map a leader key to write the current file and run a test. If I’m on vs code or zed, I use the integrated terminal because they recognize the FILE:LINE format to quickly open test locations or stack traces.

edit:

options like --no-all-warnings , --failed and more can be found here:

1 Like

Thanks both, I think mix_test_interactive is indeed what I am looking for.

Not quite a TUI, but much more compact.