If you want to write unit tests against your JavaScript code, and you want to automate the process of running those unit tests in your CI server, then there are few options available, and one of those main options is JsTestDriver.
JsTestDriver, is a framework to write unit test for JavaScript code, and to allow you to run these unit tests inside your choice of web browser.
JsTestDriver, is a java application that runs the web browser and load JavaScript code, and unit test code inside that browser.
But, what if you already invested in another JavaScript unit test framework, like Jasmine? and wrote lots of unit test code?
Then you need to convert your unit test code to JsTestDriver.
For Jasmine, there is an adapter that will do that for you. It is called Jasmine-Jstd-adapter.
So, in order to automate your unit test code written in Jasmine, with JsTestDriver, follow these steps.

  1. Download JsTestDriver, you need the "Self-contained executable jar" from the list
  2. Download Jasmine - JsTestDriver adapter from this link
  3. JsTestDriver uses a config file to locate the JavaScript andJasmine test files. Our next step is to write the config file
The config file will look like the following:


server: http://localhost:4224

load
:
 
- src/*.js
  - src-test/*.js

serve:
 - htmlFixtures/*.html


On the server entry, we give the local host address, with a port number that is not in use.
we are going to use this number later when we initialize the JSTD.
on load entry, we specify the locations of JavaScript files, and the unit test files.
we add to these locations, the Jasmin-JSTD-adapter file location, and the Jasmine locations.
On server entry, we specify any static files, like css, html files that are going to be used by unit test.
for example, those html fixtures used in unit test. we can specify their location in the server entry of the config file.
        4. finally we write the command line that will intialize the JSTD.

java -jar jstestdriver JsTestDriver-1.2.2.jar --config --tests all --browser --port 4224

as you can find from the command line, we specify the browser by specifying the path of the browser.
So, we can choose IE, or FF, by specifying the location of it, and we can specify more that one browser, by having comma separated list of the browser locations.

finally if we added the above command line, into our build server, then our build server is able to run the unit test and dump the result to the console.
In order to give a better look for the result, we can generate reports of the unit test results.
To do that , just add the following argument on the previous command line : --testOutput , where you can specify the path for the resulting reports.
The generated reports are JUnit-compliant reports, which they are just XML.
Some CI servers like Hudson are able to read JUnit reports.