stryker-mutator / stryker-js

Mutation testing for JavaScript and friends
https://stryker-mutator.io
Apache License 2.0
2.55k stars 242 forks source link

feat(core/frameworks): add ignore plugin for Angular IO functions #4789

Open kal-rein opened 3 months ago

kal-rein commented 3 months ago

Since Angular 16 and 17 there is a new way to perform IO operations with data inside components and directives using signals with the input(), model() and output() functions. These functions are effectively a counterpart of the @Input() and @Output() decorators and thus accept a configuration object as part of their parameters.

Currently, StrykerJS doesn't place mutations inside decorators so the configuration object while performing IO with them are unaffected. But functions are mutated, so the configuration object inside them is as well leading into errors with the ivy compiler.

This PR aims to include a new ignore plugin inside the core package that can be used to avoid the mentioned problem when using the new signal functions. It can be used by including the angular ignorer inside the ignorers property in the configuration file, e.g.

{
  "ignorers": ["angular"]
}

Closes #4771

kal-rein commented 3 months ago

@nicojs should the init command include the angular ignorer into the config file if the project type is angular-cli? Right now it's not mandatory as @Input and @Output are not deprecated, so most people will continue to use that, but that might change at some point.

Also, this should be mentioned somewhere in the docs, but I'm not sure which page is more appropriate, the angular guide or the troubleshooting page. Maybe both with a different wording, so new projects are aware of when it is necessary and old projects have an easier time debugging the error.