Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

chore(typescript): migrate runnerCli to TS #3148

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export class Runner extends EventEmitter {
this.config_ = config;
if (config.v8Debug) {
// Call this private function instead of sending SIGUSR1 because Windows.
process['_debugProcess'](process.pid);
(<any>process)['_debugProcess'](process.pid);
}

if (config.nodeDebug) {
process['_debugProcess'](process.pid);
(<any>process)['_debugProcess'](process.pid);
let flow = webdriver.promise.controlFlow();

flow.execute(() => {
Expand Down
64 changes: 0 additions & 64 deletions lib/runnerCli.js

This file was deleted.

55 changes: 55 additions & 0 deletions lib/runnerCli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* This serves as the main function for starting a test run that has been
* requested by the launcher.
*/

import {ConfigParser} from './configParser';
import {Logger} from './logger2';
import {Runner} from './runner';

let logger = new Logger('runnerCli');

process.on('message', (m: any) => {
switch (m.command) {
case 'run':
if (!m.capabilities) {
throw new Error('Run message missing capabilities');
}
// Merge in config file options.
let configParser = new ConfigParser();
if (m.configFile) {
configParser.addFileConfig(m.configFile);
}
if (m.additionalConfig) {
configParser.addConfig(m.additionalConfig);
}
let config = configParser.getConfig();
Logger.set(config);

// Grab capabilities to run from launcher.
config.capabilities = m.capabilities;

// Get specs to be executed by this runner
config.specs = m.specs;

// Launch test run.
let runner = new Runner(config);

// Pipe events back to the launcher.
runner.on('testPass', () => { process.send({event: 'testPass'}); });
runner.on('testFail', () => { process.send({event: 'testFail'}); });
runner.on('testsDone', (results: any) => {
process.send({event: 'testsDone', results: results});
});

runner.run()
.then((exitCode: number) => { process.exit(exitCode); })
.catch((err: Error) => {
logger.info(err.message);
process.exit(1);
});
break;
default:
throw new Error('command ' + m.command + ' is invalid');
}
});