-
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
feature(instrumentor): Allow only running specific mutants #2751
feature(instrumentor): Allow only running specific mutants #2751
Conversation
…obbing patterns and put them into mutator description
…ame. Add a specific mutant e2e test. Add an input-resolver unit test to strip mutants
…added unit test for options-validator
…nd use glob expressions. Added more tests to the babel-transformer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've started a review at my own risk (since you're still busy with it) and got some remarks. Mainly I think file.js:5:0:20:0
should mutate line 5 up and including line 20. So you declare a range of mutants. I think the way you see it is that it will only mutate that specific mutant itself.
It's fine, I was thinking of doing the
Only mutating the specific mutant defined and not any inclusive mutants is what I laid out in the issue and was what I thought would be good here. What's the advantage of having an inclusive range rather than a specific match? As long as I can have some way to define specific non-inclusive mutant ranges then I'm not bothered. I can move that functionality to |
…rom specific mutants to mutant range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Garethp I've taken a more in-depth look.
Sorry for the delay 😔, There is a lot of stuff on my plate and I sometimes need a trigger, so feel free to do that any time on Slack (as you now did).
I could also pick up the remarks in this PR. I have some time this week, I planned an open-source day this Friday and will have some time in this weekend as well.
…the options validator and the parsing purely into the input-file-resolver
I've gone ahead and moved the parsing to happen only in the We'd have to not I think it's a great idea, I'm just not sure how you want to approach it |
Exactly right. We should have tests for all those cases you're describing, make sure our code works, then we can introduce the performance enhancement and see if the tests still pass. The performance enhancement doesn't have an observable output, but that's fine, as long as the tests still pass, nothing broke 🤷♂️. That's enough for me. It would result in equivalent mutants, which is why I wouldn't go for 100% mutation score. I actually found a bug... I think: path.node.loc!.start.line >= mutant.start.line &&
path.node.loc!.start.column >= mutant.start.column &&
path.node.loc!.end.line <= mutant.end.line &&
path.node.loc!.end.column <= mutant.end.column This would mean that a mutant from line 2, column 1, to line 2 column 2 would not fall into the range of line 1, column 0, line 100, column 0 (because of the column matches) I'll go ahead and add tests for this and fix it. As well as review your work. Thanks for the hard work and sorry again for my late responses |
Ok I think this should be it 😅. This is what I changed:
Some final thoughts:
|
Thanks for your help, the changes you made are great!
Both of these ideas are fantastic. I'll try to find some time to do that |
…format line:column-line:column
…ser to leave out column numbers
@nicojs I've updated the regex to accept the new format as well as optional columns. The documentation should also be updated to reflect it |
I've changed the implementation a bit. Now the to-line is inclusive when using |
This is a PR to accompany issue #2751. It allows you to define specific mutants through the
--mutate
flag by adding a non-inclusive range for the mutant you want to run. For example,--mutate src/index.ts:1:3:1:5
would only instrument mutants that start on line 1 column 3 and end on line 1 column 5 (non-inclusive)