Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

invalid option: -f #169

Closed
kalda341 opened this Issue · 38 comments

9 participants

@kalda341

invalid option: -f
Test::Unit automatic runner.
Usage: /home/max/bin/rspec [options] [-- untouched arguments]

When I run guard.

Gemfile:

 23 group :test, :development do
 24   gem 'minitest'
 25   gem 'turn'
 26   gem 'rspec-rails'
 27   gem 'capybara'
 28   gem 'guard-rspec'
 29   gem 'guard-test'
 30   gem 'launchy'
 31 end

All my gems are up to date as I just ran gem update.

@rymai
Owner

Hi,

as per the contributing guide, please add debug information to the issue by running guard --debug.

Thanks in advance!

@kalda341

That is the debug output, or at least the relevant section.

Guardfile:

  1 # A sample Guardfile
  2 # More info at https://github.com/guard/guard#readme
  3 
  4 guard 'rspec' do
  5   watch(%r{^spec/.+_spec\.rb$})
  6   watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  7   watch('spec/spec_helper.rb')  { "spec" }
  8 
  9   # Rails example
 10   watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
 11   watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
 12   watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb    ", "spec/acceptance/#{m[1]}_spec.rb"] }
 13   watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
 14   watch('config/routes.rb')                           { "spec/routing" }
 15   watch('app/controllers/application_controller.rb')  { "spec/controllers" }
 16 
 17   # Capybara features specs
 18   watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/features/#{m[1]}_spec.rb" }
 19 
 20   # Turnip features and steps
 21   watch(%r{^spec/acceptance/(.+)\.feature$})
 22   watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }```
 23 end
@rymai
Owner

Sorry, this is the Guardfile, not the debug output, please run guard --debug and paste the output here (and please format the output by surrounding it with triple backticks, see GitHub Flavored Markdown). Thank you!

@kalda341

Sorry, perhaps I wasn't clear. The first error I posted was with the output of guard -- debug

@thibaudgg
Owner

Still an issue? Without the debug output it'll be hard to help you.

@DanThiffault

I'm having the same issue. Here's the output with debug turned on:

11:42:03 - DEBUG - Command execution: uname
11:42:03 - DEBUG - Command execution: sw_vers -productVersion
11:42:03 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
11:42:03 - INFO - Guard uses TerminalNotifier to send notifications.
11:42:03 - INFO - Guard uses TerminalTitle to send notifications.
11:42:03 - DEBUG - Command execution: hash stty
11:42:03 - DEBUG - Guard starts all plugins
11:42:03 - DEBUG - Hook :start_begin executed for Guard::RSpec
11:42:03 - INFO - Guard::RSpec is running
11:42:03 - INFO - Running all specs
11:42:03 - DEBUG - Command execution: bundle exec rspec --help
11:42:06 - DEBUG - Command execution: bundle exec rspec -f progress -r /Users/dan/.rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.1.2/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --out /dev/null --failure-exit-code 2 spec 
required simplecov
Rack::File headers parameter replaces cache_control after Rack 1.5.
............................................................*...............................................................................................................*.................................................................................................

Pending:
  Api::ProjectsController GET index for a business owner returns their projects, last edited first
    # No reason given
    # ./spec/controllers/api/projects_controller_spec.rb:12
  ApplicationsController PUT update updates the application
    # No reason given
    # ./spec/controllers/applications_controller_spec.rb:129

Finished in 27.06 seconds
270 examples, 0 failures, 2 pending


Randomized with seed 64177

invalid option: -f
Test::Unit automatic runner.
Usage: /Users/dan/.rvm/gems/ruby-1.9.3-p194/bin/rspec [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        --collector=COLLECTOR        Use the given COLLECTOR.
                                     (de[scendant], di[r], l[oad], o[bject]_space)
    -n, --name=NAME                  Runs tests matching NAME.
                                     (patterns may be used).
        --ignore-name=NAME           Ignores tests matching NAME.
                                     (patterns may be used).
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     (patterns may be used).
        --ignore-testcase=TESTCASE   Ignores tests in TestCases matching TESTCASE.
                                     (patterns may be used).
        --location=LOCATION          Runs tests that defined in LOCATION.
                                     LOCATION is one of PATH:LINE, PATH or LINE
        --attribute=EXPRESSION       Runs tests that matches EXPRESSION.
                                     EXPRESSION is evaluated as Ruby's expression.
                                     Test attribute name can be used with no receiver in EXPRESSION.
                                     EXPRESSION examples:
                                       !slow
                                       tag == 'important' and !slow
        --[no-]priority-mode         Runs some tests based on their priority.
        --default-priority=PRIORITY  Uses PRIORITY as default priority
                                     (h[igh], i[mportant], l[ow], m[ust], ne[ver], no[rmal])
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
        --color-scheme=SCHEME        Use SCHEME as color scheme.
                                     (d[efault])
        --config=FILE                Use YAML fomat FILE content as configuration file.
        --order=ORDER                Run tests in a test case in ORDER order.
                                     (a[lphabetic], d[efined], r[andom])
        --max-diff-target-string-size=SIZE
                                     Shows diff if both expected result string size and actual result string size are less than or equal SIZE in bytes.
                                     (1000)
    -v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                     (important-only, n[ormal], p[rogress], s[ilent], v[erbose])
        --[no-]use-color=[auto]      Uses color output
                                     (default is auto)
        --progress-row-max=MAX       Uses MAX as max terminal width for progress mark
                                     (default is auto)
        --no-show-detail-immediately Shows not passed test details immediately.
                                     (default is yes)
        --output-file-descriptor=FD  Outputs to file descriptor FD
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).

Coverage report generated for RSpec to /Users/dan/Documents/Development/labs119/studentsrclp/coverage. 582 / 757 LOC (76.88%) covered.

11:42:53 - INFO - Guard is now watching at '/Users/dan/Documents/Development/labs119/studentsrclp'
11:42:54 - DEBUG - Command execution: stty -g 2>/dev/null
11:42:54 - DEBUG - Start interactor
@thibaudgg
Owner

Can you give your Guardfile and .rspec files please

@thibaudgg
Owner

Please try also to update rspec ang give your actual version be rspec -v. Thanks

@DanThiffault
# A sample Guardfile
# More info at https://github.com/guard/guard#readme


# guard :test do
#   watch(%r{^lib/(.+)\.rb$})     { |m| "test/#{m[1]}_test.rb" }
#   watch(%r{^test/.+_test\.rb$})
#   watch('test/test_helper.rb')  { "test" }
# 
#   # Rails example
#   watch(%r{^app/models/(.+)\.rb$})                   { |m| "test/unit/#{m[1]}_test.rb" }
#   watch(%r{^app/controllers/(.+)\.rb$})              { |m| "test/functional/#{m[1]}_test.rb" }
#   watch(%r{^app/views/.+\.rb$})                      { "test/integration" }
#   watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
# end

guard 'rspec' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
end
@thibaudgg
Owner

Ok, and you are launching guard with bundle exec guard ?

@DanThiffault

.rspec contains one line --color

bundle exec rspec -v
2.13.1

Thanks for looking into it!

@DanThiffault

yes launching with bundle exec guard

@thibaudgg
Owner

That's really weird, try to run /Users/dan/.rvm/gems/ruby-1.9.3-p194/bin/rspec -v to see the version of rspec used here.

@DanThiffault

Same version when running the above command. In case it helps:

from my Gemfile.lock

guard (1.6.2)
      listen (>= 0.6.0)
      lumberjack (>= 1.0.2)
      pry (>= 0.9.10)
      terminal-table (>= 1.4.3)
      thor (>= 0.14.6)
    guard-rspec (2.1.2)
      guard (>= 1.1)
      rspec (~> 2.11)
    guard-test (0.7.0)
      guard (>= 1.1)
      test-unit (~> 2.2)
@thibaudgg
Owner

You have an old version of guard & guard-rspec, please update them.

@DanThiffault

Yes thanks should have tried that first. Unfortunately still getting the same message after updating.

    guard (1.7.0)
      formatador (>= 0.2.4)
      listen (>= 0.6.0)
      lumberjack (>= 1.0.2)
      pry (>= 0.9.10)
      thor (>= 0.14.6)
    guard-rspec (2.5.2)
      guard (>= 1.1)
      rspec (~> 2.11)
    guard-test (0.8.0)
      guard (>= 1.1)
      test-unit (~> 2.2)
@thibaudgg
Owner

it maybe comes from simplecov configuration.

This Test::Unit automatic runner. is also quite strange to me, have you a useless test folder?

@DanThiffault

I'm transitioning over from Test::Unit to Rspec. I commented out the guard block while trying to track down this issue.

After removing simplecov, the error went away. Thank you for the incredibly quick help. This is resolved for me.

@thibaudgg
Owner

That's great, you're welcome!

@thibaudgg thibaudgg closed this
@carlsonjf

Can I ask this same question please? I have a new project.

I have the same issue as DanThiffault, same versions, etc. New guard, guard-rspec. I do not have simpleconv anywhere.

Debug information is:

Mangoat:pfa jeff$ bundle exec guard --debug
14:43:18 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
14:43:18 - INFO - Guard uses TerminalTitle to send notifications.
14:43:18 - DEBUG - Command execution: hash stty
14:43:18 - DEBUG - Guard starts all plugins
14:43:18 - DEBUG - Hook :start_begin executed for Guard::RSpec
14:43:18 - INFO - Guard::RSpec is running
14:43:18 - INFO - Running all specs
14:43:18 - DEBUG - Command execution: bundle exec rspec --help
14:43:18 - DEBUG - Command execution: bundle exec rspec -f progress -r /Users/jeff/ruby/gems/guard-rspec-
2.6.0/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2 spec
..**`

Finished in 0.03572 seconds
4 examples, 0 failures, 2 pending

Randomized with seed 41935`

Deprecated option (--fox).
invalid argument: -r /Users/jeff/ruby/gems/guard-rspec-2.6.0/lib/guard/rspec/formatter.rb
Test::Unit automatic runner.
Usage: /Users/jeff/ruby/bin/rspec [options] [-- untouched arguments]

-r, --runner=RUNNER              Use the given RUNNER.
                                 (c[onsole], f[ox], g[tk], g[tk]2, t[k])
-n, --name=NAME                  Runs tests matching NAME.
                                 (patterns may be used).
-t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                 (patterns may be used).
-I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
-v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                 (s[ilent], p[rogress], n[ormal], v[erbose])
    --                           Stop processing options so that the
                                 remaining options will be passed to the
                                 test.
-h, --help                       Display this help.

Deprecated options:
--console Console runner (use --runner).
--gtk GTK runner (use --runner).
--fox Fox runner (use --runner).

14:43:20 - INFO - Guard is now watching at '/Users/jeff/work/ruby/pfa'
14:43:21 - DEBUG - Command execution: stty -g 2>/dev/null
14:43:21 - DEBUG - Start interactor
[1] guard(main)>`

@thibaudgg
Owner

Some ideas:

  • Update RSpec, Guard & Guard-Rspec
  • Remove test folder if present
  • Search for where come from --fox & --gtk deprecated options.
