Skip to content

Coverage analysis stops before all tests have finished when using the gem minitest-optional_retry #673

Open
@michel-zimmer

Description

@michel-zimmer

When requiring the gem minitest-optional_retry the coverage analysis stops before all tests have finished.

Output from before adding the gem:

bin/rails test
Running via Spring preloader in process 16635
Run options: --seed 9134

# Running:

.....

Finished in 0.119671s, 41.7812 runs/s, 58.4937 assertions/s.
5 runs, 7 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to [...]/rails-simplecov-minitest-optional_retry-mcve/coverage. 25 / 29 LOC (86.21%) covered.

Output from after adding the gem:

bin/rails test
Running via Spring preloader in process 16735
Coverage report generated for MiniTest to [...]/rails-simplecov-minitest-optional_retry-mcve/coverage. 0 / 44 LOC (0.0%) covered.
Run options: --seed 56425

# Running:

.....

Finished in 0.111954s, 44.6613 runs/s, 62.5258 assertions/s.
5 runs, 7 assertions, 0 failures, 0 errors, 0 skips

Everything is on most recent release:

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
gem 'rails', '~> 5.1.6'
gem 'minitest-optional_retry', '~> 0.0.2'
gem 'simplecov', '~> 0.16.1'

This file contains everything the gem actually does:

require 'minitest/autorun'

module Minitest
  module OptionalRetry
    def run_one_method(klass, method_name, reporter)
      report_result = nil
      3.times do
        result = Minitest.run_one_method(klass, method_name)
        report_result ||= result
        (report_result = result) and break if result.passed?
      end
      reporter.record(report_result)
    end
  end
end

(Taken from https://github.com/appfolio/minitest-optional_retry/blob/22490f82088cf13b2bf1abee8ebb3fc8050bd543/lib/minitest/optional_retry.rb)

I've create a mcve to be sure. It's source code can be found here (direct link to commits view). It consists of creating a Rails app, scaffolding something for testing, adding SimpleCov and then adding them gem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions