node-qunit not working with nodeJS

Problem

I have installed node-qunit using npm and this appeared to work correctly.

The following script simply does nothing…no errors, no qunit output (not even failed test cases):

var testrunner = require('qunit');

testrunner.run({
code: '/Users/macuser/Documents/test-input.js',
tests: '/Users/macuser/Documents/test-cases.js'
}, function(report) {
console.log(report);
});

Problem courtesy of: Lea Hayes

Solution

Check what version of qunit you are using. I believe 0.2+ is unstable as it relies on Node 0.5+ (which is also unstable : http://www.quora.com/What-is-the-current-state-of-node-js/answer/Matt-Ranney)

See issue 31 https://github.com/kof/node-qunit/pull/31

Try installing the stable branch

npm install qunit@stable

Solution courtesy of: timrwood

View additional discussion.