test: add trailing commas in test/common (#45550)

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Antoine du Hamel authored and GitHub committed 2022-11-21 18:38:12 +01:00
1 parent ccd3a42dd9
commit 73da2c426d
23 files changed
+63 -64

No files matched your search

-1
View File
@@ -74,7 +74,6 @@ overrides:
- files:
- addons/*/*.js
- async-hooks/*.js
- common/*.js
- es-module/*.js
- es-module/*.mjs
- internet/*.js
+2 -2
View File
@@ -15,7 +15,7 @@ function runBenchmark(name, env) {
const child = fork(runjs, argv, {
env: mergedEnv,
stdio: ['inherit', 'pipe', 'inherit', 'ipc']
stdio: ['inherit', 'pipe', 'inherit', 'ipc'],
});
child.stdout.setEncoding('utf8');
@@ -35,7 +35,7 @@ function runBenchmark(name, env) {
// get from testing the benchmark file.
assert.ok(
/^(?:\n.+?\n.+?\n)+$/.test(stdout),
`benchmark file not running exactly one configuration in test: ${stdout}`
`benchmark file not running exactly one configuration in test: ${stdout}`,
);
});
}
+1 -1
View File
@@ -45,5 +45,5 @@ module.exports = {
cleanupStaleProcess,
logAfterTime,
kExpiringChildRunTime,
kExpiringParentTimer
kExpiringParentTimer,
};
+2 -2
View File
@@ -38,7 +38,7 @@ function verifyFrames(output, file, suffix) {
const kCpuProfInterval = 50;
const env = {
...process.env,
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER',
};
module.exports = {
@@ -46,5 +46,5 @@ module.exports = {
kCpuProfInterval,
env,
getFrames,
verifyFrames
verifyFrames,
};
+3 -3
View File
@@ -30,11 +30,11 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey },
expectedValue) {
const buf1 = crypto.diffieHellman({
privateKey: alicePrivateKey,
publicKey: bobPublicKey
publicKey: bobPublicKey,
});
const buf2 = crypto.diffieHellman({
privateKey: bobPrivateKey,
publicKey: alicePublicKey
publicKey: alicePublicKey,
});
assert.deepStrictEqual(buf1, buf2);
@@ -44,5 +44,5 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey },
module.exports = {
modp2buf,
testDH
testDH,
};
+5 -5
View File
@@ -13,11 +13,11 @@ const types = {
MX: 15,
TXT: 16,
ANY: 255,
CAA: 257
CAA: 257,
};
const classes = {
IN: 1
IN: 1,
};
// Naïve DNS parser/serializer.
@@ -34,7 +34,7 @@ function readDomainFromPacket(buffer, offset) {
const { nread, domain } = readDomainFromPacket(buffer, offset + length);
return {
nread: 1 + length + nread,
domain: domain ? `${chunk}.${domain}` : chunk
domain: domain ? `${chunk}.${domain}` : chunk,
};
}
// Pointer to another part of the packet.
@@ -43,7 +43,7 @@ function readDomainFromPacket(buffer, offset) {
const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000;
return {
nread: 2,
domain: readDomainFromPacket(buffer, pointeeOffset)
domain: readDomainFromPacket(buffer, pointeeOffset),
};
}
@@ -316,5 +316,5 @@ module.exports = {
parseDNSPacket,
errorLookupMock,
mockedErrorCode,
mockedSysCall
mockedSysCall,
};
+9 -9
View File
@@ -41,7 +41,7 @@ function createJSHeapSnapshot(stream = getHeapSnapshot()) {
type,
to: toNode,
from: fromNode,
name: typeof name_or_index === 'string' ? name_or_index : null
name: typeof name_or_index === 'string' ? name_or_index : null,
};
toNode.incomingEdges.push(edge);
fromNode.outgoingEdges.push(edge);
@@ -130,7 +130,7 @@ class State {
const check = typeof expectedEdge === 'function' ? expectedEdge :
(edge) => (isEdge(edge, expectedEdge));
const hasChild = rootNodes.some(
(node) => node.outgoingEdges.some(check)
(node) => node.outgoingEdges.some(check),
);
// Don't use assert with a custom message here. Otherwise the
// inspection in the message is done eagerly and wastes a lot of CPU
@@ -164,7 +164,7 @@ class State {
// Validate our internal embedded graph representation
validateGraph(rootName, expected, { loose = false } = {}) {
const rootNodes = this.embedderGraph.filter(
(node) => node.name === rootName
(node) => node.name === rootName,
);
if (loose) {
assert(rootNodes.length >= expected.length,
@@ -185,7 +185,7 @@ class State {
// inspection in the message is done eagerly and wastes a lot of CPU
// time.
const hasChild = rootNodes.some(
(node) => node.edges.some(check)
(node) => node.edges.some(check),
);
if (!hasChild) {
throw new Error(
@@ -221,16 +221,16 @@ function getHeapSnapshotOptionTests() {
// We don't have anything special to test here yet
// because we don't use cppgc or embedder heap tracer.
{ edge_name: 'nonNumeric', node_name: 'test' },
]
}]
],
}],
},
{
options: { exposeNumericValues: true },
expected: [{
children: [
{ edge_name: 'numeric', node_name: 'smi number' },
]
}]
],
}],
},
];
return {
@@ -245,5 +245,5 @@ function getHeapSnapshotOptionTests() {
module.exports = {
recordState,
validateSnapshotNodes,
getHeapSnapshotOptionTests
getHeapSnapshotOptionTests,
};
+1 -1
View File
@@ -28,5 +28,5 @@ module.exports = {
hijackStdout: hijackStdWritable.bind(null, 'stdout'),
hijackStderr: hijackStdWritable.bind(null, 'stderr'),
restoreStdout: restoreWritable.bind(null, 'stdout'),
restoreStderr: restoreWritable.bind(null, 'stderr')
restoreStderr: restoreWritable.bind(null, 'stderr'),
};
+1 -1
View File
@@ -144,5 +144,5 @@ module.exports = {
PingFrame,
kFakeRequestHeaders,
kFakeResponseHeaders,
kClientMagic
kClientMagic,
};
+8 -8
View File
@@ -39,7 +39,7 @@ const hasIntl = !!process.config.variables.v8_enable_i18n_support;
const {
atob,
btoa
btoa,
} = require('buffer');
// 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 &&
console.log(
'NOTE: The test started as a child_process using these flags:',
inspect(flags),
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.'
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.',
);
const args = [...flags, ...process.execArgv, ...process.argv.slice(1)];
const options = { encoding: 'utf8', stdio: 'inherit' };
@@ -175,7 +175,7 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
}
initHandles[id] = {
resource,
stack: inspect(new Error()).substr(6)
stack: inspect(new Error()).substr(6),
};
},
before() { },
@@ -435,7 +435,7 @@ function _mustCallInner(fn, criteria = 1, field) {
[field]: criteria,
actual: 0,
stack: inspect(new Error()),
name: fn.name || '<anonymous>'
name: fn.name || '<anonymous>',
};
// Add the exit listener only once to avoid listener leak warnings
@@ -478,7 +478,7 @@ function hasMultiLocalhost() {
function skipIfEslintMissing() {
if (!fs.existsSync(
path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint')
path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint'),
)) {
skip('missing ESLint');
}
@@ -567,7 +567,7 @@ function mustNotMutateObjectDeep(original) {
},
setPrototypeOf(target, prototype) {
assert.fail(`Expected no side effects, got set prototype to ${prototype}`);
}
},
};
const proxy = new Proxy(original, _mustNotMutateObjectDeepHandler);
@@ -670,7 +670,7 @@ function expectWarning(nameOrMap, expected, code) {
if (!catchWarning[warning.name]) {
throw new TypeError(
`"${warning.name}" was triggered without being expected.\n` +
inspect(warning)
inspect(warning),
);
}
catchWarning[warning.name](warning);
@@ -1034,5 +1034,5 @@ module.exports = new Proxy(common, {
if (!validProperties.has(prop))
throw new Error(`Using invalid common property: '${prop}'`);
return obj[prop];
}
},
});
+3 -3
View File
@@ -434,8 +434,8 @@ class NodeInstance extends EventEmitter {
'Connection': 'Upgrade',
'Upgrade': 'websocket',
'Sec-WebSocket-Version': 13,
'Sec-WebSocket-Key': 'key=='
}
'Sec-WebSocket-Key': 'key==',
},
});
}
@@ -530,5 +530,5 @@ function fires(promise, error, timeoutMs) {
}
module.exports = {
NodeInstance
NodeInstance,
};
+2 -2
View File
@@ -43,7 +43,7 @@ const addresses = {
// An accessible IPv4 DNS server
DNS4_SERVER: '8.8.8.8',
// An accessible IPv4 DNS server
DNS6_SERVER: '2001:4860:4860::8888'
DNS6_SERVER: '2001:4860:4860::8888',
};
for (const key of Object.keys(addresses)) {
@@ -54,5 +54,5 @@ for (const key of Object.keys(addresses)) {
}
module.exports = {
addresses
addresses,
};
+2 -2
View File
@@ -45,7 +45,7 @@ function assertSingleDetailedShape(result) {
function expectExperimentalWarning() {
common.expectWarning(
'ExperimentalWarning',
'vm.measureMemory is an experimental feature and might change at any time'
'vm.measureMemory is an experimental feature and might change at any time',
);
}
@@ -53,5 +53,5 @@ module.exports = {
assertSummaryShape,
assertDetailedShape,
assertSingleDetailedShape,
expectExperimentalWarning
expectExperimentalWarning,
};
+1 -1
View File
@@ -21,7 +21,7 @@ function onGC(obj, gcListener) {
this.gcListener.ongc();
onGcAsyncHook.disable();
}
}
},
}).enable();
onGcAsyncHook.gcListener = gcListener;
+3 -3
View File
@@ -13,7 +13,7 @@ function getHeapProfiles(dir) {
function findFirstFrameInNode(root, func) {
const first = root.children.find(
(child) => child.callFrame.functionName === func
(child) => child.callFrame.functionName === func,
);
if (first) {
return first;
@@ -53,7 +53,7 @@ const TEST_ALLOCATION = kHeapProfInterval * 2;
const env = {
...process.env,
TEST_ALLOCATION,
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER',
};
// TODO(joyeecheung): share the fixutres with v8 coverage tests
@@ -63,5 +63,5 @@ module.exports = {
findFirstFrame,
kHeapProfInterval,
TEST_ALLOCATION,
env
env,
};
+1 -1
View File
@@ -216,7 +216,7 @@ function _validateContent(report, fields = []) {
for (let i = 0; i < jsHeapFields.length - 1; i++) {
assert(
Number.isSafeInteger(heap[jsHeapFields[i]]),
`heap.${jsHeapFields[i]} is not a safe integer`
`heap.${jsHeapFields[i]} is not a safe integer`,
);
}
assert(typeof heap.heapSpaces === 'object' && heap.heapSpaces !== null);
+1 -1
View File
@@ -17,7 +17,7 @@ const { Worker, isMainThread, workerData } = require('worker_threads');
if (isMainThread) {
if (process.argv[2] === 'worker') {
new Worker(__filename, {
workerData: process.argv[3]
workerData: process.argv[3],
});
return;
}
+1 -1
View File
@@ -46,5 +46,5 @@ function getBinaryPath() {
module.exports = {
addLibraryPath,
getBinaryPath,
getSharedLibPath
getSharedLibPath,
};
+1 -1
View File
@@ -45,7 +45,7 @@ function runWithSnapshot(entry, env) {
env: {
...process.env,
...env,
}
},
});
const stderr = child.stderr.toString();
+1 -1
View File
@@ -52,7 +52,7 @@ class TestTLSSocket extends net.Socket {
createClientKeyExchange() {
const encrypted_pre_primary_secret = crypto.publicEncrypt({
key: this.server_cert,
padding: crypto.constants.RSA_PKCS1_PADDING
padding: crypto.constants.RSA_PKCS1_PADDING,
}, this.pre_primary_secret);
const length = Buffer.alloc(2);
length.writeUIntBE(encrypted_pre_primary_secret.length, 0, 2);
+1 -1
View File
@@ -57,5 +57,5 @@ function onexit() {
module.exports = {
path: tmpPath,
refresh
refresh,
};
+2 -2
View File
@@ -67,7 +67,7 @@ class FakeUDPWrap extends EventEmitter {
address = '127.0.0.1',
port = 1337,
},
flags = 0
flags = 0,
} = info;
let familyInt;
@@ -97,5 +97,5 @@ function makeUDPPair() {
module.exports = {
FakeUDPWrap,
makeUDPPair
makeUDPPair,
};
+12 -12
View File
@@ -34,7 +34,7 @@ const harnessMock = {
assert_array_equals: assert.deepStrictEqual,
assert_unreached(desc) {
assert.fail(`Reached unreachable code: ${desc}`);
}
},
};
class ResourceLoader {
@@ -46,7 +46,7 @@ class ResourceLoader {
// We need to patch this to load the WebIDL parser
url = url.replace(
'/resources/WebIDLParser.js',
'/resources/webidl2/lib/webidl2.js'
'/resources/webidl2/lib/webidl2.js',
);
const base = path.dirname(from);
return url.startsWith('/') ?
@@ -70,7 +70,7 @@ class ResourceLoader {
return {
ok: true,
json() { return JSON.parse(data.toString()); },
text() { return data.toString(); }
text() { return data.toString(); },
};
});
}
@@ -304,7 +304,7 @@ class WPTRunner {
this.status = new StatusLoader(path);
this.status.load();
this.specMap = new Map(
this.status.specs.map((item) => [item.filename, item])
this.status.specs.map((item) => [item.filename, item]),
);
this.results = {};
@@ -440,7 +440,7 @@ class WPTRunner {
for (const script of meta.script) {
const obj = {
filename: this.resource.toRealFilePath(relativePath, script),
code: this.resource.read(relativePath, script, false)
code: this.resource.read(relativePath, script, false),
};
this.scriptsModifier?.(obj);
scriptsToRun.push(obj);
@@ -449,7 +449,7 @@ class WPTRunner {
// The actual test
const obj = {
code: content,
filename: absolutePath
filename: absolutePath,
};
this.scriptsModifier?.(obj);
scriptsToRun.push(obj);
@@ -494,9 +494,9 @@ class WPTRunner {
status: NODE_UNCAUGHT,
name: 'evaluation in WPTRunner.runJsTests()',
message: err.message,
stack: inspect(err)
stack: inspect(err),
},
kUncaught
kUncaught,
);
this.inProgress.delete(testFileName);
});
@@ -517,7 +517,7 @@ class WPTRunner {
obj[key] = this.results[key];
return obj;
},
{}
{},
), null, 2));
const failures = [];
@@ -691,7 +691,7 @@ class WPTRunner {
name: test.name,
expected,
status: kFail,
reason: test.message || status
reason: test.message || status,
});
}
@@ -702,7 +702,7 @@ class WPTRunner {
console.log(`[SKIPPED] ${joinedReasons}`);
this.addTestResult(filename, {
status: kSkip,
reason: joinedReasons
reason: joinedReasons,
});
}
@@ -753,5 +753,5 @@ class WPTRunner {
module.exports = {
harness: harnessMock,
ResourceLoader,
WPTRunner
WPTRunner,
};