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

refactor to fix lints. #5184

Merged
merged 3 commits into from
Apr 7, 2019
Merged
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
3 changes: 1 addition & 2 deletions lib/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class TaskResults {
let processFailures = this.totalProcessFailures();
this.results_.forEach((result: any) => {
let capabilities = result.capabilities;
let shortName = (capabilities.browserName) ? capabilities.browserName : '';
shortName = (capabilities.logName) ?
let shortName = (capabilities.logName) ?
cnishina marked this conversation as resolved.
Show resolved Hide resolved
capabilities.logName :
(capabilities.browserName) ? capabilities.browserName : '';
shortName += (capabilities.version) ? capabilities.version : '';
Expand Down
92 changes: 45 additions & 47 deletions lib/runnerCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,50 @@ 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');
if (m.command === '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);
});
} else {
throw new Error('command ' + m.command + ' is invalid');
}
});