@@ -594,9 +594,12 @@ defmodule Mix.Tasks.Test do
594
594
595
595
# Prepare and extract all files to require and run
596
596
test_paths = project [ :test_paths ] || default_test_paths ( )
597
- test_files = if files != [ ] , do: parse_file_paths ( files ) , else: test_paths
598
597
test_pattern = project [ :test_pattern ] || "*_test.exs"
599
598
warn_test_pattern = project [ :warn_test_pattern ] || "*_test.ex"
599
+
600
+ { test_files , test_opts } =
601
+ if files != [ ] , do: ExUnit.Filters . parse_paths ( files ) , else: { test_paths , [ ] }
602
+
600
603
unfiltered_test_files = Mix.Utils . extract_files ( test_files , test_pattern )
601
604
602
605
matched_test_files =
@@ -608,7 +611,8 @@ defmodule Mix.Tasks.Test do
608
611
609
612
try do
610
613
Enum . each ( test_paths , & require_test_helper ( shell , & 1 ) )
611
- ExUnit . configure ( merge_helper_opts ( ex_unit_opts ) )
614
+ # test_opts always wins because those are given via args
615
+ ExUnit . configure ( ex_unit_opts |> merge_helper_opts ( ) |> Keyword . merge ( test_opts ) )
612
616
CT . require_and_run ( matched_test_files , test_paths , test_elixirc_options , opts )
613
617
catch
614
618
kind , reason ->
@@ -733,12 +737,6 @@ defmodule Mix.Tasks.Test do
733
737
[ autorun: false ] ++ opts
734
738
end
735
739
736
- defp parse_file_paths ( file_paths ) do
737
- { parsed_file_paths , ex_unit_opts } = ExUnit.Filters . parse_paths ( file_paths )
738
- ExUnit . configure ( ex_unit_opts )
739
- parsed_file_paths
740
- end
741
-
742
740
defp parse_filters ( opts , key ) do
743
741
if Keyword . has_key? ( opts , key ) do
744
742
ExUnit.Filters . parse ( Keyword . get_values ( opts , key ) )
0 commit comments