Skip to content

Use co-mocha for tests to simplify async flow. Fixes #19 #20

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

Merged
merged 4 commits into from
Oct 4, 2015

Conversation

techniq
Copy link
Member

@techniq techniq commented Oct 4, 2015

Tests run fine under Node 4.x+ or io.js where generators are available by default, but will require the --harmony_generators flag when ran on Node 0.11 or 0.12.

@jmdobry
Copy link
Member

jmdobry commented Oct 4, 2015

@techniq Can you update the CONTRIBUTING.md and README.md files to explain what you need in order to run the tests, i.e. Node 4.x?

@techniq
Copy link
Member Author

techniq commented Oct 4, 2015

Sure. I tried to find a simple way to pass the --harmony_generators flag to grunt when using Node 0.11 / 0.12 but there isn't a simple way. I also couldn't find a way to add the flag conditionally as adding it on io.js / Node 4.x throws an error. I'll just add a note about using Node 4.x since it's the recommended version nowadays.

@techniq
Copy link
Member Author

techniq commented Oct 4, 2015

Btw, if we didn't use grunt and changed package.json to just used npm's pretest/test and mocha directly it would allow us to pass flags to mocha easily, such that

  "scripts": {
    "pretest": "...webpack...",
    "test": "mocha mocha.start.js 'test/**/*.js"
  },

You could call npm test -- --harmony_generators. I didn't test this specifically, but I use a similar approach on one of my projects to send other flags to mocha, such as -g some_filter. I've note used webpack in any of my projects to understand exactly how it works / how best to configure it. I know it does what browserify does (and then some?). It doesn't appear to be doing any transpiling from what I saw though (I had looked to use some arrow functions but removed them to keep things working on older versions of Node (albeit with the generator flag)

jmdobry added a commit that referenced this pull request Oct 4, 2015
Use co-mocha for tests to simplify async flow.  Fixes #19
@jmdobry jmdobry merged commit c656b9f into js-data:master Oct 4, 2015
@techniq techniq deleted the co-mocha branch October 16, 2015 02:34
@techniq techniq restored the co-mocha branch October 16, 2015 11:05
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.

None yet

2 participants