Skip to content

Commit

Permalink
Use IO.ANSI.format
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Oct 14, 2024
1 parent 58adbd4 commit 464fbf0
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ defmodule Sentry.Mixfile do
end

defp run_integration_tests(integration, args) do
header = if IO.ANSI.enabled?(), do: IO.ANSI.bright() <> IO.ANSI.cyan(), else: ""
reset = if IO.ANSI.enabled?(), do: IO.ANSI.reset(), else: ""

IO.puts("\n#{header}==> Running tests for integration: #{integration}#{reset}")
IO.puts(
IO.ANSI.format([
"\n",
[:bright, :cyan, "==> Running tests for integration: #{integration}"]
])
)

integration_dir = Path.join("test_integrations", integration)

Expand All @@ -156,12 +158,21 @@ defmodule Sentry.Mixfile do
)

if status > 0 do
error = if IO.ANSI.enabled?(), do: IO.ANSI.red(), else: ""
IO.puts("#{error}Integration tests for #{integration} failed#{reset}")
IO.puts(
IO.ANSI.format([
:red,
"Integration tests for #{integration} failed"
])
)

System.at_exit(fn _ -> exit({:shutdown, 1}) end)
else
success = if IO.ANSI.enabled?(), do: IO.ANSI.green(), else: ""
IO.puts("#{success}Integration tests for #{integration} passed#{reset}")
IO.puts(
IO.ANSI.format([
:green,
"Integration tests for #{integration} passed"
])
)
end
end
end

0 comments on commit 464fbf0

Please sign in to comment.