Skip to content

Commit 464fbf0

Browse files
committed
Use IO.ANSI.format
1 parent 58adbd4 commit 464fbf0

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

mix.exs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ defmodule Sentry.Mixfile do
143143
end
144144

145145
defp run_integration_tests(integration, args) do
146-
header = if IO.ANSI.enabled?(), do: IO.ANSI.bright() <> IO.ANSI.cyan(), else: ""
147-
reset = if IO.ANSI.enabled?(), do: IO.ANSI.reset(), else: ""
148-
149-
IO.puts("\n#{header}==> Running tests for integration: #{integration}#{reset}")
146+
IO.puts(
147+
IO.ANSI.format([
148+
"\n",
149+
[:bright, :cyan, "==> Running tests for integration: #{integration}"]
150+
])
151+
)
150152

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

@@ -156,12 +158,21 @@ defmodule Sentry.Mixfile do
156158
)
157159

158160
if status > 0 do
159-
error = if IO.ANSI.enabled?(), do: IO.ANSI.red(), else: ""
160-
IO.puts("#{error}Integration tests for #{integration} failed#{reset}")
161+
IO.puts(
162+
IO.ANSI.format([
163+
:red,
164+
"Integration tests for #{integration} failed"
165+
])
166+
)
167+
161168
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
162169
else
163-
success = if IO.ANSI.enabled?(), do: IO.ANSI.green(), else: ""
164-
IO.puts("#{success}Integration tests for #{integration} passed#{reset}")
170+
IO.puts(
171+
IO.ANSI.format([
172+
:green,
173+
"Integration tests for #{integration} passed"
174+
])
175+
)
165176
end
166177
end
167178
end

0 commit comments

Comments
 (0)