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

Missing --profile option #506

Closed
rafamanzo opened this issue Jul 17, 2013 · 11 comments
Closed

Missing --profile option #506

rafamanzo opened this issue Jul 17, 2013 · 11 comments

Comments

@rafamanzo
Copy link

Hi!

I don't know if this was intended to not work anymore.

I've searched about this and found anything relevant about this error.

But on the versions 1.3.(3|4), when I run the tests with cucumber --profile default I get the following error:

/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:1037:in `block in process_args': invalid option: --profile (OptionParser::InvalidOption)
    from /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `new'
    from /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `process_args'
    from /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:1066:in `_run'
    from /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:1059:in `run'
    from /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:795:in `block in autorun'

Downgrading to 1.3.2 fixed it.

Thank you in advance!

@mattwynne
Copy link
Member

You're requiring minitest/autorun somewhere aren't you? Stop doing that.

@rafamanzo
Copy link
Author

Thank you for the reply!

Actually, I'm not. Probably some gem is...

Look:

rafael@WALL-A:~/workspace/mezuro-standalone$ grep -lrh 'minitest/autorun'
rafael@WALL-A:~/workspace/mezuro-standalone$

rafael@WALL-A:~/workspace/mezuro-standalone$ grep -lrh "require 'minitest/autorun'" /home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems 
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/rake-10.1.0/test/support/rakefile_definitions.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/rake-10.1.0/test/helper.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/arel-4.0.0/test/helper.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activerecord-deprecated_finders-1.0.3/test/helper.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/test/minitest/metametameta.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/test/minitest/test_minitest_mock.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/test/minitest/test_minitest_benchmark.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/README.txt
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/rails-4.0.0/guides/bug_report_templates/active_record_gem.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/rails-4.0.0/guides/bug_report_templates/active_record_master.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/nokogiri-1.6.0/test/helper.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/rdoc-3.12.2/lib/rdoc/test_case.rb
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/mime-types-1.23/test/test_mime_type.rb

So, if this is the cause, should be rake, arel, activerecord-deprecated_finders, rails, nokogiri, rdoc and mime-types.

Digging about this require you mentioned I've reached this thread: https://groups.google.com/forum/#!topic/cukes/VoLUFDbiNdc

Puting a raise on the MiniTest::Unit.autorun method, as suggested, gave this stack trace:

rafael@WALL-A:~/workspace/mezuro-standalone$ cucumber --backtrace --profile default
macaco (RuntimeError)
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/minitest-4.7.5/lib/minitest/unit.rb:780:in `autorun'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/testing/autorun.rb:5:in `<top (required)>'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/railties-4.0.0/lib/rails/test_help.rb:5:in `<top (required)>'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:11:in `<top (required)>'
/home/rafael/workspace/mezuro-standalone/features/support/env.rb:11:in `require'
/home/rafael/workspace/mezuro-standalone/features/support/env.rb:11:in `<top (required)>'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/rb_support/rb_language.rb:122:in `load'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime.rb:183:in `load_step_definitions'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/runtime.rb:42:in `run!'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/lib/cucumber/cli/main.rb:47:in `execute!'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/gems/cucumber-1.3.4/bin/cucumber:13:in `<top (required)>'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/bin/cucumber:23:in `load'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/bin/cucumber:23:in `<main>'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/bin/ruby_noexec_wrapper:14:in `eval'
/home/rafael/.rvm/gems/ruby-2.0.0-p195@mezuro-standalone/bin/ruby_noexec_wrapper:14:in `<main>'

So it's activesupport who is calling it.

Commenting it out from activesupport-4.0.0/lib/active_support/testing/autorun.rb fixes it.

I've opened this issue to ask the Rails team about it: rails/rails#11484

Thank you again.

@mattwynne
Copy link
Member

Thanks a lot for digging into this @rafamanzo.

The reason this functionality was removed from Cucumber was that the code was gnarly and untested. We extracted the code out into a separate gem: https://github.com/cucumber/multi_test and on the way we did simplify it. It seemed to us that the use case where someone was requiring multitest/autorun as well as cucumber was an edge-case.

I don't think this behaviour should be in Cucumber, but if it doesn't get removed from ActiveSupport then what we need is for someone to add that behaviour back into multi_test, with tests.

@rafamanzo
Copy link
Author

Looks like it's necessary on Rails so it is capable of calling it's tests.

And it's to important find a way to avoid this call since it affects everyone using rails 4.

I'm not an specialist on it, but I'm thinking about sending a pull request to the cucumber-rails repository where the file cucumber/rails instead of requiring 'rails/test_help' requires one version of it without the require to 'active_support/testing/autorun'.

How wrong is that? :)

Thanks!

@mattwynne
Copy link
Member

I think it is broken of Rails to assume that minitest is the only testing framework you'll want to use. I haven't looked into it yet but maybe you're on to something @rafamanzo.

@alindeman how are you handling this for RSpec?

@alindeman
Copy link

@alindeman how are you handling this for RSpec?

I don't think rspec-rails is triggering this somehow. What exactly causes Rails to enable Minitest's autorun?

@mattwynne
Copy link
Member

@alindeman see cucumber/multi_test#2 (comment)

Cucumber-rails requires rails/test_help and that in turn requires the autorun. Are you plugging in Rails differently then? Maybe @tooky is on to something. We'll have to take a look at your code.

@alindeman
Copy link

What does rails/test_help provide that cucumber needs? We don't pull that in within rspec-rails as far as I can tell.

@aslakhellesoy
Copy link
Contributor

Yes, not requiring rails/test_help is definitely the solution to this bug:

@aslakhellesoy
Copy link
Contributor

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants