ci-reporter / ci_reporter

CI::Reporter is an add-on to popular test frameworks that allows you to generate XML reports
MIT License
343 stars 110 forks source link

rake tasks doesn't work in a bundled environment #99

Closed maxenced closed 10 years ago

maxenced commented 11 years ago

I'm in the case described in the readme : "If you don’t have control over the Rakefile or don’t want to modify it".

In fact, I want to test external puppet modules, so this is basically a:

git clone git@github.com/some/puppet/module.git
cd module
bundle install
rake spec

Which triggers RSpec tests. If I want to use your rake task, with :

rake -f  /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/stub.rake ci:setup:rspec spec

I get the error :

/home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/test_suite.rb:84:in `require': cannot load such file -- builder (LoadError)
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/test_suite.rb:84:in `create_builder'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/test_suite.rb:91:in `to_xml'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/report_manager.rb:18:in `block in write_report'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/report_manager.rb:17:in `open'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/report_manager.rb:17:in `write_report'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/rspec.rb:195:in `write_report'
    from /home/maxence/.rvm/gems/ruby-1.9.3-p392/gems/ci_reporter-1.8.4/lib/ci/reporter/rspec.rb:166:in `dump_summary'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:98:in `block in notify'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:97:in `each'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:97:in `notify'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:82:in `finish'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:36:in `ensure in report'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:36:in `report'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
    from /home/maxence/repo/eco2clouds-dev/puppet-recipes/modules/apt/vendor/ruby/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
rake aborted!

Because the 'builder' gem can't be loaded in bundle. However, I don't want to modify repo's Gemfile.

Is there a way to solve this dependency (the gem is installed system wide) ?

tobischo commented 11 years ago

We had a similar issue and I fixed it for now by adding 'builder' to the Gemfile - but I would also be interested in a way to do this without adding builder explicitely to the Gemfile (since ci_reporter already has it as dependency and the gem should be present and loaded...)

maxenced commented 11 years ago

I currently solve it with something like :

echo "gem 'bundler'" >> Gemfile 
bundle install 
do my stuff 
git reset --hard HEAD 

but that's not a good solution.

MMore commented 10 years ago

+1

shepmaster commented 10 years ago

We are in the process of cleaning out old issues. If this issue still applies to this version, please let us know, otherwise we're going to close this issue to focus on current problems. Thanks for your report!

Of special note, our plan is to deprecate the alternate methods of invoking CI::Reporter. However, we are flexible and willing to keep this behavior, if you can help us understand why you need to run tests in CI for a project you cannot modify. Thanks!

shepmaster commented 10 years ago

Closing due to inactivity.