test: add trailing commas in test/internet

PR-URL: https://github.com/nodejs/node/pull/46407
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Antoine du Hamel 2023-02-01 10:46:06 +01:00 committed by GitHub
parent 190fb59380
commit f57e9c36ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 56 additions and 57 deletions

View File

@ -76,7 +76,6 @@ overrides:
- files:
- es-module/*.js
- es-module/*.mjs
- internet/*.js
- js-native-api/*/*.js
- known_issues/*.js
- parallel/*.js

View File

@ -25,13 +25,13 @@ const corepackYarnPath = path.join(
'deps',
'corepack',
'dist',
'yarn.js'
'yarn.js',
);
const pkgContent = JSON.stringify({
dependencies: {
'package-name': fixtures.path('packages/main')
}
'package-name': fixtures.path('packages/main'),
},
});
const pkgPath = path.join(installDir, 'package.json');
@ -46,7 +46,7 @@ const env = { ...process.env,
exec(`${process.execPath} ${corepackYarnPath} install`, {
cwd: installDir,
env: env
env: env,
}, common.mustCall(handleExit));
function handleExit(error, stdout, stderr) {

View File

@ -166,7 +166,7 @@ if (process.argv[2] !== 'child') {
const sendSocket = dgram.createSocket({
type: 'udp4',
reuseAddr: true
reuseAddr: true,
});
// Bind the address explicitly for sending
@ -203,7 +203,7 @@ if (process.argv[2] !== 'child') {
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
@ -219,7 +219,7 @@ if (process.argv[2] === 'child') {
const receivedMessages = [];
const listenSocket = dgram.createSocket({
type: 'udp4',
reuseAddr: true
reuseAddr: true,
});
listenSocket.on('message', (buf, rinfo) => {

View File

@ -19,7 +19,7 @@ const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true });
const socket = setup();
assert.throws(
() => { socket.dropMembership(multicastAddress); },
/^Error: dropMembership EADDRNOTAVAIL$/
/^Error: dropMembership EADDRNOTAVAIL$/,
);
socket.close();
}

View File

@ -188,7 +188,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
@ -197,7 +197,7 @@ if (process.argv[2] === 'child') {
const receivedMessages = [];
const listenSocket = dgram.createSocket({
type: 'udp4',
reuseAddr: true
reuseAddr: true,
});
listenSocket.on('listening', function() {

View File

@ -25,7 +25,7 @@ const networkInterfaces = require('os').networkInterfaces();
const fork = require('child_process').fork;
const MULTICASTS = {
IPv4: ['224.0.0.115', '224.0.0.116', '224.0.0.117'],
IPv6: ['ff02::1:115', 'ff02::1:116', 'ff02::1:117']
IPv6: ['ff02::1:115', 'ff02::1:116', 'ff02::1:117'],
};
const LOOPBACK = { IPv4: '127.0.0.1', IPv6: '::1' };
const ANY = { IPv4: '0.0.0.0', IPv6: '::' };
@ -201,7 +201,7 @@ if (process.argv[2] !== 'child') {
const sendSocket = dgram.createSocket({
type: UDP[FAM],
reuseAddr: true
reuseAddr: true,
});
// Don't bind the address explicitly when sending and start with
@ -241,7 +241,7 @@ if (process.argv[2] !== 'child') {
msg.mcast, PORTS[msg.mcast]);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
@ -256,7 +256,7 @@ if (process.argv[2] === 'child') {
console.error(`pid ${process.pid} iface ${IFACE} MULTICAST ${MULTICAST}`);
const listenSocket = dgram.createSocket({
type: UDP[FAM],
reuseAddr: true
reuseAddr: true,
});
listenSocket.on('message', (buf, rinfo) => {

View File

@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
@ -191,7 +191,7 @@ if (process.argv[2] === 'child') {
const receivedMessages = [];
const listenSocket = dgram.createSocket({
type: 'udp4',
reuseAddr: true
reuseAddr: true,
});
listenSocket.on('listening', function() {

View File

@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
@ -191,7 +191,7 @@ if (process.argv[2] === 'child') {
const receivedMessages = [];
const listenSocket = dgram.createSocket({
type: 'udp6',
reuseAddr: true
reuseAddr: true,
});
listenSocket.on('listening', function() {

View File

@ -78,7 +78,7 @@ const checkers = {
assert.strictEqual(typeof r.priority, 'number');
assert.strictEqual(typeof r.weight, 'number');
assert.strictEqual(r.type, 'SRV');
}
},
};
function TEST(f) {

View File

@ -34,7 +34,7 @@ dns.lookup(
}
assert.ifError(err);
assert.strictEqual(address, fixture.expectedAddress);
})
}),
);
dns.promises.lookup(fixture.hostname, { family: fixture.family })

View File

@ -127,7 +127,7 @@ TEST(async function test_lookup_ipv4_explicit_object(done) {
validateResult(await dnsPromises.lookup(addresses.INET4_HOST, { family: 4 }));
const req = dns.lookup(addresses.INET4_HOST, {
family: 4
family: 4,
}, common.mustSucceed((ip, family) => {
validateResult({ address: ip, family });
done();
@ -143,11 +143,11 @@ TEST(async function test_lookup_ipv4_hint_addrconfig(done) {
}
validateResult(await dnsPromises.lookup(addresses.INET4_HOST, {
hints: dns.ADDRCONFIG
hints: dns.ADDRCONFIG,
}));
const req = dns.lookup(addresses.INET4_HOST, {
hints: dns.ADDRCONFIG
hints: dns.ADDRCONFIG,
}, common.mustSucceed((ip, family) => {
validateResult({ address: ip, family });
done();
@ -203,7 +203,7 @@ TEST(async function test_lookup_all_ipv4(done) {
validateResult(await dnsPromises.lookup(addresses.INET4_HOST, {
all: true,
family: 4
family: 4,
}));
const req = dns.lookup(
@ -212,7 +212,7 @@ TEST(async function test_lookup_all_ipv4(done) {
common.mustSucceed((ips) => {
validateResult(ips);
done();
})
}),
);
checkWrap(req);
@ -232,7 +232,7 @@ TEST(async function test_lookupservice_ip_ipv4(done) {
common.mustSucceed((hostname, service) => {
validateResult({ hostname, service });
done();
})
}),
);
checkWrap(req);

View File

@ -122,7 +122,7 @@ TEST(async function test_lookup_ipv6_explicit_object(done) {
validateResult(await dnsPromises.lookup(addresses.INET6_HOST, { family: 6 }));
const req = dns.lookup(addresses.INET6_HOST, {
family: 6
family: 6,
}, common.mustSucceed((ip, family) => {
validateResult({ address: ip, family });
done();
@ -134,7 +134,7 @@ TEST(async function test_lookup_ipv6_explicit_object(done) {
TEST(function test_lookup_ipv6_hint(done) {
const req = dns.lookup(addresses.INET6_HOST, {
family: 6,
hints: dns.V4MAPPED
hints: dns.V4MAPPED,
}, common.mustCall((err, ip, family) => {
if (err) {
// FreeBSD does not support V4MAPPED
@ -191,7 +191,7 @@ TEST(async function test_lookup_all_ipv6(done) {
validateResult(await dnsPromises.lookup(addresses.INET6_HOST, {
all: true,
family: 6
family: 6,
}));
const req = dns.lookup(
@ -200,7 +200,7 @@ TEST(async function test_lookup_all_ipv6(done) {
common.mustSucceed((ips) => {
validateResult(ips);
done();
})
}),
);
checkWrap(req);
@ -220,7 +220,7 @@ TEST(function test_lookupservice_ip_ipv6(done) {
assert(host);
assert(['http', 'www', '80'].includes(service));
done();
})
}),
);
checkWrap(req);

View File

@ -11,35 +11,35 @@ assert.rejects(
dnsPromises.lookup(addresses.NOT_FOUND, {
hints: 0,
family: 0,
all: false
all: false,
}),
{
code: 'ENOTFOUND',
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`
}
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
},
);
assert.rejects(
dnsPromises.lookup(addresses.NOT_FOUND, {
hints: 0,
family: 0,
all: true
all: true,
}),
{
code: 'ENOTFOUND',
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`
}
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
},
);
dns.lookup(addresses.NOT_FOUND, {
hints: 0,
family: 0,
all: true
all: true,
}, common.mustCall((error) => {
assert.strictEqual(error.code, 'ENOTFOUND');
assert.strictEqual(
error.message,
`getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`
`getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
);
assert.strictEqual(error.syscall, 'getaddrinfo');
assert.strictEqual(error.hostname, addresses.NOT_FOUND);
@ -48,7 +48,7 @@ dns.lookup(addresses.NOT_FOUND, {
assert.throws(
() => dnsPromises.lookup(addresses.NOT_FOUND, {
family: 'ipv4',
all: 'all'
all: 'all',
}),
{ code: 'ERR_INVALID_ARG_VALUE' }
{ code: 'ERR_INVALID_ARG_VALUE' },
);

View File

@ -12,8 +12,8 @@ const dnsPromises = require('dns').promises;
{
code: 'ERR_INVALID_ARG_VALUE',
name: 'TypeError',
message: `The argument 'rrtype' is invalid. Received '${rrtype}'`
}
message: `The argument 'rrtype' is invalid. Received '${rrtype}'`,
},
);
}
@ -26,8 +26,8 @@ const dnsPromises = require('dns').promises;
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
message: 'The "rrtype" argument must be of type string. ' +
`Received type ${typeof rrtype} (${rrtype})`
}
`Received type ${typeof rrtype} (${rrtype})`,
},
);
}

View File

@ -97,11 +97,11 @@ TEST(async function test_resolve4_ttl(done) {
}
validateResult(await dnsPromises.resolve4(addresses.INET4_HOST, {
ttl: true
ttl: true,
}));
const req = dns.resolve4(addresses.INET4_HOST, {
ttl: true
ttl: true,
}, function(err, result) {
assert.ifError(err);
validateResult(result);
@ -125,11 +125,11 @@ TEST(async function test_resolve6_ttl(done) {
}
validateResult(await dnsPromises.resolve6(addresses.INET6_HOST, {
ttl: true
ttl: true,
}));
const req = dns.resolve6(addresses.INET6_HOST, {
ttl: true
ttl: true,
}, function(err, result) {
assert.ifError(err);
validateResult(result);
@ -555,7 +555,7 @@ TEST(async function test_lookup_ip_all(done) {
assert.strictEqual(family, undefined);
validateResult(ips);
done();
}
},
);
checkWrap(req);
@ -621,7 +621,7 @@ TEST(async function test_lookup_all_mixed(done) {
validateResult(await dnsPromises.lookup(addresses.INET_HOST, { all: true }));
const req = dns.lookup(addresses.INET_HOST, {
all: true
all: true,
}, function(err, ips) {
assert.ifError(err);
validateResult(ips);
@ -654,7 +654,7 @@ TEST(function test_reverse_failure(done) {
.then(common.mustNotCall())
.catch(common.expectsError({
code: 'ENOTFOUND',
hostname: '203.0.113.0'
hostname: '203.0.113.0',
}));
// 203.0.113.0/24 are addresses reserved for (RFC) documentation use only
@ -676,7 +676,7 @@ TEST(function test_lookup_failure(done) {
.then(common.mustNotCall())
.catch(common.expectsError({
code: 'ENOTFOUND',
hostname: addresses.NOT_FOUND
hostname: addresses.NOT_FOUND,
}));
const req = dns.lookup(addresses.NOT_FOUND, (err) => {

View File

@ -35,7 +35,7 @@ function httpreq(count) {
host: 'not-a-real-domain-name.nobody-would-register-this-as-a-tld',
port: 80,
path: '/',
method: 'GET'
method: 'GET',
}, common.mustNotCall());
req.on('error', common.mustCall((e) => {

View File

@ -24,7 +24,7 @@ const caCert = loadPEM('ca1-cert');
const opts = {
host: 'www.nodejs.org',
port: 443,
rejectUnauthorized: true
rejectUnauthorized: true,
};
// Success relies on the compiled in well-known root CAs

View File

@ -37,7 +37,7 @@ const tests = {
'resolveSrv': 'dns.resolveSrv("example.com", (err, res) => {});',
'resolvePtr': 'dns.resolvePtr("example.com", (err, res) => {});',
'resolveNaptr': 'dns.resolveNaptr("example.com", (err, res) => {});',
'resolveSoa': 'dns.resolveSoa("example.com", (err, res) => {});'
'resolveSoa': 'dns.resolveSoa("example.com", (err, res) => {});',
};
for (const tr in tests) {