summaryrefslogtreecommitdiff
path: root/lib/mix
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2024-09-17 13:45:15 +0200
committermarcin mikołajczak <git@mkljczk.pl>2024-09-17 13:45:15 +0200
commit76cfc6127fa05a8c5214d1dff368bad0e0a0b1a8 (patch)
tree5a63ebd265d8fa97f677e5f86dbb1de776f60936 /lib/mix
parent309d22aca2ec0557b27c8e3d8d12b088061e0142 (diff)
parente7176bb998a7e20f2bb3c9f32e1e2dfe8c3cd818 (diff)
downloadpleroma-76cfc6127fa05a8c5214d1dff368bad0e0a0b1a8.tar.gz
pleroma-76cfc6127fa05a8c5214d1dff368bad0e0a0b1a8.zip
Merge remote-tracking branch 'origin/develop' into ensure-authorized-fetch
Diffstat (limited to 'lib/mix')
-rw-r--r--lib/mix/tasks/pleroma/test_runner.ex25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/test_runner.ex b/lib/mix/tasks/pleroma/test_runner.ex
new file mode 100644
index 000000000..69fefb001
--- /dev/null
+++ b/lib/mix/tasks/pleroma/test_runner.ex
@@ -0,0 +1,25 @@
+defmodule Mix.Tasks.Pleroma.TestRunner do
+ @shortdoc "Retries tests once if they fail"
+
+ use Mix.Task
+
+ def run(args \\ []) do
+ case System.cmd("mix", ["test"] ++ args, into: IO.stream(:stdio, :line)) do
+ {_, 0} ->
+ :ok
+
+ _ ->
+ retry(args)
+ end
+ end
+
+ def retry(args) do
+ case System.cmd("mix", ["test", "--failed"] ++ args, into: IO.stream(:stdio, :line)) do
+ {_, 0} ->
+ :ok
+
+ _ ->
+ exit(1)
+ end
+ end
+end