-
Notifications
You must be signed in to change notification settings - Fork 305
Mocha examples should not use arrow functions #318
Comments
Oh interesting, I didn't know mocha used Kind of a bummer, since it makes all the tests a lot more verbose, but it is the way it is! @tmeasday something to remember. Would you mind submitting a PR? |
Yup, I ran into this today when I needed to call
Sadly I don't have enough time in my schedule to submit a PR for the Meteor Guide. You might like to consider adding a "pull-requests-wanted" label to the issue, and then in the README encourage people who'd like to contribute to check those issues. (See for example https://github.com/meteor/meteor/labels/pull-requests-encouraged ... notice how you can give someone a URL which displays all the issues with that label). |
Great idea! The guide is a great first place for people to contribute, we should definitely encourage that. |
Hi guys - I can submit a quick PR for this. Would you prefer to see anonymous functions or named functions used in the Mocha examples? In either case we'll need to adjust the eslint rules a bit - for example if you want anonymous:
or if you want named:
Let me know - thanks! |
Damn that's a bit unfortunate. I don't have a preference personally though. |
@hwillson given that the tests are already described with the first argument to As an aside, it's common to need to use |
As a personal note, I'd be pretty happy if |
@awwx Yes, I agree with using anonymous functions in this case (I just wanted to check before submitting the PR). With regards to having a lint rule that recommends using arrow functions (where relevant), that's what the Airbnb rules do (that MDG is using). So to use anonymous functions with tests we'll need to include:
Not a huge deal, just something extra to consider. PR coming shortly. I'll aim to fire a similar PR in for the todos app as well. Just to add - there is some discussion about leveraging arrow functions in Mocha 3. |
Thanks for the PR @hwillson! Going to close this. |
The Meteor Guide Mocha examples shouldn't use arrow functions, says the Mocha documentation:
The text was updated successfully, but these errors were encountered: