parroty / excoveralls

Coverage report tool for Elixir with coveralls.io integration.
MIT License
820 stars 178 forks source link

"function ExCoveralls.start/2 is undefined" #321

Closed thbar closed 6 months ago

thbar commented 9 months ago

Hi!

We're facing an issue recently while running our coverage on https://github.com/etalab/transport-site (open-source app).

The command is MIX_ENV=test mix coveralls.html --umbrella.

** (UndefinedFunctionError) function ExCoveralls.start/2 is undefined (module ExCoveralls is not available)
    (excoveralls 0.18.0) ExCoveralls.start("/Users/thbar/git/transport/transport-site/_build/test/lib/shared/ebin", [export: false, output: "cover", tool: ExCoveralls])
    (mix 1.15.5) lib/mix/tasks/test.ex:534: Mix.Tasks.Test.do_run/3
    (mix 1.15.5) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.5) lib/mix/project.ex:458: Mix.Project.in_project/4
    (elixir 1.15.5) lib/file.ex:1624: File.cd!/2
    (mix 1.15.5) lib/mix/task.ex:604: anonymous fn/4 in Mix.Task.run_in_children_projects/2
    (elixir 1.15.5) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.15.5) lib/mix/task.ex:603: Mix.Task.run_in_children_projects/2

It is a bit hard to diagnose when it was introduced for different reasons (we don't run it automatically, git bisect will need a bit of work to work etc).

What I ultimately found is that running the test command twice will show the issue, when running it only one will not:

rm -rf deps/excoveralls
mix deps.get
MIX_ENV=test mix coveralls.html --umbrella
MIX_ENV=test mix coveralls.html --umbrella

The same will work (with faster feedback on that app) with:

mix test --cover apps/shared/test/data_visualization_test.exs
mix test --cover apps/shared/test/data_visualization_test.exs

Are other people facing that issue? Thanks!

Nezteb commented 6 months ago

All of your project config looks correct at first glance.

The only idea I have is to try reproducing this with a new minimum viable umbrella app using the same versions of Elixir/Erlang as in your transport-site project.

elixir 1.15.5-otp-24
erlang 24.3.4.13
thbar commented 6 months ago

The only idea I have is to try reproducing this with a new minimum viable umbrella app using the same versions of Elixir/Erlang as in your transport-site project.

Yeah I will try to trim down the app and see how it goes. Maybe I'll have to poke into the Mix source to see if I can set some breakpoint and figure things out too. Thanks!

thbar commented 6 months ago

I ultimately found out: the reason is that we were not following (or maybe stopped following at some point for some other reasons) the advice in the middle of the documentation:

Note on umbrella application: If you want to use Excoveralls within an umbrella project, every apps must have test_coverage: [tool: ExCoveralls] in the mix.exs of each app.

It seems to have fixed it! I'll close the issue for now.