Skip to content

Commit c26e4c1

Browse files
aduh95danielleadams
authored andcommitted
test: add trailing commas in test/common (#45550)
PR-URL: #45550 Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent f743fe6 commit c26e4c1

23 files changed

+59
-60
lines changed

test/.eslintrc.yaml

Lines changed: 0 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 8 additions & 8 deletions
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
});

0 commit comments

Comments
 (0)