The Grunt plugin for Jasmine(
1.3.0) tests on Saucelabs services
A few posts ago, I had written about a grunt plugin for running qunit tests on cloudified Saucelabs browsers. This is an open source that I worked on (would have loved to work on it in exchange for some Saucelabs goodies :P) to change the pouchdb build system. One of the comments to that post was by the author of the awesome IndexedDB library called db.js, and I volunteered to migrate db.js to a similar mechanism.
The tests for db.js were basically run using an node-express server. The express server basically converted the index.jade file to a HTML file that could run jasmine tests.
Since most of the code for integrating with saucelabs was the same, I decided to enhance the grunt-saucelabs-qunit plugin to include this too. As a result, I renamed (never rename a project !!) to grunt-saucelabs, a generic grunt interface to run tests on saucelabs, and moved it to a new location. I also created a new npm package, and all dependents are now using this. I will soon be deprecating the older package.
The jasmine tests are very similar to the qunit tests - the same process of setting up a tunnel to the local server, loading the pages, and waiting for an element to indicate a success or a failure. The only difference was the actual element, which was a class with name 'alert'.
Using it is very similar to using qunit tests, it takes the exact same parameters. With the Jasmine tests now running on grunt, here is how the new build system for db.js looks like. You may notice that the express servlet is gone, and grunt-jade converts the jade files to their HTML format.
For next steps, I am looking at ways to expose the actual test URLs to the grunt file tasks so that the callbacks could use those for reporting. Watch out this space for more updates on this project.