1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | const configParser_1 = require("./configParser");
|
8 | const logger_1 = require("./logger");
|
9 | const runner_1 = require("./runner");
|
10 | let logger = new logger_1.Logger('runnerCli');
|
11 | process.on('message', (m) => {
|
12 | switch (m.command) {
|
13 | case 'run':
|
14 | if (!m.capabilities) {
|
15 | throw new Error('Run message missing capabilities');
|
16 | }
|
17 |
|
18 | let configParser = new configParser_1.ConfigParser();
|
19 | if (m.configFile) {
|
20 | configParser.addFileConfig(m.configFile);
|
21 | }
|
22 | if (m.additionalConfig) {
|
23 | configParser.addConfig(m.additionalConfig);
|
24 | }
|
25 | let config = configParser.getConfig();
|
26 | logger_1.Logger.set(config);
|
27 |
|
28 | config.capabilities = m.capabilities;
|
29 |
|
30 | config.specs = m.specs;
|
31 |
|
32 | let runner = new runner_1.Runner(config);
|
33 |
|
34 | runner.on('testPass', () => {
|
35 | process.send({ event: 'testPass' });
|
36 | });
|
37 | runner.on('testFail', () => {
|
38 | process.send({ event: 'testFail' });
|
39 | });
|
40 | runner.on('testsDone', (results) => {
|
41 | process.send({ event: 'testsDone', results: results });
|
42 | });
|
43 | runner.run()
|
44 | .then((exitCode) => {
|
45 | process.exit(exitCode);
|
46 | })
|
47 | .catch((err) => {
|
48 | logger.info(err.message);
|
49 | process.exit(1);
|
50 | });
|
51 | break;
|
52 | default:
|
53 | throw new Error('command ' + m.command + ' is invalid');
|
54 | }
|
55 | });
|
56 |
|
\ | No newline at end of file |