Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include Sean Cribbs eunit formatter by default #918

Merged
merged 2 commits into from
Nov 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{bbmustache, "1.0.4"},
{relx, "3.8.0"},
{cf, "0.1.3"},
{cth_readable, "1.0.1"}]}.
{cth_readable, "1.0.1"},
{eunit_formatters, "0.2.0"}]}.

{escript_name, rebar3}.
{escript_emu_args, "%%! +sbtu +A0\n"}.
Expand Down
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{<<"cf">>,{pkg,<<"cf">>,<<"0.1.3">>},0},
{<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.0.1">>},0},
{<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.16.0">>},0},
{<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.2.0">>},0},
{<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0},
{<<"providers">>,{pkg,<<"providers">>,<<"1.5.0">>},0},
{<<"relx">>,{pkg,<<"relx">>,<<"3.8.0">>},0},
Expand Down
3 changes: 2 additions & 1 deletion src/rebar.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
certifi,
cth_readable,
relx,
inets]},
inets,
eunit_formatters]},
{env, [
%% Default log level
{log_level, warn},
Expand Down
17 changes: 14 additions & 3 deletions src/rebar_prv_eunit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,20 @@ validate_module(_State, Module) ->
resolve_eunit_opts(State) ->
{Opts, _} = rebar_state:command_parsed_args(State),
EUnitOpts = rebar_state:get(State, eunit_opts, []),
case proplists:get_value(verbose, Opts, false) of
true -> set_verbose(EUnitOpts);
false -> EUnitOpts
EUnitOpts1 = case proplists:get_value(verbose, Opts, false) of
true -> set_verbose(EUnitOpts);
false -> EUnitOpts
end,
case proplists:get_value(eunit_formatters, Opts, true) of
true -> custom_eunit_formatters(EUnitOpts1);
false -> EUnitOpts1
end.

custom_eunit_formatters(Opts) ->
%% If `report` is already set then treat that like `eunit_formatters` is false
case lists:keymember(report, 1, Opts) of
true -> Opts;
false -> [no_tty, {report, {eunit_progress, [colored, profile]}} | Opts]
end.

set_verbose(Opts) ->
Expand Down