Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Javascript errors being swallowed? #19

mcmire opened this Issue · 5 comments

2 participants

Elliot Winkler John Bintz
Elliot Winkler

Hello sir,

First off, thanks for the helpful doc page -- it was pretty easy to get this and the Guard integration set up. However I've run into some problems. I only have one Jasmine spec, with several tests in it, but every time I run this spec using the jasmine-headless-webkit executable, I get output like "PASS: 0 tests, 0 failures, 0 secs." Now, if I use the Jasmine gem to run this spec normally, I get Javascript errors -- which is totally true, some files aren't being required properly and I'm still getting everything set up. Shouldn't jasmine-headless-webkit (or the QTWebkit wrapper which I guess is actually running the tests) propagate these errors, though? Otherwise, it's pretty frustrating trying to figure out what's going on...

John Bintz

Can you post some code that should fail, and what errors should be triggered? JS errors are passed along normally...

...but perhaps there is something that is being not displayed.

Elliot Winkler

Upon further inspection, it appears that I only get the "0 tests run" message if my specs are in CoffeeScript. If I'm just using straight Javascript, I get test failures.

I've made a sample project to demonstrate this: There are two commits -- you can read the commit messages, or check out the commits and try it yourself (you'll need to use bundle exec jasmine-headless-webkit as I'm pointing to HEAD in the Gemfile).

Elliot Winkler

Okay, I went ahead and looked into it further.

There are two issues here. The first is that the code that compiles .coffee files into Javascript isn't concatenating CoffeeScript files properly -- when you have multiple CoffeeScript files, the string which results from the concatenation is invalid CoffeeScript. Using the sample project I set up, the string is this: = 42describe "foo", ->
  it "equals 1", ->

So, a simple fix would be to add either a new line or a semicolon in between each file's contents.

The second issue is that, yes, something is swallowing errors, and that something is the jasmine-headless-webkit executable (the rescue which is exiting 1). I realize you want to keep the status code, so perhaps a simple fix here would be to just print the exception details to the console?

John Bintz

Oooo, GitHub auto-links those in! Didn't know that. :) Try the latest HEAD and see if that makes a difference.

Elliot Winkler

Yup, looks like that did it, errors are showing up the console now. Thanks a bunch for the quick turnaround!

John Bintz johnbintz closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.