Skip to content

Commit 5b25761

Browse files
author
José Valim
committed
Do not trigger additional error reports on failures when loading tests
1 parent e1f10a9 commit 5b25761

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/mix/lib/mix/compilers/test.ex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule Mix.Compilers.Test do
3333

3434
case test_files_to_run do
3535
[] when stale ->
36-
Mix.shell.info "No stale tests."
36+
Mix.shell.info "No stale tests"
3737
:noop
3838

3939
[] when test_patterns == [] ->
@@ -45,8 +45,9 @@ defmodule Mix.Compilers.Test do
4545
:noop
4646

4747
test_files ->
48+
task = Task.async(ExUnit, :run, [])
49+
4850
try do
49-
task = Task.async(ExUnit, :run, [])
5051
Kernel.ParallelRequire.files(test_files, parallel_require_callbacks)
5152
ExUnit.Server.cases_loaded()
5253
%{failures: failures} = results = Task.await(task, :infinity)
@@ -56,6 +57,13 @@ defmodule Mix.Compilers.Test do
5657
end
5758

5859
{:ok, results}
60+
catch
61+
kind, reason ->
62+
stack = System.stacktrace
63+
# In case there is an error, shutdown the runner task
64+
# before the error propagates up and trigger links.
65+
Task.shutdown(task)
66+
:erlang.raise(kind, reason, stack)
5967
after
6068
agent_stop(stale_manifest_pid)
6169
end

lib/mix/test/mix/tasks/test_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defmodule Mix.Tasks.TestTest do
4040
assert_stale_run_output "2 tests, 0 failures"
4141

4242
assert_stale_run_output """
43-
No stale tests.
43+
No stale tests
4444
"""
4545
end
4646
end
@@ -124,7 +124,7 @@ defmodule Mix.Tasks.TestTest do
124124

125125
Port.command(port, "\n")
126126

127-
assert receive_until_match(port, "No stale tests.", []) =~ "Restarting..."
127+
assert receive_until_match(port, "No stale tests", []) =~ "Restarting..."
128128
end
129129
end
130130

0 commit comments

Comments
 (0)