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

Guard-Rspec 4.6.0 - Guard::RSpec formatter! #334

Closed
elbouillon opened this issue Jul 5, 2015 · 18 comments
Closed

Guard-Rspec 4.6.0 - Guard::RSpec formatter! #334

elbouillon opened this issue Jul 5, 2015 · 18 comments
Labels

Comments

@elbouillon
Copy link

Hi, I updated to the last version and I'm using zeus to run rspec trough guard. When I run it directly with zeus I don't get any message, but when I run it trough guard I'm getting a result file formatter error.

Here is my guardfile :

   guard :rspec, cmd: "zeus rspec", cmd_additional_args: "-f progress" do…

I tried to add : , launchy: nil, notification: false, but always get this error.

Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/guard-rspec-4.6.0/lib/guard/rspec_formatter.rb:113:in `_results_file': Fatal: No output file given for Guard::RSpec formatter! (RuntimeError)
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/guard-rspec-4.6.0/lib/guard/rspec_formatter.rb:83:in `_write'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/guard-rspec-4.6.0/lib/guard/rspec_formatter.rb:76:in `write_summary'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/guard-rspec-4.6.0/lib/guard/rspec_formatter.rb:65:in `dump_summary'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:184:in `block in notify'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:183:in `each'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:183:in `notify'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:162:in `block in finish'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:170:in `close_after'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:151:in `finish'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/reporter.rb:79:in `report'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:113:in `run_specs'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:89:in `run'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in `run'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/zeus-0.15.2/lib/zeus/rails.rb:208:in `test'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/zeus-0.15.2/lib/zeus.rb:148:in `block in command'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/zeus-0.15.2/lib/zeus.rb:135:in `fork'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/zeus-0.15.2/lib/zeus.rb:135:in `command'
    from /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/zeus-0.15.2/lib/zeus.rb:50:in `go'
    from -e:1:in `<main>'
15:31:29 - ERROR - Failed: "zeus rspec -f progress -r /Users/mkurmann/.rvm/gems/ruby-1.9.3-p547@ppl-management/gems/guard-rspec-4.6.0/lib/guard/rspec_formatter.rb -f Guard::RSpecFormatter --failure-exit-code 2 -f progress spec" (exit code: 1)
@e2
Copy link
Contributor

e2 commented Jul 5, 2015

It's likely a bug (the formatter needs an environment variable passed by Guard::Rspec - but zeus fork() is probably getting in the way somehow).

Meanwhile, try and switch to an earlier version for Guard::RSpec:

gem 'rspec', '~> 4.5.2'

Let me know if that works (it should).

@e2 e2 added the bug label Jul 5, 2015
@e2
Copy link
Contributor

e2 commented Jul 5, 2015

Ok, I can't do much more than this workaround:

https://github.com/guard/guard-rspec/blob/master/README.md#integration-with-zeus

I've added an issue in: burke/zeus#523, so hopefully someday the workaround won't be necessary.

@e2 e2 closed this as completed Jul 5, 2015
@elbouillon
Copy link
Author

Thanks for the kick answer, I moved to version 4.6 because of an other bug in 4.5.2 (formatter deprecation... I can't find the related issue, but was fixed)

@elbouillon
Copy link
Author

THANKS for the workaround… I'm moving to rails 4 and spring so a workaround is just fine!

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

Glad to help. Let me know if you have any issues - including Guard, Guard::RSpec or Spring.

For spring, you may prefer to add this gem: https://github.com/jonleighton/spring-watcher-listen

(It uses native backend for listening to changes instead of polling - it may not be as responsive as zeus, but it should be pretty close).

@elbouillon
Copy link
Author

Hum, now I'm back with my error from 4.5.2… I'll investigate.

/.rvm/gems/ruby-1.9.3-p547/gems/rspec-core-3.3.1/lib/rspec/core/formatters/deprecation_formatter.rb:186:in `puts': The `:example_group` key in an
 example group's metadata hash is deprecated. Use the example group's hash directly for the computed 
keys and `:parent_example_group` to access the parent example group metadata instead.

Seems to be related to rspec not guard-rspec

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

Make sure you've switched back to guard-rspec 4.6.0.

If that doesn't help, if you can, set up a repo so I can reproduce this (because this issue was quite tricky to reproduce and fix - without breaking other RSpec versions).

Or, if you can't set up a repo, you can try adding STDERR.puts statements here to debug:

root_metadata = metadata
location = metadata[:location]
until spec_path?(location)
metadata = metadata[:parent_example_group] || metadata[:example_group]
unless metadata
STDERR.puts "no spec file location in #{root_metadata.inspect}"
return root_metadata[:location]
end
# rspec issue https://github.com/rspec/rspec-core/issues/1243
location = (metadata[:location] || "").split(":").first
end

At least if you can provide a dump of what metadata looks like, I think I can reproduce it as a test and then fix it.

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

Or, if you're in a hurry, you can just downgrade RSpec - to since before the deprecation. There are some cool new RSpec 3.3. features, but this shouldn't be a blocker for you to get work done.

@elbouillon
Copy link
Author

I'm back to guard-rspec 4.6.0, I think I'll downgrade. As you said it won't block me and I think you may not loose time to solve an issue for older configs (ruby 1.9.3, rails 3.2 it's pretty old nowadays)

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

If there's a bug with the metadata thing, I'd like to know about - especially because lots of people have lots of old project they need to upgrade, and I wouldn't want Guard::RSpec to be in their way.

So don't hesitate to report issues - you never know when a fixing a small deprecation issue leads to fixing a major, hard-to-debug issue elsewhere.

Thanks and have a nice day!

@elbouillon
Copy link
Author

Ok no problem how can I send you all my metadata ?

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

I meant the parameter metadata.

Just add a line like this:

IO.write('metadata.txt', metadata.inspect)

before this line here:

root_metadata = metadata

Then,

  1. run to get the deprecation
  2. check/modify the file to make sure it doesn't have any non-public info inside
  3. upload it as a gist and link it here

@e2
Copy link
Contributor

e2 commented Jul 5, 2015

Just make sure you're getting this deprecation on Guard::RSpec 4.6.0

Put this in the Gemfile to make sure, and restart Guard (and don't forget to restart Zeus too!):

gem 'rspec', '~> 4.6.0'

@elbouillon
Copy link
Author

Thanks, here are my metadata, with Guard::RSpec 4.6.0 and the quick fix for zeus.

 {:execution_result=>#<RSpec::Core::Example::ExecutionResult:0x007fef0d274ad0 @started_at=2015-07-05 21:04:46 +0200, @status=:failed, @finished_at=2015-07-05 21:04:50 +0200, @run_time=3.831327, @exception=#<Capybara::ElementNotFound: Unable to find field "project_customer_id">>, :block=>#<Proc:0x007fef0d274d50@/spec/features/project_spec.rb:23>, :description_args=>["I can create a project"], :description=>"I can create a project", :full_description=>"Project as a user I can create a project", :described_class=>nil, :file_path=>"./spec/features/project_spec.rb", :line_number=>23, :location=>"./spec/features/project_spec.rb:23", :absolute_file_path=>"/spec/features/project_spec.rb", :rerun_file_path=>"./spec/features/project_spec.rb", :scoped_id=>"1:1:3", :capybara_feature=>true, :type=>:feature, :example_group=>{:execution_result=>#<RSpec::Core::Example::ExecutionResult:0x007fef0d26be08>, :block=>#<Proc:0x007fef0d26c678@/spec/features/project_spec.rb:4>, :description_args=>["as a user"], :description=>"as a user", :full_description=>"Project as a user", :described_class=>nil, :file_path=>"./spec/features/project_spec.rb", :line_number=>4, :location=>"./spec/features/project_spec.rb:4", :absolute_file_path=>"/spec/features/project_spec.rb", :rerun_file_path=>"./spec/features/project_spec.rb", :scoped_id=>"1:1", :capybara_feature=>true, :type=>:feature, :parent_example_group=>{:execution_result=>#<RSpec::Core::Example::ExecutionResult:0x007fef05653898> , :block=>#<Proc:0x007fef056647d8@/spec/features/project_spec.rb:3>, :description_args=>["Project"], :description=>"Project", :full_description=>"Project", :described_class=>nil, :file_path=>"./spec/features/project_spec.rb", :line_number=>3, :location=>"./spec/features/project_spec.rb:3", :absolute_file_path=>"/spec/features/project_spec.rb", :rerun_file_path=>"./spec/features/project_spec.rb", :scoped_id=>"1", :capybara_feature=>true, :type=>:feature}}, :shared_group_inclusion_backtrace=>[], :focus=>true, :javascript=>true, :last_run_status=>"unknown"}

@e2
Copy link
Contributor

e2 commented Jul 10, 2015

I checked this out and I think something else is wrong.

First, if you can, add config.raise_errors_for_deprecations! in your spec/spec_helper.rb - just to be sure where the problem is.

Second - it's strange, because if you're getting the error, it means ./spec/features/project_spec.rb is not a spec path (do you have custom RSpec configuration for spec locations?).

Everything else seems ok (my RSpec version matches yours, I seem to have the same metadata structure, etc.), so I can't work out how you're getting a deprecation.

Could you create a repo where I can reproduce the problem - I could probably fix this quickly.

@e2 e2 reopened this Jul 10, 2015
@elbouillon
Copy link
Author

Hi, ok I'll try to do that asap, as I'm leasure developper I don't have much time right now. Thanks for your help.

@e2
Copy link
Contributor

e2 commented Jul 23, 2015

@elbouillon - the metadata (deprecation) problem is likely caused by #338

@e2 e2 closed this as completed Jul 23, 2015
@elbouillon
Copy link
Author

Great news! Thanks!

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

No branches or pull requests

2 participants