You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Math mutator: Don't mutate string concatenation '+' #10
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.
👍 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.
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.
Activity
simondel commentedon Apr 25, 2018
Why not? It's valid JavaScript.
DiegoRBaquero commentedon Apr 25, 2018
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.
simondel commentedon Apr 25, 2018
True, but how big of an issue is this in modern JavaScript code? Since you won't have this issue with template strings.
DiegoRBaquero commentedon Apr 25, 2018
Small, even more reason to not mutate it as template strings take over.
simondel commentedon Apr 25, 2018
👍 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.
DiegoRBaquero commentedon Apr 25, 2018
This I like
How did you mutate string concat? + to - too?
simondel commentedon Apr 26, 2018
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.