rjz / supertest-session

Persistent sessions for supertest
Other
89 stars 21 forks source link

Chaining problem when calling done inside expect #20

Closed davidjohnwoolf closed 8 years ago

davidjohnwoolf commented 8 years ago

Supertest lets you call done inside of an expect call instead of calling .end(done). When you use supertest-session to do this, you cannot chain methods. For example, when you try something like this:

var request = require('supertest-session');
var user = request(app)
    .post('/login')
    .type('form')
    .send(credentials)
    .expect(302, done);

It does not chain correctly, and you need to instead use:

var request = require('supertest-session');
var user = request(app);
user
    .post('/login')
    .type('form')
    .send(credentials)
    .expect(302, done);
davidjohnwoolf commented 8 years ago

Closed issue because the issue was not actually an issue!