- Make LeaderElection check_interval, max_cluster_wait, and cluster_check_interval configurable via Application env so tests can override with short values - Slow LeaderElection tests now use 50-150ms timeouts instead of 3-6s - Remove :slow tag from unused_test (compile cache makes reruns cheap) - Drop :slow from test_helper exclude list All 2490 tests now run in ~45s (up from 2485 with 5 excluded).
48 lines
1.3 KiB
Elixir
48 lines
1.3 KiB
Elixir
defmodule Mix.Tasks.Compile.UnusedTest do
|
|
use ExUnit.Case, async: false
|
|
|
|
alias Mix.Tasks.Compile.Unused
|
|
|
|
describe "manifests/0" do
|
|
test "returns an empty list (no manifest tracking)" do
|
|
assert Unused.manifests() == []
|
|
end
|
|
end
|
|
|
|
describe "clean/0" do
|
|
test "returns :ok" do
|
|
assert Unused.clean() == :ok
|
|
end
|
|
end
|
|
|
|
describe "run/1" do
|
|
test "manifests/0 and clean/0 are idempotent" do
|
|
assert Unused.manifests() == Unused.manifests()
|
|
assert Unused.clean() == :ok
|
|
assert Unused.clean() == :ok
|
|
end
|
|
|
|
test "runs against the project and returns either :ok or :error tuple" do
|
|
ExUnit.CaptureIO.capture_io(fn ->
|
|
result = Unused.run([])
|
|
assert match?({:ok, _}, result) or match?({:error, _}, result)
|
|
end)
|
|
end
|
|
|
|
test "honors --severity option override" do
|
|
ExUnit.CaptureIO.capture_io(fn ->
|
|
result = Unused.run(["--severity", "error"])
|
|
assert match?({:ok, _}, result) or match?({:error, _}, result)
|
|
end)
|
|
end
|
|
|
|
test "accepts --severity warning, info, and unknown values" do
|
|
for severity <- ["warning", "info", "garbage"] do
|
|
ExUnit.CaptureIO.capture_io(fn ->
|
|
result = Unused.run(["--severity", severity])
|
|
assert match?({:ok, _}, result) or match?({:error, _}, result)
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
end
|