Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I effectively use Jasmine to test javascript assets packaged via Jammit?
    text
    copied!<p>I have a rails app that is combining javascript assets using <a href="http://documentcloud.github.com/jammit/" rel="nofollow">Jammit</a>, and I'd like to use <a href="http://pivotal.github.com/jasmine/" rel="nofollow">Jasmine</a> for BDD-style testing of my javascript. I'm wondering if anyone has any advice on accessing the Jammit-generated 'pacakges' from within Jasmine? </p> <p>The issue is that Jasmine is configured by defining a list of JS files on disk to test, and it then includes those files within its own test runner page which is loaded and run in a browser.</p> <p>I could reference each of the individual JS files inside of the jasmine.yml config file before they're packaged with Jammit... however, Jammit is already dealing with dependencies between files for me, and, more importantly, I also need access to the compiled <a href="http://documentcloud.github.com/jammit/#jst" rel="nofollow">javascript templates</a> that Jammit produces. </p> <p>I could also manually run Jammit to generate the compiled assets first and then run Jasmine, but I'd wind up having to re-generate the assets by hand before each test run in order to test changes, which would seriously cramp a fast test-driven type workflow.</p> <p>I'm wondering if I could somehow: </p> <ul> <li>Mount the Jammit controller from within Jasmine's rack server so it could serve out the packages from Jasmine? This would basically work the same way as Jammit already does from within Rails' development env. </li> <li>Hook into Jasmine somehow to package the assets on every page load before the tests are executed? This would be slower, but would save me a step and ensure things were up to date.</li> </ul> <p>Any suggestions? I'm just getting started with this, so I could be going about it all wrong. Any advice would be greatly appreciated. :-) </p> <p>Thanks! -John </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload