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
Testing ECONNREFUSED #410
Comments
You could use I'm keeping this issue open, since I think nock could provide an easier way to reply with those types of errors. |
@pgte like this: nock('http://ww.cantconnecttothis.addres/')
.get('feed')
.replyWithError({
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'www.skdhsdk.com'
}); Doesn't seems to work. |
I wrote a project that starts servers for this in Python: http://github.com/kevinburke/hamms The easiest way is simply to connect to a localhost port where nothing is listening. ETIMEDOUT you can generally use |
There's a problem with replyWithError: it doesn't support afaik this is also not tested: https://github.com/pgte/nock/blob/049799c35f388d7fbf0a614e1f956a8b5eb7f63d/tests/test_intercept.js#L2863 |
@1999 could you please create a separate issue for this? |
@redben what's the status of this? |
@filipedeschamps could you please elaborate? |
@pgte I can also PR this if you think that's unexpected behaviour |
@1999 PR is welcome :) |
@pgte sorry, I've just re-run tests and acknowledged that everything is okay. The problem was in old nock version used in webdriverio. |
I'm closing this for lack of feedback. Please reopen if you have more info. |
Sorry didn't pay attention to notifications.
So basically these two can be tested without nock. Thanks anyway ! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you! |
When using nock one can test server http errors.
Is there any way to test request errors like ENOTFOUND or ECONNREFUSED using nock ?
The text was updated successfully, but these errors were encountered: