-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test: refactor test-net-connect-buffer #17710
Conversation
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()`
It feels weird that |
Actually null is still special also in the binary case. You have to .push(null) on a Readable to terminate. |
Right … just seems odd since we also do the same type checks for |
|
||
assert.strictEqual(socket.connecting, true); | ||
assert.strictEqual('opening', socket.readyState); |
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.
Nit: now that you are here, can you please swap the arguments? There are more below.
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.
Yup, done!
let connectHappened = false; | ||
|
||
const tcp = net.Server(function(s) { | ||
const tcp = net.Server(common.mustCall((s) => { | ||
tcp.close(); | ||
|
||
console.log('tcp server connection'); |
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 would also remove the remaining console.log()
, they don't seem to be very useful.
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.
Done! :)
@addaleax that's an oddity of streams backward compatibility. I'm ok in changing that if you want to fire a separate PR. |
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
Landing... |
Landed in 7352bf2 |
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: nodejs#17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
test doesn't pass on 6.x or 8.x (commit lands on both). |
common.mustCall()
console.log()
s/turn them into assertionscommon.expectsError()
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test/net