[英]Elixir: How to run tests with "mod" set inside mix.exs?
In my mix.exs
I have:在我的
mix.exs
我有:
...
def application do
[
mod: {MyProject, []},
extra_applications: [:logger]
]
end
...
I use the mod
in order to execute my project (eg: mix run myproject ARGS
).我使用
mod
来执行我的项目(例如: mix run myproject ARGS
)。 However, when I try to run mix test
, it seems to execute MyProject.start
with the parameter test
.但是,当我尝试运行
mix test
时,似乎使用参数test
执行MyProject.start
。
If I comment out the mod
-line inside mix.exs
, mix test
runs successfully.如果我注释掉
mix.exs
中的mod
-line,则mix test
会成功运行。
Is there a way I can do both, run the project and run the tests without changing the mix.exs
?有没有一种方法我可以同时运行项目并运行测试而不更改
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.退出
def start(_type, _args) do
function 和{:ok, Kernel.self()}
使mix test
运行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.