Skip to content

Commit

Permalink
Generate cover HTML files in parallel (#13596)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypconstante authored and josevalim committed May 24, 2024
1 parent d74e631 commit ebe3474
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/mix/lib/mix/tasks/test.coverage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,17 @@ defmodule Mix.Tasks.Test.Coverage do
output = Keyword.get(opts, :output, "cover")
File.mkdir_p!(output)

for mod <- modules do
{:ok, _} = :cover.analyse_to_file(mod, ~c"#{output}/#{mod}.html", [:html])
end
modules
|> Enum.map(fn mod ->
pid = :cover.async_analyse_to_file(mod, ~c"#{output}/#{mod}.html", [:html])
Process.monitor(pid)
end)
|> Enum.each(fn ref ->
receive do
{:DOWN, ^ref, :process, _pid, _reason} ->
:ok
end
end)

Mix.shell().info("Generated HTML coverage results in #{inspect(output)} directory")
end
Expand Down

0 comments on commit ebe3474

Please sign in to comment.