-
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
Plugin hook to filter/select AST nodes for mutation #1681
Comments
@apalaniuk you can provide some easier explanation, give a better example? I could implement this idea, but honestly, your "story" was too long for me to fully understand :x |
No problem. Allowing users to programmatically select which code is mutated would allow for more flexibility than current inline approaches (#1472) or proposed future config-based approaches. The context, since this seems to have been suggested in the past (eg. #1464, or this comment) but dropped in favour of other approaches, is that I'd like to mutate arbitrary subsets of code (eg. based on specific lines in git diffs, or based on other properties of the code), which I think can best/only be done programmatically. I won't prescribe a specific implementation, but I would think allowing users to write plugin implementations for node selection would be straightforward. I have no problem with implementing it myself, but wanted to get agreement on the approach first. |
Hi @apalaniuk and @kmdrGroch; I'm reading this paper about mutation tests, and I really appreciate if it's possible to do this! Introduce mutation tests at diff on PR's. |
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. |
Currently, entire files have mutations applied to them. #1660/#1472 will allow inline disabling of mutations, but a programmatic approach of selecting which AST nodes to forward for mutation (eg. via a plugin hook) could allow mutation testing more easily in other workflows; for instance, only applying mutations to lines in a VCS diff, which can make it more possible, in certain circumstances, to run as part of standard PRs. This could be especially true when using TypeScript (which I am).
It's trivial to do this at the file level through scripting, but this may not always be granular enough. The above example case is simplified, as there are additional complications, but externalizing it would allow the user to make those decisions, without committing to any approaches in core. As I imagine it, it could be done well in advance of mutation switching, which would also provide some benefits along the same lines, but I don't believe would obviate this approach.
In addition to some comments in the above issues/PRs, #1464 looks like it proposed something similar, so it seems there's some existing interest along these lines.
The text was updated successfully, but these errors were encountered: