Most of the time, you will be using Karma directly from the command line. You can, however, call Karma programmatically from your node module. Here is the public API.
Equivalent of karma start
.
var server = require('karma').server;
server.start({port: 9876}, function(exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});
Equivalent of karma run
.
var runner = require('karma').runner;
runner.run({port: 9876}, function(exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});