First of all, this project is awesome! Thanks for all the effort you are putting on it!
I was taking a look a the available mutators, and even though they cover many cases, it would be really valuable to be able to add your own custom mutators. E.g for JSX or libraries like Ramda.
These custom mutators could work like plugins imported from npm and local modules.
I would like to contribute to make this happen.
@gillchristian thanks a lot for your kind words.
It is already possible to add your custom Mutator plugin. This feature was implemented in order to mutate different languages. As of now, we have the TypescriptMutator and the ES5Mutator. However, it is not possible to add a specific mutator to the ES5Mutator for example.
What is your use case here? If you are talking about mutating a different language (i.e. JSX), i would say we already support it. If you are talking about a mutator for a specific javascript library (i.e. RamdaJS) i would say we don't support it yet.
The challenge with the latter use case is that every language produces its own abstract syntax tree (AST). So a mutator to mutate RamdaJS calls for the typescript AST is different from the mutator to mutate RamdaJS calls for javascript AST. We don't want to over complicate things, that's why we don't support that use case (yet).
@gillchristian what is your view on this? How would you want to mutate only for specific libraries?
Ohh I see. Well my thought was more like adding _specific_ cases (let's call them that) to the mutators. But as well could be adding new mutators.
I'm thinking of custom cases in mutators that make sense to the person/team using it. I mention Ramda as an example, can be anything.
Hmm ok. What kind of special cases do you want to mutate? Specific method names? Or also different things? Like i said earlier, the AST differs per language, but every language has methods for example. We could maybe standardize on common language constructs (if that makes sense)
I have a perfect scenario for this: Support for momentjs.
I don't think we want to keep ballooning the size of the default plugins, but it would be nice to be able to just configure support for momentjs isBefore isAfter, etc.
We _can_ add that to the base, but I see that becoming a maintenance and speed issue over time.
hasn't it been solved yet?
@simondel and I discussed mutation switching and we think we can go back to one AST. Once we've got that custom mutators is high on the priority list.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@simondel and I discussed mutation switching and we think we can go back to one AST. Once we've got that custom mutators is high on the priority list.