Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Javascript errors being swallowed? #19

mcmire opened this Issue Jun 19, 2011 · 5 comments


None yet
2 participants

mcmire commented Jun 19, 2011

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...


johnbintz commented Jun 19, 2011

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.

mcmire commented Jun 19, 2011

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: https://github.com/mcmire/jhw-issue-19. 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).

mcmire commented Jun 19, 2011

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:

window.foo = 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?


johnbintz commented Jun 19, 2011

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

mcmire commented Jun 19, 2011

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

@johnbintz johnbintz closed this Jun 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment