semaperepelitsa / spork-minitest

MiniTest runner for Spork
MIT License
13 stars 25 forks source link

Test output appears in Spork terminal #9

Closed mmueller closed 11 years ago

mmueller commented 11 years ago

When I run testdrb, the output in the terminal is:

No examples found.

Finished in 0.00139 seconds
0 examples, 0 failures

Meanwhile the Spork terminal contains the actual test output:

Running tests with args ["-Itest/", "test/integration/admin/user_test.rb"]...
Run options: --seed 28261

# Running tests:

.....

Finished tests in 2.391578s, 2.0907 tests/s, 3.3451 assertions/s.

5 tests, 8 assertions, 0 failures, 0 errors, 0 skips
Done.

Am I doing it wrong or is this a minitest issue? Note that my rspec test output appears in the correct terminal, this only happens for my minitest tests.

Thanks!

semaperepelitsa commented 11 years ago

What versions of spork and spork-minitest are you running? Can you give me the commands you are using to start spork and run the tests? Try these: bundle exec spork minitest and bundle exec testdrb test/foo_test.rb

mmueller commented 11 years ago

Versions: spork 1.0.0rc3, spork-rails 3.2.0, spork-minitest from git (c3db9e8f8089)

I'm running bundle exec spork and SPORK_PORT=8989 bundle exec testdrb -Itest/ test/integration/**/*_test.rb

When I run spork with the minitest argument, as you suggest, the testdrb command doesn't accept the -I option anymore and without it, fails with a LoadError on my test_helper.rb file.

Thanks for your help on this.

semaperepelitsa commented 11 years ago

When you run Spork server without an argument it tries to guess the test framework. It seems like you also have a spec directory for RSpec so Spork boots an RSpec server. Due to how MiniTest works, the tests run automatically when required so you see them in Spork server output accidentally.

Yes, testdrb does not support -I option. (In fact it does not have any own options at all.) It is hardcoded to include "test" directory to the load path so you can omit -Itest.

mmueller commented 11 years ago

Ok, that makes sense. However, the LoadError seems to indicate that the hard-coded "test" include isn't working?

$ bundle exec testdrb test/integration/**/*_test.rb
Exception encountered: #<LoadError: cannot load such file -- test_helper>
semaperepelitsa commented 11 years ago

Oh, sorry, you are using the latest 1.0 beta. It does not add "test" to load path anymore. Can you try putting $LOAD_PATH << "test" at the very top of your test helper?

mmueller commented 11 years ago

Ah, I see. testdrb looks for test_helper.rb and requires it manually. I removed the require line from my foo_test.rb files and now the tests run fine. (And the output is in the terminal where I ran the test!)

Thanks!

semaperepelitsa commented 11 years ago

That works too, if you are not running tests manually outside spork.

zenspider commented 11 years ago

@mmueller you should also note that your backtrace on SO shows that you're running test/unit, not minitest.