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

refactor(test): consolidate local http server creation #1950

Merged
merged 1 commit into from Mar 16, 2020

Conversation

mastermatt
Copy link
Member

Following the same pattern used to create HTTPS local servers, added a utility
that creates and listens for a HTTP server and ensures it gets closed after the test ends.

There were some tests that weren't properly closing the server if the
test failed, but mostly this refactor reduces boilerplate from tests.

Not all tests that call http.createServer were updated. The ones
not migrated to Mocha DSL or Chai were left alone since they're due
for refactors anyway.

Following the same pattern used to HTTPS local servers, added a utility
that creates and listens for a HTTP server and ensures it gets closed
after the test ends.

There were some tests that weren't properly closing the server if the
test failed, but mostly this refactor reduces boilerplate from tests.

Not all tests that call `http.createServer` were updated. The ones
not migrated to Mocha DSL or Chai were left alone since they're due
for refactors anyway.
@mastermatt mastermatt merged commit 1080675 into nock:master Mar 16, 2020
@mastermatt mastermatt deleted the http-start-server branch March 16, 2020 02:02
Copy link
Member

@paulmelnikow paulmelnikow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really nice!

@github-actions
Copy link

🎉 This PR is included in version 12.0.3 🎉

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

Successfully merging this pull request may close these issues.

None yet

3 participants