stryker-mutator / stryker-js

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

Allow more fine grained control over excluded mutation checks with `mutator.excludedMutations` #3981

Open mcmxcdev opened 1 year ago

mcmxcdev commented 1 year ago

Summary

We use Mantine as our UI framework and it's common nowadays in frontend to use the sx prop: https://mantine.dev/styles/sx/

Unfortunately, stryker-mutator modifies this prop and counts all of them as survived mutants, even though don't care about modified styling in our unit tests.

Now its possible to turn off rules that spam much like:

 mutator: {
    excludedMutations: [
      'UnaryOperator',
      'ObjectLiteral',
      'ArrowFunction',
      'StringLiteral',
    ],
  },

But that also turns it off for useful checks, unfortunately.

What we would need is a config option that allows us to define more fine-grained when to ignore certain objects lets say. Yes, its possible with a disable statement above the respective code, but that brings a lot of noise to the project and unnecessary LOC.

Test runner config

Stryker environment

"@stryker-mutator/api": "^6.3.1",
"@stryker-mutator/core": "^6.3.1",
"@stryker-mutator/jest-runner": "^6.3.1",
"@stryker-mutator/typescript-checker": "^6.3.1",
nicojs commented 1 year ago

Would something like #3229 work for you? I had to dig, because stalebot closed it for us, but it's still very much on my mind.

mcmxcdev commented 1 year ago

Not 100% what we had in mind, but I think what you linked could work.

stale[bot] commented 4 months ago

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.