@thibaudgg
Owner

Feel free to also share your Gemfile, Gemfile.lock & Guardfile.

@carlsonjf

RSpec 2.13.0
guard 1.8.0
guard-rspec 2.6.9

no test folder

searched whole project and no instance of fox or gtk

Gemfile

source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'sqlite3'
gem 'json'
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

group :test, :development do
    gem 'turn', '< 0.8.3'
    gem 'rspec'
    gem 'rspec-rails'
    gem 'capybara', '~> 2.0.3'
    gem 'guard-rspec'
    gem 'rmagick'
    gem 'carrierwave'
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    ansi (1.4.3)
    arel (3.0.2)
    builder (3.0.4)
    capybara (2.0.3)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 1.0.0)
    carrierwave (0.8.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
    childprocess (0.3.9)
      ffi (~> 1.0, >= 1.0.11)
    coderay (1.0.9)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.2)
    diff-lcs (1.2.4)
    erubis (2.7.0)
    execjs (1.4.0)
      multi_json (~> 1.0)
    ffi (1.8.1)
    formatador (0.2.4)
    guard (1.8.0)
      formatador (>= 0.2.4)
      listen (>= 1.0.0)
      lumberjack (>= 1.0.2)
      pry (>= 0.9.10)
      thor (>= 0.14.6)
    guard-rspec (2.6.0)
      guard (>= 1.8)
      rspec (~> 2.13)
    hike (1.2.2)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.2.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.7.7)
    listen (1.0.3)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
      rb-kqueue (>= 0.2)
    lumberjack (1.0.3)
    mail (2.5.3)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.1)
    mime-types (1.23)
    multi_json (1.7.2)
    nokogiri (1.5.9)
    polyglot (0.3.3)
    pry (0.9.12.1)
      coderay (~> 1.0.5)
      method_source (~> 0.8)
      slop (~> 3.4)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.0.4)
    rb-fsevent (0.9.3)
    rb-inotify (0.9.0)
      ffi (>= 0.5.0)
    rb-kqueue (0.2.0)
      ffi (>= 0.5.0)
    rdoc (3.12.2)
      json (~> 1.4)
    rmagick (2.13.2)
    rspec (2.13.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rspec-core (2.13.1)
    rspec-expectations (2.13.0)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.13.1)
    rspec-rails (2.13.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rubyzip (0.9.9)
    sass (3.2.8)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.32.1)
      childprocess (>= 0.2.5)
      multi_json (~> 1.0)
      rubyzip
      websocket (~> 1.0.4)
    slop (3.4.4)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.7)
    thor (0.18.1)
    tilt (1.4.0)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    turn (0.8.2)
      ansi (>= 1.2.2)
    tzinfo (0.3.37)
    uglifier (2.0.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    websocket (1.0.7)
    xpath (1.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  capybara (~> 2.0.3)
  carrierwave
  coffee-rails (~> 3.2.1)
  guard-rspec
  jquery-rails
  json
  rails (= 3.2.13)
  rmagick
  rspec
  rspec-rails
  sass-rails (~> 3.2.3)
  sqlite3
  turn (< 0.8.3)
  uglifier (>= 1.0.3)

Guardfile

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'rspec' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }

  # Capybara features specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/features/#{m[1]}_spec.rb" }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
@thibaudgg
Owner

hmm, try to comment gem 'turn', '< 0.8.3' in your Gemfile and re-run bundle install.

@carlsonjf

indeed. turn seems to have been the problem for my config. Thanks for your insights and your help!

@thibaudgg
Owner

@carlsonjf nice to hear that. You're welcome!

@hakunin

For anyone stumbling on this one, for me the it disappeared when I removed test-unit gem.

@dchersey

Having the same issue with a brand-new rails app ... I've checked all the comments above and no luck.

Running spec 3.17, guard 2.11.1.
No test-unit anywhere in my Gemfile or Gemfile.lock
No test folder.

Guardfile:

guard :rspec, cmd: 'bundle exec rspec' do
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^spec/.+spec.rb$})
watch(%r{^app/(.+).rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(.erb|.haml|.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^lib/(.+).rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)
(controller).rb$}) { |m| ["spec/routing/#{m[1]}routing_spec.rb", "spec/#{m[2]}s/#{m[1]}#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/factories/(.+).rb$}) { "spec/models" }
end

Debug output:

bundle exec guard --debug
15:47:33 - DEBUG - Notiffany: gntp not available (Please add "gem 'ruby_gntp'" to your Gemfile and run your app with "bundle exec".).
15:47:33 - DEBUG - Notiffany: growl not available (Please add "gem 'growl'" to your Gemfile and run your app with "bundle exec".).
15:47:33 - DEBUG - Command execution: emacsclient --eval '1'
15:47:33 - DEBUG - Notiffany: emacs not available (Emacs client failed).
15:47:33 - DEBUG - Notiffany: tmux not available (:tmux notifier is only available inside a TMux session.).
15:47:33 - DEBUG - Notiffany: file not available (No :path option given).
15:47:33 - DEBUG - Notiffany is using TerminalNotifier to send notifications.
15:47:33 - DEBUG - Notiffany is using TerminalTitle to send notifications.
15:47:33 - DEBUG - Command execution: hash stty
15:47:33 - DEBUG - Guard starts all plugins
15:47:33 - DEBUG - Hook :start_begin executed for Guard::RSpec
15:47:33 - INFO - Guard::RSpec is running
15:47:33 - DEBUG - Hook :start_end executed for Guard::RSpec
15:47:33 - INFO - Guard is now watching at '/Users/david/projects/hugatroll'
15:47:33 - DEBUG - Start interactor
15:47:33 - DEBUG - Command execution: stty -g 2>/dev/null

Frame number: 0/1
[1] guard(main)>
15:47:35 - DEBUG - Interactor was stopped or killed
15:47:35 - DEBUG - Command execution: stty 2>/dev/null
15:47:35 - INFO - Run all
15:47:35 - DEBUG - Hook :run_all_begin executed for Guard::RSpec
15:47:35 - INFO - Running all specs
15:47:35 - DEBUG - Command execution: bundle exec rspec -f progress -r /Users/david/.rvm/gems/ruby-2.1.2/gems/guard-rspec-4.5.0/lib/guard/rspec_formatter.rb -f Guard::RSpecFormatter --failure-exit-code 2 spec
Resque::Helpers will be gone with no replacement in Resque 2.0.0.
......................

Finished in 0.25952 seconds (files took 2.79 seconds to load)
22 examples, 0 failures

invalid option: -f

minitest options:
-h, --help Display this help.
-s, --seed SEED Sets random seed. Also via env. Eg: SEED=n rake
-v, --verbose Verbose. Show progress processing files.
-n, --name PATTERN Filter run on /pattern/ or string.

Known extensions: guard_minitest, pride
-p, --pride Pride. Show your testing pride!

15:47:39 - DEBUG - Start interactor
15:47:39 - DEBUG - Command execution: stty -g 2>/dev/null

Frame number: 0/1
[1] guard(main)>

Note that this does not cause the error when a spec fails; only when all of them pass.

Any thoughts would be most welcome!

David

@e2
Owner
e2 commented

@dchersey (and anyone else still having this issue), see:
#308

Basically, minitest could be "creeping in" through an included Rails file.

@dchersey

I checked the discussion in #308 and it sent me in the direction of looking for minitest in my Gemfile.lock

I don't have any refs to test/unit or minitest in my code or Gemfile, but my Gemfile.lock shows
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)

Seems like Rails 4.2 pulls it in.

Before I try patching autorun, can anyone comment on whether there needs to be another solution in the guard codebase?

@e2
Owner
e2 commented

@dchersey - guard can't do anything here, because minitest autorun creates an 'at_exit' hook. (minitest is setting itself up using pure Ruby, not Guard).

Instead, rename the minitest file being load (minitest/autorun probably) - just so things blow up and then see where it's included from. Or you can put a 'fail' statement in the file. Then paste a stack trace so we can work out how to fix this.

@dchersey

Hmmm. I put the following code in minitest.rb:

def self.autorun
    at_exit {
      puts Thread.current.backtrace.join("\n")
      next if $! and not ($!.kind_of? SystemExit and $!.success?)

      exit_code = nil

      at_exit {
        @@after_run.reverse_each(&:call)
        exit exit_code || false
      }

      exit_code = Minitest.run ARGV
    } unless @@installed_at_exit
    @@installed_at_exit = true
  end

Unfortunately, the full stack trace seems to be:
/Users/david/.rvm/gems/ruby-2.1.2/gems/minitest-5.5.1/lib/minitest.rb:47:in backtrace'
/Users/david/.rvm/gems/ruby-2.1.2/gems/minitest-5.5.1/lib/minitest.rb:47:in
block in autorun'

I tried looking at this with show-stack in pry, and also just adding 'fail' -- same result.

Looking at the error message (-f is invalid) and the debug output I can see what is happening -- rspec is being passed -f progress as part of the execution of the cmd: parameter.

This gets captured in ARGV as

 ["-f",
 "progress",
 "-r",
 "/Users/david/.rvm/gems/ruby-2.1.2/gems/guard-rspec-4.5.0/lib/guard/rspec_formatter.rb",
 "-f",
 "Guard::RSpecFormatter",
 "--failure-exit-code",
 "2",
 "spec"]

and when minitest executes itself as part of the at_exit block, it doesn't like the -f.

Can we simply avoid passing the ARGV intended for rspec to minitest? Perhaps clear it?

@e2
Owner
e2 commented

@dchersey - no, you need to put debugging in the beginning of 'minitest/autorun.rb' (or rename that file) - to see which file is including it. (it's requiring 'minitest/autorun.rb' that is installing the at_exit callback).

Can we simply avoid passing the ARGV intended for rspec to minitest? Perhaps clear it?

This is happening at Ruby-level. It's beyond the control of guard. E.g. if you create a file hello.rb with JUST the following (no Guard, etc.):

require 'minitest/autorun'

Running it will run the tests:

$ ruby hello.rb
Run options: --seed 39267
# Running:
Finished in 0.000769s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
@dchersey

DOH

apparently the rails 4.2 generator puts require minitest/autorun in config/application.rb.

removing it solved this ... so simple in retrospect. Thanks for your help, and hope this helps others spot the obvious.

@e2
Owner
e2 commented

@dchersey - thanks, good to know!

@morgler morgler referenced this issue in rebelidealist/stripe-ruby-mock
Open

Weird server issues when specs run #10

@kleinjm

I'm having the same problem and I read this entire thread and tried everything. Please help.

  • I have no test directory, only spec
  • Not using minitest or test-unit or turn or any other gems mentioned in this thread that may be causing the problem.

Output upon saving any spec:

23:03:52 - INFO - Running: spec/requests/users_spec.rb
.

Finished in 2.03 seconds (files took 4.61 seconds to load)
1 example, 0 failures

invalid option: -f
Test::Unit automatic runner.
Usage: /Users/james/.rvm/gems/ruby-1.9.3-p448/bin/rspec [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        --collector=COLLECTOR        Use the given COLLECTOR.
                                     (de[scendant], di[r], l[oad], o[bject]_space)
    -n, --name=NAME                  Runs tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
        --ignore-name=NAME           Ignores tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
        --ignore-testcase=TESTCASE   Ignores tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
        --location=LOCATION          Runs tests that defined in LOCATION.
                                     LOCATION is one of PATH:LINE, PATH or LINE
        --attribute=EXPRESSION       Runs tests that matches EXPRESSION.
                                     EXPRESSION is evaluated as Ruby's expression.
                                     Test attribute name can be used with no receiver in EXPRESSION.
                                     EXPRESSION examples:
                                       !slow
                                       tag == 'important' and !slow
        --[no-]priority-mode         Runs some tests based on their priority.
        --default-priority=PRIORITY  Uses PRIORITY as default priority
                                     (h[igh], i[mportant], l[ow], m[ust], ne[ver], no[rmal])
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
        --color-scheme=SCHEME        Use SCHEME as color scheme.
                                     (d[efault])
        --config=FILE                Use YAML fomat FILE content as configuration file.
        --order=ORDER                Run tests in a test case in ORDER order.
                                     (a[lphabetic], d[efined], r[andom])
        --max-diff-target-string-size=SIZE
                                     Shows diff if both expected result string size and actual result string size are less than or equal SIZE in bytes.
                                     (1000)
    -v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                     (important-only, n[ormal], p[rogress], s[ilent], v[erbose])
        --[no-]use-color=[auto]      Uses color output
                                     (default is auto)
        --progress-row-max=MAX       Uses MAX as max terminal width for progress mark
                                     (default is auto)
        --no-show-detail-immediately Shows not passed test details immediately.
                                     (default is yes)
        --output-file-descriptor=FD  Outputs to file descriptor FD
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).

Guardfile

guard :rspec, cmd: "bundle exec rspec" do
  require "guard/rspec/dsl"
  dsl = Guard::RSpec::Dsl.new(self)

  # Feel free to open issues for suggestions and improvements

  # RSpec files
  rspec = dsl.rspec
  watch(rspec.spec_helper) { rspec.spec_dir }
  watch(rspec.spec_support) { rspec.spec_dir }
  watch(rspec.spec_files)

  # Ruby files
  ruby = dsl.ruby
  dsl.watch_spec_files_for(ruby.lib_files)

  # Rails files
  rails = dsl.rails(view_extensions: %w(erb haml slim))
  dsl.watch_spec_files_for(rails.app_files)
  dsl.watch_spec_files_for(rails.views)

  watch(rails.controllers) do |m|
    [
      rspec.spec.("routing/#{m[1]}_routing"),
      rspec.spec.("controllers/#{m[1]}_controller"),
      rspec.spec.("acceptance/#{m[1]}")
    ]
  end

  # Rails config changes
  watch(rails.spec_helper)     { rspec.spec_dir }
  watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
  watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }

  # Capybara features specs
  watch(rails.view_dirs)     { |m| rspec.spec.("features/#{m[1]}") }
  watch(rails.layouts)       { |m| rspec.spec.("features/#{m[1]}") }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
  end
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.18)
      actionpack (= 3.2.18)
      mail (~> 2.5.4)
    actionpack (3.2.18)
      activemodel (= 3.2.18)
      activesupport (= 3.2.18)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.18)
      activesupport (= 3.2.18)
      builder (~> 3.0.0)
    activerecord (3.2.18)
      activemodel (= 3.2.18)
      activesupport (= 3.2.18)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.18)
      activemodel (= 3.2.18)
      activesupport (= 3.2.18)
    activesupport (3.2.18)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    arel (3.0.3)
    aws_cf_signer (0.1.3)
    bcrypt (3.1.10)
    best_in_place (3.0.3)
      actionpack (>= 3.2)
      railties (>= 3.2)
    better_errors (1.1.0)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.1.1.1)
      sass (~> 3.2)
    bootstrap-typeahead-rails (0.9.3.3)
      railties (>= 3.0)
    builder (3.0.4)
    carrierwave (0.10.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)
    celluloid (0.16.0)
      timers (~> 4.0.0)
    cloudinary (1.0.79)
      aws_cf_signer
      rest-client
    cocoon (1.2.6)
    coderay (1.1.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.9.1.1)
    debug_inspector (0.0.2)
    devise (3.2.4)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    domain_name (0.5.24)
      unf (>= 0.0.5, < 1.0.0)
    erubis (2.7.0)
    execjs (2.5.2)
    factory_girl (4.5.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.5.0)
      factory_girl (~> 4.5.0)
      railties (>= 3.0.0)
    faker (1.4.3)
      i18n (~> 0.5)
    ffi (1.9.8)
    figaro (1.1.0)
      thor (~> 0.14)
    formatador (0.2.5)
    guard (2.12.6)
      formatador (>= 0.2.4)
      listen (~> 2.7)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-rspec (4.5.2)
      guard (~> 2.1)
      guard-compat (~> 1.1)
      rspec (>= 2.99.0, < 4.0)
    guard-test (2.0.6)
      guard-compat (~> 1.2)
      test-unit (~> 3.0)
    haml (4.1.0.beta.1)
      tilt
    hike (1.2.3)
    hitimes (1.2.2)
    http-cookie (1.0.2)
      domain_name (~> 0.5)
    i18n (0.7.0)
    ice_cube (0.9.3)
    journey (1.0.4)
    jquery-rails (3.1.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    listen (2.10.0)
      celluloid (~> 0.16.0)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    lumberjack (1.0.9)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.2)
    mime-types (1.25.1)
    multi_json (1.11.1)
    nenv (0.2.0)
    netrc (0.10.3)
    notiffany (0.0.6)
      nenv (~> 0.1)
      shellany (~> 0.0)
    orm_adapter (0.5.0)
    pg (0.17.1)
    polyamorous (0.5.0)
      activerecord (~> 3.0)
    polyglot (0.3.5)
    power_assert (0.2.3)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (3.2.18)
      actionmailer (= 3.2.18)
      actionpack (= 3.2.18)
      activerecord (= 3.2.18)
      activeresource (= 3.2.18)
      activesupport (= 3.2.18)
      bundler (~> 1.0)
      railties (= 3.2.18)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.4)
    rails_stdout_logging (0.0.3)
    railties (3.2.18)
      actionpack (= 3.2.18)
      activesupport (= 3.2.18)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.4.2)
    rb-fsevent (0.9.5)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rdoc (3.12.2)
      json (~> 1.4)
    rest-client (1.8.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 3.0)
      netrc (~> 0.7)
    rspec (3.3.0)
      rspec-core (~> 3.3.0)
      rspec-expectations (~> 3.3.0)
      rspec-mocks (~> 3.3.0)
    rspec-core (3.3.0)
      rspec-support (~> 3.3.0)
    rspec-expectations (3.3.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.3.0)
    rspec-mocks (3.3.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.3.0)
    rspec-rails (3.3.0)
      actionpack (>= 3.0, < 4.3)
      activesupport (>= 3.0, < 4.3)
      railties (>= 3.0, < 4.3)
      rspec-core (~> 3.3.0)
      rspec-expectations (~> 3.3.0)
      rspec-mocks (~> 3.3.0)
      rspec-support (~> 3.3.0)
    rspec-support (3.3.0)
    sass (3.2.13)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    shellany (0.0.1)
    simple_form (2.1.2)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    slop (3.6.0)
    sprockets (2.2.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    squeel (1.0.16)
      activerecord (~> 3.0)
      activesupport (~> 3.0)
      polyamorous (~> 0.5.0)
    test-unit (3.1.2)
      power_assert
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    timers (4.0.1)
      hitimes
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    twitter-typeahead-rails (0.10.5)
      actionpack (>= 3.1)
      jquery-rails
      railties (>= 3.1)
    tzinfo (0.3.44)
    uglifier (2.7.1)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.1)
    warden (1.2.3)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  best_in_place (~> 3.0.1)
  better_errors (~> 1.1.0)
  binding_of_caller (~> 0.7.2)
  bootstrap-sass (~> 3.1.1.1)
  bootstrap-typeahead-rails (= 0.9.3.3)
  carrierwave (= 0.10.0)
  cloudinary (= 1.0.79)
  cocoon (~> 1.2.6)
  coffee-rails (~> 3.2.1)
  devise (~> 3.2.4)
  factory_girl_rails (~> 4.5.0)
  faker (= 1.4.3)
  figaro (= 1.1.0)
  guard (~> 2.12.6)
  guard-rspec (~> 4.5.2)
  guard-test (~> 2.0.6)
  haml (~> 4.1.0.beta.1)
  ice_cube (= 0.9.3)
  jquery-rails (~> 3.1.1)
  pg (~> 0.17.1)
  rails (= 3.2.18)
  rails_12factor (~> 0.0.2)
  rspec-rails (~> 3.0)
  sass (= 3.2.13)
  sass-rails (~> 3.2.3)
  simple_form (~> 2.1.1)
  squeel (= 1.0.16)
  twitter-typeahead-rails (= 0.10.5)
  uglifier (>= 1.0.3)

BUNDLED WITH
   1.10.3

.rspec file

--color
--require spec_helper
@e2
Owner
e2 commented

@kleinjm - remove guard-test from your Gemfile and try again.

@kleinjm

Wow I didn't even realize that was still there after removing the test directory.
All fixed. Thanks for the fast reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.