-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
test: Fix common.PIPE
to be process unique
#14168
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,7 +243,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { | |
|
||
Object.defineProperty(exports, 'hasCrypto', { | ||
get: function() { | ||
return process.versions.openssl ? true : false; | ||
return Boolean(process.versions.openssl); | ||
} | ||
}); | ||
|
||
|
@@ -253,22 +253,21 @@ Object.defineProperty(exports, 'hasFipsCrypto', { | |
} | ||
}); | ||
|
||
if (exports.isWindows) { | ||
exports.PIPE = '\\\\.\\pipe\\libuv-test'; | ||
if (process.env.TEST_THREAD_ID) { | ||
exports.PIPE += `.${process.env.TEST_THREAD_ID}`; | ||
} | ||
} else { | ||
exports.PIPE = `${exports.tmpDir}/test.sock`; | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is block scoping really needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it, easier to see that the |
||
const pipePrefix = exports.isWindows ? '\\\\.\\pipe\\' : `${exports.tmpDir}/`; | ||
const pipeName = `node-test.${process.pid}.sock`; | ||
exports.PIPE = pipePrefix + pipeName; | ||
} | ||
|
||
const ifaces = os.networkInterfaces(); | ||
const re = /lo/; | ||
exports.hasIPv6 = Object.keys(ifaces).some(function(name) { | ||
return re.test(name) && ifaces[name].some(function(info) { | ||
return info.family === 'IPv6'; | ||
{ | ||
const iFaces = os.networkInterfaces(); | ||
const re = /lo/; | ||
exports.hasIPv6 = Object.keys(iFaces).some(function(name) { | ||
return re.test(name) && iFaces[name].some(function(info) { | ||
return info.family === 'IPv6'; | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
/* | ||
* Check that when running a test with | ||
|
This file was deleted.
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.
Not a huge fan of
!!
outside of minimal code competitions.Willing to change if anyone has a strong opinion.
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.
No strong opinion from me. I think it used to be preferred in hot paths for performance. No idea if that's still the case. Regardless, it's totally sensible to value readable code over performant code in
test/common/index.js
.