Skip to content

Commit

Permalink
feat(es2017): output es2017 code (#1518)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: changed TypeScript output target from es5 to es2017. This requires a NodeJS runtime of version 8 or higher.
  • Loading branch information
simondel committed May 17, 2019
1 parent 95d6054 commit e85561e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion e2e/test/angular-project/e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"node"
]
}
}
}
25 changes: 17 additions & 8 deletions packages/karma-runner/src/StrykerReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ export interface KarmaSpec {

/**
* This is a singleton implementation of a KarmaReporter.
* It is loaded by
* It is loaded by karma and functions as a bridge between the karma world and the stryker world
*
* It uses properties as functions because karma is not able to find actual methods.
*
* i.e. use `public readonly onFoo = () => {}` instead of `onFoo() { }`.
*/
export default class StrykerReporter extends EventEmitter implements karma.Reporter {

public adapters: any[] = [];

private constructor() {

super();
}

Expand All @@ -32,11 +37,11 @@ export default class StrykerReporter extends EventEmitter implements karma.Repor
return this._instance;
}

public onListening(port: number) {
public readonly onListening = (port: number) => {
this.emit('server_start', port);
}

public onSpecComplete(_browser: any, spec: KarmaSpec) {
public readonly onSpecComplete = (_browser: any, spec: KarmaSpec) => {
const name = spec.suite.reduce((name, suite) => name + suite + ' ', '') + spec.description;
let status = TestStatus.Failed;
if (spec.skipped) {
Expand All @@ -53,19 +58,23 @@ export default class StrykerReporter extends EventEmitter implements karma.Repor
this.emit('test_result', testResult);
}

public onRunComplete(runResult: karma.TestResults) {
public readonly onRunComplete = (runResult: karma.TestResults) => {
this.emit('run_complete', this.collectRunState(runResult));
}

public onBrowserComplete(_browser: any, result: { coverage: CoverageCollection | CoverageCollectionPerTest }) {
public readonly onLoadError = (...args: any[]) => {
this.emit('load_error', ...args);
}

public readonly onBrowserComplete = (_browser: any, result: { coverage: CoverageCollection | CoverageCollectionPerTest }) => {
this.emit('coverage_report', result.coverage);
}

public onBrowsersReady() {
public readonly onBrowsersReady = () => {
this.emit('browsers_ready');
}

public onBrowserError(_browser: any, error: any) {
public readonly onBrowserError = (_browser: any, error: any) => {
// Karma 2.0 has different error messages
if (error.message) {
this.emit('browser_error', error.message);
Expand All @@ -74,7 +83,7 @@ export default class StrykerReporter extends EventEmitter implements karma.Repor
}
}

public onCompileError(errors: string[]) {
public readonly onCompileError = (errors: string[]) => {
// This is called from angular cli logic
// https://github.com/angular/angular-cli/blob/012672161087a05ae5ecffbed5d1ee307ce1e0ad/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/karma.ts#L96
this.emit('compile_error', errors);
Expand Down
11 changes: 2 additions & 9 deletions tsconfig.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"composite": true,
"declarationMap": true,
"module": "commonjs",
"target": "es5",
"target": "es2017",
"noImplicitAny": true,
"moduleResolution": "node",
"rootDir": ".",
Expand All @@ -21,14 +21,7 @@
"node"
],
"lib": [
"es5",
"es2015.promise",
"es2015.collection",
"es2015.iterable",
"es2015.core",
"es2015.symbol",
"es2015.symbol.wellknown",
"es2015.proxy"
"es2017"
]
}
}

0 comments on commit e85561e

Please sign in to comment.