`mix test --cover` fails with exit code 3 after upgrading to Elixir 1.13 in umbrella app

After upgrading to Elixir 1.13, I’ve noticed my CI pipelines failing without any obvious explanation.

The tests are run per-app like this: mix cmd --app myapp mix test --cover and that yields this output:

Finished in 0.9 seconds (0.4s async, 0.5s sync)
149 tests, 0 failures
[... snip coverage results]
Generated HTML coverage results in "cover" directory
** (exit) 3
    (mix 1.13.1) lib/mix/tasks/cmd.ex:64: Mix.Tasks.Cmd.run/1
    (mix 1.13.1) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.1) lib/mix/project.ex:396: Mix.Project.in_project/4
    (elixir 1.13.1) lib/file.ex:1560: File.cd!/2
    (mix 1.13.1) lib/mix/task.ex:531: anonymous fn/4 in Mix.Task.recur/1
    (elixir 1.13.1) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.13.1) lib/mix/task.ex:530: Mix.Task.recur/1
    (mix 1.13.1) lib/mix/project_stack.ex:221: Mix.ProjectStack.recur/1

As the first line in the traceback indicates, the subcommand (mix test --cover) appeared to run successfully, but then exited with status 3 for no apparent reason.

If I run mix test --cover from the apps/myapp folder, it also exits with status 3. Same happens when run on other apps in the umbrella, so it’s not specific to that app in particular.

But if I run mix test --cover from the root of the umbrella, running the tests on all apps in the umbrella at once, it runs successfully and finishes with status 0.

I’ve Googled and prodded around, but I can’t find any explanation of why mix test --cover would exit with status 3 without providing any error message or explanation. Anyone got an idea?

Edit: additional context

My elixir --version:

Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]
Elixir 1.13.1 (compiled with Erlang/OTP 24)

Erlang is 24.2.

My localdev is ASDF + macOS + Apple Silicon and the CI pipeline is running the hexpm/elixir:1.13.1-erlang-24.2-debian-buster-20210902-slim Docker images, on Intel CPUs and Linux (Gitlab CI), but the error is the same on both, so it does not appear to be a platform-specific issue.

1 Like

Do you have a threshold configuration? If so, you are below the threshold. We have recently improved the error message to be clearer.

4 Likes

I did not have a threshold config, but once I added it (and set it to an acceptable value) the problem went away, thanks for the tip :slight_smile:

1 Like