jejacks0n / teaspoon

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

Fresh Rails app, latest teaspoon, phantomjs 2.0 - tests not run or detected at all #355

Closed davetron5000 closed 9 years ago

davetron5000 commented 9 years ago

See https://github.com/davetron5000/jasmine-test

Basically:

  1. Fresh rails app
  2. Add teaspoon and bower-rails to Gemfile
  3. Add jasmine '1.3.1' to Bowerfile
  4. bundle install && rake bower:install
  5. rails g teaspoon:install
  6. Add jasmine/lib/jasmine-core/jasmine to spec/javascripts/spec_helper.js
  7. Create a dummy spec in spec/javascripts/dummy_spec.js
  8. Run rake teaspoon

This definitely loads all of my files, but doesn't run any tests. 0 examples, 0 failures.

Now, if I load it up in the browser, it doesn't even load spec/javascripts/spec_helper.js at all. It somehow detects that spec/javascripts/dummy_spec.js exists, but doesn't run any tests.

I've added console.log and throw 'wtf'; in various places to prove what is/isn't being loaded.

Any ideas? I can't even figure out how to debug this. Is there some way to tell teaspoon to print debug messages about what it's doing?

davetron5000 commented 9 years ago

OK, nevermind. Turns out that you don't need to require jasmine again—somehow it's being brought in by teaspoon. And if you do require it again, everything just silently fails.

My recommendation is to use JavaScript and its ecosystem for every possible software task, because this behavior (which I blame on asset pipeline and/or jasmin—not teaspoon) is the sort of thing that'll keep us employed for decades.

Sorry for the bother.

mikepack commented 9 years ago

No bother. I like being employed :)

Teaspoon requires the framework libraries to provide a consistent experience for people at any level. For the conventional cases, Teaspoon requiring the framework makes it easier to get started, makes Teaspoon core simpler and more performant, and fails faster when things are misconfigured. I agree it would be more transparent if they were required from spec_helper, though.

:beers:

davetron5000 commented 9 years ago

Yeah, I think that call makes sense, and I have no reason for including it (again)—the instructions don't say to.

I guess it would've been nice if Jasmine had detected this and realized it was blowing away all the global state it sets up and warn me, but we can't have it all :)