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

Always reports 0 tests #97

Open
ghost opened this issue Dec 18, 2013 · 4 comments
Open

Always reports 0 tests #97

ghost opened this issue Dec 18, 2013 · 4 comments

Comments

@ghost
Copy link

ghost commented Dec 18, 2013

With guard:
screenshot from 2013-12-18 17 57 06

dbonev@dbonev:~/Workspaces/project$ be guard --debug
18:34:27 - DEBUG - Command execution: which notify-send
18:34:27 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
18:34:27 - INFO - Guard is using NotifySend to send notifications.
18:34:27 - INFO - Guard is using TerminalTitle to send notifications.
18:34:27 - DEBUG - Guard starts all plugins
18:34:27 - DEBUG - Hook :start_begin executed for Guard::Minitest
18:34:27 - INFO - Guard::Minitest 2.1.3 is running, with Minitest::Unit 4.7.5!
18:34:27 - DEBUG - Hook :start_end executed for Guard::Minitest
18:34:27 - INFO - Guard is now watching at '/home/dbonev/Workspaces/project'
18:34:32 - DEBUG - Hook :run_on_additions_begin executed for Guard::Minitest
18:34:32 - INFO - Running: test/unit/some_test.rb
18:34:32 - DEBUG - Command execution: bundle exec ruby -I"test" -I"spec" -r bundler/setup -r minitest/autorun -r ./test/unit/some_test.rb -r /home/dbonev/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-minitest-2.1.3/lib/guard/minitest/runners/old_runner.rb -e "" -- 
Loaded suite -e
Started
.....

Finished in 11.375964879989624 seconds.

5 tests, 278 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

0.44 tests/s, 24.44 assertions/s
Coverage report generated for Unit Tests to /home/dbonev/Workspaces/project/coverage. 4148 / 7815 LOC (53.08%) covered.
Run options: --seed 51433

# Running tests:



Finished tests in 0.000422s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

18:34:53 - DEBUG - Hook :run_on_additions_end executed for Guard::Minitest

Without guard:

dbonev@dbonev:~/Workspaces/project$ be rake test TEST=/home/dbonev/Workspaces/project/test/unit/some_test.rb
psql:/home/dbonev/Workspaces/project/db/structure.sql:29: WARNING:  => is deprecated as an operator name
DETAIL:  This name may be disallowed altogether in future versions of PostgreSQL.
Loaded suite /home/dbonev/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader
Started
.....

Finished in 10.480250120162964 seconds.

5 tests, 278 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

0.48 tests/s, 26.53 assertions/s
Coverage report generated for Unit Tests to /home/dbonev/Workspaces/project/coverage. 4148 / 7815 LOC (53.08%) covered.

I have removed minitest-reporters from Gemfile to eliminate it as a reason.
Guardfile:

interactor :off

guard :minitest, all_on_start: false do
  # with Minitest::Unit
  watch(%r{^test/(.*)\/?test_(.*)\.rb})
  watch(%r{^test/.+_test\.rb})
  watch(%r{^lib/(.*/)?([^/]+)\.rb})     { |m| "test/#{m[1]}test_#{m[2]}.rb" }
  watch(%r{^test/test_helper\.rb})      { 'test' }

  # Rails < 4
  watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
  watch(%r{^app/helpers/(.*)\.rb})     { |m| "test/helpers/#{m[1]}_test.rb" }
  watch(%r{^app/models/(.*)\.rb})      { |m| "test/unit/#{m[1]}_test.rb" }
end
@rymai
Copy link
Member

rymai commented May 1, 2014

Hi, the tests seem to actually run well the first time and then there's another run without any tests run...

Have you tried to run the actual command run by guard-minitest?

bundle exec ruby -I"test" -I"spec" -r bundler/setup -r minitest/autorun -r ./test/unit/some_test.rb -r /home/dbonev/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-minitest-2.1.3/lib/guard/minitest/runners/old_runner.rb -e ""

@rymai rymai added bug labels May 1, 2014
@aspiers
Copy link

aspiers commented Jun 14, 2014

I see a similar thing as mentioned in #114 (comment)

@jacquescrocker
Copy link
Member

I'm seeing this error too. Whenever I change a file in lib/ it runs and reports 0 tests

is there a way to only notify when tests are actually run?

group :tests do
  guard :minitest do
    # with Minitest::Unit
    watch(%r{^test/(.*)\/?test_(.*)\.rb})
    watch(%r{^lib/(.*/)?([^/]+)\.rb})     { |m| "test/#{m[1]}test_#{m[2]}.rb" }
    watch(%r{^test/test_helper\.rb})      { 'test' }

    # with Minitest::Spec
    # watch(%r{^spec/(.*)_spec\.rb})
    # watch(%r{^lib/(.+)\.rb})         { |m| "spec/#{m[1]}_spec.rb" }
    # watch(%r{^spec/spec_helper\.rb}) { 'spec' }

    # Rails 4
    watch(%r{^app/(.+)\.rb})                               { |m| "test/#{m[1]}_test.rb" }
    watch(%r{^app/views/(.+)_mailer/.+})                   { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
    # watch(%r{^lib/(.+)\.rb})                               { |m| "test/lib/#{m[1]}_test.rb" }
    watch(%r{^test/.+_test\.rb})

  end
end

EDIT: oops: nevermind, i see the error. i commented out one lib/ rule but forgot to comment out the other

@joe-sharp
Copy link

I had the same issue until I specified the test_folder parameter which had the side effect of replacing -r minitest/autorun with -r <test file path> or in the case of running all tests it had many -r arguments with all the test paths. It seems like a slightly related issue, but maybe it will help someone else.

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

No branches or pull requests

4 participants