I've been trying to find an answer to this at least for the last two hours without any luck. I hope someone here might be able to help.
I'm getting this ReferenceError: Can't find variable: $
when running my Jasmine specs using the JasmineHeadlessWebkit.
The weird thing is, this only happens when I say
$ ->
game.init()
in my game.coffee
file.
I can use the $
without any problems further down game.coffee
. For example:
window.game =
init: ->
$('.gamelayer').hide()
$('#gamestartscreen').show()
This is no problem at all.
Also, the tests work okay in Chrome.
So, I'm assuming this has to do with jQuery not being loaded in time but I can't figure out why.
I have jQuery in specs/javascripts/helpers/
and in jasmine.yml
i'm mentioning the helpers
before the spec_files
and src_files
but that doesn't seem to really make a difference.
So, if anyone has any idea how I can make sure that jQuery is completely loaded when Jasmine's specs are run, I would really appreciate any help.
Also, please let me know if you need any additional information.
Thank you.