Open jperry opened 12 years ago
I tried adding the minitest-reporters gem to minitest-chef-handler but not having much success. Any ideas?
Changed runner.rb to:
class Runner < MiniTest::SuiteRunner
Changed minitest-chef-handler.rb have:
runner = Runner.new(run_status)
MiniTest::Unit.runner = runner
# Add reporters
MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new
Failure:
Run options: -v --seed 34541
Started
TestXML
ERROR
test_that_the_libxml2_package_was_installed (0.01s)
undefined method `[]' for nil:NilClass
/var/chef/minitest/xml/xml_test.rb:12:in `test_that_the_libxml2_package_was_installed'
/usr/local/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
ERROR test_that_the_libxml_devel_package_was_installed (0.00s)
undefined method `[]' for nil:NilClass
/var/chef/minitest/xml/xml_test.rb:3:in `test_that_the_libxml_devel_package_was_installed'
/usr/local/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
You don't need to call MiniTest::Unit.runner
since you already have the runner
instance a few lines above.
So you think just doing below would suffice?
runner.reporters << MiniTest::Reporters::SpecReporter.new
When I wasn't setting MiniTest::Unit.runner I was having issue with this line:
https://github.com/CapnKernul/minitest-reporters/blob/develop/lib/minitest/reporter.rb#L4
I see. The problem is that I don't set Minitest::Unit.runner anywhere because it's not used. I don't see the point to set it and I feel that behaviour is wrong, the reporter should not rely on a global variable but in the runner that has been assigned to.
Yeah, maybe I'll just fork that code and not use that approach but instead use the runner that is already set. Does that sound like that would fix the problem?
I changed the minitest-reporters to not use a global variable and pass the runner to the reporter and I'm getting a undefined method [] for nil:NilClass
# Running tests:
EE
Finished tests in 0.006150s, 325.2033 tests/s, 0.0000 assertions/s.
1) Error:
test_that_the_zip_package_was_installed(TestZip):
NoMethodError: undefined method `[]' for nil:NilClass
/vagrant/cookbooks/zip/files/default/tests/minitest/zip_test.rb:3:in `test_that_the_zip_package_was_installed'
/usr/local/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
2) Error:
test_that_the_unzip_package_was_installed(TestZip):
NoMethodError: undefined method `[]' for nil:NilClass
/vagrant/cookbooks/zip/files/default/tests/minitest/zip_test.rb:12:in `test_that_the_unzip_package_was_installed'
/usr/local/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
It's becoming hard to debug or track this one down.
for what I see, that project is basically a complete refactor of minitest. I'm afraid that unless it's merged with minitest the reporters won't work.
I note a flurry of activity over on minitest-reporters in the last few days. Is their project still incompatible? I didn't see an open ticket regarding the incompatibility noted here - perhaps someone here would like to check if the incompatibility issue still exists?
Hi,
It would be nice if minitest-chef-handler supported different minitest reporters. I'll see about forking the repo and adding this functionality to allow the user to specify different reporters as an option. Just wanted to mention it in case you had this code already in the works.
https://github.com/CapnKernul/minitest-reporters
Thanks, Jay