Reputation: 4467
I want to start lager
before any eunit
test is executed so that I can see the log when the tests are actually run (I use the log for debugging purposes).
However I have hundreds of tests (spread across multiple apps and modules) and I don't want to go through every single one and put lager:start()
at the beginning so I was wondering if there is a way to tell rebar
(or eunit
) to execute lager:start()
before executing the eunit
tests?
Upvotes: 3
Views: 1332
Reputation: 170
(I know this isn't a full answer, but I agree with Svetlin that there should be a more elegant approach... I'll offering this as an incremental improvement on Petr's answer)
If you use a Makefile with rebar, you could modify the make target to set this environment variable, it'd be something like:
$ make test
or
$ make localtest
And that target would look like:
test:
ERL_AFLAGS="-s lager"
$(REBAR) skip_deps=true eunit
Upvotes: 0
Reputation: 426
I think you can use erl params like "-s lager", and pass it by method are described in following post.
passing runtime arguments to erlang when running rebar eunit
Upvotes: 2