ExUnit tests from a module instead of command line/mix

That’s how I could call it from iex:

➜ env MIX_ENV=test iex -S mix
Erlang/OTP 21 [erts-10.3.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.8.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> ExUnit.start(autorun: false)
:ok
iex(2)> test_files = Path.wildcard("test/**/*_test.exs")
["test/lib/..._test.exs", ...]
iex(3)> Mix.Compilers.Test.require_and_run(test_files, ["test"], formatters: [ExUnit.CLIFormatter])
...................................................................................................................................................................................................................................................

Finished in 69.6 seconds
193 properties, 50 tests, 0 failures

Randomized with seed 791939
{:ok, %{excluded: 0, failures: 0, skipped: 0, total: 243}}
iex(5)>
4 Likes