Skip to content

Handle multiple types in coveralls.multiple when --umbrella is present#340

Open
pablocostass wants to merge 1 commit intoparroty:masterfrom
pablocostass:fix-coveralls.multiple-for-umbrella
Open

Handle multiple types in coveralls.multiple when --umbrella is present#340
pablocostass wants to merge 1 commit intoparroty:masterfrom
pablocostass:fix-coveralls.multiple-for-umbrella

Conversation

@pablocostass
Copy link
Contributor

When the --umbrella flag isn't passed, excoveralls actually knows how to handle multiple types (it invokes ExCoveralls.analyze/3 for each of them), but if the option is present, then we handle the types as if it were only one

if options[:umbrella] do
store_stats(stats, options, compile_path)
else
types = List.wrap(options[:type] || "local")
stats = Stats.update_paths(stats, options)
# Push all available options down
options = options ++ opts
Enum.each(types, &analyze(stats, &1, options))

This results in a function clause error, which can be replicated in the umbrella example repo, https://github.com/parroty/excoveralls_umbrella

excoveralls_umbrella on  master [!] via 💧 v1.18.2
➜ mix coveralls.multiple --umbrella --type html --type cobertura
==> subapp0
Running ExUnit with seed: 57138, max_cases: 24

..
Finished in 0.00 seconds (0.00s async, 0.00s sync)
2 tests, 0 failures
==> subapp1
Running ExUnit with seed: 57138, max_cases: 24

.
Finished in 0.00 seconds (0.00s async, 0.00s sync)
1 test, 0 failures
** (RuntimeError) Undefined type (htmlcobertura) is specified for ExCoveralls
    (excoveralls 0.18.5) lib/excoveralls.ex:157: ExCoveralls.analyze/3
    (mix 1.18.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.18.2) lib/mix/cli.ex:107: Mix.CLI.run_task/2
    /Users/pablocostass/code/other/elixir/bin/mix:2: (file)
    (elixir 1.18.2) lib/code.ex:1525: Code.require_file/2

With the fix, however, one gets the following output

excoveralls_umbrella on  master [!] via 💧 v1.18.2
➜ mix coveralls.multiple --umbrella --type html --type cobertura
==> subapp0
Running ExUnit with seed: 860797, max_cases: 24

..
Finished in 0.00 seconds (0.00s async, 0.00s sync)
2 tests, 0 failures
==> subapp1
Running ExUnit with seed: 860797, max_cases: 24

.
Finished in 0.00 seconds (0.00s async, 0.00s sync)
1 test, 0 failures
----------------
COV    FILE                                        LINES RELEVANT   MISSED
100.0% apps/subapp0/lib/subapp0.ex                     9        2        0
 50.0% apps/subapp1/lib/subapp1.ex                     9        2        1
[TOTAL]  75.0%
----------------
Generating report...
Saved to: cover/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant