@@ -165,14 +165,14 @@ defmodule ExUnit.Runner do
165165 running
166166 end
167167
168- defp spawn_modules ( config , [ { _group , [ _ | _ ] = modules } | groups ] , async? , running ) do
168+ defp spawn_modules ( config , [ { group , [ _ | _ ] = modules } | groups ] , async? , running ) do
169169 if max_failures_reached? ( config ) do
170170 running
171171 else
172172 { pid , ref } =
173173 spawn_monitor ( fn ->
174174 Enum . each ( modules , fn { module , params } ->
175- run_module ( config , module , async? , params )
175+ run_module ( config , module , async? , group , params )
176176 end )
177177 end )
178178
@@ -231,12 +231,13 @@ defmodule ExUnit.Runner do
231231
232232 ## Running modules
233233
234- defp run_module ( config , module , async? , params ) do
234+ defp run_module ( config , module , async? , group , params ) do
235235 test_module = % { module . __ex_unit__ ( ) | parameters: params }
236236 EM . module_started ( config . manager , test_module )
237237
238238 # Prepare tests, selecting which ones should be run or skipped
239- { to_run_tests , excluded_and_skipped_tests } = prepare_tests ( config , async? , test_module . tests )
239+ { to_run_tests , excluded_and_skipped_tests } =
240+ prepare_tests ( config , async? , group , test_module . tests )
240241
241242 for excluded_or_skipped_test <- excluded_and_skipped_tests do
242243 EM . test_started ( config . manager , excluded_or_skipped_test )
@@ -271,7 +272,7 @@ defmodule ExUnit.Runner do
271272 end
272273 end
273274
274- defp prepare_tests ( config , async? , tests ) do
275+ defp prepare_tests ( config , async? , group , tests ) do
275276 tests = shuffle ( config , tests )
276277 include = config . include
277278 exclude = config . exclude
@@ -280,7 +281,13 @@ defmodule ExUnit.Runner do
280281 { to_run , to_skip } =
281282 for test <- tests , include_test? ( test_ids , test ) , reduce: { [ ] , [ ] } do
282283 { to_run , to_skip } ->
283- tags = Map . merge ( test . tags , % { test: test . name , module: test . module , async: async? } )
284+ tags =
285+ Map . merge ( test . tags , % {
286+ test: test . name ,
287+ module: test . module ,
288+ async: async? ,
289+ test_group: group
290+ } )
284291
285292 case ExUnit.Filters . eval ( include , exclude , tags , tests ) do
286293 :ok -> { [ % { test | tags: tags } | to_run ] , to_skip }
0 commit comments