-
Notifications
You must be signed in to change notification settings - Fork 251
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
Specify lines to mutate #1980
Comments
Isn’t what you’re looking for more in the lines of incremental analysis? #322 |
I'm not sure. I need this to only perform mutation testing for specific lines that have been changed in a specific Pull Request. So I have list of files with corresponding lists of lines that have been changed. I want to provide that into the Stryker so it can check only specified lines of code. |
I suppose "Incremental analysis" issue implies that the feature I describe exists. |
But what if your PR changes test? |
I need to run mutation test using all PR's specs, but only mutate selected lines of specified files. I just need to check whether those lines are covered with tests. |
I'd also really like this feature. My use-case is similar to incremental analysis, but more straightforward. I'm building a IntelliJ plugin for Stryker, and I'm looking to implement a Though the problem sounds the same as incremental analysis (being able to skip mutants you know are dead), I think the end user use-case is different (being able to only check changed code vs. being able to target specific mutants for specific reasons). If there are Plugin API hooks that I could use to filter out mutants once they've been detected but before being finalised, I'd be happy to write a Plugin to take care of this feature |
One example for an end-user where specifying lines to mutate would be better than incremental analysis would be a use-case where you've got your CI build telling you that lines 23 and 55 have surviving mutants, so you checkout master and want to run just those two lines through the mutator. No need to rebuild the incremental analysis when changing branches, just specify those two lines and run |
Yes, that's exactly what I meant. This feature will be very useful for CI and scripts. |
Thanks for your feedback everyone.
We're busy with a complete overhaul of the code with #1514 . I think the plugin you want to request is similar to the |
@nicojs So, you're thinking of having a generic plugin that would allow for various forms of Mutant pre-checks (for lack of a better term off the top of my head), where you could have a pre-check for type compilation (that would be nice, being able to check for compilation errors before hitting the testRunner) or a pre-check for user excluded mutants and one for more context based filtering (for example, checking if a mutant is the dependants argument in a React Hook, or whatever else you might not want to mutate in your Domain). I think that's pretty cool, it would allow a lot of flexibility for people to write plugins to help Stryker be more suited to their particular domain. |
I've opened #2240 for a However, the check api will have no knowledge of syntax. So checking if a mutant is the dependants argument in a React Hook is probably not possible (without again parsing the file). It's probably better to exclude those mutants, see #1472. We're planning exclude functionality after the migration to mutation switching. No time line I can give at the moment unfortunately, but work is progressing. |
Thanks for the update! Is there anything I could help with? |
@vitaly-rudenko you can help by reviewing the checker API as it stands now. Would allowing you to implement a |
Yes, I'll review the PR asap. I'm not an expert in the stryker's source code though. But providing a simple API for implementing a custom checker would solve my issue, as I'm willing to create a plugin that suits my needs. Thanks! |
Adds `Checker` plugin type, to be used in #1514 (and can later be used to filter mutants in #1980). The idea is that, before mutation testing (or even before files are instrumented), we initialize the checker. It can be used as a sanity check. The `TypescriptChecker` can use this to load all files and compile once (with `--no-emit`) to make sure errors don't occur under normal circumstances. The `check` method is called one-by-one on each mutant. A checker can decide to assign any of a `CheckStatus`. If it `Passed` it proceeds to the next checker, or if it was the last checker it will be run in a test runner. If another status is assigned, it will stop processing that mutant and report it as done.
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. |
We've implemented specifying specific lines to mutate a while ago: #2751. Closing this issue. |
Is your feature request related to a problem? Please describe.
I would like to be able to specify certain lines to mutate. This is necessary to automatically test changes in pull requests.
Describe the solution you'd like
-m some/file.js:1-5;8-12,some/other/file.js:21,30-40
would mutate only1-5
,8-12
lines ofsome/file.js
, and21
,30-40
lines ofsome/other/file.js
The text was updated successfully, but these errors were encountered: