-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
refac: refactor test-http-response-multiheaders.js test to use countdown #17419
refac: refactor test-http-response-multiheaders.js test to use countdown #17419
Conversation
@@ -47,7 +48,7 @@ const server = http.createServer(function(req, res) { | |||
}); | |||
|
|||
server.listen(0, common.mustCall(function() { | |||
let count = 0; | |||
const countdown = new Countdown(2, () => server.close()); | |||
for (let n = 1; n <= 2; n++) { |
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.
Could we store 2
in a const or something? Potentially this could also be rewritten to utilize the countdown more fully (loop could be based on countdown being > 0, etc.) but at the very least we should remove magic numbers.
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.
@apapirovski might be a good idea. Do you have any variable name preferences? Maybe runs = 2
or runCount = 2
?
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.
Either of those sound good 👍
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.
@apapirovski here is the commit 6e9f719
a80a543
to
6e9f719
Compare
Changed commit messages to have less than 72 chars. |
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.
One quick comment, then LGTM
@@ -47,8 +48,9 @@ const server = http.createServer(function(req, res) { | |||
}); | |||
|
|||
server.listen(0, common.mustCall(function() { | |||
let count = 0; | |||
for (let n = 1; n <= 2; n++) { | |||
const runCount = 2; |
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.
Can you move runCount
to live outside of the server.listen
?
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.
@maclover7 like this afacc3e ?
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.
I believe so -- although the linter may want an extra blank line (you can check this via make lint-js
:))
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.
@maclover7 it says Running JS linter...
and then exits. Does it mean that everything is ok? :)
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.
@LEQADA Yep -- if no errors show up then all good. You can also see the linter CI job passing at https://ci.nodejs.org/job/node-test-linter/14156/
Landing... |
Landed in 35c01d8, congrats on your first PR to Node.js! |
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
PR-URL: #17419 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
Refs #17169 to fix
test/parallel/test-http-response-multiheaders.js
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes