Skip to content

Commit

Permalink
chore(typescript): fix imports and remove default classes (angular#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnishina committed Apr 21, 2016
1 parent ebbca6b commit a618bfd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
'use strict';

var ConfigParser = require('./configParser').ConfigParser,
TaskScheduler = require('./taskScheduler').default,
TaskScheduler = require('./taskScheduler').TaskScheduler,
helper = require('./util'),
log = require('./logger'),
q = require('q'),
TaskRunner = require('./taskRunner').default;
TaskRunner = require('./taskRunner').TaskRunner;

var logPrefix = '[launcher]';
var RUNNERS_FAILED_EXIT_CODE = 100;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var webdriver = require('selenium-webdriver'),
q = require('q'),
ConfigParser = require('./configParser').default,
ConfigParser = require('./configParser').ConfigParser,
log = require('./logger');

var PROMISE_TYPE = {
Expand Down
12 changes: 6 additions & 6 deletions lib/taskLogger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {EOL} from 'os';
import * as os from 'os';
import * as Logger from './logger';

export default class TaskLogger {
export class TaskLogger {
private buffer: string = '';
private insertTag: boolean = true;

Expand All @@ -22,9 +22,9 @@ export default class TaskLogger {
* @private
*/
private logHeader_(): void {
let output = 'PID: ' + this.pid + EOL;
let output = 'PID: ' + this.pid + os.EOL;
if (this.task.specs.length === 1) {
output += 'Specs: ' + this.task.specs.toString() + EOL + EOL;
output += 'Specs: ' + this.task.specs.toString() + os.EOL + os.EOL;
}
this.log(output);
}
Expand All @@ -35,9 +35,9 @@ export default class TaskLogger {
public flush(): void {
if (this.buffer) {
// Flush buffer if nonempty
Logger.print(EOL + '------------------------------------' + EOL);
Logger.print(os.EOL + '------------------------------------' + os.EOL);
Logger.print(this.buffer);
Logger.print(EOL);
Logger.print(os.EOL);
this.buffer = '';
}
}
Expand Down
15 changes: 7 additions & 8 deletions lib/taskRunner.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {fork} from 'child_process';
import * as child_process from 'child_process';
import {EventEmitter} from 'events';
import {defer, Promise} from 'q';
import {inherits} from 'util';
import * as q from 'q';

import {ConfigParser, Config} from './configParser';
import * as Logger from './logger';
import TaskLogger from './taskLogger';
import {TaskLogger} from './taskLogger';

export interface RunResults {
taskId: number;
Expand All @@ -16,7 +15,7 @@ export interface RunResults {
specResults: Array<any>;
}

export default class TaskRunner extends EventEmitter {
export class TaskRunner extends EventEmitter {
/**
* A runner for running a specified task (capabilities + specs).
* The TaskRunner can either run the task from the current process (via
Expand All @@ -42,7 +41,7 @@ export default class TaskRunner extends EventEmitter {
* result of the run:
* taskId, specs, capabilities, failedCount, exitCode, specResults
*/
public run(): Promise<any> {
public run(): q.Promise<any> {
let runResults: RunResults = {
taskId: this.task.taskId,
specs: this.task.specs,
Expand All @@ -54,9 +53,9 @@ export default class TaskRunner extends EventEmitter {
};

if (this.runInFork) {
let deferred = defer();
let deferred = q.defer();

let childProcess = fork(
let childProcess = child_process.fork(
__dirname + '/runnerCli.js', process.argv.slice(2),
{cwd: process.cwd(), silent: true});
let taskLogger = new TaskLogger(this.task, childProcess.pid);
Expand Down
3 changes: 1 addition & 2 deletions lib/taskScheduler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ConfigParser, Config} from './configParser';


export interface Task {
capabilities: any;
specs: Array<string>;
Expand All @@ -23,7 +22,7 @@ export class TaskQueue {
}
}

export default class TaskScheduler {
export class TaskScheduler {
taskQueues: Array<TaskQueue>;
rotationIndex: number;

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/taskScheduler_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var TaskScheduler = require('../../built/taskScheduler').default;
var ConfigParser = require('../../built/configParser').default;
var TaskScheduler = require('../../built/taskScheduler').TaskScheduler;
var ConfigParser = require('../../built/configParser').ConfigParser;

describe('the task scheduler', function() {

Expand Down

0 comments on commit a618bfd

Please sign in to comment.