Skip to content

Conversation

@mpareja
Copy link
Contributor

@mpareja 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
Copy link
Contributor

Readme update?

hueniverse pushed 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
hueniverse pushed a commit that referenced this pull request Apr 25, 2014
hueniverse pushed a commit that referenced this pull request Apr 26, 2014
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants