App names not logged in umbrella for "mix test"

Did anyone noticed that in umbrella apps, when you run mix test from the root, the first application name gets logged but all the subsequent don’t?

Take one of my logs for example:

$ mix test
==> triplex
...............

Finished in 1.9 seconds
15 tests, 0 failures

Randomized with seed 209466
.

Finished in 2.0 seconds
1 test, 0 failures

Randomized with seed 310959
.........................................................................

Finished in 8.8 seconds
73 tests, 0 failures

Randomized with seed 454343

The triplex application gets logged, but probably as the its tests disables the logger, the subsequent ones don’t.

I would like to have them here, do anyone else fixed it? Or is it an issue on elixir mix core?

I’ve created a test project with three apps in it (one of them being phoenix). And the output from mix test seems to contain app names for me:

==> phx_test
....

Finished in 0.1 seconds
4 tests, 0 failures

Randomized with seed 700364
==> app_one
..

Finished in 0.05 seconds
2 tests, 0 failures

Randomized with seed 862477
==> app_two
..

Finished in 0.03 seconds
2 tests, 0 failures

Randomized with seed 929386
1 Like

Cool, that’s what I want. Let me see. My elixir version here is:

$ elixir -v
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.4.0

You?

Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.4.2

Thanks, I’ll update here and I return if it works. :wink:

Nope :confused:

Didn’t fixed :’(

Probably some configuration… Which can be a lot o things since I have 7 apps on this umbrella. But thanks anyway! I’ll let you know if I fix it.

just checked with an existing 5 apps umbrella, all names were shown, Elixir 1.4.1

Got it guys!!!

One of my tests was from a mix task that uses Mix.shel.info/1 to log. So, I was getting logs in the middle of my tests. To fix it, at that time (that was a loooong time ago, it was not even an umbrella), I had just added this:

setup do
  Mix.shell(Mix.Shell.Process)

  :ok
end

Which sets the output of Mix.shell.info/1 to the current process and not the default stdout. So problem solved.

But it turned out that once I had set the Mix.shell to the process, it stills like this for all the umbrella apps, because mix application is not shut down and reopened for each app, which means the mix process will use that value until my mix test ends. To fix it I just used:

setup do
  Mix.shell(Mix.Shell.Process)
  on_exit fn ->
    Mix.shell(Mix.Shell.IO)
  end

  :ok
end

And now it’s perfect! Thanks!

1 Like