diff --git a/lib/mix/lib/mix/tasks/test.ex b/lib/mix/lib/mix/tasks/test.ex index 0e5fbb3f0b3..5f2bed5327e 100644 --- a/lib/mix/lib/mix/tasks/test.ex +++ b/lib/mix/lib/mix/tasks/test.ex @@ -430,6 +430,7 @@ defmodule Mix.Tasks.Test do elixir_version_check: :boolean, failed: :boolean, stale: :boolean, + repeat: :boolean, listen_on_stdin: :boolean, formatter: :keep, slowest: :integer, @@ -573,6 +574,13 @@ defmodule Mix.Tasks.Test do warn_test_pattern ) + # ExUnit.FailuresManifest.write(matched_test_files, ".mix_repeat_tests") + + # matched_test_files |> IO.inspect(label: "test.ex:578: matched_test_files") + # test_paths |> IO.inspect(label: "test.ex:579: test_paths") + # test_elixirc_options |> IO.inspect(label: "test.ex:579: test_elixirc_options") + # opts |> IO.inspect(label: "test.ex:580: opts") + case CT.require_and_run(matched_test_files, test_paths, test_elixirc_options, opts) do {:ok, %{excluded: excluded, failures: failures, total: total}} -> Mix.shell(shell) @@ -746,6 +754,10 @@ defmodule Mix.Tasks.Test do Mix.raise("Combining --failed and --stale is not supported.") end + if opts[:repeat] do + Mix.raise("Combining --failed and --repeat is not supported.") + end + {allowed_files, failed_ids} = ExUnit.Filters.failure_info(manifest_file) {Keyword.put(opts, :only_test_ids, failed_ids), allowed_files} else diff --git a/lib/mix/test/mix/tasks/test_test.exs b/lib/mix/test/mix/tasks/test_test.exs index b3b4a686401..ba52d98749d 100644 --- a/lib/mix/test/mix/tasks/test_test.exs +++ b/lib/mix/test/mix/tasks/test_test.exs @@ -60,6 +60,10 @@ defmodule Mix.Tasks.TestTest do describe "--stale" do test "runs all tests for first run, then none on second" do in_fixture("test_stale", fn -> + # mix(["test"]) + # |> IO.inspect(label: "test_test.exs:64: mix test") + # |> tap(&IO.write(&1)) + assert_stale_run_output("2 tests, 0 failures") assert_stale_run_output("""