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

support co-based generators #1032

Closed
jonathanong opened this issue Nov 10, 2013 · 8 comments
Closed

support co-based generators #1032

jonathanong opened this issue Nov 10, 2013 · 8 comments

Comments

@jonathanong
Copy link
Contributor

https://github.com/visionmedia/co

it('should work', function* () {
  yield wait(1)
})
@tj
Copy link
Contributor

tj commented Nov 10, 2013

meh :p easy to delegate that and just do

it('should work', function(done){
  co(function *(){
    yield whatever;
  })(done)
})

similar to the promise argument, I think leaving mocha at the simplest level with regular old callbacks is the best way to go

@jonathanong
Copy link
Contributor Author

:( yeah it's good to be consistent and only supporting callbacks and rejecting all control flow libs.

@hallas
Copy link

hallas commented Nov 11, 2013

I agree

@hallas hallas closed this as completed Nov 11, 2013
@goloroden
Copy link

It may be a stupid question - but how do I have to call mocha from the command-line to support generators? If I simply run mocha as usual, I get an error telling me about an unexpected * at the generator function that I hand over to co.

Any advice?

@hallas
Copy link

hallas commented May 6, 2014

@goloroden

mocha --harmony should do it :)

@goloroden
Copy link

Ah, okay, thanks a lot :-)). This option doesn't show up when running mocha --help, but it works perfectly :-).

@schickling
Copy link

Currently the best way seems to be:

it('should work', function(){
  return co(function *(){
    yield whatever;
  });
})

@ruimarinho
Copy link

@schickling you can use something like co-mocha to avoid using co on every test.

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

6 participants