31 lines
731 B
JavaScript
Executable File
31 lines
731 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
|
|
// Try to find a local install
|
|
var dir = path.resolve(process.cwd(), 'node_modules', 'karma', 'lib');
|
|
|
|
// Check if the local install exists else we use the install we are in
|
|
if (!fs.existsSync(dir)) {
|
|
dir = path.join('..', 'lib');
|
|
}
|
|
|
|
var cli = require(path.join(dir, 'cli'));
|
|
var config = cli.process();
|
|
|
|
switch (config.cmd) {
|
|
case 'start':
|
|
require(path.join(dir, 'server')).start(config);
|
|
break;
|
|
case 'run':
|
|
require(path.join(dir, 'runner')).run(config);
|
|
break;
|
|
case 'init':
|
|
require(path.join(dir, 'init')).init(config);
|
|
break;
|
|
case 'completion':
|
|
require(path.join(dir, 'completion')).completion(config);
|
|
break;
|
|
}
|