I\'ve got a repository which is integrated with travis. I\'ve got QUnit tests which I\'d like to run from grunt/node server side and AMD (requirejs). This is the source of m
I am using grunt-contrib-qunit to run QUnit tests via grunt. It uses phantomjs internally.
I was getting the same error as the OP after upgrading grunt-contrib-qunit to the latest version (0.7.0):
PhantomJS timed out, possibly due to a missing QUnit start() call.
To fix this problem, I had to first load QUnit via require() and then execute QUnit.start() and define all my QUnit modules and tests after that.
The HTML file looks something like this:
QUnit + RequireJS + PhantomJS
Then the mytests.js file:
require.config({
paths: {
'qunit': 'lib/qunit/qunit/qunit'
}
});
require(['qunit'], function(QUnit) {
QUnit.start();
QUnit.module('My Module');
QUnit.test('some normal test', function(assert) {
assert.ok(true, 'can run a normal QUnit test');
});
QUnit.test('some asynchronous test', function(assert) {
var done = assert.async();
setTimeout(function() {
assert.ok(true, 'can run an asynchronous QUnit test');
done();
}, 50);
});
});