Uniting testing using JS Test Driver.
Navigate your console to your project folder and run command:
npm install grunt-jstestdriver
This will download the plugin to your project folder.
Then add this line to your project's `Gruntfile.js':
A basic config of jstestdriver is as follows.
jstestdriver:files: "src-test/unit/jsTestDriver.conf" "src-test/integration/jsTestDriver.conf"
Then you can add the task to your gruntfile.
Here is my sample jstd config file for this plugin.
server:basepath: ../load:- src-test/lib/jasmine-1.3.1/lib/jasmine-1.3.1/jasmine.js- src-test/lib/jasmine-adapter/src/JasmineAdapter.jstest:- src-test/jstestdriver_jstd.js
jstestdriver:options:canFail: trueverbose: truefiles: "task-test/jsTestDriver_jstd.conf" "task-test/jsTestDriver_jas.conf"
The list of JSTD .conf files that you want to test.
Extra options you want to pass to JSTD.
grunt-jstestdriver specific. If true tests are allowed to fail with stopping all tasks.
You can use most of the command file flags in the options object. https://code.google.com/p/js-test-driver/wiki/CommandLineFlags
The ones that you cannot use are:
To run tests you must start your server. Navigate your command line to your project folder.
Then run the command below to start yourJSTD server.
java -jar node_modules/grunt-jstestdriver/lib/jstestdriver.jar --port 9876
You MUST leave the shell open to keep the server alive.
Open all the browsers you wish to connect, and navigate them to:
You are now ready to run the tests.
Open a new shell and navigate to your project again.
You can then run your grunt task.
If you run into any problems and you need to reset the server, point to your jstestdriver.jar and call with the --reset option. Or you can close down your terminal window.
java -jar lib/jstestdriverjar --reset
If you just want to test that the plugin is working.
Let me now if you experience any bugs. I have not spent long on this plugin, but there was definitely a whole where people are only testing on Webkit.
Copyright (c) 2013 Ricky Clegg Licensed under the MIT license.