Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN FloatDomainError after upgrading to 0.14.0 #563

Closed
stevehanson opened this issue Mar 17, 2017 · 7 comments
Closed

NaN FloatDomainError after upgrading to 0.14.0 #563

stevehanson opened this issue Mar 17, 2017 · 7 comments
Labels

Comments

@stevehanson
Copy link

After upgrading to 0.14.0, I receive the following error after my tests run, presumably while the SimpleCov report is being generated:

vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round': NaN (FloatDomainError)
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round_float'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:130:in `covered_strength'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `block in covered_strength'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `map'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `covered_strength'
  from (erb):7:in `formatted_file_list'
  from ~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/erb.rb:864:in `eval'
  from ~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/erb.rb:864:in `result'
  from vendor/bundle/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:66:in `formatted_file_list'
  from (erb):21:in `block in format'

Downgrading to 0.13.0 resolved the issue for me. I'm on Ruby 2.3.0, Rails 4.2.5.

@PragTob
Copy link
Collaborator

PragTob commented Mar 17, 2017

Argh jeez, I knew this was gonna happen some day! Thanks for the report ❤️

So this error happens here - if you could give me the values of float and places in that part (by inserting a puts on your end there) that'd be amazing and helpful in tracking down the error source.

If you had something that reproduces, even better but that'll help get me started :)

I won't get to it today (am at work and have evening plans) but will try to make and publish a fix over the weekend.

Sorry for the inconvenience!

@PragTob PragTob added the Bug label Mar 17, 2017
@chief
Copy link

chief commented Mar 17, 2017

Same here (got Infinity error)

ruby-2.4.0/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round': Infinity (FloatDomainError)

@stevehanson
Copy link
Author

@PragTob No worries! It took me all of a couple minutes to downgrade the gem and move on, so no big deal.

Here is the puts output for float, places when I run a test. Let me know if I can do anything else to help, but no urgency on my end.

0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
0.0, 1
NaN, 1

@PragTob
Copy link
Collaborator

PragTob commented Mar 17, 2017

@stevehanson I'm on fixing this right now. No idea how NaN gets there... I identified the commit that is likely responsible (b35f569) and am cooking up a fix right now. It catches the 0.0 case, not the NaN one but I'll see... opening a PR soon

@stevehanson
Copy link
Author

@PragTob cool. Feel free to ping me when you get the PR up, and I can test it out if you'd like.

@PragTob
Copy link
Collaborator

PragTob commented Mar 17, 2017

@stevehanson that's the idea, hope and intention. Thanks :)

PragTob added a commit that referenced this issue Mar 17, 2017
* Fixes #563 hopefully
* tracked the bug back to hopefully b35f569 (only thing
  that touched the caller of the method, but maybe there is some
  other interaction ongoing)
* Guess is/was that this might trigger if there aren't any lines
  covered... obviously test cases still missing to up our
  coverage here :)
@PragTob
Copy link
Collaborator

PragTob commented Mar 18, 2017

Fixed in 0.14.1 - thanks everyone

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 20, 2017
0.14.1 2017-03-18 ([changes](simplecov-ruby/simplecov@v0.14.0...v0.14.1))
========

## Bugfixes

* Files that were skipped as a whole/had no relevant coverage could lead to Float errors. See [#564](simplecov-ruby/simplecov#564) (thanks to @stevehanson for the report in [#563](simplecov-ruby/simplecov#563))

0.14.0 2017-03-15 ([changes](simplecov-ruby/simplecov@v0.13.0...v0.14.0))
==========

## Enhancements

* Officially support JRuby 9.1+ going forward (should also work with previous releases). See [#547](simplecov-ruby/simplecov#547) (ping @PragTob when encountering issues)
* Add Channel group to Rails profile, when `ActionCable` is loaded. See [#492](simplecov-ruby/simplecov#492) (thanks @BenMorganIO)
* Stop `extend`ing instances of `Array` and `Hash` during merging results avoiding problems frozen results while manually merging results. See [#558](simplecov-ruby/simplecov#558) (thanks @aroben)

## Bugfixes

* Fix parallel_tests when a thread ends up running no tests. See [#533](simplecov-ruby/simplecov#533) (thanks @cshaffer)
* Skip the `:nocov:` comments along with the code that they skip. See [#551](simplecov-ruby/simplecov#551) (thanks @ebiven)
* Fix crash when Home environment variable is unset. See [#482](simplecov-ruby/simplecov#482) (thanks @waldyr)
* Make track_files work again when explicitly setting it to nil. See [#463](simplecov-ruby/simplecov#463) (thanks @craiglittle)
* Do not overwrite .last_run.json file when refuse_coverage_drop option is enabled and the coverage has dropped (lead to you being able to just rerun tests and everything was _fine_). See [#553](simplecov-ruby/simplecov#553) (thanks @Miloshes)

0.13.0 2016-01-25 ([changes](simplecov-ruby/simplecov@v0.12.0...v0.13.0))
==========

## Enhancements

* Faster run times when a very large number of files is loaded into SimpleCov. See [#520](simplecov-ruby/simplecov#520) (thanks @alyssais)
* Only read in source code files that are actually used (faster when files are ignored etc.). See [#540](simplecov-ruby/simplecov#540) (tahks @yui-knk)

## Bugfixes

* Fix merging of resultsets if a file is missing on one side. See [#513](simplecov-ruby/simplecov#513) (thanks @hanazuki)
* Fix Ruby 2.4 deprecation warnings by using Integer instead of Fixnum. See [#523](simplecov-ruby/simplecov#523) (thanks @nobu)
* Force Ruby 2 to json 2. See [dc7417d50](simplecov-ruby/simplecov@dc7417d) (thanks @amatsuda)
* Various other gem dependency fixes for different gems on different ruby versions. (thanks @amatsuda)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants