Skip to content

Commit b1e17b4

Browse files
aduh95danielleadams
authored andcommitted
test: add trailing commas in test/common (#45550)
PR-URL: #45550 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 31233b2 commit b1e17b4

23 files changed

+59
-60
lines changed

test/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ overrides:
7474
- files:
7575
- addons/*/*.js
7676
- async-hooks/*.js
77-
- common/*.js
7877
- es-module/*.js
7978
- es-module/*.mjs
8079
- internet/*.js

test/common/benchmark.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function runBenchmark(name, env) {
1515

1616
const child = fork(runjs, argv, {
1717
env: mergedEnv,
18-
stdio: ['inherit', 'pipe', 'inherit', 'ipc']
18+
stdio: ['inherit', 'pipe', 'inherit', 'ipc'],
1919
});
2020
child.stdout.setEncoding('utf8');
2121

@@ -35,7 +35,7 @@ function runBenchmark(name, env) {
3535
// get from testing the benchmark file.
3636
assert.ok(
3737
/^(?:\n.+?\n.+?\n)+$/.test(stdout),
38-
`benchmark file not running exactly one configuration in test: ${stdout}`
38+
`benchmark file not running exactly one configuration in test: ${stdout}`,
3939
);
4040
});
4141
}

test/common/child_process.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ module.exports = {
4545
cleanupStaleProcess,
4646
logAfterTime,
4747
kExpiringChildRunTime,
48-
kExpiringParentTimer
48+
kExpiringParentTimer,
4949
};

test/common/cpu-prof.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function verifyFrames(output, file, suffix) {
3838
const kCpuProfInterval = 50;
3939
const env = {
4040
...process.env,
41-
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
41+
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER',
4242
};
4343

4444
module.exports = {
4545
getCpuProfiles,
4646
kCpuProfInterval,
4747
env,
4848
getFrames,
49-
verifyFrames
49+
verifyFrames,
5050
};

test/common/crypto.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey },
3030
expectedValue) {
3131
const buf1 = crypto.diffieHellman({
3232
privateKey: alicePrivateKey,
33-
publicKey: bobPublicKey
33+
publicKey: bobPublicKey,
3434
});
3535
const buf2 = crypto.diffieHellman({
3636
privateKey: bobPrivateKey,
37-
publicKey: alicePublicKey
37+
publicKey: alicePublicKey,
3838
});
3939
assert.deepStrictEqual(buf1, buf2);
4040

@@ -44,5 +44,5 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey },
4444

4545
module.exports = {
4646
modp2buf,
47-
testDH
47+
testDH,
4848
};

test/common/dns.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ const types = {
1313
MX: 15,
1414
TXT: 16,
1515
ANY: 255,
16-
CAA: 257
16+
CAA: 257,
1717
};
1818

1919
const classes = {
20-
IN: 1
20+
IN: 1,
2121
};
2222

2323
// Naïve DNS parser/serializer.
@@ -34,7 +34,7 @@ function readDomainFromPacket(buffer, offset) {
3434
const { nread, domain } = readDomainFromPacket(buffer, offset + length);
3535
return {
3636
nread: 1 + length + nread,
37-
domain: domain ? `${chunk}.${domain}` : chunk
37+
domain: domain ? `${chunk}.${domain}` : chunk,
3838
};
3939
}
4040
// Pointer to another part of the packet.
@@ -43,7 +43,7 @@ function readDomainFromPacket(buffer, offset) {
4343
const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000;
4444
return {
4545
nread: 2,
46-
domain: readDomainFromPacket(buffer, pointeeOffset)
46+
domain: readDomainFromPacket(buffer, pointeeOffset),
4747
};
4848
}
4949

@@ -316,5 +316,5 @@ module.exports = {
316316
parseDNSPacket,
317317
errorLookupMock,
318318
mockedErrorCode,
319-
mockedSysCall
319+
mockedSysCall,
320320
};

test/common/heap.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function createJSHeapSnapshot(stream = getHeapSnapshot()) {
4141
type,
4242
to: toNode,
4343
from: fromNode,
44-
name: typeof name_or_index === 'string' ? name_or_index : null
44+
name: typeof name_or_index === 'string' ? name_or_index : null,
4545
};
4646
toNode.incomingEdges.push(edge);
4747
fromNode.outgoingEdges.push(edge);
@@ -130,7 +130,7 @@ class State {
130130
const check = typeof expectedEdge === 'function' ? expectedEdge :
131131
(edge) => (isEdge(edge, expectedEdge));
132132
const hasChild = rootNodes.some(
133-
(node) => node.outgoingEdges.some(check)
133+
(node) => node.outgoingEdges.some(check),
134134
);
135135
// Don't use assert with a custom message here. Otherwise the
136136
// inspection in the message is done eagerly and wastes a lot of CPU
@@ -164,7 +164,7 @@ class State {
164164
// Validate our internal embedded graph representation
165165
validateGraph(rootName, expected, { loose = false } = {}) {
166166
const rootNodes = this.embedderGraph.filter(
167-
(node) => node.name === rootName
167+
(node) => node.name === rootName,
168168
);
169169
if (loose) {
170170
assert(rootNodes.length >= expected.length,
@@ -185,7 +185,7 @@ class State {
185185
// inspection in the message is done eagerly and wastes a lot of CPU
186186
// time.
187187
const hasChild = rootNodes.some(
188-
(node) => node.edges.some(check)
188+
(node) => node.edges.some(check),
189189
);
190190
if (!hasChild) {
191191
throw new Error(
@@ -213,5 +213,5 @@ function validateSnapshotNodes(...args) {
213213

214214
module.exports = {
215215
recordState,
216-
validateSnapshotNodes
216+
validateSnapshotNodes,
217217
};

test/common/hijackstdio.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ module.exports = {
2828
hijackStdout: hijackStdWritable.bind(null, 'stdout'),
2929
hijackStderr: hijackStdWritable.bind(null, 'stderr'),
3030
restoreStdout: restoreWritable.bind(null, 'stdout'),
31-
restoreStderr: restoreWritable.bind(null, 'stderr')
31+
restoreStderr: restoreWritable.bind(null, 'stderr'),
3232
};

test/common/http2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,5 @@ module.exports = {
144144
PingFrame,
145145
kFakeRequestHeaders,
146146
kFakeResponseHeaders,
147-
kClientMagic
147+
kClientMagic,
148148
};

test/common/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const hasIntl = !!process.config.variables.v8_enable_i18n_support;
3939

4040
const {
4141
atob,
42-
btoa
42+
btoa,
4343
} = require('buffer');
4444

4545
// Some tests assume a umask of 0o022 so set that up front. Tests that need a
@@ -98,7 +98,7 @@ if (process.argv.length === 2 &&
9898
console.log(
9999
'NOTE: The test started as a child_process using these flags:',
100100
inspect(flags),
101-
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.'
101+
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.',
102102
);
103103
const args = [...flags, ...process.execArgv, ...process.argv.slice(1)];
104104
const options = { encoding: 'utf8', stdio: 'inherit' };
@@ -175,7 +175,7 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
175175
}
176176
initHandles[id] = {
177177
resource,
178-
stack: inspect(new Error()).substr(6)
178+
stack: inspect(new Error()).substr(6),
179179
};
180180
},
181181
before() { },
@@ -433,7 +433,7 @@ function _mustCallInner(fn, criteria = 1, field) {
433433
[field]: criteria,
434434
actual: 0,
435435
stack: inspect(new Error()),
436-
name: fn.name || '<anonymous>'
436+
name: fn.name || '<anonymous>',
437437
};
438438

439439
// Add the exit listener only once to avoid listener leak warnings
@@ -476,7 +476,7 @@ function hasMultiLocalhost() {
476476

477477
function skipIfEslintMissing() {
478478
if (!fs.existsSync(
479-
path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint')
479+
path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint'),
480480
)) {
481481
skip('missing ESLint');
482482
}
@@ -565,7 +565,7 @@ function mustNotMutateObjectDeep(original) {
565565
},
566566
setPrototypeOf(target, prototype) {
567567
assert.fail(`Expected no side effects, got set prototype to ${prototype}`);
568-
}
568+
},
569569
};
570570

571571
const proxy = new Proxy(original, _mustNotMutateObjectDeepHandler);
@@ -668,7 +668,7 @@ function expectWarning(nameOrMap, expected, code) {
668668
if (!catchWarning[warning.name]) {
669669
throw new TypeError(
670670
`"${warning.name}" was triggered without being expected.\n` +
671-
inspect(warning)
671+
inspect(warning),
672672
);
673673
}
674674
catchWarning[warning.name](warning);
@@ -1032,5 +1032,5 @@ module.exports = new Proxy(common, {
10321032
if (!validProperties.has(prop))
10331033
throw new Error(`Using invalid common property: '${prop}'`);
10341034
return obj[prop];
1035-
}
1035+
},
10361036
});

test/common/inspector-helper.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ class NodeInstance extends EventEmitter {
434434
'Connection': 'Upgrade',
435435
'Upgrade': 'websocket',
436436
'Sec-WebSocket-Version': 13,
437-
'Sec-WebSocket-Key': 'key=='
438-
}
437+
'Sec-WebSocket-Key': 'key==',
438+
},
439439
});
440440
}
441441

@@ -530,5 +530,5 @@ function fires(promise, error, timeoutMs) {
530530
}
531531

532532
module.exports = {
533-
NodeInstance
533+
NodeInstance,
534534
};

test/common/internet.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const addresses = {
4343
// An accessible IPv4 DNS server
4444
DNS4_SERVER: '8.8.8.8',
4545
// An accessible IPv4 DNS server
46-
DNS6_SERVER: '2001:4860:4860::8888'
46+
DNS6_SERVER: '2001:4860:4860::8888',
4747
};
4848

4949
for (const key of Object.keys(addresses)) {
@@ -54,5 +54,5 @@ for (const key of Object.keys(addresses)) {
5454
}
5555

5656
module.exports = {
57-
addresses
57+
addresses,
5858
};

test/common/measure-memory.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function assertSingleDetailedShape(result) {
4545
function expectExperimentalWarning() {
4646
common.expectWarning(
4747
'ExperimentalWarning',
48-
'vm.measureMemory is an experimental feature and might change at any time'
48+
'vm.measureMemory is an experimental feature and might change at any time',
4949
);
5050
}
5151

5252
module.exports = {
5353
assertSummaryShape,
5454
assertDetailedShape,
5555
assertSingleDetailedShape,
56-
expectExperimentalWarning
56+
expectExperimentalWarning,
5757
};

test/common/ongc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function onGC(obj, gcListener) {
2121
this.gcListener.ongc();
2222
onGcAsyncHook.disable();
2323
}
24-
}
24+
},
2525
}).enable();
2626
onGcAsyncHook.gcListener = gcListener;
2727

test/common/prof.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getHeapProfiles(dir) {
1313

1414
function findFirstFrameInNode(root, func) {
1515
const first = root.children.find(
16-
(child) => child.callFrame.functionName === func
16+
(child) => child.callFrame.functionName === func,
1717
);
1818
if (first) {
1919
return first;
@@ -53,7 +53,7 @@ const TEST_ALLOCATION = kHeapProfInterval * 2;
5353
const env = {
5454
...process.env,
5555
TEST_ALLOCATION,
56-
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
56+
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER',
5757
};
5858

5959
// TODO(joyeecheung): share the fixutres with v8 coverage tests
@@ -63,5 +63,5 @@ module.exports = {
6363
findFirstFrame,
6464
kHeapProfInterval,
6565
TEST_ALLOCATION,
66-
env
66+
env,
6767
};

test/common/report.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function _validateContent(report, fields = []) {
216216
for (let i = 0; i < jsHeapFields.length - 1; i++) {
217217
assert(
218218
Number.isSafeInteger(heap[jsHeapFields[i]]),
219-
`heap.${jsHeapFields[i]} is not a safe integer`
219+
`heap.${jsHeapFields[i]} is not a safe integer`,
220220
);
221221
}
222222
assert(typeof heap.heapSpaces === 'object' && heap.heapSpaces !== null);

test/common/require-as.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const { Worker, isMainThread, workerData } = require('worker_threads');
1717
if (isMainThread) {
1818
if (process.argv[2] === 'worker') {
1919
new Worker(__filename, {
20-
workerData: process.argv[3]
20+
workerData: process.argv[3],
2121
});
2222
return;
2323
}

test/common/shared-lib-util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ function getBinaryPath() {
4646
module.exports = {
4747
addLibraryPath,
4848
getBinaryPath,
49-
getSharedLibPath
49+
getSharedLibPath,
5050
};

test/common/snapshot.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function runWithSnapshot(entry, env) {
4545
env: {
4646
...process.env,
4747
...env,
48-
}
48+
},
4949
});
5050

5151
const stderr = child.stderr.toString();

test/common/tls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TestTLSSocket extends net.Socket {
5252
createClientKeyExchange() {
5353
const encrypted_pre_primary_secret = crypto.publicEncrypt({
5454
key: this.server_cert,
55-
padding: crypto.constants.RSA_PKCS1_PADDING
55+
padding: crypto.constants.RSA_PKCS1_PADDING,
5656
}, this.pre_primary_secret);
5757
const length = Buffer.alloc(2);
5858
length.writeUIntBE(encrypted_pre_primary_secret.length, 0, 2);

test/common/tmpdir.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ function onexit() {
5757

5858
module.exports = {
5959
path: tmpPath,
60-
refresh
60+
refresh,
6161
};

test/common/udppair.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FakeUDPWrap extends EventEmitter {
6767
address = '127.0.0.1',
6868
port = 1337,
6969
},
70-
flags = 0
70+
flags = 0,
7171
} = info;
7272

7373
let familyInt;
@@ -97,5 +97,5 @@ function makeUDPPair() {
9797

9898
module.exports = {
9999
FakeUDPWrap,
100-
makeUDPPair
100+
makeUDPPair,
101101
};

0 commit comments

Comments
 (0)