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

Add support for mutating Javascript vNext #429

Closed
5 tasks done
nicojs opened this issue Oct 20, 2017 · 8 comments · Fixed by #467
Closed
5 tasks done

Add support for mutating Javascript vNext #429

nicojs opened this issue Oct 20, 2017 · 8 comments · Fixed by #467
Assignees

Comments

@nicojs
Copy link
Member

nicojs commented Oct 20, 2017

We should add support for mutating JavaScript vNext (6, 7, etc).

This issue tracks the work done on branch stryker-es6-mutator

Todo:

  • Rewrite current es5 mutators using babel
  • Remove IdentitifiedNode
  • Rename to stryker-javascript-mutator
  • Add unit tests for mutators
  • Add deprecation warning when using the es5 mutator.

This issue is closely related to #133

@simondel simondel self-assigned this Oct 20, 2017
@simondel
Copy link
Member

@nicojs What do you think of this message?
image

@j-truax
Copy link

j-truax commented Oct 20, 2017

Just to make sure I understand what is changing....

ES5 will still be supported, just through this new module. Is this correct or are you saying you are dropping support for mutating ES5 code once this is released?

@nicojs
Copy link
Member Author

nicojs commented Oct 20, 2017

@j-truax that is correct. Since Stryker is now language agnostic we've chosen to move out the code for mutating JavaScript. This new implementation is based on babel, which can be a pretty large dependency, especially if you don't need it (for example, when mutating typescript code). So Stryker itself won't be mutating code anymore (which is a little bit ironic for a mutation testing framework). We will give people some heads-up time with this deprecation warning.

What do you think of this message?
message

How about: DEPRECATED: The es5 mutator is deprecated and will be removed in the future. Please upgrade to the stryker-javascript-mutator (npm install --save-dev stryker-javascript-mutator) and set "mutator: 'javascript'" in your stryker.conf.js!

@j-truax
Copy link

j-truax commented Oct 20, 2017

@nicojs Thanks for the clarification. Glad we are not losing ES5 support 👍

And yes that is ironic 😄 for a mutation framework.

Either message seems sufficient to me

@simondel
Copy link
Member

I've changed the message to your suggestion @nicojs 👍

@FezVrasta
Copy link

FezVrasta commented Oct 31, 2017

Is this going to support any babel plugin? (JSX, Flow, stage-2 etc?)

@simondel
Copy link
Member

@FezVrasta Not in the initial version but we plan on adding it later on. If you look at this line we don't specify any options object. In the future we could pass an options object with a plugins sections. This however won't fix everything as the stryker plugin may not know how to mutate the code.

Note that this plugin is merely for mutating the code. If the input was ES2017 code, the output will be ES2017. In order to run ES2017 code in your environment you may have to transpile it to ES5. That will be handled by a plugin like stryker-babel-transpiler which we plan on developing in the future.

Is your code open source? If not, a demo project would help us test the plugins early on 👍

@FezVrasta
Copy link

Not open source sorry, anyway it's just a create-react-app 👍

simondel added a commit that referenced this issue Nov 24, 2017
* Add stryker-javascript-mutator package that is compatible with modern JavaScript features such as arrow functions.
* Deprecate the `ES5Mutator`
* Remove `UnaryNotMutator` as it is already present in the `PrefixUnaryExpressionMutator`
* Make the `ConditionalExpressionMutator` also mutate to `true`

Fixes #429
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 a pull request may close this issue.

4 participants