From e18a25b01878debe9db7fa0ecb6aada3dd31bb84 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 20 Nov 2022 18:44:24 +0100 Subject: [PATCH] test: add missing trailing commas in `test/common` --- test/.eslintrc.yaml | 1 - test/common/benchmark.js | 4 ++-- test/common/child_process.js | 2 +- test/common/cpu-prof.js | 4 ++-- test/common/crypto.js | 6 +++--- test/common/dns.js | 10 +++++----- test/common/heap.js | 18 +++++++++--------- test/common/hijackstdio.js | 2 +- test/common/http2.js | 2 +- test/common/index.js | 16 ++++++++-------- test/common/inspector-helper.js | 6 +++--- test/common/internet.js | 4 ++-- test/common/measure-memory.js | 4 ++-- test/common/ongc.js | 2 +- test/common/prof.js | 6 +++--- test/common/report.js | 2 +- test/common/require-as.js | 2 +- test/common/shared-lib-util.js | 2 +- test/common/snapshot.js | 2 +- test/common/tls.js | 2 +- test/common/tmpdir.js | 2 +- test/common/udppair.js | 4 ++-- test/common/wpt.js | 24 ++++++++++++------------ 23 files changed, 63 insertions(+), 64 deletions(-) diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 7e931cdab977e3..f66b101bc06f3a 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -74,7 +74,6 @@ overrides: - files: - addons/*/*.js - async-hooks/*.js - - common/*.js - es-module/*.js - es-module/*.mjs - internet/*.js diff --git a/test/common/benchmark.js b/test/common/benchmark.js index 88c918766fd76c..d9c1cdc627d994 100644 --- a/test/common/benchmark.js +++ b/test/common/benchmark.js @@ -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}`, ); }); } diff --git a/test/common/child_process.js b/test/common/child_process.js index 6d52e33fcef8d4..799c963a7ed7dc 100644 --- a/test/common/child_process.js +++ b/test/common/child_process.js @@ -45,5 +45,5 @@ module.exports = { cleanupStaleProcess, logAfterTime, kExpiringChildRunTime, - kExpiringParentTimer + kExpiringParentTimer, }; diff --git a/test/common/cpu-prof.js b/test/common/cpu-prof.js index e4bba24037dff9..42f55b35feb738 100644 --- a/test/common/cpu-prof.js +++ b/test/common/cpu-prof.js @@ -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, }; diff --git a/test/common/crypto.js b/test/common/crypto.js index 298badf5c2b8bc..8919b54d1fc632 100644 --- a/test/common/crypto.js +++ b/test/common/crypto.js @@ -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, }; diff --git a/test/common/dns.js b/test/common/dns.js index 0c88d1963f24d3..2ee4bff5182699 100644 --- a/test/common/dns.js +++ b/test/common/dns.js @@ -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, }; diff --git a/test/common/heap.js b/test/common/heap.js index 1c22c274af125a..8eb36a8bfcaf6c 100644 --- a/test/common/heap.js +++ b/test/common/heap.js @@ -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, }; diff --git a/test/common/hijackstdio.js b/test/common/hijackstdio.js index 44e00ed0b11cc2..749d6aab48760a 100644 --- a/test/common/hijackstdio.js +++ b/test/common/hijackstdio.js @@ -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'), }; diff --git a/test/common/http2.js b/test/common/http2.js index baaed492e5a9a3..6df1c29c09eecd 100644 --- a/test/common/http2.js +++ b/test/common/http2.js @@ -144,5 +144,5 @@ module.exports = { PingFrame, kFakeRequestHeaders, kFakeResponseHeaders, - kClientMagic + kClientMagic, }; diff --git a/test/common/index.js b/test/common/index.js index 7a2cbb2133c670..06ea1fee1d9437 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -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 || '' + name: fn.name || '', }; // 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]; - } + }, }); diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index ed3a6c90989664..48c9e5f1d17141 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -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, }; diff --git a/test/common/internet.js b/test/common/internet.js index a15ee9ff69c774..51f18aeb4470c1 100644 --- a/test/common/internet.js +++ b/test/common/internet.js @@ -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, }; diff --git a/test/common/measure-memory.js b/test/common/measure-memory.js index 82b3ca61d14f05..ffde35f285da36 100644 --- a/test/common/measure-memory.js +++ b/test/common/measure-memory.js @@ -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, }; diff --git a/test/common/ongc.js b/test/common/ongc.js index d8e27beb8f0a13..d361c55b51fe30 100644 --- a/test/common/ongc.js +++ b/test/common/ongc.js @@ -21,7 +21,7 @@ function onGC(obj, gcListener) { this.gcListener.ongc(); onGcAsyncHook.disable(); } - } + }, }).enable(); onGcAsyncHook.gcListener = gcListener; diff --git a/test/common/prof.js b/test/common/prof.js index 3eb288be1b9ca3..13047406dc7b7f 100644 --- a/test/common/prof.js +++ b/test/common/prof.js @@ -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, }; diff --git a/test/common/report.js b/test/common/report.js index 12bf30f4d0a499..f30c4d2a75477a 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -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); diff --git a/test/common/require-as.js b/test/common/require-as.js index 9425404fa1416d..bffdc3d83804ff 100644 --- a/test/common/require-as.js +++ b/test/common/require-as.js @@ -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; } diff --git a/test/common/shared-lib-util.js b/test/common/shared-lib-util.js index f40acd783ba0e7..3ecd38791cf481 100644 --- a/test/common/shared-lib-util.js +++ b/test/common/shared-lib-util.js @@ -46,5 +46,5 @@ function getBinaryPath() { module.exports = { addLibraryPath, getBinaryPath, - getSharedLibPath + getSharedLibPath, }; diff --git a/test/common/snapshot.js b/test/common/snapshot.js index 97367c05656c3c..3037ce45639eb9 100644 --- a/test/common/snapshot.js +++ b/test/common/snapshot.js @@ -45,7 +45,7 @@ function runWithSnapshot(entry, env) { env: { ...process.env, ...env, - } + }, }); const stderr = child.stderr.toString(); diff --git a/test/common/tls.js b/test/common/tls.js index 2c91241c3b20b7..d212fbe076072c 100644 --- a/test/common/tls.js +++ b/test/common/tls.js @@ -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); diff --git a/test/common/tmpdir.js b/test/common/tmpdir.js index 8dbb6fda43cb0e..1f2ebb18ee64e0 100644 --- a/test/common/tmpdir.js +++ b/test/common/tmpdir.js @@ -57,5 +57,5 @@ function onexit() { module.exports = { path: tmpPath, - refresh + refresh, }; diff --git a/test/common/udppair.js b/test/common/udppair.js index 6213f4becfd6aa..3f2b0aed78a169 100644 --- a/test/common/udppair.js +++ b/test/common/udppair.js @@ -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, }; diff --git a/test/common/wpt.js b/test/common/wpt.js index b3ec2b369b3dcc..9d6debdb0b87fb 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -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, };