<a href="http://docs.jquery.com/QUnit">QUnit</a> adapter for <a href="https://github.com/caolan/nodeunit">nodeunit</a>
Run all your QUnit tests natively in
node.js using nodeunit!
Install the module with:
npm install qunit2node.
Create a new file where you concat
lib/qunit2node.js on top and your QUnit file right after and you are done!
qunit2node provides the boolean
NODE variable that can help you make your QUnit tests run on both environments (web and node.js). So if you are testing a library that can be reached on a certain namespace in the web, say
ss.ready, then you'd want to do something like;
// my QUnit test fileif NODEvar ss =ready: require'../path/to/lib/ready.js';;test'basic test'okssreadyloaded 'Our library is loaded';;
In case testing goes haywire, a
DEBUG variable exists which you can set to boolean
true and view in a very verbose way, what is going on when your QUnit test runs on nodeunit.
qunit2node supports the majority of the QUnit API.
test()function. In this version the typical
test(name, test)is only supported.
module()declarations are supported in full as well along with
expect()and async testing:
qunit2node does not support:
QUnit.reset()as they have no meaningfull interpretetion to nodeunit
asyncTest()cmon, grow up and use
A plain and straightforward example can be viewed in this repo's test/ folder.
Copyright (c) 2012 Thanasis Polychronakis Licensed under the MIT license.