Skip to content

Commit d1d5e04

Browse files
committed
Revert "Run all available tests if there are no pending --failed tests"
This reverts commit ae48325.
1 parent ba1fd1a commit d1d5e04

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

lib/mix/lib/mix/tasks/test.ex

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ defmodule Mix.Tasks.Test do
116116
* `--export-coverage` - the name of the file to export coverage results to.
117117
Only has an effect when used with `--cover`
118118
119-
* `--failed` - runs only tests that failed the last time they ran.
120-
If there are no pending --failed tests, `mix test` will run all available tests
119+
* `--failed` - runs only tests that failed the last time they ran
121120
122121
* `--force` - forces compilation regardless of modification times
123122
@@ -702,13 +701,7 @@ defmodule Mix.Tasks.Test do
702701
end
703702

704703
{allowed_files, failed_ids} = ExUnit.Filters.failure_info(manifest_file)
705-
706-
if MapSet.size(failed_ids) == 0 do
707-
Mix.shell().info("No pending --failed tests, re-running all available tests...")
708-
{opts, nil}
709-
else
710-
{Keyword.put(opts, :only_test_ids, failed_ids), allowed_files}
711-
end
704+
{Keyword.put(opts, :only_test_ids, failed_ids), allowed_files}
712705
else
713706
{opts, nil}
714707
end

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,8 @@ defmodule Mix.Tasks.TestTest do
214214
System.put_env("PASS_FAILING_TESTS", "true")
215215
assert mix(["test", "--failed"]) =~ "2 tests, 0 failures"
216216

217-
# All tests should be run if we try it again with no failing tests.
218-
# This prevents `mix test --failed` from passing in cases where
219-
# `mix test` had a compilation error before having failing tests.
220-
# It also provides a better workflow as you can always run with --failed.
221-
output = mix(["test", "--failed"])
222-
assert output =~ "No pending --failed tests, re-running all available tests..."
223-
assert output =~ "4 tests, 0 failures"
217+
# Nothing should get run if we try it again since everything is passing.
218+
assert mix(["test", "--failed"]) =~ "There are no tests to run"
224219

225220
# `--failed` and `--stale` cannot be combined
226221
output = mix(["test", "--failed", "--stale"])

0 commit comments

Comments
 (0)