Skip to content
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

got() automatic retries makes for confusing failures in Nock tests #1523

Closed
paulmelnikow opened this issue May 1, 2019 · 2 comments
Closed
Labels

Comments

@paulmelnikow
Copy link
Member

paulmelnikow commented May 1, 2019

As I mentioned at #1515 (comment), Got automatically retries failed requests twice.

That means if you have a test which mocks a 4xx or 5xx response, got will immediately reissue it.

At that point, the mock will have been consumed. The test will error out with Nock: No match for request.

Adding { retry: 0 } to the got calls will disable this behavior, and will make the tests behave less confusingly.

As I also mentioned in that thread:

While automatic retrying may be nice in certain cases, it is unsuited to testing. I am not convinced it is a good default.

We should use got.extend() to set defaults that turn off this behavior.

@nockbot
Copy link
Collaborator

nockbot commented May 2, 2019

🎉 This issue has been resolved in version 11.0.0-beta.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nockbot
Copy link
Collaborator

nockbot commented Aug 13, 2019

🎉 This issue has been resolved in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants