testdouble / jasmine-rails

A Jasmine runner for rails projects that's got you covered in both the terminal and the browser
http://rubygems.org/gems/jasmine-rails
MIT License
378 stars 154 forks source link

SPEC=spec/individual/test.js.coffee not working #142

Closed jhaber1 closed 9 years ago

jhaber1 commented 10 years ago

Just implemented Jasmine into our Rails application, opting for this gem over Pivotal's due to out-of-the-box Coffeescript support, and when running rake spec:javascript, all tests run and everything's good. However SPEC=test does not appear to work.

I've tried the following:

rake spec:javascript SPEC=spec/javascripts/new_spec.js.coffee

rake spec:javascript SPEC='spec/javascripts/new_spec.js.coffee'

and both give the following output:

Running `"/usr/local/bin/phantomjs" "/usr/local/rvm/gems/ruby-2.1.2/gems/jasmine-rails-0.10.0/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/Users/jhaber/git/the_rails_app/tmp/jasmine/runner.html?spec=spec/javascripts/new_spec.js.coffee"`

Running: /Users/jhaber/git/the_rails_app/tmp/jasmine/runner.html?spec=spec/javascripts/new_spec.js.coffee
Starting...

Finished
-----------------
16 specs, 16 skipped or pending, 0 failures in 0.009s.

...when only 8 should run (2 files total, 8 specs each). In the other file, I even broke a spec on purpose and even though through the CL it said all 16 tests pass, opening up Jasmine in a browser shows that the spec (which wasn't passed in to run through SPEC=) had an error so it definitely was running the entire suite.

As an aside, we'd like to get this integrated with our 3rd party CI service CircleCI (https://circleci.com) to allow for parallel tests, and they use the ability to pass in specific spec files to run to achive this.

Anyone run into similar issues? Am I just doing something boneheaded?

Running Ruby 2.1.2, Rails 3.2.19, jasmine-rails 0.10.0, jasmine-core 2.0.1 ... thanks in advance for any reply!

searls commented 10 years ago

First, to directly respond to your issue:

  1. I don't believe I wrote the spec_filter stuff, I've never used it, and I'm not sure how it works.
  2. Reading your output: "16 specs, 16 skipped " tells me that your filter didn't match any specs, not both of them. So I would say the filter is probably working, but how you are identifying the specs you want to run is not.

I just read Runner#get_spec_runner and it looks like SPEC is just passed as a query param ?spec=foo, so my guess is that giving it the full file path will not match anything. It probably needs to be the name of a describe or an it or something else that jasmine actually knows about

searls commented 10 years ago

Another comment: I'd recommend using something like jasmine-only so you can it.only or describe.only to narrow what tests run. I think this only works on jasmine 1.x. not sure if similar is out for jasmine 2

larsklevan commented 9 years ago

Try this:

rake spec:javascript SPEC=new
jhaber1 commented 9 years ago

Forgot I had this open...going to close it. No longer a relevant problem. Thanks for the input though!