Skip to content

Commit e717a4b

Browse files
committed
Revert "Run all available tests if there are no pending --failed tests"
This reverts commit 230b276.
1 parent f4fa14c commit e717a4b

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
@@ -713,13 +712,7 @@ defmodule Mix.Tasks.Test do
713712
end
714713

715714
{allowed_files, failed_ids} = ExUnit.Filters.failure_info(manifest_file)
716-
717-
if MapSet.size(failed_ids) == 0 do
718-
Mix.shell().info("No pending --failed tests, re-running all available tests...")
719-
{opts, nil}
720-
else
721-
{Keyword.put(opts, :only_test_ids, failed_ids), allowed_files}
722-
end
715+
{Keyword.put(opts, :only_test_ids, failed_ids), allowed_files}
723716
else
724717
{opts, nil}
725718
end

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

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

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

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

0 commit comments

Comments
 (0)