Skip to content

Commit

Permalink
test: prepare for consistent comma-dangle lint rule
Browse files Browse the repository at this point in the history
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: #37930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
  • Loading branch information
Trott authored and targos committed Sep 4, 2021
1 parent 315eba7 commit a2e4020
Show file tree
Hide file tree
Showing 385 changed files with 879 additions and 864 deletions.
2 changes: 1 addition & 1 deletion test/abort/test-worker-abort-uncaught-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (process.argv[2] === 'child') {
}

const child = spawn(process.execPath, [
'--abort-on-uncaught-exception', __filename, 'child'
'--abort-on-uncaught-exception', __filename, 'child',
]);
child.on('exit', common.mustCall((code, sig) => {
if (common.isWindows) {
Expand Down
2 changes: 1 addition & 1 deletion test/addons/register-signal-handler/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ for (const raiseSignal of [ 'SIGABRT', 'SIGSEGV' ]) {
{ reset: true, count: 1, stderr: [signo], code: 0, signal: null },
{ reset: true, count: 2, stderr: [signo], code: null, signal: raiseSignal },
{ reset: false, count: 1, stderr: [signo], code: 0, signal: null },
{ reset: false, count: 2, stderr: [signo, signo], code: 0, signal: null }
{ reset: false, count: 2, stderr: [signo, signo], code: 0, signal: null },
]) {
// We do not want to generate core files when running this test as an
// addon test. We require this file as an abort test as well, though,
Expand Down
4 changes: 2 additions & 2 deletions test/addons/worker-addon/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ for (const { test, expected } of [
// musl doesn't support unloading, so the output may be missing
// a dtor + ctor pair.
expected: [
'ctor cleanup dtor ctor cleanup dtor '
'ctor cleanup dtor ctor cleanup dtor ',
].concat(libcMayBeMusl ? [
'ctor cleanup cleanup dtor ',
] : [])
Expand All @@ -57,7 +57,7 @@ for (const { test, expected } of [
console.log('spawning test', test);
const proc = child_process.spawnSync(process.execPath, [
__filename,
test
test,
]);
process.stderr.write(proc.stderr.toString());
assert.strictEqual(proc.stderr.toString(), '');
Expand Down
2 changes: 1 addition & 1 deletion test/async-hooks/test-graph.tls-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function onexit() {
{ type: 'TCPCONNECTWRAP',
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
{ type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' }
{ type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' },
]
);
}
10 changes: 5 additions & 5 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ expectWarning('Warning', 'Foobar is really bad');
expectWarning('DeprecationWarning', 'Foobar is deprecated', 'DEP0XXX');

expectWarning('DeprecationWarning', [
'Foobar is deprecated', 'DEP0XXX'
'Foobar is deprecated', 'DEP0XXX',
]);

expectWarning('DeprecationWarning', [
['Foobar is deprecated', 'DEP0XXX'],
['Baz is also deprecated', 'DEP0XX2']
['Baz is also deprecated', 'DEP0XX2'],
]);

expectWarning('DeprecationWarning', {
Expand All @@ -135,7 +135,7 @@ expectWarning({
},
Warning: [
['Multiple array entries are fine', 'SpecialWarningCode'],
['No code is also fine']
['No code is also fine'],
],
SingleEntry: ['This will also work', 'WarningCode'],
SingleString: 'Single string entries without code will also work'
Expand Down Expand Up @@ -667,9 +667,9 @@ validateSnapshotNodes('TLSWRAP', [
children: [
{ name: 'enc_out' },
{ name: 'enc_in' },
{ name: 'TLSWrap' }
{ name: 'TLSWrap' },
]
}
},
]);
```

Expand Down
10 changes: 5 additions & 5 deletions test/common/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function parseDNSPacket(buffer) {
['questions', buffer.readUInt16BE(4)],
['answers', buffer.readUInt16BE(6)],
['authorityAnswers', buffer.readUInt16BE(8)],
['additionalRecords', buffer.readUInt16BE(10)]
['additionalRecords', buffer.readUInt16BE(10)],
];

let offset = 12;
Expand Down Expand Up @@ -185,7 +185,7 @@ function writeDomainName(domain) {
assert(label.length < 64);
return Buffer.concat([
Buffer.from([label.length]),
Buffer.from(label, 'ascii')
Buffer.from(label, 'ascii'),
]);
}).concat([Buffer.alloc(1)]));
}
Expand All @@ -208,7 +208,7 @@ function writeDNSPacket(parsed) {
buffers.push(writeDomainName(q.domain));
buffers.push(new Uint16Array([
types[q.type],
q.cls === undefined ? classes.IN : q.cls
q.cls === undefined ? classes.IN : q.cls,
]));
}

Expand All @@ -221,7 +221,7 @@ function writeDNSPacket(parsed) {
buffers.push(writeDomainName(rr.domain));
buffers.push(new Uint16Array([
types[rr.type],
rr.cls === undefined ? classes.IN : rr.cls
rr.cls === undefined ? classes.IN : rr.cls,
]));
buffers.push(new Int32Array([rr.ttl]));

Expand Down Expand Up @@ -266,7 +266,7 @@ function writeDNSPacket(parsed) {
rdLengthBuf[0] = mname.length + rname.length + 20;
buffers.push(mname, rname);
buffers.push(new Uint32Array([
rr.serial, rr.refresh, rr.retry, rr.expire, rr.minttl
rr.serial, rr.refresh, rr.retry, rr.expire, rr.minttl,
]));
break;
}
Expand Down
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ function getArrayBufferViews(buf) {
Uint32Array,
Float32Array,
Float64Array,
DataView
DataView,
];

for (const type of arrayBufferViews) {
Expand Down
2 changes: 1 addition & 1 deletion test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function fires(promise, error, timeoutMs) {
const timeout = timeoutPromise(error, timeoutMs);
return Promise.race([
onResolvedOrRejected(promise, () => timeout.clear()),
timeout
timeout,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion test/common/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TestTLSSocket extends net.Socket {
createClientHello() {
const compressions = Buffer.from('0100', 'hex'); // null
const msg = addHandshakeHeader(0x01, Buffer.concat([
this.version, this.client_random, this.ciphers, compressions
this.version, this.client_random, this.ciphers, compressions,
]));
this.emit('handshake', msg);
return addRecordHeader(0x16, msg);
Expand Down
28 changes: 14 additions & 14 deletions test/doctool/test-doctool-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const testData = [
name: 'array',
type: 'Array'
}]
}
},
]
}],
type: 'module',
Expand Down Expand Up @@ -113,7 +113,7 @@ const testData = [
{ 'version': 'v4.2.0',
'pr-url': 'https://github.com/nodejs/node/pull/3276',
'description': 'The `error` parameter can now be ' +
'an arrow function.' }
'an arrow function.' },
]
},
desc: '<p>Describe <code>Foobar II</code> in more detail ' +
Expand Down Expand Up @@ -141,11 +141,11 @@ const testData = [
'Describe <code>Something</code> in more detail here.</p>',
type: 'module',
displayName: 'Something'
}
},
],
type: 'module',
displayName: 'Sample Markdown with YAML info'
}
},
]
}
},
Expand All @@ -162,61 +162,61 @@ const testData = [
{
name: 'fullName',
textRaw: '`Fqhqwhgads.fullName`'
}
},
],
classMethods: [
{
name: 'again',
signatures: [
{
params: []
}
},
],
textRaw: 'Static method: `Fhqwhgads.again()`',
type: 'classMethod'
}
},
],
classes: [
{
textRaw: 'Class: `ComeOn`',
type: 'class',
name: 'ComeOn'
}
},
],
ctors: [
{
name: 'Fhqwhgads',
signatures: [
{
params: []
}
},
],
textRaw: 'Constructor: `new Fhqwhgads()`',
type: 'ctor'
}
},
],
methods: [
{
textRaw: '`everybody.to(limit)`',
type: 'method',
name: 'to',
signatures: [{ params: [] }]
}
},
],
events: [
{
textRaw: "Event: `'FHQWHfest'`",
type: 'event',
name: 'FHQWHfest',
params: []
}
},
],
type: 'module',
displayName: 'Fhqwhgads'
}
},
]
}
}
},
];

testData.forEach((item) => {
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ strictEqual(secret.ofLife, 42);
// Test warning message
const child = spawn(process.execPath, [
'--experimental-json-modules',
path('/es-modules/json-modules.mjs')
path('/es-modules/json-modules.mjs'),
]);

let stderr = '';
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-nowarn-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { spawn } from 'child_process';

const child = spawn(process.execPath, [
'--experimental-import-meta-resolve',
path('/es-modules/import-resolve-exports.mjs')
path('/es-modules/import-resolve-exports.mjs'),
]);

let stderr = '';
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-preserve-symlinks-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function doTest(flags, done) {
spawn(process.execPath,
flags.concat([
'--preserve-symlinks',
'--preserve-symlinks-main', entry_link_absolute_path
'--preserve-symlinks-main', entry_link_absolute_path,
]),
{ stdio: 'inherit' }).on('exit', (code) => {
assert.strictEqual(code, 0);
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const { spawn } = require('child_process');

const child = spawn(process.execPath, [
'--interactive'
'--interactive',
]);
child.stdin.end(`
import('fs').then(
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-specifiers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ main().catch(mustNotCall);
);
[
'--experimental-specifier-resolution',
'--es-module-specifier-resolution'
'--es-module-specifier-resolution',
].forEach((option) => {
spawn(process.execPath,
[`${option}=node`, modulePath],
Expand Down
4 changes: 2 additions & 2 deletions test/es-module/test-esm-symlink-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const symlinks = [
target: fixtures.path('es-modules/package-without-type/index.js'),
prints: 'package-without-type',
errorsWithPreserveSymlinksMain: false
}
},
];

symlinks.forEach((symlink) => {
Expand All @@ -49,7 +49,7 @@ symlinks.forEach((symlink) => {

const flags = [
'',
'--preserve-symlinks-main'
'--preserve-symlinks-main',
];
flags.forEach((nodeOptions) => {
const opts = {
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ strictEqual(addImported(1), 43);
// Test warning message
const child = spawn(process.execPath, [
'--experimental-wasm-modules',
path('/es-modules/wasm-modules.mjs')
path('/es-modules/wasm-modules.mjs'),
]);

let stderr = '';
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dgram-multicast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const messages = [
Buffer.from('First message to send'),
Buffer.from('Second message to send'),
Buffer.from('Third message to send'),
Buffer.from('Fourth message to send')
Buffer.from('Fourth message to send'),
];
const workers = {};
const listeners = 3;
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dgram-multicast-set-interface-lo.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const messages = [
{ tail: 'Fourth message to send', mcast: MULTICASTS[FAM][2] },
{ tail: 'Fifth message to send', mcast: MULTICASTS[FAM][1], rcv: true },
{ tail: 'Sixth message to send', mcast: MULTICASTS[FAM][2], rcv: true,
newAddr: LOOPBACK[FAM] }
newAddr: LOOPBACK[FAM] },
];


Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dgram-multicast-ssm-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const messages = [
Buffer.from('First message to send'),
Buffer.from('Second message to send'),
Buffer.from('Third message to send'),
Buffer.from('Fourth message to send')
Buffer.from('Fourth message to send'),
];
const workers = {};
const listeners = 3;
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dgram-multicast-ssmv6-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const messages = [
Buffer.from('First message to send'),
Buffer.from('Second message to send'),
Buffer.from('Third message to send'),
Buffer.from('Fourth message to send')
Buffer.from('Fourth message to send'),
];
const workers = {};
const listeners = 3;
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dns-cares-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const methods = [
'resolveSrv',
'resolvePtr',
'resolveNaptr',
'resolveSoa'
'resolveSoa',
];

methods.forEach(function(method) {
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-trace-events-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ for (const tr in tests) {
[ '--trace-event-categories',
'node.dns.native',
'-e',
test_str + tests[tr]
test_str + tests[tr],
],
{ encoding: 'utf8' });

Expand Down
4 changes: 2 additions & 2 deletions test/js-native-api/test_array/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const array = [
[
'world',
'node',
'abi'
]
'abi',
],
];

assert.throws(
Expand Down
Loading

0 comments on commit a2e4020

Please sign in to comment.