Comments (7)
I have the same with schema
which toggles between covered and not covered during consecutive runs.
from excoveralls.
Same here; the output of mix coveralls.html
is inconsistent, especially for schema
blocks.
from excoveralls.
I'm seeing exactly the same issue. Over multiple runs of mix espec --cover
or mix coveralls
, I'm seeing different coverage amounts because it sometimes counts the schema
line in the models and sometimes does not.
from excoveralls.
I'm having the same issue here and it sometimes leads to increasingly lower coverage scores without reason.
I'm not sure the underlying cause of this, but it seems to be rather high priority. Would appreciate someone digging around into internals to find a reason behind this.
from excoveralls.
+1 would be great to resolve this
from excoveralls.
Thanks for the follow up. I haven't been able to track down this item. If someone have insight, it would be great.
from excoveralls.
I have proposed a solution to this problem. I don't have enough knowledge about how the Erlang cover tool works to determine the real cause for this, but here is what I found out.
First of all, the coverage seems to be lower most of the times when running mix coveralls.html
, while it is usually higher when running mix coveralls
or mix test --cover
. Multiple runs will still yield the other result in some cases, so it seems like a concurrency issue is at work here.
Exploring the data returned by :cover.analyse/3
I quickly saw why the result is different (Elplan.User
is my Ecto model, on line 5 there is my schema declaration):
# The data structure is: {{module, line_number}, count}
lines = [{{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0},
{{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0},
{{Elplan.User, 0}, 2}, {{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0},
{{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 1},
{{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 1}, {{Elplan.User, 0}, 1},
{{Elplan.User, 0}, 1}, {{Elplan.User, 0}, 1}, {{Elplan.User, 0}, 0},
{{Elplan.User, 0}, 1}, {{Elplan.User, 0}, 0}, {{Elplan.User, 0}, 0},
{{Elplan.User, 0}, 1}, {{Elplan.User, 0}, 0}, {{Elplan.User, 5}, 0},
{{Elplan.User, 5}, 1}, {{Elplan.User, 5}, 1}, {{Elplan.User, 5}, 0},
{{Elplan.User, 5}, 1}, {{Elplan.User, 15}, 0}, {{Elplan.User, 18}, 1}]
As you can see, we have 5 results for line 5, 3 of them report a coverage count of 1 and 2 of them a count of 0. In this case, the last result for line 5 has a count of 1 so my code is reported as covered. When the coverage gets lower, I have the same amount of results, but the latest one has a count of 0.
My hypothesis is that there are multiple processes running and reporting the coverage at the module levels (the only duplicate lines that I see are at module level, not inside functions). The coverage reports are then sent back to the master process and depending on the order of arrival we would get different results.
Is this truly what is happening? Why some lines are reported more than once? Why in some cases the count is 1 and in others 0? Why this seems to only affect schema declarations?
These questions remain unanswered, but maybe someone else can shed some light on this based on my discoveries.
My fix simply takes the highest coverage count for every line, which might or might not be correct depending on the answers to the questions above.
from excoveralls.
Related Issues (20)
- Coverage report drops between Elixir-1.11.4 and 1.12.1 HOT 1
- Coverage calculation question
- With clause in the controller gets missing coverage, works when has some calculation before HOT 1
- (FunctionClauseError) no function clause matching in IO.chardata_to_string/1 HOT 9
- ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1 HOT 3
- mix coveralls.html --open HOT 4
- How to find out by which test selected line is covered by?
- Coveralls is not picking all my files HOT 1
- Coveralls errors out HOT 3
- Github actions fail on scheduled workflows
- Cannot specify subdir with circle
- Is it possible to include HEEX files in the coverage?
- Support --warnings-as-errors option HOT 3
- Reports different results at an umbrella level vs in-app level
- Is there a way to post coverage from Github Actions in parallel mode? HOT 3
- don't ignore `min_coverage` in `mix coveralls.json` HOT 4
- Coveralls reporting does not understand slots
- Story: Please add totals at the bottom of the report for LINES, RELEVANT and MISSED
- Cobertura error when protocols and implementations in codebase HOT 1
- Incompatibility between excoveralls and meck? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excoveralls.