summaryrefslogtreecommitdiff
path: root/src/rebar_prv_eunit.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-04-04 20:24:04 -0500
committerTristan Sloughter <t@crashfast.com>2015-04-04 20:43:09 -0500
commita55c94cc9ca94b68b2c6217b8644c7fd0d47dbf2 (patch)
tree1b993fcce11d8e761f6c8de4dcf3a727f9d642ab /src/rebar_prv_eunit.erl
parent257e7fb6678ad55473efe5800434007e20639784 (diff)
support provider hooks on ct and eunit
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r--src/rebar_prv_eunit.erl15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index 6872c99..1388a7b 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -37,9 +37,19 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
?INFO("Performing EUnit tests...", []),
+ %% Run ct provider prehooks
+ Providers = rebar_state:providers(State),
+ Cwd = rebar_dir:get_cwd(),
+ rebar_hooks:run_all_hooks(Cwd, pre, ?PROVIDER, Providers, State),
+
case prepare_tests(State) of
- {ok, Tests} -> do_tests(State, Tests);
- Error -> Error
+ {ok, Tests} ->
+ {ok, State1} = do_tests(State, Tests),
+ %% Run ct provider posthooks
+ rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State),
+ {ok, State1};
+ Error ->
+ Error
end.
do_tests(State, Tests) ->
@@ -250,4 +260,3 @@ help(app) -> "List of application test suites to run";
help(cover) -> "Generate cover data";
help(suite) -> "List of test suites to run";
help(verbose) -> "Verbose output".
-