question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Omitting condition section in standard for-loop breaks stryker

See original GitHub issue

When 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.

  1. git clone https://github.com/RachelSatoyama/bugreport.git
  2. cd bugreport/stryker-for-loop && npm install
  3. npm run stryker

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nicojscommented, Oct 25, 2016

Yeah i agree with @RachelSatoyama . Could we mutate it to be for(;false;) ?

0reactions
frosascommented, Jan 17, 2017

It is. Thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found