Omitting condition section in standard for-loop breaks stryker
See original GitHub issueWhen you have a code like this:
for(let i=0;;i++) {
actual behaviour stryker will fail with: [2016-10-21 17:53:14.612] [ERROR] stryker-cli - an error occurred Error: The mutator named ‘RemoveConditionals’ caused an error: TypeError: Cannot read property ‘nodeID’ of null
expected behaviour What is expected: stryker does not supposed to fail in this case. While it’s not idiomatic (and most probably could be rewritten in a more readable fashion) this is 100% valid code.
if there will be any valid expression condition expression in for loop, this will work, so it’s enought to have:
for(let i=0;true;i++) {
how to reproduce I’ve created a minimal example.
git clone https://github.com/RachelSatoyama/bugreport.git
cd bugreport/stryker-for-loop && npm install
npm run stryker
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Stryker Benefits Summary
This Stryker Benefits Summary provides information about the plan provisions and guidelines governing your healthcare, welfare and retirement ...
Read more >for - JavaScript | MDN - MDN Web Docs - Mozilla
Like the initialization block, the condition part is also optional. If you are omitting this expression, you must make sure to break the...
Read more >Inside a for-loop, should I move the break condition into the ...
The for loop is just there to specify the iterating values in the loop. Coding the breaking condition within that just muddies the...
Read more >How To Use Break, Continue, and Pass Statements when ...
The continue statement gives you the option to skip over the part of a loop where an external condition is triggered, but to...
Read more >for loop - cppreference.com
Executes init-statement once, then executes statement and iteration-expression repeatedly, until the value of condition becomes false.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah i agree with @RachelSatoyama . Could we mutate it to be
for(;false;)
?It is. Thanks!