How to speed up the start of `mix test`?

Another possible option is to test it in MIX_ENV=test iex -S mix, which I saw bruce asked about as well.

As you can see in the image below, in a project generated with mix new elixir_demo, the speedup in iex is 100 times faster than running mix test from the command line, because the app is not started again.

If you guys think this is a possibility, can you tell me some caveats? Daniel Olshansky discusses some options in this article, but I’m concerned that the recompile approach to the problem of caching test results may be flawed.

Currently, I mainly use neotest to run tests in Neovim(currently it calls mix test). This gif shows lua testing a block on the left and elixir testing a block on the right. In the future, if we can also run tests in iex, they will be as fast as the left.

1 Like