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

why did you create this package? I find it useful for testing. #1

Open
Alino opened this issue Aug 7, 2016 · 2 comments
Open

why did you create this package? I find it useful for testing. #1

Alino opened this issue Aug 7, 2016 · 2 comments

Comments

@Alino
Copy link

Alino commented Aug 7, 2016

this is a cool thing, I was just struggling with converting my meteor 1.2.1 app into version 1.4. And as well moving all velocity packages tests into ES6 import/export modules style and wallaby. But my methods in the tests were not testable because they are not global anymore. This package enables me to import them into the tests. Did you also create it for testing or is there any other reasoning? Thank you

@Alino
Copy link
Author

Alino commented Aug 7, 2016

btw I just found this article, you mind find this also useful
http://www.east5th.co/blog/2016/08/01/method-imports-and-exports/

@huttonr
Copy link
Owner

huttonr commented Aug 8, 2016

I am very glad you found it useful! I see how it would be helpful for testing in order to isolate modules containing Meteor methods.

I personally use it in production with all Meteor methods. Instead of:

Meteor.call('myMethod', 'test string', (err, res) => {
  /*    ...    */
});

I prefer:

import { myMethod } from '/imports/shared/methods';

function onClick() {
  myMethod('test string', (err, res) => {
    /*    ...    */
  });
}

I believe this fits far better within the javascript modules ecosystem and not only looks better in the code but is far more declarative (in keeping with the remainder of modular code philosophy).

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

No branches or pull requests

2 participants