-
Notifications
You must be signed in to change notification settings - Fork 3
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
Math mutator: Don't mutate string concatenation '+' #10
Comments
Why not? It's valid JavaScript. |
Valid JavaScript but results in NaN. Easily caught while coding, when failing to see the expected text or by a linter. Saves many mutators when there are many concatenations -> saves time. |
True, but how big of an issue is this in modern JavaScript code? Since you won't have this issue with template strings. |
Small, even more reason to not mutate it as template strings take over. |
👍 your call. You could also keep it in to encourage devs to switch to template strings. In the case of Stryker, the only complaints we got from mutating string concatenation was from TypeScript users and we fixed that by using the TypeScript compiler together with the projects tsconfig.json to determine which code would cause a transpiler error. |
This I like
How did you mutate string concat? + to - too? |
Yes. We don't look at the types of the left or right operand in binary expressions. We simply change the plus token into a minus token. With JavaScript code, the mutant will actually get tested. With TypeScript it will first be ran though the TypeScript compiler which will (in most cases) cause an error. Mutants that cause a transpilation error are not tested and not counted in the score. |
No description provided.
The text was updated successfully, but these errors were encountered: