Skip to content

Commit 0b38bc0

Browse files
author
José Valim
committed
Demonitor and flush when appropriate
1 parent 9431338 commit 0b38bc0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/ex_unit/lib/ex_unit/runner.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ defmodule ExUnit.Runner do
159159
{test_case, pending} =
160160
receive do
161161
{^case_pid, :case_finished, test_case, tests} ->
162+
Process.demonitor(case_ref, [:flush])
162163
{test_case, tests}
163164
{:DOWN, ^case_ref, :process, ^case_pid, error} ->
164165
test_case = %{test_case | state: {:failed, {{:EXIT, case_pid}, error, []}}}
@@ -213,12 +214,14 @@ defmodule ExUnit.Runner do
213214
test =
214215
receive do
215216
{^test_pid, :test_finished, test} ->
217+
Process.demonitor(test_ref, [:flush])
216218
test
217219
{:DOWN, ^test_ref, :process, ^test_pid, error} ->
218220
%{test | state: {:failed, {{:EXIT, test_pid}, error, []}}}
219221
after
220222
timeout ->
221223
Process.exit(test_pid, :kill)
224+
Process.demonitor(test_ref, [:flush])
222225
%{test | state: {:failed, {:error, %ExUnit.TimeoutError{timeout: timeout}, []}}}
223226
end
224227

0 commit comments

Comments
 (0)