Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async transpiler plugin support #433

Merged
merged 11 commits into from
Oct 24, 2017
Merged

Async transpiler plugin support #433

merged 11 commits into from
Oct 24, 2017

Conversation

sanderkoenders
Copy link
Member

@sanderkoenders sanderkoenders commented Oct 23, 2017

In order to add webpack support in Stryker, Stryker has to support async transpiler plugins.

This pull-request will:

  • Add support for asynchronous transpilers in Stryker.
  • Change Transpiler interface accordingly.
  • Change Typescript transpiler plugin accordingly.
  • Fix all tests that broke because of the changes that were made.

Copy link
Member

@nicojs nicojs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some small remarks.

@@ -24,7 +24,7 @@ export default class CoverageInstrumenterTranspiler implements Transpiler {
this.log = getLogger(CoverageInstrumenterTranspiler.name);
}

transpile(files: File[]): TranspileResult {
public async transpile(files: File[]): Promise<TranspileResult> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think async is not needed here. It is only used to mark methods in which you can use await

@@ -74,7 +74,7 @@ export default class MutantTranspiler {
}
}

private transpileMutant(mutant: TestableMutant): Promise<TranspileResult> {
private async transpileMutant(mutant: TestableMutant): Promise<TranspileResult> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed here as well

@@ -17,11 +17,11 @@ export default class TranspilerFacade implements Transpiler {
}
}

transpile(files: File[]): TranspileResult {
public async transpile(files: File[]): Promise<TranspileResult> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed here as well

Copy link
Member Author

@sanderkoenders sanderkoenders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinion requested about using async in one of the functions.

} catch (error) {
return this.errorResult(errorToString(error));
return Promise.resolve(this.errorResult(errorToString(error)));
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to leave the function async because otherwise the two return statements have to be a Promise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as it is. It looks clean in the resulting JavaScript.

@nicojs
Copy link
Member

nicojs commented Oct 24, 2017

@simondel it can be merged IMO. What commit message should we use? Strictly speaking its a breaking change, but we could also state that the transpiler api is still experimental (no one is creating stryker transpilers at the moment anyway)

@Archcry great job on this PR!

@sanderkoenders
Copy link
Member Author

👍

@simondel
Copy link
Member

@Archcry Nice job!
@nicojs I'd go with a feat for now due to the fact that it's still experimental

@nicojs nicojs merged commit 794e587 into master Oct 24, 2017
@nicojs nicojs deleted the async-transpiler branch October 24, 2017 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants