We\'ve set up a Jenkins CI server running Karma targeting PhantomJS. We\'re running our tests through Grunt. Jenkins, Grunt, and Phantom are all running correctly, and Karma
Use polling instead of sockets and absolute paths instead of relative paths in the karma.conf.js
configuration file to ensure the directory structure is being traversed correctly and the client/server connection has no external dependencies:
module.exports = function(config)
{
var absolute_root = process.cwd() + '/';
config.set
(
{
// https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files
files:
[
absolute_root + 'test/Spec/**/*.js',
absolute_root + 'js/*.js',
absolute_root + '../libs/jquery.js'
],
usePolling: true,
transports: ['xhr-polling', 'jsonp-polling'],
browsers: ['PhantomJS']
}
);
};
References
Karma is not able to run test cases on phantomJS
Karma doesn't exit properly when using public api with the finish callback
AngularJS + Socket.IO + karma not working in karma 0.8.5
Karma Runner Hangs Indefinitely