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

When server is down, the error message is not useful #314

Open
sakovias opened this Issue Feb 14, 2016 · 5 comments

Comments

Projects
None yet
6 participants
@sakovias
Copy link

sakovias commented Feb 14, 2016

My test suit is hitting a server with a bunch of requests and then checks on responses. supertest is really good for making tests on response body and status code easy!

However, when the server is down for some reason the error message doesn't allow to identify the source of the problem. Me and some other folks tripped over this a bunch of times :)

var request = require('supertest');
request('localhost:6237')
  .get('/')
  .expect(200)
  .end(function(err, res) {
    if (err) throw err;
    console.log('Success', res.body);
  });

Running this given the server at localhost:6237 is down results in this stack trace:

$ node test.js
/path/to/test.js:8
    if (err) throw err;
                   ^
TypeError: Cannot read property 'status' of undefined

Is it something I can go ahead and fix or it's intended functionality?

@malhar-trivedi

This comment has been minimized.

Copy link

malhar-trivedi commented Mar 1, 2016

@jxm262

This comment has been minimized.

Copy link

jxm262 commented Mar 12, 2016

After looking at #237 , I'm seeing the same error on the newest version of master. Perhaps the fix was never merged?

@parxier

This comment has been minimized.

Copy link

parxier commented Jun 1, 2016

Is there any update on this one?
Is it possible to merge #237 fix into latest version?

@contra

This comment has been minimized.

Copy link

contra commented Aug 11, 2017

I'm still getting this error, but it seems to happen randomly. Running the tests again it doesn't happen, maybe 1 out of every 30 runs this happens on a random test.

@bkeepers

This comment has been minimized.

Copy link

bkeepers commented Nov 17, 2017

#446 should help reveal the underlying error here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment