Better Test Coverage Report

68 views
Skip to first unread message

TecNoz by Daniel Cukier

unread,
Sep 9, 2020, 11:32:03 PM9/9/20
to elixir-lang-core
I am trying to run a test coverage report in my project, but there are some difficulties. I run

$ mix test --cover

1) Is there a way to ignore some files? I'd like to ignore some auto-generated files from the coverage report, because the files that matter are those that I created code.
2) The generated report have some mysterious bugs. It shows that module definition lines are uncovered, but at the same time some lines inside the module are covered. Also it shows method definition lines uncovered, but lines inside those methods are covered.  Here is an example. How 

Screen Shot 2020-09-10 at 00.29.59.png

Thanks

D

José Valim

unread,
Sep 10, 2020, 1:30:57 AM9/10/20
to elixir-l...@googlegroups.com
Hi Cukier!

1. There is no way to ignore files but it could definitely be added. Note the coverage in the files are independent though, so ignoring the files would only affect the total coverage report shown by mix.

2. In this example, what is not being covered is the default argument. You never call that function without an argument, so the default argument is never covered, showing the line as red.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/cc9b3c23-0df6-4afb-8eaf-48093cbf730fn%40googlegroups.com.

TecNoz by Daniel Cukier

unread,
Sep 10, 2020, 9:30:13 AM9/10/20
to elixir-lang-core
Thanks for the answer Valim.

1) Do you know where is the code related to the coverage report? Maybe I could try to contribute with this change.
2) perfect, now I understand. What about this one? Why the module definition is not covered?
Screen Shot 2020-09-10 at 10.29.13.png

José Valim

unread,
Sep 10, 2020, 9:40:57 AM9/10/20
to elixir-l...@googlegroups.com
1. it is under the lib/mix application on Elixir's repo
2. It is most likely that "use ..., :view" is defining functions and those functions are not being executed by your tests

TecNoz by Daniel Cukier

unread,
Sep 11, 2020, 3:03:02 PM9/11/20
to elixir-lang-core
Mission accomplished! Thanks for all support
Reply all
Reply to author
Forward
0 new messages