0.3.0 • Published 9 years ago
node-karma-wrapper v0.3.0
node-karma-wrapper
I'm just wrapping the the karma public API here.
Information
Usage
var karma = require('node-karma-wrapper');
// Preconfig you server
var aKarmaTestServer = karma({ configFile : './test/karma.conf.js');
// Then run once
aKarmaTestServer.simpleRun();
// Run in background
aKarmaTestServer.inBackground();
// Normal launch
aKarmaTestServer.start();
// Run the tests using the already started karma server
aKarmaTestServer.run();
Api
karma(configs)
Defines a karma server with a specific configuration (see the official api). Return a « Karma Helper Object »
« Karma Helper Object » methods
kho.start(callback)
Equivalent of karma start.
kho.run(callback)
Equivalent of karma run.
kho.inBackground(callback)
On continuous integration you can start the karma server without blocking the main process and without logging anything.
kho.simpleRun(callback)
Equivalent of karma start with the singleRun option on.
Travis CI trick
Here is a way to run specific config on Travis :
var assign = require('lodash.assign');
// TRAVIS TRICKS
function testConfig(configFile, customOptions){
var options = { configFile: configFile };
var travisOptions = process.env.TRAVIS && { browsers: [ 'Firefox', 'PhantomJS'], reporters: ['dots'] };
return assign(options, customOptions, travisOptions);
}