Why ExUnit does the job in System.at_exit/1?

I was researching the source code of ExUnit and found that when ExUnit starts automatically it runs inside System.at_exit/1.
I am wondering what was the purpose of it. What benefits does it give?
Even in docs: “Starts ExUnit and automatically runs tests right before the VM terminates.”

Link to this function https://github.com/elixir-lang/elixir/blob/main/lib/ex_unit/lib/ex_unit.ex#L194

This is so you can have scripts like this:

defmodule Foo do
  # some code
end

ExUnit.start()

defmodule FooTest do
  use ExUnit.Case
  # tests
end

and tests will automatically run at the end.

Oh, wow
never thought about such a case. Thank you!