Running tests on a burrito-wrapped CLI app
First of all, thank you for this wonderful project.
I'm writing a Burrito-wrapped CLI and am wondering how it is supposed to run tests. When defining an application entry point with the start/2 function doing the Burrito.Util.Args.get_arguments() processing, this start/2 function is also used when calling mix test with the arguments of the mix call, which doesn't work, of course.
My current solution is to set a compile flag :in_burrito in the prod environment config to only add the Burrito start logic when it is actually running in a Burrito release. This has the nice side effect that it allows the use as an escript during development and not having to do the expensive building of a Burrito release all the time.
defmodule MyEntryModule do
if Application.compile_env(:my_app, :in_burrito) do
def start(_type, _args) do
Burrito.Util.Args.get_arguments()
|> main()
|> System.halt()
end
else
def start(_, _) do
{:ok, self()}
end
end
end
Am I missing something, or is there a better solution? In any case, some guidance in the README on running tests would be helpful.