-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Does not work with Mootools #2591
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
i signed it |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I signed it! |
CLAs look good, thanks! |
Change karma.js to check for own property during for...in loop Because mootools adds functions to the array prototype, the use of for..in will get more than the array elements.
@@ -179,6 +179,10 @@ var createKarmaMiddleware = function ( | |||
var filePath = file.path | |||
var fileExt = path.extname(filePath) | |||
|
|||
if (!files.included.hasOwnProperty(i)) { | |||
continue |
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.
this continue
means the things below are skipped in this case, I don't think we want to do that.
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.
Perhaps. But let's say they added a new method called randomize to the Array prototype. I don't see any further processing you would want to do to that method. I'd think it should just be skipped.
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.
What's holding up a merge?
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 think this: https://github.com/karma-runner/karma/pull/2580/files#r104290773 is a better approach to fixing this issue
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.
My original code changed things to a forEach loop, but I thought there may be unwanted side effects or opportunities for bugs--for instance, the loop variable i
is addressed in the loop. So, I kept it simple and just continued the loop on the next item if it was not an own property.
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.
okay, but shouldn't the check then be the first thing in the loop?
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 guess that depends on style. The style here seemed to be to have all the variable declarations at the top of the block, so I added my code underneath.
None of the existing variable initializations should have a problem dealing with an undefined value, but it could break future code. I could go either way.
The for..in loop was not working with mootools because mootools adds functions to the array prototype.
checking for own property