mix test.coverage --export-coverage fails
zetaron opened this issue · comments
Environment
- Elixir version (elixir -v): 1.13.3
- Domo version (mix deps | grep domo | head -1): master
- TypedStruct version (mix deps | grep typed_struct | head -1): N/A
Actual behavior
When exporting a test coverage report, the command seemingly fails due to missing *.TypeEnsurer
Module Code.
domo/example_avialia on master is 📦 v0.1.0 via 💧 v1.13.3 (OTP 24)
❯ mix test.coverage --export-coverage
... a lot of output ...
** (MatchError) no match of right hand side value: {:error, {:no_source_code_found, ExampleAvialia.Boardings.Passenger.TypeEnsurer}}
(mix 1.13.3) lib/mix/tasks/test.coverage.ex:290: anonymous fn/3 in Mix.Tasks.Test.Coverage.html/2
(elixir 1.13.3) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix 1.13.3) lib/mix/tasks/test.coverage.ex:289: Mix.Tasks.Test.Coverage.html/2
(mix 1.13.3) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
Full Log (click to expand)
domo/example_avialia on master is 📦 v0.1.0 via 💧 v1.13.3 (OTP 24)
❯ mix test.coverage --export-coverage
warning: use Mix.Config is deprecated. Use the Config module instead
config/config.exs:8
warning: use Mix.Config is deprecated. Use the Config module instead
config/test.exs:1
13:24:13.899 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :channel_handled_in]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :channel_joined]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :endpoint, :start]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :endpoint, :stop]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :error_rendered]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :router_dispatch, :start]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
13:24:13.910 [info] The function passed as a handler with ID {Phoenix.Logger, [:phoenix, :socket_connected]} is a local function.
This means that it is either an anonymous function or a capture of a function without a module specified. That may cause a performance penalty when calling that handler. For more details see the note in `telemetry:attach/4` documentation.
https://hexdocs.pm/telemetry/telemetry.html#attach/4
Domo will treat the following types as any() globally: Ecto.Schema.Metadata.t()
Domo is compiling type ensurer for 0 module (.ex)
Importing cover results: cover/html.coverdata
Percentage | Module
-----------|--------------------------
0.00% | ExampleAvialia.Boardings.Passenger.TypeEnsurer
0.00% | ExampleAvialia.Cargos.Measurement.TypeEnsurer
0.00% | ExampleAvialia.Cargos.Shipment.TypeEnsurer
0.00% | ExampleAvialia.Cargos.ShipmentDocument
0.00% | ExampleAvialia.Cargos.ShipmentDocument.TypeEnsurer
0.00% | ExampleAvialia.Cargos.ShipmentWeight
0.00% | ExampleAvialia.DataCase
0.00% | ExampleAvialia.SharedKernel
0.00% | ExampleAvialiaWeb
0.00% | ExampleAvialiaWeb.ChannelCase
6.67% | ExampleAvialia.Cargos.Shipment
16.67% | ExampleAvialia.Cargos.ShipmentKind
20.00% | ExampleAvialia.Cargos
20.00% | ExampleAvialiaWeb.ErrorHelpers
25.00% | ExampleAvialia.Boardings.Passenger
27.45% | ExampleAvialiaWeb.PageController
33.33% | ExampleAvialia.Cargos.Measurement
37.50% | ExampleAvialiaWeb.Router
50.00% | ExampleAvialia.BoardingsRepo
50.00% | ExampleAvialia.CargosRepo
50.00% | ExampleAvialiaWeb.LayoutView
50.00% | ExampleAvialiaWeb.PageView
55.56% | ExampleAvialia.Boardings
66.67% | ExampleAvialiaWeb.ErrorView
75.00% | ExampleAvialia.Application
100.00% | ExampleAvialia
100.00% | ExampleAvialia.TaggedTupleEctoType
100.00% | ExampleAvialiaWeb.ConnCase
100.00% | ExampleAvialiaWeb.Endpoint
100.00% | ExampleAvialiaWeb.Router.Helpers
-----------|--------------------------
13.44% | Total
Coverage test failed, threshold not met:
Coverage: 13.44%
Threshold: 90.00%
** (MatchError) no match of right hand side value: {:error, {:no_source_code_found, ExampleAvialia.Boardings.Passenger.TypeEnsurer}}
(mix 1.13.3) lib/mix/tasks/test.coverage.ex:290: anonymous fn/3 in Mix.Tasks.Test.Coverage.html/2
(elixir 1.13.3) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix 1.13.3) lib/mix/tasks/test.coverage.ex:289: Mix.Tasks.Test.Coverage.html/2
(mix 1.13.3) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
Expected behavior
I'd expect the coverage export to not fail.
From the top of my head, I could imagine multiple ways to attempt a solution:
- have the source code available to the coverage task
- or to add the
TypeEnsurer
Modules to theignore_modules
List of thetest_coverage
config - or provide a Function to get a list of all the
TypeEnsurer
's to easily ignore them, maybe including an example as part of the setup guide
For now we are going to manually manage the ignore_modules
List, which prevents the error but is an extra burden to remember for every Module we setup to use Domo.
If there is anything we can do to help implement a solution you think to be maintainable, we'd be happy to help out.
These modules are not covered by tests but are generated. So excluding them from analysis seems a good option.
Starting from Elixir v1.13 you can use regex in ignore_modules
to exclude all TypeEnsurer
modules like the following:
def project do
[
...
test_coverage: [ignore_modules: [~r/\.TypeEnsurer$/]]
]
end
Does it solve your issue?
Great didn’t realize Regex are an option there.
Would you accept a PR to add a note about this somewhere within the installation instructions?
Thank you. No need for PR. I already added the info to the Readme.MD for the next release.