Skip to content

Commit

Permalink
Merge pull request #918 from tsloughter/eunit_formatters
Browse files Browse the repository at this point in the history
include Sean Cribbs eunit formatter by default
  • Loading branch information
ferd committed Nov 13, 2015
2 parents 2d6dc1c + 87d9edc commit bab8078
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
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

0 comments on commit bab8078

Please sign in to comment.