stryker-js
stryker-js copied to clipboard
first stab at statementRemoverMutator #3913
This is a preview. Works for me because the code I am using it with is really small and primitive. I would like to get some feedback on which statements to remove, and which ones not to remove. And ofc on the general direction. I intend to work on the project with which I use stryker, and update the mutator in an as-needed basis, and also incorporate feedback here.
I would love this mutator. Stryker.NET also has it, but they call it the block statement mutator if I'm not mistaken.
It has an additional feature, which I would love. Statements are not removed when there are other mutants generated anywhere in the statement. I view that as a requirement for this mutator because it would otherwise generate many mutants of low quality.
@richardwerkman @rouke-broersma could one of you elaborate on how that works in Stryker.NET? Do you generate mutants and later decide which ones to keep, filtering out these low-quality mutants? Or did you make the "block statement" mutator "smart"?
No we have both. We call them removal mutators. Statement and block: https://stryker-mutator.io/docs/stryker-net/mutations/#removal-mutators-statement-block
It has an additional feature, which I would love. Statements are not removed when there are other mutants generated anywhere in the statement. I view that as a requirement for this mutator because it would otherwise generate many mutants of low quality.
As I understand there is no info in the mutator itself to decide on it. Ofc. it is an option to modify the calling code.
I consider that feature as an optimization. First I concentrate to get the functionality together.
No we have both. We call them removal mutators. Statement and block
@rouke-broersma do you have a way to make sure these mutants are generated when there are no other mutants generated in the (block)statement?
Not sure on the specifics of the implementation, @richardwerkman ?
The specifics of the implementation are: we don't have an implementation... I wanted to add that but so far without success. For now, we place these mutations all the time. Despite it generating some unwanted mutants.
I had some ideas like filtering the mutants after generating them. Or keeping track of context and passing a value to mutators that helps identify if a mutant has been placed in this scope already.
I've created an issue at stryker-net for this: https://github.com/stryker-mutator/stryker-net/issues/2367
I added my experiment for functioncall remover mutator here as well #3920
I have updated the snapshots, fixed eslint problems (not mine), and a couple of tests (one was not mine). Now npm run all runs okay. There are some errors in npm run e2e. I have no idea what causes them or how to fix them.
This is the point when I consider this pull request ready.
If anything else is needed for acceptance, I need guidance.
Any news with this PR? If anything should be fixed to make it acceptable, please let me know.
Anything I can do to get this pull request accepted?
Anything I can do to get this pull request accepted?
I've opened issue #4463. We should tackle it during hacktober. I think that should be implemented before we can merge this PR.