Simplecov: Undefined method `floor` while checking min_coverage with Simplecov 0.21.0

Created on 4 Jan 2021  路  3Comments  路  Source: simplecov-ruby/simplecov

Hello, my automatic builds have started failing tonight, potentially after the release of Simplecov 0.21.0 due to a NoMethodError raised. Looking at the stack trace, it seems related to the minimum_coverage check, but not sure if it's a more extended issue.

Here is how we setup Simplecov (very top of spec_helper):

require 'simplecov'
SimpleCov.start do
  add_filter '/spec/'
  minimum_coverage 75
  minimum_coverage_by_file 75
end

Additional info

/opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:297:in `round_coverage': undefined method `floor' for #<SimpleCov::CoverageStatistics:0x0000562a4d76d3b0> (NoMethodError)
417
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:47:in `block (2 levels) in compute_minimum_coverage_data'
418
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:43:in `map'
419
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:43:in `block in compute_minimum_coverage_data'
420
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:42:in `each'
421
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:42:in `flat_map'
422
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:42:in `compute_minimum_coverage_data'
423
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:36:in `minimum_violations'
424
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb:12:in `failing?'
425
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/exit_code_handling.rb:11:in `each'
426
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/exit_code_handling.rb:11:in `find'
427
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/exit_codes/exit_code_handling.rb:11:in `call'
428
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:262:in `result_exit_status'
429
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:249:in `process_result'
430
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:234:in `process_results_and_report_error'
431
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:192:in `run_exit_tasks!'
432
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov.rb:179:in `at_exit_behavior'
433
    from /opt/hostedtoolcache/Ruby/2.7.2/x64/lib/ruby/gems/2.7.0/gems/simplecov-0.21.0/lib/simplecov/defaults.rb:30:in `block in <top (required)>'
Bug

Most helpful comment

Thanks a lot for the super-quick fix @PragTob! It has already fixed the tests 馃帀!

All 3 comments

Hello!

Thanks for the bug report! Also, can I have just one release without the need for a bug fix release :cry:

Turns out we have complete full testing with cucumber scenarios for minimum_coverage but not minimum_coverage_by_file which allowed this to slip through :|

My apologies, getting into fixing mode.

Released as 0.21.1

Thanks a lot for the super-quick fix @PragTob! It has already fixed the tests 馃帀!

Was this page helpful?
0 / 5 - 0 ratings