GeezerVison is showing github.com — test: add trailing commas in `test/common` (#45550) · nodejs/node@d6c68ce
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/.eslintrc.yaml -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -74,7 +74,6 @@ overrides: | 74 | 74 | - files: | 75 | 75 | - addons/*/*.js | 76 | 76 | - async-hooks/*.js | 77 | | - - common/*.js | 78 | 77 | - es-module/*.js | 79 | 78 | - es-module/*.mjs | 80 | 79 | - internet/*.js | |
Collapse file Copy file name to clipboardExpand all lines: test/common/benchmark.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ function runBenchmark(name, env) { | 15 | 15 |
| 16 | 16 | const child = fork(runjs, argv, { | 17 | 17 | env: mergedEnv, | 18 | | - stdio: ['inherit', 'pipe', 'inherit', 'ipc'] | | 18 | + stdio: ['inherit', 'pipe', 'inherit', 'ipc'], | 19 | 19 | }); | 20 | 20 | child.stdout.setEncoding('utf8'); | 21 | 21 |
| @@ -35,7 +35,7 @@ function runBenchmark(name, env) { | 35 | 35 | // get from testing the benchmark file. | 36 | 36 | assert.ok( | 37 | 37 | /^(?:\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}`, | 39 | 39 | ); | 40 | 40 | }); | 41 | 41 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/common/child_process.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,5 +45,5 @@ module.exports = { | 45 | 45 | cleanupStaleProcess, | 46 | 46 | logAfterTime, | 47 | 47 | kExpiringChildRunTime, | 48 | | - kExpiringParentTimer | | 48 | + kExpiringParentTimer, | 49 | 49 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/cpu-prof.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,13 +38,13 @@ function verifyFrames(output, file, suffix) { | 38 | 38 | const kCpuProfInterval = 50; | 39 | 39 | const env = { | 40 | 40 | ...process.env, | 41 | | - NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' | | 41 | + NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER', | 42 | 42 | }; | 43 | 43 |
| 44 | 44 | module.exports = { | 45 | 45 | getCpuProfiles, | 46 | 46 | kCpuProfInterval, | 47 | 47 | env, | 48 | 48 | getFrames, | 49 | | - verifyFrames | | 49 | + verifyFrames, | 50 | 50 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/crypto.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,11 +30,11 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey }, | 30 | 30 | expectedValue) { | 31 | 31 | const buf1 = crypto.diffieHellman({ | 32 | 32 | privateKey: alicePrivateKey, | 33 | | - publicKey: bobPublicKey | | 33 | + publicKey: bobPublicKey, | 34 | 34 | }); | 35 | 35 | const buf2 = crypto.diffieHellman({ | 36 | 36 | privateKey: bobPrivateKey, | 37 | | - publicKey: alicePublicKey | | 37 | + publicKey: alicePublicKey, | 38 | 38 | }); | 39 | 39 | assert.deepStrictEqual(buf1, buf2); | 40 | 40 |
| @@ -44,5 +44,5 @@ function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey }, | 44 | 44 |
| 45 | 45 | module.exports = { | 46 | 46 | modp2buf, | 47 | | - testDH | | 47 | + testDH, | 48 | 48 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/dns.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,11 +13,11 @@ const types = { | 13 | 13 | MX: 15, | 14 | 14 | TXT: 16, | 15 | 15 | ANY: 255, | 16 | | - CAA: 257 | | 16 | + CAA: 257, | 17 | 17 | }; | 18 | 18 |
| 19 | 19 | const classes = { | 20 | | - IN: 1 | | 20 | + IN: 1, | 21 | 21 | }; | 22 | 22 |
| 23 | 23 | // Naïve DNS parser/serializer. | @@ -34,7 +34,7 @@ function readDomainFromPacket(buffer, offset) { | 34 | 34 | const { nread, domain } = readDomainFromPacket(buffer, offset + length); | 35 | 35 | return { | 36 | 36 | nread: 1 + length + nread, | 37 | | - domain: domain ? `${chunk}.${domain}` : chunk | | 37 | + domain: domain ? `${chunk}.${domain}` : chunk, | 38 | 38 | }; | 39 | 39 | } | 40 | 40 | // Pointer to another part of the packet. | @@ -43,7 +43,7 @@ function readDomainFromPacket(buffer, offset) { | 43 | 43 | const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000; | 44 | 44 | return { | 45 | 45 | nread: 2, | 46 | | - domain: readDomainFromPacket(buffer, pointeeOffset) | | 46 | + domain: readDomainFromPacket(buffer, pointeeOffset), | 47 | 47 | }; | 48 | 48 | } | 49 | 49 |
| @@ -316,5 +316,5 @@ module.exports = { | 316 | 316 | parseDNSPacket, | 317 | 317 | errorLookupMock, | 318 | 318 | mockedErrorCode, | 319 | | - mockedSysCall | | 319 | + mockedSysCall, | 320 | 320 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/heap.js +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,7 +41,7 @@ function createJSHeapSnapshot(stream = getHeapSnapshot()) { | 41 | 41 | type, | 42 | 42 | to: toNode, | 43 | 43 | from: fromNode, | 44 | | - name: typeof name_or_index === 'string' ? name_or_index : null | | 44 | + name: typeof name_or_index === 'string' ? name_or_index : null, | 45 | 45 | }; | 46 | 46 | toNode.incomingEdges.push(edge); | 47 | 47 | fromNode.outgoingEdges.push(edge); | @@ -130,7 +130,7 @@ class State { | 130 | 130 | const check = typeof expectedEdge === 'function' ? expectedEdge : | 131 | 131 | (edge) => (isEdge(edge, expectedEdge)); | 132 | 132 | const hasChild = rootNodes.some( | 133 | | - (node) => node.outgoingEdges.some(check) | | 133 | + (node) => node.outgoingEdges.some(check), | 134 | 134 | ); | 135 | 135 | // Don't use assert with a custom message here. Otherwise the | 136 | 136 | // inspection in the message is done eagerly and wastes a lot of CPU | @@ -164,7 +164,7 @@ class State { | 164 | 164 | // Validate our internal embedded graph representation | 165 | 165 | validateGraph(rootName, expected, { loose = false } = {}) { | 166 | 166 | const rootNodes = this.embedderGraph.filter( | 167 | | - (node) => node.name === rootName | | 167 | + (node) => node.name === rootName, | 168 | 168 | ); | 169 | 169 | if (loose) { | 170 | 170 | assert(rootNodes.length >= expected.length, | @@ -185,7 +185,7 @@ class State { | 185 | 185 | // inspection in the message is done eagerly and wastes a lot of CPU | 186 | 186 | // time. | 187 | 187 | const hasChild = rootNodes.some( | 188 | | - (node) => node.edges.some(check) | | 188 | + (node) => node.edges.some(check), | 189 | 189 | ); | 190 | 190 | if (!hasChild) { | 191 | 191 | throw new Error( | @@ -221,16 +221,16 @@ function getHeapSnapshotOptionTests() { | 221 | 221 | // We don't have anything special to test here yet | 222 | 222 | // because we don't use cppgc or embedder heap tracer. | 223 | 223 | { edge_name: 'nonNumeric', node_name: 'test' }, | 224 | | - ] | 225 | | - }] | | 224 | + ], | | 225 | + }], | 226 | 226 | }, | 227 | 227 | { | 228 | 228 | options: { exposeNumericValues: true }, | 229 | 229 | expected: [{ | 230 | 230 | children: [ | 231 | 231 | { edge_name: 'numeric', node_name: 'smi number' }, | 232 | | - ] | 233 | | - }] | | 232 | + ], | | 233 | + }], | 234 | 234 | }, | 235 | 235 | ]; | 236 | 236 | return { | @@ -245,5 +245,5 @@ function getHeapSnapshotOptionTests() { | 245 | 245 | module.exports = { | 246 | 246 | recordState, | 247 | 247 | validateSnapshotNodes, | 248 | | - getHeapSnapshotOptionTests | | 248 | + getHeapSnapshotOptionTests, | 249 | 249 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/hijackstdio.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,5 +28,5 @@ module.exports = { | 28 | 28 | hijackStdout: hijackStdWritable.bind(null, 'stdout'), | 29 | 29 | hijackStderr: hijackStdWritable.bind(null, 'stderr'), | 30 | 30 | restoreStdout: restoreWritable.bind(null, 'stdout'), | 31 | | - restoreStderr: restoreWritable.bind(null, 'stderr') | | 31 | + restoreStderr: restoreWritable.bind(null, 'stderr'), | 32 | 32 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/http2.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -144,5 +144,5 @@ module.exports = { | 144 | 144 | PingFrame, | 145 | 145 | kFakeRequestHeaders, | 146 | 146 | kFakeResponseHeaders, | 147 | | - kClientMagic | | 147 | + kClientMagic, | 148 | 148 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/common/index.js +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,7 @@ const hasIntl = !!process.config.variables.v8_enable_i18n_support; | 39 | 39 |
| 40 | 40 | const { | 41 | 41 | atob, | 42 | | - btoa | | 42 | + btoa, | 43 | 43 | } = require('buffer'); | 44 | 44 |
| 45 | 45 | // 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 && | 98 | 98 | console.log( | 99 | 99 | 'NOTE: The test started as a child_process using these flags:', | 100 | 100 | 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.', | 102 | 102 | ); | 103 | 103 | const args = [...flags, ...process.execArgv, ...process.argv.slice(1)]; | 104 | 104 | const options = { encoding: 'utf8', stdio: 'inherit' }; | @@ -175,7 +175,7 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) { | 175 | 175 | } | 176 | 176 | initHandles[id] = { | 177 | 177 | resource, | 178 | | - stack: inspect(new Error()).substr(6) | | 178 | + stack: inspect(new Error()).substr(6), | 179 | 179 | }; | 180 | 180 | }, | 181 | 181 | before() { }, | @@ -435,7 +435,7 @@ function _mustCallInner(fn, criteria = 1, field) { | 435 | 435 | [field]: criteria, | 436 | 436 | actual: 0, | 437 | 437 | stack: inspect(new Error()), | 438 | | - name: fn.name || '<anonymous>' | | 438 | + name: fn.name || '<anonymous>', | 439 | 439 | }; | 440 | 440 |
| 441 | 441 | // Add the exit listener only once to avoid listener leak warnings | @@ -478,7 +478,7 @@ function hasMultiLocalhost() { | 478 | 478 |
| 479 | 479 | function skipIfEslintMissing() { | 480 | 480 | if (!fs.existsSync( | 481 | | - path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint') | | 481 | + path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint'), | 482 | 482 | )) { | 483 | 483 | skip('missing ESLint'); | 484 | 484 | } | @@ -567,7 +567,7 @@ function mustNotMutateObjectDeep(original) { | 567 | 567 | }, | 568 | 568 | setPrototypeOf(target, prototype) { | 569 | 569 | assert.fail(`Expected no side effects, got set prototype to ${prototype}`); | 570 | | - } | | 570 | + }, | 571 | 571 | }; | 572 | 572 |
| 573 | 573 | const proxy = new Proxy(original, _mustNotMutateObjectDeepHandler); | @@ -670,7 +670,7 @@ function expectWarning(nameOrMap, expected, code) { | 670 | 670 | if (!catchWarning[warning.name]) { | 671 | 671 | throw new TypeError( | 672 | 672 | `"${warning.name}" was triggered without being expected.\n` + | 673 | | - inspect(warning) | | 673 | + inspect(warning), | 674 | 674 | ); | 675 | 675 | } | 676 | 676 | catchWarning[warning.name](warning); | @@ -1034,5 +1034,5 @@ module.exports = new Proxy(common, { | 1034 | 1034 | if (!validProperties.has(prop)) | 1035 | 1035 | throw new Error(`Using invalid common property: '${prop}'`); | 1036 | 1036 | return obj[prop]; | 1037 | | - } | | 1037 | + }, | 1038 | 1038 | }); |
|