alexgb / guard-konacha

Automatically run konacha tests through Guard
MIT License
31 stars 17 forks source link

#<NoMethodError: undefined method `formatters' for Konacha:Module> #17

Closed mattbeedle closed 10 years ago

mattbeedle commented 11 years ago

Hi,

I installed konacha into a new ember project and it runs absolutely fine with

bundle exec rake konacha:serve

and

bundle exec rake konacha:run

However, when I try adding guard-konacha I get this error:

08:16:29 - INFO - Starting Konacha
08:16:29 - INFO - Konacha Running: All tests
08:16:29 - INFO - Starting Konacha-Capybara session using poltergeist driver, this can take a few seconds...
DEBUG: -------------------------------
DEBUG: Ember.VERSION : 1.0.0-rc.6
DEBUG: Handlebars.VERSION : 1.0.0
DEBUG: jQuery.VERSION : 1.10.1
DEBUG: -------------------------------
DEBUG: -------------------------------
DEBUG: Ember.VERSION : 1.0.0-rc.6
DEBUG: Handlebars.VERSION : 1.0.0
DEBUG: jQuery.VERSION : 1.10.1
DEBUG: -------------------------------
Transitioned into 'index'
Transitioned into 'index'
Transitioned into 'index'
Transitioned into 'index'
08:16:32 - ERROR - #<NoMethodError: undefined method `formatters' for Konacha:Module>
08:16:32 - ERROR - Guard::Konacha failed to achieve its <start>, exception was:
> [#A60B86D60FBE] NoMethodError: undefined method `[]' for nil:NilClass
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:64:in `block in run'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:61:in `each'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:61:in `each_with_index'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:61:in `run'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:113:in `run_all'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha/runner.rb:117:in `run_all_on_start'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-konacha-0.3.1/lib/guard/konacha.rb:18:in `start'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:99:in `block in run_supervised_task'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:97:in `catch'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:97:in `run_supervised_task'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:54:in `block (2 levels) in run'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:175:in `block (3 levels) in scoped_guards'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:173:in `each'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:173:in `block (2 levels) in scoped_guards'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:172:in `catch'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:172:in `block in scoped_guards'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:170:in `each'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:170:in `scoped_guards'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:53:in `block in run'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/lumberjack-1.0.4/lib/lumberjack.rb:31:in `unit_of_work'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/runner.rb:52:in `run'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/dsl.rb:110:in `after_reevaluate_guardfile'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard/dsl.rb:82:in `reevaluate_guardfile'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/guard-1.8.1/lib/guard.rb:102:in `block in setup_listener'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/listener.rb:252:in `call'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/listener.rb:252:in `on_change'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/listener.rb:287:in `block in initialize_adapter'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/adapter.rb:252:in `call'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/adapter.rb:252:in `report_changes'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/adapter.rb:321:in `poll_changed_directories'
> [#A60B86D60FBE] /Users/hansolo/.rvm/gems/ruby-2.0.0-p247/gems/listen-1.2.2/lib/listen/adapter.rb:297:in `block in start_poller'

Here is my Guardfile

guard 'bundler' do
  watch('Gemfile')
  # Uncomment next line if Gemfile contain `gemspec' command
  # watch(/^.+\.gemspec/)
end

guard 'cucumber', change_format: 'pretty', cli: '--format pretty' do
  watch(%r{^features/.+\.feature$})
  watch(%r{^features/support/.+$})          { 'features' }
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end

guard 'migrate' do
  watch(%r{^db/migrate/(\d+).+\.rb})
  watch('db/seeds.rb')
end

require 'capybara/poltergeist'
guard :konacha, driver: :poltergeist do
  watch(%r{^app/assets/javascripts/(.*)\.js(\.coffee)?$}) { |m| "#{m[1]}_spec.js" }
  watch(%r{^spec/javascripts/.+_spec(\.js|\.js\.coffee)$})
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" }

  # 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

And my initializer:

require 'capybara/poltergeist' if defined?(Capybara)
Konacha.configure do |config|
  config.spec_dir     = "spec/javascripts"
  config.spec_matcher = /_spec\.|_test\./
  config.driver       = :poltergeist
  config.stylesheets  = %w(application)
end if defined?(Konacha)

What did I do wrong?

alexgb commented 11 years ago

I created a small rails 3.2 app with ember-rails and couldn't recreate the issue. Where do the ember related DEBUG lines come from, is this a flag you turned on somewhere?

franciscodelgadodev commented 11 years ago

something new with this issue? o.o thanks!

otobrglez commented 11 years ago

Hi guys!

I'm also having this issue. I'm using Ruby 2.0 and Rails 4.0 and Konacha with Guard.

00:16:30 - INFO - Starting Konacha
00:16:30 - INFO - Konacha Running: All tests
00:16:30 - INFO - Starting Konacha-Capybara session using poltergeist driver, this can take a few seconds...
00:16:31 - ERROR - #<NoMethodError: undefined method `formatters' for Konacha:Module>
00:16:31 - ERROR - Guard::Konacha failed to achieve its <start>, exception was:

Any ideas? Thanks!

otobrglez commented 11 years ago

I have downgraded konacha gem from 3.0.0. to 2.7.0 and it works like a charm.

gem 'konacha', github: 'jfirebaugh/konacha', tag: 'v2.7.0'
mattbeedle commented 11 years ago

This also fixes the issue for me.

alexgb commented 10 years ago

@mattbeedle and @otobrglez try giving the new Konacha 3 branch a try to see if it fixes your issue.

# Gemfile
gem 'guard-konacha', :git => 'git@github.com:alexgb/guard-konacha.git', :branch => 'konacha_3_0_compatibility'
madmaniak commented 10 years ago

@alexgb it fixed the issue for me. (Ruby2 & Rails4)

cryo28 commented 10 years ago

@alexgb konacha_3_0_compatibility branch works for me too on Konacha 3.0 and Rails 3.2.12.

alexgb commented 10 years ago

Should be fixed by a6bf737d7d2db04ce83d432b5c09fc4742e2aed5