mike-zorn / rspec-teamcity

TeamCity's rspec reporter
GNU General Public License v3.0
8 stars 5 forks source link

LoadError for `spec/runner/formatter/teamcity_formatter` #4

Open darkn3rd opened 7 years ago

darkn3rd commented 7 years ago

SUMMARY

I cannot get this to work, not sure what to do. It looks like there needs to be spec/runner/formatter/teamcity_formatter, but don't know if I need to do anything.

ACTUAL RESULTS

bundler: failed to load command: rspec (/usr/local/bundle/bin/rspec) [0m
LoadError: cannot load such file -- spec/runner/formatter/teamcity_formatter
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:222:in `require'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:222:in `rescue in custom_formatter'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:219:in `custom_formatter'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:172:in `find_formatter'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:141:in `add'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:828:in `add_formatter'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `block in load_formatters_into'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `each'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `load_formatters_into'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:23:in `configure'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:99:in `setup'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
  /usr/local/bundle/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
  /usr/local/bundle/bin/rspec:17:in `load'
  /usr/local/bundle/bin/rspec:17:in `<top (required)>'

STEPS

I added this to my configuration:

require 'rspec/teamcity'

RSpec.configure do |config|
  config.add_formatter Spec::Runner::Formatter::TeamcityFormatter
  config.before do |example|
    # disable all the observers
    ... snip ...
  end
end

And ran it by doing this:

  bundle exec rspec \
    ${OPTIONS} \
    --format Spec::Runner::Formatter::TeamcityFormatter \
    spec/${CURRENT_TEST}
mike-zorn commented 7 years ago

@darkn3rd did you add it to your Gemfile?

darkn3rd commented 6 years ago

Hello. I did add it. I have gotten these to work, but this requirements to have --require is quite painful. Our test group may have sub-directories with the tests.

So I pass in a command like:

bundle exec rspec --no-color --format progress --require /gobalto/spec/integration --format Spec::Runner::Formatter::TeamcityFormatter spec/integration

Which will fail, as there are no immediate tests in there, only in the sub-directories. When I run it regularly without --require and the TeamCity formatter, use html, it works find, finds everything by the last parameter passed of spec/integration

mike-zorn commented 6 years ago

Oh. I see. I'm sorry to say I haven't worked on this in long enough that I don't actually know how to work around that. If you are able to patch this, that's a very welcome pull request 😸

darkn3rd commented 6 years ago

It seems the utility of this is limited, as you have to explicitly list the individual files. The reason why I am interested in this reporter is because TeamCity Rails Runner doesn't seem to work through Docker. Thus I use this reporter in the container, and get nice UI output in TeamCity.