I wish to programmatically run the mix test
task within my Elixir application. This can be done with Mix.Tasks.Test.run/1
, though attempting to do so without first setting the MIX_ENV
environmental variable results in the task refusing to run.
We can set the env with System.put_env/2
, but then the application will crash once it finds a reference to a module defined in a dependancy marked as test only.
How can I load these dependancies in this situation?