-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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: replace string concatenation in async-hooks/test-tlswrap.js with template literals #14319
Conversation
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 if CI is green. If you want to take it a step further, you can replace the template literals with path.join()
calls. (For example: path.join(common.fixturesDir, 'test_cert.pem')
)
Thanks @Trott . |
test/async-hooks/test-tlswrap.js
Outdated
@@ -19,8 +20,8 @@ hooks.enable(); | |||
// | |||
const server = tls | |||
.createServer({ | |||
cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'), | |||
key: fs.readFileSync(common.fixturesDir + '/test_key.pem') | |||
cert: fs.readFileSync(path.join(common.fixturesDir, '/test_cert.pem')), |
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.
Should not the '/test_cert.pem'
and '/test_key.pem'
be the 'test_cert.pem'
and 'test_key.pem'
? Path delimiters shoud be inserted by path.join()
.
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 agree (even though this will work as far as I know).
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.
Yes, it is better remove the delimiters. Will update it.
Thanks.
…of template literals
Updated accordingly. |
test/async-hooks/test-tlswrap.js
Outdated
@@ -4,6 +4,7 @@ const common = require('../common'); | |||
if (!common.hasCrypto) | |||
common.skip('missing crypto'); | |||
|
|||
const path = require('path'); |
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 is a nit pick, but can you move path
below assert
? In tests, we try to (but admittedly often don't) keep the built-in modules in alphabetical order. (Well, ASCII order actually. https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#lines-7-8)
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 with or without my additional nit-pick addressed. (Nit-pick can be addressed while landing if it doesn't get addressed in this PR.)
@Trott Thanks. |
test/async-hooks/test-tlswrap.js
Outdated
@@ -4,12 +4,15 @@ const common = require('../common'); | |||
if (!common.hasCrypto) | |||
common.skip('missing crypto'); | |||
|
|||
|
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.
If this extra empty line is unwanted, anybody who will land the PR can delete it.
Deleted. |
Landed in d8eb30a, thank you for your first contribution! 🎉 |
PR-URL: #14319 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #14319 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Thanks. |
PR-URL: #14319 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
[JSConf CN Code&Learn] Replace string concatenation in
async-hooks/test-tlswrap.js
with template literalsChecklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
no.
Just update tests.