netzpirat / guard-cucumber

Guard::Cucumber automatically runs your features (much like autotest)
https://rubygems.org/gems/guard-cucumber
MIT License
39 stars 56 forks source link

Cucumber formatter conflict #1

Closed thecatwasnot closed 13 years ago

thecatwasnot commented 13 years ago

I've got a stock cucumber install (aside from spork setup?) and am trying to get guard-spork/guard-cucumber to run with it.

I encountered an issue with a conflict from guard and my stock cucumber.yml file, In the end I just changed my default cucumber profile so that it did not automatically call a formatter. Is there a better way to handle this? Also a note in the readme wouldn't go amiss either :)

cucumber.yml now looks like: std_opts = "--strict --tags ~@wip" %> default: --drb <%= std_opts %> features

netzpirat commented 13 years ago

What was the previous, failing formatter option within your cucumber.yml? I have a default cucumber.yml and it works without any problems:

<%
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
thecatwasnot commented 13 years ago

Interesting... old cucumber.yml looks like: <% rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip" %> default: --drb <%= std_opts %> features wip: --drb --tags @wip:3 --wip features rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

Error looks like: Using the default profile... Disabling profiles... Exception encountered: #<RuntimeError: All but one formatter must use --out, only one can print to each stream (or STDOUT)> backtrace: /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/cucumber-0.10.0/lib/cucumber/cli/configuration.rb:194:in arrange_formats' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/cucumber-0.10.0/lib/cucumber/cli/configuration.rb:26:inparse!' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/cucumber-0.10.0/lib/cucumber/cli/main.rb:54:in configuration' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/cucumber-0.10.0/lib/cucumber/cli/main.rb:62:inrun_drb_client' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/cucumber-0.10.0/lib/cucumber/cli/main.rb:34:in execute!' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/test_framework/cucumber.rb:22:inrun_tests' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:13:in block in run' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/forker.rb:21:inblock in initialize' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/forker.rb:18:in fork' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/forker.rb:18:ininitialize' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in new' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:inrun' /home/pixel/.rvm/gems/ruby-1.9.2-p0@myscrybe/gems/spork-0.8.4/lib/spork/server.rb:47:in run' /home/pixel/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1558:inperform_without_block' /home/pixel/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1518:in perform' /home/pixel/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1592:inblock (2 levels) in main_loop' /home/pixel/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in loop' /home/pixel/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:inblock in main_loop'

The one I posted above, is the same minus the --format option in std_opts, and that one has been working fine.

netzpirat commented 13 years ago

I can't see any references to Guard or Guard Cucumber in the stacktrace at all. Is this the output you receive by running Guard or Spork? When it's from Guard, does it run without the drb option?

netzpirat commented 13 years ago

Since I wanted to work at the different guards tomorrow anyway, I'll try to run it with guard-spork. I have stopped to use Spork last year when I was using it together with Autotest, because after the test suite has grown, I noticed that it was faster without Spork.

thecatwasnot commented 13 years ago

I got that error from running Cucumber inside Guard with guard-spork running.

Ok, I've tried this a bunch of ways, monkeying around with my Guardfile and cucumber.yml 2 ways that WORK, all green passing scenarios: 1: remove --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} from cucumber.yml std_opts: line 2: run cucumber inside guard without spork running at all, or force cucumber not to use spork (no --drb in cuc.yml AND no :drb =>true in Guardfile)

Any time cucumber tries to use spork inside guard it fails with the above error, unless I modify that line in cucumber.yml.

I was previously running cucumber and spork together without guard and had no issue.

This is quite weird. Thanks for looking into it.

netzpirat commented 13 years ago

I have now guard-spork up and running and can reproduce this bug. After searching for the reason, I found this lighthouse ticket about cucumber and drb: https://rspec.lighthouseapp.com/projects/16211/tickets/365-cucumber-out-option-does-not-worj-with-drb

It seems there is nothing I can do in guard-cucumber, apart from not passing a formatter to cucumber, but then I prefer the workaround to remove the formatter from cucumber.yml, since the guard-cucumber is in fact a progress formatter that adds guard notifications to it.

Anyway, since my rather large test suite is slower with Spork, my own interests with guard-cucumber is to further develop the experimental :preload functionality. The only missing peace is to reload Ruby code and I hope I can reuse ActiveSupport::Dependencies for exactly that reason and massively speed up the cucumber startup time.

thecatwasnot commented 13 years ago

Thanks for the followup! Will definitely keep an eye on things, and I'm just fine with the small tweek to cucumber.yml. Am interested to see how your preloader comes along.