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
fix: remove server.unref from tests (#3790) #3815
Conversation
@@ -98,7 +98,7 @@ module.exports.payloadMethod = function (method, t, isSetErrorHandler = false) { | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this return
will cause t.teardown
not to be called.
To be inline with most other test files, suggest we remove the if and the return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to resolve this one is normalise calling t.teardown
immediately after fastify is instantiated as stated in the test docs and not done in many places.
Kinda like go's defer
.
@@ -139,7 +139,7 @@ module.exports.payloadMethod = function (method, t) { | |||
t.error(err) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if
around t.error
can likely be removed following what's done in most other test files.
@@ -115,7 +115,7 @@ test('route', t => { | |||
|
|||
fastify.listen({ port: 0 }, function (err) { | |||
if (err) t.error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if
around t.error
can likely be removed following what's done in most other test files.
@@ -25,7 +25,7 @@ test('Should honor ignoreTrailingSlash option', t => { | |||
}) | |||
|
|||
fastify.listen({ port: 0 }, (err) => { | |||
fastify.server.unref() | |||
t.teardown(() => { fastify.close() }) | |||
if (err) t.threw(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling t.threw
instead of t.error
as we do in most other test files.
For consistency, would change to t.error
and call before t.teardown
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Closes #3790
/test
files calls tofastify.server.unref()
witht.teardown(() => { fastify.close() })
as detailed in the issue.t.error
beforet.teardown
. Normalising to this pattern where it wasn't.Checklist
npm run test
andnpm run benchmark
and the Code of conduct