Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 2d7729e

Browse files
committed
feat: support Karma 0.10
1 parent 3df4297 commit 2d7729e

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

bin/karma

+29-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,38 @@ var requireCliAndRun = function(karmaPath) {
1818
if (process.argv.indexOf('--which') !== -1) {
1919
console.log(karmaPath);
2020
} else {
21-
require(karmaPath + '/lib/cli').run();
21+
var karmaCli = require(karmaPath + '/lib/cli');
22+
23+
if (karmaCli.run) {
24+
karmaCli.run();
25+
} else {
26+
karmaCliRun(karmaCli, karmaPath);
27+
}
28+
}
29+
};
30+
31+
32+
// TODO(vojta): remove once we don't care about Karma 0.10
33+
var karmaCliRun = function(karmaCli, karmaPath) {
34+
var config = karmaCli.process();
35+
36+
switch (config.cmd) {
37+
case 'start':
38+
require(karmaPath + '/lib/server').start(config);
39+
break;
40+
case 'run':
41+
require(karmaPath + '/lib/runner').run(config);
42+
break;
43+
case 'init':
44+
require(karmaPath + '/lib/init').init(config);
45+
break;
46+
case 'completion':
47+
require(karmaPath + '/lib/completion').completion(config);
48+
break;
2249
}
2350
};
2451

52+
2553
resolve('karma', {basedir: process.cwd()}, function(err, pathToKarma) {
2654
// There is a local version, let's use it.
2755
if (!err) {

0 commit comments

Comments
 (0)