jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

No specs found in CLI #527

Open mollerhoj opened 7 years ago

mollerhoj commented 7 years ago

Hi, I'm new to this gem. I tried setting it up for my project. It seems to work fine the browser, but I can't get the CLI to work. Running:

bin/rake teaspoon

returns:

Starting the Teaspoon server...
Teaspoon running default suite at http://127.0.0.1:60536/teaspoon/default

Finished in 0.00100 seconds
0 examples, 0 failures

I've tried with capybara_webkit and phantomjs. No luck

jwlms commented 5 years ago

You probably don't have the spec file named correctly. It needs to end with _spec.js.

rmm5t commented 5 years ago

I'm experiencing the same problem.

Tests work as expected in the browser:

teaspoon javascript test runner 2018-09-06 16-30-25

But don't show anything in the CLI. However, I do see console.log output in the CLI from the application, but no console output from the actual tests themselves.

Starting the Teaspoon server...
Puma starting in single mode...
* Version 3.12.0 (ruby 2.4.4-p296), codename: Llamas in Pajamas
* Min threads: 1, max threads: 1
* Environment: test
* Listening on tcp://127.0.0.1:62040
Use Ctrl-C to stop
Teaspoon running default suite at http://127.0.0.1:62040/teaspoon/default
<app console log output here>
<app console log output here>

Finished in 0.00200 seconds
0 examples, 0 failures
rmm5t commented 5 years ago

I found a workaround.

The problem (at least that I was experiencing) was that the phantomjs driver wasn't working. When running the suite with that driver, the tests weren't being found (or loaded) for some reason. I confirmed this when trying to run phantomjs manually using the phantomjs.js script that ships with teaspoon.

I switched to the selenium driver (tied to chrome), and things are working as expected now.

# teaspoon_env.rb  
  config.driver = :selenium
  config.driver_options = { client_driver: :chrome }

Starting the Teaspoon server...
Puma starting in single mode...
* Version 3.12.0 (ruby 2.4.4-p296), codename: Llamas in Pajamas
* Min threads: 1, max threads: 1
* Environment: test
* Listening on tcp://127.0.0.1:64744
Use Ctrl-C to stop
Teaspoon running default suite at http://127.0.0.1:64744/teaspoon/default
..

Finished in 0.00900 seconds
2 examples, 0 failures

Yay! 🎉

saikumar-everest commented 3 years ago

Is there anyway to fail teaspoon command with non-zero output when it finds 0 tests?

mathieujobin commented 3 years ago

@saikumar-everest not that I know of. I don't think rspec or cucumber complains about having ran no tests either, but I could be wrong.