Open atroche opened 12 years ago
What is in your jasmine.yml file?
src_files:
- "vendor/**/*.{js,coffee}"
- "lib/**/*.{js,coffee}"
- "app/**/*.{js,coffee}"
stylesheets:
- "vendor/**/*.css"
- "lib/**/*.css"
- "app/**/*.css"
helpers:
- "helpers/**/*.{js,coffee}"
spec_files:
- "**/*[Ss]pec.{js,coffee}"
src_dir:
spec_dir: spec/javascripts
I've tried changing {js,coffee} to {js,coffee,jst}, but it doesn't make a difference.
Hi folks, I'm having this issue also on jasmine-headless-webkit-0.8.4 w/jasmine-core-1.1.0 (if there are any other relevant version #s you need let me know). In response to the last comment by johnbintz, related to what atroche responded with, if I do a
bundle exec jasmine-headless-webkit -l
...I do see the (in my case) .ejs files included, so I think the jasmine.yml file is not the issue. Or more generally, inclusion of the files is not the issue...if that's what you were trying to investigate.
Also, atroche, I've converted your little hacky function to CoffeeScript, so until we've got a better solution to this here's another version for those using CS:
findTemplate = (template_name) ->
# Search through global JavaScript Templates object compiled by
# asset pipeline, and return a template with a matching name.
blank_template = -> ""
return blank_template if typeof JST is "undefined"
for key of JST
return JST[key] if key.indexOf(template_name) isnt -1
blank_template
I'm using this as a helper in Jasmine, which is better than it not working but needless to say, it'd be better if I knew what was up and could fix this in a more "solid" way.
@ddellacosta I think that you should change your
for key in JST
for
for key of JST
As that's the way to iterate over object properties in Coffeescript : )
Gotcha, thanks madtrick! I'm new to CS so still picking up the syntax...
Where should I place the function? I placed it in a helper file, but it had no effect.
Thanks.
My tests were passing in the browser-based Jasmine test runner (/specs/) but failing when in jasmine-headless-webkit. I worked out that it was because the keys in the global JST object (the compiled from JavaScript templates by Srockets) were different.
For example, in the browser the object looked like:
But in headless, it was:
I worked around this by writing a hacky little function:
Is there a better way to fix this? Am I missing something obvious?
Any help would be much appreciated.