'invalid option: --format' when executing rspec
Hi all -- I'm getting 'invalid option: --format' when I try to run rspec tests in IntelliJ. I can't seem to sort out why this is happening. Here's a typical console output:
/home/mark/.rvm/rubies/jruby-1.7.20/bin/jruby -J-cp /home/mark/standalone-test/pods/out/test/pods --1.9 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/mark/.rvm/gems/jruby-1.7.20@mywave-pods/bin/rspec /home/mark/standalone-test/pods/spec/decorators/deleted_pod_decorator_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "DeletedPodDecorator.links responds with links"
Testing started at 10:09 AM ...
invalid option: --format
This would seem to be in reference to the " --format Spec::Runner::Formatter::TeamcityFormatter" part of the command -- not sure what that does, if that's necessary, or why it's not understood by the jruby executable. Any insight you provide would be greatly appreciated...
请先登录再写评论。
How do you run rspec files? From context menu, or you create run configuration manually?
From the context menu, but I've tried tweaking various options on the run configuration that gets created as a result without any luck.
Anyone have any ideas? I've been unable to run my specs from within Intellij for close to a year now.
Mark, what IDEA and Ruby plugin versions do you have? In case you remove all existing Run configurations and launch "All specs in.." or a singe test, how does it go? In addition, how does it go from the command line (when launched manually)?
I am also experiencing this problem in RubyMine 2016.2.3 Build #RM-162.1812.23, built on September 5, 2016
I get the same results regardless of how I attempt to execute specs, whether as a single test or "All specs in...". I have no problem running these specs from the command line, as long as I do not use the --format option
The output pasted below is similar to what was reported by Mark Schnitzius:
/Users/michaelarnold/.rvm/rubies/ruby-2.2.3/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/michaelarnold/Development/boxpanel/bin/rspec /Users/michaelarnold/Development/boxpanel/spec/controllers/webhooks_controller_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
Testing started at 8:40 AM ...
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 2736
0 examples, 0 failures, 0 passed
Finished in 2.011796 seconds
Randomized with seed 2736
invalid option: --format
Process finished with exit code 1
Empty test suite.
Hello, Michael,
could you please check how it goes in the last RubyMine 2016.3 EAP? If the problem persists would it possible to provide me with a sample project to reproduce the problem?
I've the latest version, still no luck
RubyMine 2022.1.3
Build #RM-221.5921.22, built on June 21, 2022
Hello! Can you please share a bit more context around the problem? Which version of Ruby are you using? Could you please share a project where we could reproduce it?
Oleg Olkhovoy
It happens when I use stripe-ruby-mock gem for some reason,
Here is my `spec_helper.rb` file :
I'm getting this error when trying to run rspecs using RubyMine :
It is working fine when I run directly on the terminal, I tried to solve the issue with no luck but it seems the error is somewhere in OptionParser#parse! , it seems caused because it's passing options to stripe-mock-server process where it doesn't expect any anguments, I'm not really sure, but I think that is part of the issue, I tried to fix by resetting the options when stripe-mock-server starts, so I made sure to pass empty options and it worked when I do tests with debug, but it doesn't work with normal run, here is how I make it work on debugging, I changed parse! method inside ruby lib itself, basically I reset the options when stripe-mock-server turn comes
Oleg Olkhovoy I believe this github issue is pretty much related will also help, this hack worked for me, but it doesn't feel like a sustainable solution