-
Notifications
You must be signed in to change notification settings - Fork 250
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
Allow mutating of decorators #5001
Comments
Hi @sanderblijlevens . Thanks for reporting this issue. We can enable this shortly. Decorators are not supported because mutating them is break in Angular projects, where Since then, we've implemented the ignore plugin type and have added an Angular specific ignore plugin earlier today (thanks @kal-rein 🙏). We can easily add ignore support for Angular decorators through this plugin. However, it will be a breaking change, so it will require a major version bump. We can do one in October or November. Do you want to pick this up @sanderblijlevens ? |
Hi @nicojs, Yes I would be happy to help but I may need some pointers. I think I found the condition that ignores all decorators in the My goal with this feature request was to allow mutating of decorators but I now see there are a lot of decorators which you don't want to mutate. The list of decorators you don't want to mutate is probably way longer than the list that you do want to mutate. (for NestJS alone I expect around the 50 decorators) So do we really want to make this a blacklist and have a ignore plugin for all de different frameworks? Maybe a whitelist makes more sense in this case? |
Why? Only Angular uses decorators AFAIK.
You can and should test your NestJS decorators, so mutating them should be fine. I would also want to mutate StrykerJS underneath uses Mutant schemata, or mutant switching. This means this: @Component({ selector: 'my-counter', template: '{{count}}' })
export class CounterComponent {
} Will be mutated like this: @Component({ selector: global.__stryker__.activeMutant === '1' ? '': 'my-counter', template: global.__stryker__.activeMutant === '2' ? '' : '{{count}}' })
export class CounterComponent {
} And this results in the error about static values:
Sure, how can I help? Your intuition is correct, remove the |
Note that the reason Angular's compiler crashes isn't because dynamic values like this aren't supported in JavaScript or TypeScript. They are. However, Angular uses its own compiler that hooks into the TS compiler and they need the values to be static. |
Is your feature request related to a problem? Please describe.
We are using strykerJS in our NestJS backend and have a lot of logic placed in decorators, for instance mapping a property from x to y. With the current version of Stryker this logic is not mutated while it would be nice to have insights in how this logic is tested.
The same problem was also described in #2415
Describe the solution you'd like
We would like the option to enable mutating decorators.
Describe alternatives you've considered
I don't see any alternatives as we are not going to change our code just for Stryker. So without this option Stryker is less valuable to us.
The text was updated successfully, but these errors were encountered: