The related question Cant test DELETE method using mocha and supertest and its current two answers didn't solved my issue :(
The following is the test definition:
api = supertest(url);
describe('when OPTIONS', function () {
it('should return only method GET', function (done) {
api
.options('/')
.expect('Allow', 'GET')
.expect(200, done);
});
});
Its keeping triggering the following error:
Uncaught TypeError: Cannot read property 'header' of undefined
at _stream_readable.js:944:16
and when:
api
.options('/')
.end(function(error,res){
if (error) return done(error);
done()
});
It says:
SyntaxError: Unexpected token G
at Object.parse (native)
at _stream_readable.js:944:16
I already tried a lot of things without being able to make this work.
I 'm using supertest ^1.0.1
and it worked fine with version ~0.13.0
.
Related issue at https://github.com/visionmedia/supertest/issues/272
Thanks