minitest-display icon indicating copy to clipboard operation
minitest-display copied to clipboard

Incompatibility with CI::Reporter

Open toddmazierski opened this issue 12 years ago • 1 comments

minitest-display appears to be incompatible with CI::Reporter. After the tests are finished, the following exception occurs:

/opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-display-0.0.3/lib/minitest/display.rb:221:in `status': You have a nil object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.sort!
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/ci_reporter-1.7.2/lib/ci/reporter/minitest.rb:158:in `finished_anything'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/ci_reporter-1.7.2/lib/ci/reporter/minitest.rb:79:in `_run_anything'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-2.7.0/lib/minitest/unit.rb:934:in `run_tests'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-2.7.0/lib/minitest/unit.rb:921:in `block in _run'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-2.7.0/lib/minitest/unit.rb:920:in `each'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-2.7.0/lib/minitest/unit.rb:920:in `_run'
  from /opt/src/foo/my-app/vendor/bundle/ruby/1.9.1/gems/minitest-2.7.0/lib/minitest/unit.rb:909:in `run'
  from /usr/lib64/ruby/1.9.1/test/unit.rb:21:in `run'
  from /usr/lib64/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
  from /usr/lib64/ruby/1.9.1/test/unit.rb:27:in `run_once'
  from /usr/lib64/ruby/1.9.1/test/unit.rb:325:in `block in autorun'

toddmazierski avatar Sep 13 '12 18:09 toddmazierski

I did a little investigation, and think I see the cause of the problem:

minitest-display appears to patch MiniTest::Unit._run_anything and MiniTest::Unit._run_suite, but CI::Reporter assigns itself as the default MiniTest runner using the MiniTest::Unit.runner= method, with its own _run_anything and _run_suite methods.

As a result, variables like @test_times aren't being set, causing the exception noted above.

Hope you find this helpful! Please let me know if you have any questions or suggestions.

toddmazierski avatar Sep 30 '12 21:09 toddmazierski