Skip to content

Commit 73da2c4

Browse files
authored
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 ccd3a42 commit 73da2c4

23 files changed

+63
-64
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
constchild=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
constkCpuProfInterval=50;
3939
constenv={
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
constbuf1=crypto.diffieHellman({
3232
privateKey: alicePrivateKey,
33-
publicKey: bobPublicKey
33+
publicKey: bobPublicKey,
3434
});
3535
constbuf2=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
constclasses={
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
constpointeeOffset=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: 9 additions & 9 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: typeofname_or_index==='string' ? name_or_index : null
44+
name: typeofname_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
constcheck=typeofexpectedEdge==='function' ? expectedEdge :
131131
(edge)=>(isEdge(edge,expectedEdge));
132132
consthasChild=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
constrootNodes=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
consthasChild=rootNodes.some(
188-
(node)=>node.edges.some(check)
188+
(node)=>node.edges.some(check),
189189
);
190190
if(!hasChild){
191191
thrownewError(
@@ -221,16 +221,16 @@ function getHeapSnapshotOptionTests(){
221221
// We don't have anything special to test here yet
222222
// because we don't use cppgc or embedder heap tracer.
223223
{edge_name: 'nonNumeric',node_name: 'test'},
224-
]
225-
}]
224+
],
225+
}],
226226
},
227227
{
228228
options: {exposeNumericValues: true},
229229
expected: [{
230230
children: [
231231
{edge_name: 'numeric',node_name: 'smi number'},
232-
]
233-
}]
232+
],
233+
}],
234234
},
235235
];
236236
return{
@@ -245,5 +245,5 @@ function getHeapSnapshotOptionTests(){
245245
module.exports={
246246
recordState,
247247
validateSnapshotNodes,
248-
getHeapSnapshotOptionTests
248+
getHeapSnapshotOptionTests,
249249
};

‎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
constargs=[...flags, ...process.execArgv, ...process.argv.slice(1)];
104104
constoptions={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(newError()).substr(6)
178+
stack: inspect(newError()).substr(6),
179179
};
180180
},
181181
before(){},
@@ -435,7 +435,7 @@ function _mustCallInner(fn, criteria = 1, field){
435435
[field]: criteria,
436436
actual: 0,
437437
stack: inspect(newError()),
438-
name: fn.name||'<anonymous>'
438+
name: fn.name||'<anonymous>',
439439
};
440440

441441
// Add the exit listener only once to avoid listener leak warnings
@@ -478,7 +478,7 @@ function hasMultiLocalhost(){
478478

479479
functionskipIfEslintMissing(){
480480
if(!fs.existsSync(
481-
path.join(__dirname,'..','..','tools','node_modules','eslint')
481+
path.join(__dirname,'..','..','tools','node_modules','eslint'),
482482
)){
483483
skip('missing ESLint');
484484
}
@@ -567,7 +567,7 @@ function mustNotMutateObjectDeep(original){
567567
},
568568
setPrototypeOf(target,prototype){
569569
assert.fail(`Expected no side effects, got set prototype to ${prototype}`);
570-
}
570+
},
571571
};
572572

573573
constproxy=newProxy(original,_mustNotMutateObjectDeepHandler);
@@ -670,7 +670,7 @@ function expectWarning(nameOrMap, expected, code){
670670
if(!catchWarning[warning.name]){
671671
thrownewTypeError(
672672
`"${warning.name}" was triggered without being expected.\n`+
673-
inspect(warning)
673+
inspect(warning),
674674
);
675675
}
676676
catchWarning[warning.name](warning);
@@ -1034,5 +1034,5 @@ module.exports = new Proxy(common,{
10341034
if(!validProperties.has(prop))
10351035
thrownewError(`Using invalid common property: '${prop}'`);
10361036
returnobj[prop];
1037-
}
1037+
},
10381038
});

0 commit comments

Comments
(0)