single_cov
single_cov copied to clipboard
Bug Error thrown: `+': no implicit conversion of Integer into String
Coverage report generated for RSpec to /Users/mollerhoj/work/dd/deepdivr/coverage. 897 / 14462 LOC (6.2%) covered.
Traceback (most recent call last):
11: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:265:in `block in override_at_exit'
10: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:103:in `block in setup'
9: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:33:in `all_covered?'
8: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:33:in `flat_map'
7: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:33:in `each'
6: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:36:in `block in all_covered?'
5: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:125:in `uncovered'
4: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:156:in `uncovered_branches'
3: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:156:in `map'
2: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:156:in `each'
1: from /Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:156:in `block in uncovered_branches'
/Users/mollerhoj/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/single_cov-1.6.0/lib/single_cov.rb:156:in `+': no implicit conversion of Integer into String (TypeError)
The sum contains a hash: {"else"=>0, "then"=>0}
which can't be parsed by
found = sum.map { |k, _| [k[0], k[1] + 1, k[2], k[3] + 1] }
I don't understand the code, but seems like there's a bug in the parsing.
add a p coverage
after line 146 to see what is coming in
it's supposed to be a branch coverage output, but it seems to be something else
... also from the 897 / 14462 LOC (6.2%) covered.
it seems that you have some other coverage tool running, turn that off to confirm that these 2 fighting is causing the issue, then lmk what this other tool is
The other tool is SimpleCov
Disabling SimpleCov fixed the issue.
The input to the function was:
{"[:unless, 0, 41, 4, 41, 41]"=>{"[:else, 1, 41, 4, 41, 41]"=>0, "[:then, 2, 41, 4, 41, 26]"=>0}}
after disabling, it is now:
{[:unless, 0, 41, 4, 41, 41]=>{[:else,1, 41, 4, 41, 41]=>0, [:then, 2, 41, 4, 41, 26]=>0}}
Perhaps unpacking the strings would make it possible to run both tools?
things being in strings is the bug afaik so we need to find out where they are coming from
what's your SimpleCov version ? ... tried bumping it ? ... tried 0.19.1
which is in the Gemfile.lock here ?