Skip to content

Commit 22371ce

Browse files
authored
Generate cover HTML files in parallel (#13596)
1 parent 5957b0b commit 22371ce

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/mix/lib/mix/tasks/test.coverage.ex

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,17 @@ defmodule Mix.Tasks.Test.Coverage do
288288
output = Keyword.get(opts, :output, "cover")
289289
File.mkdir_p!(output)
290290

291-
for mod <- modules do
292-
{:ok, _} = :cover.analyse_to_file(mod, ~c"#{output}/#{mod}.html", [:html])
293-
end
291+
modules
292+
|> Enum.map(fn mod ->
293+
pid = :cover.async_analyse_to_file(mod, ~c"#{output}/#{mod}.html", [:html])
294+
Process.monitor(pid)
295+
end)
296+
|> Enum.each(fn ref ->
297+
receive do
298+
{:DOWN, ^ref, :process, _pid, _reason} ->
299+
:ok
300+
end
301+
end)
294302

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

0 commit comments

Comments
 (0)