Most of the time, you will be using Karma directly from the command line.
You can, however, call Karma programmatically from your node module. This might be helpful when using Karma with Grunt for instance.
Equivalent of karma start
.
var server = require('karma').server;
server.start({port: 9877}, function(exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});
Equivalent of karma run
.
var runner = require('karma').runner;
runner.run({runnerPort: 9100}, function(exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});