elixir mix test --stale --listen-to-stdin

Published on

Today I found out how to run your tests in a --watch fashion, with Elixir and Mix.

Looking through the documentation for Mix.Task.Test you’ll find the --stale option and --listen-on-stdin.

From the documentation for --stale

The --stale command line option attempts to run only the test files which reference modules that have changed since the last time you ran this task with --stale.

--listen-on-stdin runs tests, and then listens on stdin. It will re-run tests once a newline is received