fireproofsocks

fireproofsocks

Test coverage for structs and mocks

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!

First Post!

tjchambers

tjchambers

Did you ever get a response to this? Would be interested.

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement