简体   繁体   中英

Elixir: How to run tests with "mod" set inside mix.exs?

In my mix.exs I have:

...
def application do
  [
    mod: {MyProject, []},
    extra_applications: [:logger]
  ]
end
...

I use the mod in order to execute my project (eg: mix run myproject ARGS ). However, when I try to run mix test , it seems to execute MyProject.start with the parameter test .

If I comment out the mod -line inside mix.exs , mix test runs successfully.

Is there a way I can do both, run the project and run the tests without changing the mix.exs ? Or do I need to run my tests differently?

The issue was unrelated. I did not exit the application properly. Exiting the def start(_type, _args) do function with {:ok, Kernel.self()} makes the mix test run the tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM