summaryrefslogtreecommitdiff
path: root/src/rebar_eunit.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_eunit.erl')
-rw-r--r--src/rebar_eunit.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index 21228df..42c6fdd 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -84,8 +84,17 @@ eunit(Config, _AppFile) ->
%% Copy source files to eunit dir for cover in case they are not directly
%% in src but in a subdirectory of src. Cover only looks in cwd and ../src
- %% for source files.
- SrcErls = rebar_utils:find_files("src", ".*\\.erl\$"),
+ %% for source files. Also copy files from src_dirs.
+ ErlOpts = rebar_utils:erl_opts(Config),
+
+ SrcErls = lists:foldl(
+ fun(Dir, Acc) ->
+ lists:append(Acc, rebar_utils:find_files(Dir, ".*\\.erl\$"))
+ end,
+ [],
+ rebar_utils:src_dirs(proplists:append_values(src_dirs, ErlOpts))
+ ),
+ ?DEBUG("SrcErls: ~s\n", [SrcErls]),
%% If it is not the first time rebar eunit is executed, there will be source
%% files already present in ?EUNIT_DIR. Since some SCMs (like Perforce) set