Javascript errors being swallowed? #19
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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...
Can you post some code that should fail, and what errors should be triggered? JS errors are passed along normally...
https://github.com/johnbintz/jasmine-headless-webkit/blob/master/ext/jasmine-webkit-specrunner/specrunner.cpp#L214
...but perhaps there is something that is being not displayed.
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).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:
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 isexit
ing 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?Oooo, GitHub auto-links those in! Didn't know that. :) Try the latest HEAD and see if that makes a difference.
Yup, looks like that did it, errors are showing up the console now. Thanks a bunch for the quick turnaround!