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

minitest-reporters #15

Open
jperry opened this issue Apr 23, 2012 · 8 comments
Open

minitest-reporters #15

jperry opened this issue Apr 23, 2012 · 8 comments

Comments

@jperry
Copy link

jperry commented Apr 23, 2012

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

@jperry jperry closed this as completed Apr 24, 2012
@jperry jperry reopened this Apr 24, 2012
@jperry
Copy link
Author

jperry commented Apr 24, 2012

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'

@calavera
Copy link
Contributor

You don't need to call MiniTest::Unit.runner since you already have the runner instance a few lines above.

@jperry
Copy link
Author

jperry commented Apr 24, 2012

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

@calavera
Copy link
Contributor

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.

@jperry
Copy link
Author

jperry commented Apr 24, 2012

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?

@jperry
Copy link
Author

jperry commented Apr 24, 2012

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.

@calavera
Copy link
Contributor

calavera commented May 1, 2012

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.

@mrjcleaver
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants