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 passing 'done' as async callback #78

Merged
merged 2 commits into from Apr 25, 2014

Conversation

@mpareja
Copy link
Contributor

mpareja commented Apr 17, 2014

The done function should operate like a standard node callback where the first parameter is interpreted as a potential error.

This would save keystrokes when testing the happy path for an async function. Here's an example from the supertest docs:

Here's an example with mocha, note how you can pass done straight to any of the .expect() calls:

describe('GET /users', function(){
  it('respond with json', function(done){
    request(app)
      .get('/user')
      .set('Accept', 'application/json')
      .expect('Content-Type', /json/)
      .expect(200, done);
  })
})
@hueniverse hueniverse added this to the 3.1.0 milestone Apr 18, 2014
@hueniverse hueniverse self-assigned this Apr 18, 2014
@hueniverse

This comment has been minimized.

Copy link
Member

hueniverse commented Apr 18, 2014

Readme update?

hueniverse added a commit that referenced this pull request Apr 25, 2014
Support passing 'done' as async callback
@hueniverse hueniverse merged commit 6eaba7a into hapijs:master Apr 25, 2014
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
hueniverse added a commit that referenced this pull request Apr 25, 2014
hueniverse added a commit that referenced this pull request Apr 26, 2014
update tests for changes in #78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.