I’m working on a umbrella app that relies on the built-in test coverage tools to generate reports, e.g
mix test --cover --export-coverage default
mix test.coverage
I’m noticing that modules that do nothing other than declare structs and mocked modules (mocked via mox
) both show up as 0% coverage in the coverage report. For example:
defmodule Bar do
defstruct [:a, :b, :c]
end
Mox.defmock(FooMock, for: Foo)
earn both modules an entry in the report, e.g.
Percentage | Module
-----------|--------------------------
0.00% | Bar
0.00% | FooMock
-----------|--------------------------
0.00% | Total
Is the only way to ignore these types of modules from the final output to explicitly list them in the ignore_modules
section, e.g.
def project do
[
# ...
test_coverage: [ignore_modules: [Bar, FooMock]]
]
end
There are reasons why we cannot currently use excoveralls
or other tools for this (even though ExCoveralls doesn’t “mis-diagnose” these particular cases IIRC). Is there some other way to modify our report? Or is this report actually telling us something useful that I have overlooked?
Thanks for any insights!