Heads Up! You're viewing the docs for v0.10, an old version of Karma. v6.4 is the newest.

Public Api

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.

karma.server #

server.start(options, [callback=process.exit]) #

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);
});

karma.runner #

runner.run(options, [callback=process.exit]) #

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);
});