Skip to content

Commit

Permalink
test: minor refactor in common/index.js
Browse files Browse the repository at this point in the history
PR-URL: #22738
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: George Adams <george.adams@uk.ibm.com>
  • Loading branch information
jasnell authored and targos committed Sep 20, 2018
1 parent e2b72c2 commit 9e1f736
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,14 @@ const PIPE = (() => {
return path.join(pipePrefix, pipeName);
})();

let hasIPv6;
{
const hasIPv6 = (() => {
const iFaces = os.networkInterfaces();
const re = isWindows ? /Loopback Pseudo-Interface/ : /lo/;
hasIPv6 = Object.keys(iFaces).some(function(name) {
return re.test(name) && iFaces[name].some(function(info) {
return info.family === 'IPv6';
});
return Object.keys(iFaces).some((name) => {
return re.test(name) &&
iFaces[name].some(({ family }) => family === 'IPv6');
});
}
})();

/*
* Check that when running a test with
Expand Down

0 comments on commit 9e1f736

Please sign in to comment.