Small library to ease the pain of using SuperTest in combination with Jasmine
If you use Supertest in combination with Jasmine, you cannot use the done callback out-of-the-box (see jasmine/jasmine-npm#31). This library eases this pain.
npm install jasmine-supertest
jasmine-supertest simply adds a wrapper function you can use to finish SuperTest testcases. Instead of writing .end(done)
you simply have to call finishTestcase(done)
.
var server = require('../lib/server');
var supertest = require('supertest');
var finishTestcase = require('jasmine-supertest');
describe('jasmine-supertest test suite', function() {
it('calls done without any params and finishes the test case is fine', function(done) {
var app = supertest(server);
app.get('/incorrect-url').expect(404).end(finishTestcase(doneMock));
});
});