@@ -173,20 +173,13 @@ defmodule ExUnit.Server do
173
173
end
174
174
175
175
defp take_modules ( % { waiting: { from , count } } = state ) do
176
- has_async_modules? = not :queue . is_empty ( state . async_modules )
177
- has_async_groups? = state . async_groups != [ ]
178
-
179
176
cond do
180
- not has_async_modules? and not has_async_groups? and state . loaded == :done ->
181
- GenServer . reply ( from , nil )
182
- % { state | waiting: nil }
183
-
184
- has_async_modules? ->
177
+ not :queue . is_empty ( state . async_modules ) ->
185
178
{ reply , remaining_modules } = take_until ( count , state . async_modules )
186
179
GenServer . reply ( from , reply )
187
180
% { state | async_modules: remaining_modules , waiting: nil }
188
181
189
- has_async_groups? ->
182
+ state . async_groups != [ ] and state . loaded == :done ->
190
183
{ groups , remaining_groups } = Enum . split ( state . async_groups , count )
191
184
192
185
{ reply , groups } =
@@ -198,6 +191,10 @@ defmodule ExUnit.Server do
198
191
GenServer . reply ( from , reply )
199
192
% { state | groups: groups , async_groups: remaining_groups , waiting: nil }
200
193
194
+ state . loaded == :done ->
195
+ GenServer . reply ( from , nil )
196
+ % { state | waiting: nil }
197
+
201
198
true ->
202
199
state
203
200
end
0 commit comments