test: fix failing coverage adding tests on closeAllConnections #6083
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I saw that the coverage threshold is not currently satisfied locally, since lines 172-173 in
lib/server.js
are not covered.In #6069 this was preventing my commit since the pre-commit hook was failing locally. On CI pipeline it should not be a problem, it seems to work and the coverage is at 100%.
I added the tests to fix the issue.
Mocking
dns.lookup
is needed in order to ensure that the secondary server always gets created whenhost
is set tolocalhost
. Even when theall
options is set totrue
the OS can choose to return only the IPv4 address, resulting in the missing creation of the secondary server.Checklist
npm run test
andnpm run benchmark
and the Code of conduct