Skip to content

Commit

Permalink
test: add trailing commas in test/internet
Browse files Browse the repository at this point in the history
PR-URL: #46407
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
aduh95 authored and MylesBorins committed Feb 18, 2023
1 parent 7e7e2d0 commit a66e7ca
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 57 deletions.
1 change: 0 additions & 1 deletion test/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ overrides:
- files:
- es-module/*.js
- es-module/*.mjs
- internet/*.js
- js-native-api/*/*.js
- known_issues/*.js
- parallel/*.js
Expand Down
8 changes: 4 additions & 4 deletions test/internet/test-corepack-yarn-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions test/internet/test-dgram-broadcast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -203,7 +203,7 @@ if (process.argv[2] !== 'child') {
LOCAL_BROADCAST_HOST, common.PORT);

process.nextTick(sendSocket.sendNext);
}
},
);
};

Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dgram-membership.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions test/internet/test-dgram-multicast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
Expand All @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions test/internet/test-dgram-multicast-set-interface-lo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '::' };
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -241,7 +241,7 @@ if (process.argv[2] !== 'child') {
msg.mcast, PORTS[msg.mcast]);

process.nextTick(sendSocket.sendNext);
}
},
);
};
}
Expand All @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions test/internet/test-dgram-multicast-ssm-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions test/internet/test-dgram-multicast-ssmv6-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') {
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
}
},
);
};
}
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dns-any.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dns-idna2008.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dns.lookup(
}
assert.ifError(err);
assert.strictEqual(address, fixture.expectedAddress);
})
}),
);

dns.promises.lookup(fixture.hostname, { family: fixture.family })
Expand Down
12 changes: 6 additions & 6 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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(
Expand All @@ -212,7 +212,7 @@ TEST(async function test_lookup_all_ipv4(done) {
common.mustSucceed((ips) => {
validateResult(ips);
done();
})
}),
);

checkWrap(req);
Expand All @@ -232,7 +232,7 @@ TEST(async function test_lookupservice_ip_ipv4(done) {
common.mustSucceed((hostname, service) => {
validateResult({ hostname, service });
done();
})
}),
);

checkWrap(req);
Expand Down
10 changes: 5 additions & 5 deletions test/internet/test-dns-ipv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -200,7 +200,7 @@ TEST(async function test_lookup_all_ipv6(done) {
common.mustSucceed((ips) => {
validateResult(ips);
done();
})
}),
);

checkWrap(req);
Expand All @@ -220,7 +220,7 @@ TEST(function test_lookupservice_ip_ipv6(done) {
assert(host);
assert(['http', 'www', '80'].includes(service));
done();
})
}),
);

checkWrap(req);
Expand Down
20 changes: 10 additions & 10 deletions test/internet/test-dns-lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' },
);
8 changes: 4 additions & 4 deletions test/internet/test-dns-promises-resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}'`,
},
);
}

Expand All @@ -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})`,
},
);
}

Expand Down
Loading

0 comments on commit a66e7ca

Please sign in to comment.