Skip to content
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

Merged
merged 1 commit into from
Apr 5, 2017
Merged

Conversation

Ondoher
Copy link
Contributor

@Ondoher Ondoher commented Mar 2, 2017

The for..in loop was not working with mootools because mootools adds functions to the array prototype.

checking for own property

@googlebot
Copy link

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!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@Ondoher
Copy link
Contributor Author

Ondoher commented Mar 2, 2017

i signed it

@googlebot
Copy link

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.

@Ondoher
Copy link
Contributor Author

Ondoher commented Mar 2, 2017

I signed it!

@googlebot
Copy link

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

@Ondoher Ondoher Mar 21, 2017

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants