test: prepare for consistent comma-dangle lint rule

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: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
This commit is contained in:
Rich Trott 2021-03-26 08:51:08 -07:00
parent f0bf373176
commit 330f25ef82
407 changed files with 962 additions and 962 deletions

View file

@ -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) {

View file

@ -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,

View file

@ -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 ',
] : [])
@ -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(), '');

View file

@ -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' },
]
);
}

View file

@ -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', {
@ -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'
@ -665,9 +665,9 @@ validateSnapshotNodes('TLSWRAP', [
children: [
{ name: 'enc_out' },
{ name: 'enc_in' },
{ name: 'TLSWrap' }
{ name: 'TLSWrap' },
]
}
},
]);
```

View file

@ -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;
@ -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)]));
}
@ -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,
]));
}
@ -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]));
@ -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;
}

View file

@ -612,7 +612,7 @@ function getArrayBufferViews(buf) {
Uint32Array,
Float32Array,
Float64Array,
DataView
DataView,
];
for (const type of arrayBufferViews) {

View file

@ -515,7 +515,7 @@ function fires(promise, error, timeoutMs) {
const timeout = timeoutPromise(error, timeoutMs);
return Promise.race([
onResolvedOrRejected(promise, () => timeout.clear()),
timeout
timeout,
]);
}

View file

@ -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);

View file

@ -79,7 +79,7 @@ const testData = [
name: 'array',
type: 'Array'
}]
}
},
]
}],
type: 'module',
@ -121,7 +121,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 ' +
@ -149,11 +149,11 @@ const testData = [
'Describe <code>Something</code> in more detail here.</p>',
type: 'module',
displayName: 'Something'
}
},
],
type: 'module',
displayName: 'Sample Markdown with YAML info'
}
},
]
}
},
@ -170,7 +170,7 @@ const testData = [
{
name: 'fullName',
textRaw: '`Fqhqwhgads.fullName`'
}
},
],
classMethods: [
{
@ -178,18 +178,18 @@ const testData = [
signatures: [
{
params: []
}
},
],
textRaw: 'Static method: `Fhqwhgads.again()`',
type: 'classMethod'
}
},
],
classes: [
{
textRaw: 'Class: `ComeOn`',
type: 'class',
name: 'ComeOn'
}
},
],
ctors: [
{
@ -197,11 +197,11 @@ const testData = [
signatures: [
{
params: []
}
},
],
textRaw: 'Constructor: `new Fhqwhgads()`',
type: 'ctor'
}
},
],
methods: [
{
@ -209,7 +209,7 @@ const testData = [
type: 'method',
name: 'to',
signatures: [{ params: [] }]
}
},
],
events: [
{
@ -217,14 +217,14 @@ const testData = [
type: 'event',
name: 'FHQWHfest',
params: []
}
},
],
type: 'module',
displayName: 'Fhqwhgads'
}
},
]
}
}
},
];
testData.forEach((item) => {

View file

@ -8,7 +8,7 @@ const expectedWarnings = [
'"./fallbackdir/"',
'"./subpath/"',
'no_exports',
'default_index'
'default_index',
];
process.addListener('warning', mustCall((warning) => {

View file

@ -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 = '';

View file

@ -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 = '';

View file

@ -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);

View file

@ -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(

View file

@ -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],

View file

@ -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) => {
@ -49,7 +49,7 @@ symlinks.forEach((symlink) => {
const flags = [
'',
'--preserve-symlinks-main'
'--preserve-symlinks-main',
];
flags.forEach((nodeOptions) => {
const opts = {

View file

@ -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 = '';

View file

@ -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;

View file

@ -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] },
];

View file

@ -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;

View file

@ -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;

View file

@ -15,7 +15,7 @@ const methods = [
'resolveSrv',
'resolvePtr',
'resolveNaptr',
'resolveSoa'
'resolveSoa',
];
methods.forEach(function(method) {

View file

@ -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' });

View file

@ -15,8 +15,8 @@ const array = [
[
'world',
'node',
'abi'
]
'abi',
],
];
assert.throws(

View file

@ -26,7 +26,7 @@ if (process.argv[2] === 'child') {
const assert = require('assert');
const { spawnSync } = require('child_process');
const child = spawnSync(process.execPath, [
'--expose-gc', __filename, 'child'
'--expose-gc', __filename, 'child',
]);
assert.strictEqual(child.signal, null);
assert.match(child.stderr.toString(), /Error during Finalize/m);

View file

@ -42,7 +42,7 @@ assert.strictEqual(test_general.testGetVersion(), 8);
new Object(),
true,
undefined,
Symbol()
Symbol(),
].forEach((val) => {
assert.strictEqual(test_general.testNapiTypeof(val), typeof val);
});

View file

@ -9,7 +9,7 @@ const test_object = require(`./build/${common.buildType}/test_object`);
const object = {
hello: 'world',
array: [
1, 94, 'str', 12.321, { test: 'obj in arr' }
1, 94, 'str', 12.321, { test: 'obj in arr' },
],
newObject: {
test: 'obj in obj'

View file

@ -64,5 +64,5 @@ console.log([
'_____________________________________________1950',
'_____________________________________________2000',
'_____________________________________________2050',
'_____________________________________________2100'
'_____________________________________________2100',
].join('\n'));

View file

@ -27,7 +27,7 @@ main();
{
const child = spawnSync(process.execPath, [
'-e',
main
main,
], {
env: { ...process.env }
});

View file

@ -29,7 +29,7 @@ main();
'--input-type',
'module',
'-e',
main
main,
], {
env: { ...process.env }
});

View file

@ -8,7 +8,7 @@ const { fixturesDir } = require('../common/fixtures');
spawn(
process.execPath,
[
join(fixturesDir, 'esm_loader_not_found_cjs_hint_bare.mjs')
join(fixturesDir, 'esm_loader_not_found_cjs_hint_bare.mjs'),
],
{
cwd: fixturesDir,

View file

@ -55,6 +55,6 @@ process.on('exit', () => {
{ type: 'before', id: testId },
{ type: 'complete' },
{ type: 'after', id: testId },
{ type: 'destroy', id: testId }
{ type: 'destroy', id: testId },
]);
});

View file

@ -44,7 +44,7 @@ function test(shouldFail, resources) {
const { status, stdout, stderr } = spawnSync(process.execPath, [
'--experimental-policy',
policyFilepath,
depFilepath
depFilepath,
]);
console.log(stdout.toString(), stderr.toString());

View file

@ -92,7 +92,7 @@ const { ok, strictEqual, throws } = require('assert');
NaN,
true,
'AbortController',
Object.create(AbortController.prototype)
Object.create(AbortController.prototype),
];
for (const badController of badAbortControllers) {
throws(
@ -123,7 +123,7 @@ const { ok, strictEqual, throws } = require('assert');
NaN,
true,
'AbortSignal',
Object.create(AbortSignal.prototype)
Object.create(AbortSignal.prototype),
];
for (const badSignal of badAbortSignals) {
throws(

View file

@ -164,7 +164,7 @@ assert.throws(
new Int32Array([1]), // Int32Array
new Uint32Array([1]), // Uint32Array
Buffer.from([1]), // Uint8Array
(function() { return arguments; })(1)
(function() { return arguments; })(1),
]);
for (const a of similar) {

View file

@ -25,12 +25,12 @@ const equalArrayPairs = [
[new Uint16Array([1, 2, 3, 4]).subarray(1), new Uint16Array([2, 3, 4])],
[new Uint32Array([1, 2, 3, 4]).subarray(1, 3), new Uint32Array([2, 3])],
[new ArrayBuffer(3), new ArrayBuffer(3)],
[new SharedArrayBuffer(3), new SharedArrayBuffer(3)]
[new SharedArrayBuffer(3), new SharedArrayBuffer(3)],
];
const looseEqualArrayPairs = [
[new Float32Array([+0.0]), new Float32Array([-0.0])],
[new Float64Array([+0.0]), new Float64Array([-0.0])]
[new Float64Array([+0.0]), new Float64Array([-0.0])],
];
const notEqualArrayPairs = [
@ -52,15 +52,15 @@ const notEqualArrayPairs = [
[new Uint8Array([1, 2, 3]).buffer, new Uint8Array([4, 5, 6]).buffer],
[
new Uint8Array(new SharedArrayBuffer(3)).fill(1).buffer,
new Uint8Array(new SharedArrayBuffer(3)).fill(2).buffer
new Uint8Array(new SharedArrayBuffer(3)).fill(2).buffer,
],
[new ArrayBuffer(2), new ArrayBuffer(3)],
[new SharedArrayBuffer(2), new SharedArrayBuffer(3)],
[new ArrayBuffer(2), new SharedArrayBuffer(3)],
[
new Uint8Array(new ArrayBuffer(3)).fill(1).buffer,
new Uint8Array(new SharedArrayBuffer(3)).fill(2).buffer
]
new Uint8Array(new SharedArrayBuffer(3)).fill(2).buffer,
],
];
equalArrayPairs.forEach((arrayPair) => {

View file

@ -592,7 +592,7 @@ a.throws(
'...',
' 1,',
' 1',
' ]'
' ]',
].join('\n');
assert.throws(
() => assert.deepEqual(
@ -613,7 +613,7 @@ a.throws(
' 1,',
' 1,',
' 1',
' ]'
' ]',
].join('\n');
assert.throws(
() => assert.deepEqual(
@ -634,7 +634,7 @@ a.throws(
' 0,',
'+ 1,',
' 1',
' ]'
' ]',
].join('\n');
assert.throws(
() => assert.deepEqual(
@ -665,7 +665,7 @@ a.throws(
'+ 1,',
' 2,',
' 1',
' ]'
' ]',
].join('\n');
assert.throws(
() => assert.deepEqual([1, 2, 1], [2, 1]),
@ -946,7 +946,7 @@ assert.throws(
[
1,
false,
Symbol()
Symbol(),
].forEach((input) => {
assert.throws(
() => assert.throws(() => {}, input),

View file

@ -29,5 +29,5 @@ function test(obj) {
[
constants, constants.crypto, constants.fs, constants.os, constants.trace,
constants.zlib, constants.os.dlopen, constants.os.errno, constants.os.signals
constants.zlib, constants.os.dlopen, constants.os.errno, constants.os.signals,
].forEach(test);

View file

@ -100,7 +100,7 @@ assert.throws(() => new Blob({}), {
'e',
'l',
'lo',
Buffer.from('world')
Buffer.from('world'),
]);
assert.strictEqual(b.size, 10);
b.text().then(common.mustCall((text) => {

View file

@ -107,7 +107,7 @@ const util = require('util');
const rulesCheck = [
'Subnet: IPv6 8592:757c:efae:4e45::/64',
'Range: IPv4 10.0.0.1-10.0.0.10',
'Address: IPv4 1.1.1.1'
'Address: IPv4 1.1.1.1',
];
assert.deepStrictEqual(blockList.rules, rulesCheck);
console.log(blockList);

View file

@ -20,7 +20,7 @@ for (const { length, expectOnHeap } of tests) {
new Float32Array(length / 4),
new Float64Array(length / 8),
Buffer.alloc(length),
Buffer.allocUnsafeSlow(length)
Buffer.allocUnsafeSlow(length),
// Buffer.allocUnsafe() is missing because it may use pooled allocations.
];

View file

@ -9,7 +9,7 @@ const vm = require('vm');
[32, 'latin1'],
[NaN, 'utf8'],
[{}, 'latin1'],
[]
[],
].forEach((args) => {
assert.throws(
() => Buffer.byteLength(...args),

View file

@ -18,7 +18,7 @@ const allocators = [
SlowBuffer,
Buffer.alloc,
Buffer.allocUnsafe,
Buffer.allocUnsafeSlow
Buffer.allocUnsafeSlow,
];
for (const allocator of allocators) {
for (const size of sizes) {

View file

@ -205,7 +205,7 @@ assert.throws(
[
['a', 0, 0, NaN],
['a', 0, 0, false]
['a', 0, 0, false],
].forEach((args) => {
assert.throws(
() => buf1.fill(...args),

View file

@ -47,7 +47,7 @@ deepStrictEqual(
5n,
(one, two, three) => {},
undefined,
null
null,
].forEach((input) => {
const errObj = {
code: 'ERR_INVALID_ARG_TYPE',

View file

@ -275,7 +275,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
[
() => { },
{},
[]
[],
].forEach((val) => {
assert.throws(
() => b.includes(val),

View file

@ -350,7 +350,7 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1);
[
() => {},
{},
[]
[],
].forEach((val) => {
assert.throws(
() => b.indexOf(val),

View file

@ -15,7 +15,7 @@ const assert = require('assert');
'ucs2',
'ucs-2',
'utf16le',
'utf-16le'
'utf-16le',
].forEach((enc) => {
assert.strictEqual(Buffer.isEncoding(enc), true);
});
@ -32,7 +32,7 @@ const assert = require('assert');
[],
1,
0,
-1
-1,
].forEach((enc) => {
assert.strictEqual(Buffer.isEncoding(enc), false);
});

View file

@ -58,5 +58,5 @@ assert.deepStrictEqual(arr, [
[1, 2],
[2, 3],
[3, 4],
[4, 5]
[4, 5],
]);

View file

@ -59,7 +59,7 @@ const expectedSameBufs = [
[buf.slice('-10', '-5'), Buffer.from('01234', 'utf8')],
[buf.slice('-10', '-0'), Buffer.from('', 'utf8')],
[buf.slice('111'), Buffer.from('', 'utf8')],
[buf.slice('0', '-111'), Buffer.from('', 'utf8')]
[buf.slice('0', '-111'), Buffer.from('', 'utf8')],
];
for (let i = 0, s = buf.toString(); i < buf.length; ++i) {
@ -114,13 +114,13 @@ assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0);
{
const buf = Buffer.from([
1, 29, 0, 0, 1, 143, 216, 162, 92, 254, 248, 63, 0,
0, 0, 18, 184, 6, 0, 175, 29, 0, 8, 11, 1, 0, 0
0, 0, 18, 184, 6, 0, 175, 29, 0, 8, 11, 1, 0, 0,
]);
const chunk1 = Buffer.from([
1, 29, 0, 0, 1, 143, 216, 162, 92, 254, 248, 63, 0
1, 29, 0, 0, 1, 143, 216, 162, 92, 254, 248, 63, 0,
]);
const chunk2 = Buffer.from([
0, 0, 18, 184, 6, 0, 175, 29, 0, 8, 11, 1, 0, 0
0, 0, 18, 184, 6, 0, 175, 29, 0, 8, 11, 1, 0, 0,
]);
const middle = buf.length / 2;

View file

@ -24,7 +24,7 @@ const resultMap = new Map([
['utf16le', Buffer.from([102, 0, 111, 0, 111, 0, 0, 0, 0])],
['base64', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
['base64url', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
['hex', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])]
['hex', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
]);
// utf8, ucs2, ascii, latin1, utf16le

View file

@ -11,35 +11,35 @@ buffer.writeDoubleBE(2.225073858507201e-308, 0);
buffer.writeDoubleLE(2.225073858507201e-308, 8);
assert.ok(buffer.equals(new Uint8Array([
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00,
])));
buffer.writeDoubleBE(1.0000000000000004, 0);
buffer.writeDoubleLE(1.0000000000000004, 8);
assert.ok(buffer.equals(new Uint8Array([
0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
])));
buffer.writeDoubleBE(-2, 0);
buffer.writeDoubleLE(-2, 8);
assert.ok(buffer.equals(new Uint8Array([
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
])));
buffer.writeDoubleBE(1.7976931348623157e+308, 0);
buffer.writeDoubleLE(1.7976931348623157e+308, 8);
assert.ok(buffer.equals(new Uint8Array([
0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f,
])));
buffer.writeDoubleBE(0 * -1, 0);
buffer.writeDoubleLE(0 * -1, 8);
assert.ok(buffer.equals(new Uint8Array([
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
])));
buffer.writeDoubleBE(Infinity, 0);
@ -47,7 +47,7 @@ buffer.writeDoubleLE(Infinity, 8);
assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7F
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7F,
])));
assert.strictEqual(buffer.readDoubleBE(0), Infinity);
@ -58,7 +58,7 @@ buffer.writeDoubleLE(-Infinity, 8);
assert.ok(buffer.equals(new Uint8Array([
0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF,
])));
assert.strictEqual(buffer.readDoubleBE(0), -Infinity);
@ -72,12 +72,12 @@ buffer.writeDoubleLE(NaN, 8);
if (buffer[1] === 0xF7) {
assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F,
])));
} else {
assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F,
])));
}

View file

@ -107,32 +107,32 @@ const errorOutOfBounds = {
buffer.writeInt32BE(0x23, 0);
buffer.writeInt32LE(0x23, 4);
assert.ok(buffer.equals(new Uint8Array([
0x00, 0x00, 0x00, 0x23, 0x23, 0x00, 0x00, 0x00
0x00, 0x00, 0x00, 0x23, 0x23, 0x00, 0x00, 0x00,
])));
buffer.writeInt32BE(-5, 0);
buffer.writeInt32LE(-5, 4);
assert.ok(buffer.equals(new Uint8Array([
0xff, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xff
0xff, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xff,
])));
buffer.writeInt32BE(-805306713, 0);
buffer.writeInt32LE(-805306713, 4);
assert.ok(buffer.equals(new Uint8Array([
0xcf, 0xff, 0xfe, 0xa7, 0xa7, 0xfe, 0xff, 0xcf
0xcf, 0xff, 0xfe, 0xa7, 0xa7, 0xfe, 0xff, 0xcf,
])));
/* Make sure we handle min/max correctly */
buffer.writeInt32BE(0x7fffffff, 0);
buffer.writeInt32BE(-0x80000000, 4);
assert.ok(buffer.equals(new Uint8Array([
0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00
0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00,
])));
buffer.writeInt32LE(0x7fffffff, 0);
buffer.writeInt32LE(-0x80000000, 4);
assert.ok(buffer.equals(new Uint8Array([
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x80
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x80,
])));
['writeInt32BE', 'writeInt32LE'].forEach((fn) => {
@ -168,12 +168,12 @@ const errorOutOfBounds = {
const buffer = Buffer.allocUnsafe(6);
buffer.writeIntBE(value, 0, 6);
assert.ok(buffer.equals(new Uint8Array([
0x12, 0x34, 0x56, 0x78, 0x90, 0xab
0x12, 0x34, 0x56, 0x78, 0x90, 0xab,
])));
buffer.writeIntLE(value, 0, 6);
assert.ok(buffer.equals(new Uint8Array([
0xab, 0x90, 0x78, 0x56, 0x34, 0x12
0xab, 0x90, 0x78, 0x56, 0x34, 0x12,
])));
}

View file

@ -24,7 +24,7 @@ for (let i = 0; i < 50; i++) {
Buffer.allocUnsafe(20),
SlowBuffer(20),
Buffer(20),
new SlowBuffer(20)
new SlowBuffer(20),
];
for (const buf of bufs) {
assert(isZeroFilled(buf));

View file

@ -8,7 +8,7 @@ const assert = require('assert');
const spawn = require('child_process').spawn;
const child = spawn(process.argv[0], [
fixtures.path('GH-1899-output.js')
fixtures.path('GH-1899-output.js'),
]);
let output = '';

View file

@ -67,7 +67,7 @@ if (common.isWindows) {
'where',
`commandline like '%${basename}%child'`,
'delete',
'/nointeractive'
'/nointeractive',
]);
});
}

View file

@ -12,7 +12,7 @@ const msgOutBuf = Buffer.from(`${msgOut}\n`);
const args = [
'-e',
`console.log("${msgOut}");`
`console.log("${msgOut}");`,
];
// Verify that an error is returned if maxBuffer is surpassed.

View file

@ -12,7 +12,7 @@ const msgOutBuf = Buffer.from(`${msgOut}\n`);
const args = [
'-e',
`"console.log('${msgOut}')";`
`"console.log('${msgOut}')";`,
];
// Verify that an error is returned if maxBuffer is surpassed.

View file

@ -19,7 +19,7 @@ const expectedEnv = { foo: 'bar' };
[],
{},
() => {},
Symbol('t')
Symbol('t'),
];
invalidModulePath.forEach((modulePath) => {
assert.throws(() => fork(modulePath), {
@ -46,7 +46,7 @@ const expectedEnv = { foo: 'bar' };
0,
true,
() => {},
Symbol('t')
Symbol('t'),
];
invalidSecondArgs.forEach((arg) => {
assert.throws(
@ -89,7 +89,7 @@ const expectedEnv = { foo: 'bar' };
0,
true,
() => {},
Symbol('t')
Symbol('t'),
];
invalidThirdArgs.forEach((arg) => {
assert.throws(

View file

@ -37,7 +37,7 @@ function primary() {
// spawn() can only create one IPC channel so we use stdin/stdout as an
// ad-hoc command channel.
const proc = spawn(process.execPath, [
'--expose-internals', __filename, 'worker'
'--expose-internals', __filename, 'worker',
], {
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
});

View file

@ -35,7 +35,7 @@ const msgErrBuf = Buffer.from(`${msgErr}\n`);
const args = [
'-e',
`console.log("${msgOut}"); console.error("${msgErr}");`
`console.log("${msgOut}"); console.error("${msgErr}");`,
];
let ret;

View file

@ -12,7 +12,7 @@ const msgOutBuf = Buffer.from(`${msgOut}\n`);
const args = [
'-e',
`console.log("${msgOut}");`
`console.log("${msgOut}");`,
];
// Verify that an error is returned if maxBuffer is surpassed.

View file

@ -61,7 +61,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
const stringifiedDefault = [
null,
retDefault.stdout.toString(),
retDefault.stderr.toString()
retDefault.stderr.toString(),
];
assert.deepStrictEqual(retUTF8.output, stringifiedDefault);
}

View file

@ -50,7 +50,7 @@ if (common.isMainThread) {
stdio: [
{ type: 'fd', fd: 0 },
{ type: 'fd', fd: 1 },
{ type: 'fd', fd: 2 }
{ type: 'fd', fd: 2 },
],
ipc: undefined,
ipcFd: undefined

View file

@ -7,7 +7,7 @@ const { spawnSync } = require('child_process');
assert.strictEqual(spawnSync(process.execPath, [
'--max-http-header-size=1234',
'--max-http-header-size=5678',
'-p', 'http.maxHeaderSize'
'-p', 'http.maxHeaderSize',
], {
encoding: 'utf8'
}).stdout.trim(), '5678');
@ -15,7 +15,7 @@ assert.strictEqual(spawnSync(process.execPath, [
// The command line takes precedence over NODE_OPTIONS:
assert.strictEqual(spawnSync(process.execPath, [
'--max-http-header-size=5678',
'-p', 'http.maxHeaderSize'
'-p', 'http.maxHeaderSize',
], {
encoding: 'utf8',
env: { ...process.env, NODE_OPTIONS: '--max-http-header-size=1234' }

View file

@ -9,7 +9,7 @@ const node = process.execPath;
// Test both sets of arguments that check syntax
const syntaxArgs = [
'-c',
'--check'
'--check',
];
// Match on the name of the `Error` but not the message as it is different

View file

@ -9,7 +9,7 @@ const node = process.execPath;
// Test both sets of arguments that check syntax
const syntaxArgs = [
'-c',
'--check'
'--check',
];
// Should not execute code piped from stdin with --check.

View file

@ -53,7 +53,7 @@ if (cluster.isWorker) {
worker_emitExit: [1, "the worker did not emit 'exit'"],
worker_state: ['disconnected', 'the worker state is incorrect'],
worker_exitedAfterDisconnect: [
false, 'the .exitedAfterDisconnect flag is incorrect'
false, 'the .exitedAfterDisconnect flag is incorrect',
],
worker_died: [true, 'the worker is still running'],
worker_exitCode: [EXIT_CODE, 'the worker exited w/ incorrect exitCode'],

View file

@ -19,7 +19,7 @@ const failFixtures = [
[
fixtures.path('failcounter.js'),
'Mismatched <anonymous> function calls. Expected exactly 1, actual 0.',
]
],
];
for (const p of failFixtures) {

View file

@ -91,11 +91,11 @@ fnAtLeast2Called3();
const failFixtures = [
[
fixtures.path('failmustcall1.js'),
'Mismatched <anonymous> function calls. Expected exactly 2, actual 1.'
'Mismatched <anonymous> function calls. Expected exactly 2, actual 1.',
], [
fixtures.path('failmustcall2.js'),
'Mismatched <anonymous> function calls. Expected at least 2, actual 1.'
]
'Mismatched <anonymous> function calls. Expected at least 2, actual 1.',
],
];
for (const p of failFixtures) {
const [file, expected] = p;

View file

@ -10,7 +10,7 @@ function check(isTTY, colorMode, expectedColorMode, inspectOptions) {
1,
{ a: 2 },
[ 'foo' ],
{ '\\a': '\\bar' }
{ '\\a': '\\bar' },
];
let i = 0;

View file

@ -49,7 +49,7 @@ common.expectWarning(
['No such label \'default\' for console.timeLog()'],
['No such label \'default\' for console.timeEnd()'],
['Label \'default\' already exists for console.time()'],
['Label \'test\' already exists for console.time()']
['Label \'test\' already exists for console.time()'],
]
);
@ -216,7 +216,7 @@ console.timeEnd('label3');
assert.strictEqual(console._times.size, timesMapSize);
const expectedStrings = [
'foo', 'foo bar', 'foo bar hop', "{ slashes: '\\\\\\\\' }", 'inspect'
'foo', 'foo bar', 'foo bar hop', "{ slashes: '\\\\\\\\' }", 'inspect',
];
for (const expected of expectedStrings) {

View file

@ -69,12 +69,12 @@ const expectedWarnings = common.hasFipsCrypto ?
['Use Cipheriv for counter mode of aes-256-ccm'],
['Use Cipheriv for counter mode of aes-256-ccm'],
['Use Cipheriv for counter mode of aes-256-ccm'],
['Use Cipheriv for counter mode of aes-256-ccm']
['Use Cipheriv for counter mode of aes-256-ccm'],
];
const expectedDeprecationWarnings = [
['crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'],
['crypto.createCipher is deprecated.', 'DEP0106']
['crypto.createCipher is deprecated.', 'DEP0106'],
];
common.expectWarning({
@ -311,7 +311,7 @@ for (const test of TEST_CASES) {
decipher.setAuthTag(Buffer.from('445352d3ff85cf94', 'hex'));
const text = Buffer.concat([
decipher.update('3a2a3647', 'hex'),
decipher.final()
decipher.final(),
]);
assert.strictEqual(text.toString('utf8'), 'node');
}
@ -612,7 +612,7 @@ for (const test of TEST_CASES) {
// Decryption should still work.
const plaintext = Buffer.concat([
decipher.update(ciphertext),
decipher.final()
decipher.final(),
]);
assert(plain.equals(plaintext));
}

View file

@ -214,7 +214,7 @@ assert.throws(function() {
'20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de04460' +
'65c97440fa8c6a58'
}
}
},
];
for (const testCase of rfc4231) {
@ -286,7 +286,7 @@ assert.throws(function() {
'Test Using Larger Than Block-Size Key and Larger Than One ' +
'Block-Size Data',
hmac: '6f630fad67cda0ee1fb1f562db3aa53e'
}
},
];
const rfc2202_sha1 = [
{
@ -340,7 +340,7 @@ assert.throws(function() {
'Test Using Larger Than Block-Size Key and Larger Than One ' +
'Block-Size Data',
hmac: 'e8e99d0f45237d786d6bbaa7965c7808bbff1a91'
}
},
];
if (!common.hasFipsCrypto) {

View file

@ -12,10 +12,10 @@ const assert = require('assert');
common.expectWarning({
Warning: [
['Use Cipheriv for counter mode of aes-256-gcm']
['Use Cipheriv for counter mode of aes-256-gcm'],
],
DeprecationWarning: [
['crypto.createCipher is deprecated.', 'DEP0106']
['crypto.createCipher is deprecated.', 'DEP0106'],
]
});

View file

@ -111,7 +111,7 @@ for (const g of [Buffer.from([]),
[0x1, 0x2],
() => { },
/abc/,
{}
{},
].forEach((input) => {
assert.throws(
() => crypto.createDiffieHellman(input),
@ -217,7 +217,7 @@ const modp2buf = Buffer.from([
0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb,
0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b,
0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe6, 0x53, 0x81,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);
{

View file

@ -49,7 +49,7 @@ function testHmac(algo, key, data, expected) {
// If the key is a Buffer, test Hmac with a key object as well.
const keyWrappers = [
(key) => key,
...(typeof key === 'string' ? [] : [crypto.createSecretKey])
...(typeof key === 'string' ? [] : [crypto.createSecretKey]),
];
for (const keyWrapper of keyWrappers) {
@ -260,7 +260,7 @@ const rfc4231 = [
'20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de04460' +
'65c97440fa8c6a58'
}
}
},
];
for (let i = 0, l = rfc4231.length; i < l; i++) {
@ -342,7 +342,7 @@ const rfc2202_md5 = [
'Test Using Larger Than Block-Size Key and Larger Than One ' +
'Block-Size Data',
hmac: '6f630fad67cda0ee1fb1f562db3aa53e'
}
},
];
for (const { key, data, hmac } of rfc2202_md5)
@ -400,7 +400,7 @@ const rfc2202_sha1 = [
'Test Using Larger Than Block-Size Key and Larger Than One ' +
'Block-Size Data',
hmac: 'e8e99d0f45237d786d6bbaa7965c7808bbff1a91'
}
},
];
for (const { key, data, hmac } of rfc2202_sha1)

View file

@ -81,12 +81,12 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
const cipher = createCipheriv('aes-256-ecb', key, null);
const ciphertext = Buffer.concat([
cipher.update(plaintext), cipher.final()
cipher.update(plaintext), cipher.final(),
]);
const decipher = createDecipheriv('aes-256-ecb', key, null);
const deciphered = Buffer.concat([
decipher.update(ciphertext), decipher.final()
decipher.update(ciphertext), decipher.final(),
]);
assert(plaintext.equals(deciphered));
@ -263,16 +263,16 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
// Test distinguishing PKCS#1 public and private keys based on the
// DER-encoded data only.
publicEncrypt({ format: 'der', type: 'pkcs1', key: publicDER }, plaintext),
publicEncrypt({ format: 'der', type: 'pkcs1', key: privateDER }, plaintext)
publicEncrypt({ format: 'der', type: 'pkcs1', key: privateDER }, plaintext),
], [
privateKey,
{ format: 'pem', key: privatePem },
{ format: 'der', type: 'pkcs1', key: privateDER },
{ key: jwk, format: 'jwk' }
{ key: jwk, format: 'jwk' },
]);
testDecryption(publicDecrypt, [
privateEncrypt(privateKey, plaintext)
privateEncrypt(privateKey, plaintext),
], [
// Decrypt using the public key.
publicKey,
@ -284,7 +284,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
privateKey,
{ format: 'pem', key: privatePem },
{ format: 'der', type: 'pkcs1', key: privateDER },
{ key: jwk, format: 'jwk' }
{ key: jwk, format: 'jwk' },
]);
}

View file

@ -1091,7 +1091,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
['group', 'prime'],
['group', 'primeLength'],
['group', 'generator'],
['prime', 'primeLength']
['prime', 'primeLength'],
];
for (const [opt1, opt2] of incompatible) {
assert.throws(() => {

View file

@ -93,7 +93,7 @@ common.expectWarning('DeprecationWarning',
new Uint32Array(10),
new Float32Array(10),
new Float64Array(10),
new DataView(new ArrayBuffer(10))
new DataView(new ArrayBuffer(10)),
].forEach((buf) => {
const before = Buffer.from(buf.buffer).toString('hex');
crypto.randomFillSync(buf);
@ -117,7 +117,7 @@ common.expectWarning('DeprecationWarning',
{
[
new ArrayBuffer(10),
new SharedArrayBuffer(10)
new SharedArrayBuffer(10),
].forEach((buf) => {
const before = Buffer.from(buf).toString('hex');
crypto.randomFillSync(buf);
@ -150,7 +150,7 @@ common.expectWarning('DeprecationWarning',
new Uint32Array(10),
new Float32Array(10),
new Float64Array(10),
new DataView(new ArrayBuffer(10))
new DataView(new ArrayBuffer(10)),
].forEach((buf) => {
const before = Buffer.from(buf.buffer).toString('hex');
crypto.randomFill(buf, common.mustSucceed((buf) => {
@ -163,7 +163,7 @@ common.expectWarning('DeprecationWarning',
{
[
new ArrayBuffer(10),
new SharedArrayBuffer(10)
new SharedArrayBuffer(10),
].forEach((buf) => {
const before = Buffer.from(buf).toString('hex');
crypto.randomFill(buf, common.mustSucceed((buf) => {
@ -223,7 +223,7 @@ common.expectWarning('DeprecationWarning',
{
[
Buffer.alloc(10),
new Uint8Array(new Array(10).fill(0))
new Uint8Array(new Array(10).fill(0)),
].forEach((buf) => {
const len = Buffer.byteLength(buf);
assert.strictEqual(len, 10, `Expected byteLength of 10, got ${len}`);

View file

@ -11,7 +11,7 @@ const {
} = require('crypto');
const last = new Set([
'00000000-0000-0000-0000-000000000000'
'00000000-0000-0000-0000-000000000000',
]);
function testMatch(uuid) {

View file

@ -99,7 +99,7 @@ const bad = [
{ N: 3, p: 1, r: 1 }, // Not power of 2.
{ N: 1, cost: 1 }, // Both N and cost
{ p: 1, parallelization: 1 }, // Both p and parallelization
{ r: 1, blockSize: 1 } // Both r and blocksize
{ r: 1, blockSize: 1 }, // Both r and blocksize
];
// Test vectors where 128*N*r exceeds maxmem.
@ -259,6 +259,6 @@ for (const { args, expected } of badargs) {
[
['N', 16384], ['cost', 16384],
['r', 8], ['blockSize', 8],
['p', 1], ['parallelization', 1]
['p', 1], ['parallelization', 1],
].forEach((arg) => testParameter(...arg));
}

View file

@ -174,14 +174,14 @@ assert.throws(
getEffectiveSaltLength(crypto.constants.RSA_PSS_SALTLEN_DIGEST),
crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN,
getEffectiveSaltLength(crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN),
0, 16, 32, 64, 128
0, 16, 32, 64, 128,
];
const verifySaltLengths = [
crypto.constants.RSA_PSS_SALTLEN_DIGEST,
getEffectiveSaltLength(crypto.constants.RSA_PSS_SALTLEN_DIGEST),
getEffectiveSaltLength(crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN),
0, 16, 32, 64, 128
0, 16, 32, 64, 128,
];
const errMessage = /^Error:.*data too large for key size$/;
@ -390,7 +390,7 @@ assert.throws(
});
[
Uint8Array, Uint16Array, Uint32Array, Float32Array, Float64Array
Uint8Array, Uint16Array, Uint32Array, Float32Array, Float64Array,
].forEach((clazz) => {
// These should all just work
sign.update(new clazz());
@ -429,7 +429,7 @@ assert.throws(
{ private: fixtures.readKey('rsa_private_2048.pem', 'ascii'),
public: fixtures.readKey('rsa_public_2048.pem', 'ascii'),
algo: 'sha1',
sigLen: 256 }
sigLen: 256 },
].forEach((pair) => {
const algo = pair.algo;
@ -465,7 +465,7 @@ assert.throws(
}
[
Uint8Array, Uint16Array, Uint32Array, Float32Array, Float64Array
Uint8Array, Uint16Array, Uint32Array, Float32Array, Float64Array,
].forEach((clazz) => {
const data = new clazz();
const sig = crypto.sign(algo, data, pair.private);
@ -503,7 +503,7 @@ assert.throws(
[
crypto.createSign('sha1').update(data).sign(privKey),
crypto.sign('sha1', data, privKey),
crypto.sign('sha1', data, { key: privKey, dsaEncoding: 'der' })
crypto.sign('sha1', data, { key: privKey, dsaEncoding: 'der' }),
].forEach((sig) => {
// Signature length variability due to DER encoding
assert(sig.length >= length + 4 && sig.length <= length + 8);

View file

@ -149,7 +149,7 @@ const der = Buffer.from(
'wildcards',
'partialWildcards',
'multiLabelWildcards',
'singleLabelSubdomains'
'singleLabelSubdomains',
].forEach((key) => {
[1, '', null, {}].forEach((i) => {
assert.throws(() => x509.checkHost('agent1', { [key]: i }), {

View file

@ -27,7 +27,7 @@ if (!common.hasCrypto)
common.expectWarning({
DeprecationWarning: [
['crypto.createCipher is deprecated.', 'DEP0106']
['crypto.createCipher is deprecated.', 'DEP0106'],
]
});
@ -212,7 +212,7 @@ assert.throws(() => {
'eKN7LggbF3Dk5wIQN6SL+fQ5H/+7NgARsVBp0QIRANxYRukavs4QvuyNhMx+vrkCEQCbf6j/',
'Ig6/HueCK/0Jkmp+',
'-----END RSA PRIVATE KEY-----',
''
'',
].join('\n');
crypto.createSign('SHA256').update('test').sign(priv);
}, (err) => {

View file

@ -11,13 +11,13 @@ const invalidTypes = [
true,
false,
null,
undefined
undefined,
];
const validTypes = [
'udp4',
'udp6',
{ type: 'udp4' },
{ type: 'udp6' }
{ type: 'udp6' },
];
const errMessage = /^Bad socket type specified\. Valid types are: udp4, udp6$/;

View file

@ -14,12 +14,12 @@ const propertiesToTest = [
'_receiving',
'_bindState',
'_queue',
'_reuseAddr'
'_reuseAddr',
];
const methodsToTest = [
'_healthCheck',
'_stopReceiving'
'_stopReceiving',
];
const propertyCases = propertiesToTest.map((propName) => {
@ -41,7 +41,7 @@ const propertyCases = propertiesToTest.map((propName) => {
'DEP0112'
);
sock[propName] = null;
}
},
];
});

View file

@ -56,7 +56,7 @@ async function lookupPositive() {
stub: getaddrinfoPositive(['some-address2']),
factory: () => dnsPromises.lookup('example.com', { family: 6 }),
expectation: { address: 'some-address2', family: 6 }
}
},
].forEach(async ({ stub, factory, expectation }) => {
getaddrinfoStub = stub;
assert.deepStrictEqual(await factory(), expectation);
@ -80,7 +80,7 @@ async function lookupallPositive() {
factory: () => dnsPromises.lookup('example', { all: true }),
expectation: [
{ address: '::1', family: 6 },
{ address: '::2', family: 6 }
{ address: '::2', family: 6 },
]
},
{
@ -88,7 +88,7 @@ async function lookupallPositive() {
factory: () => dnsPromises.lookup('example', { all: true, family: 4 }),
expectation: [
{ address: '::1', family: 4 },
{ address: '::2', family: 4 }
{ address: '::2', family: 4 },
]
},
{
@ -96,7 +96,7 @@ async function lookupallPositive() {
factory: () => dnsPromises.lookup('example', { all: true }),
expectation: [
{ address: '127.0.0.1', family: 4 },
{ address: 'some-address', family: 0 }
{ address: 'some-address', family: 0 },
]
},
{
@ -104,14 +104,14 @@ async function lookupallPositive() {
factory: () => dnsPromises.lookup('example', { all: true, family: 6 }),
expectation: [
{ address: '127.0.0.1', family: 6 },
{ address: 'some-address', family: 6 }
{ address: 'some-address', family: 6 },
]
},
{
stub: getaddrinfoPositive([]),
factory: () => dnsPromises.lookup('example', { all: true }),
expectation: []
}
},
].forEach(async ({ stub, factory, expectation }) => {
getaddrinfoStub = stub;
assert.deepStrictEqual(await factory(), expectation);
@ -134,6 +134,6 @@ async function lookupallNegative() {
lookupPositive(),
lookupNegative(),
lookupallPositive(),
lookupallNegative()
lookupallNegative(),
]);
})().then(common.mustCall());

View file

@ -27,7 +27,7 @@ const dnsPromises = dns.promises;
common.expectWarning({
// For 'internal/test/binding' module.
'internal/test/binding': [
'These APIs are for internal testing only. Do not use them.'
'These APIs are for internal testing only. Do not use them.',
],
// For calling `dns.lookup` with falsy `hostname`.
'DeprecationWarning': {

View file

@ -13,7 +13,7 @@ const servers = [
{
socket: dgram.createSocket('udp4'),
reply: { type: 'A', address: '5.6.7.8', ttl: 123, domain: 'example.org' }
}
},
];
let waiting = servers.length;

View file

@ -27,7 +27,7 @@ const answers = [
type: 'CAA',
critical: 128,
issue: 'platynum.ch'
}
},
];
const server = dgram.createSocket('udp4');

View file

@ -15,7 +15,7 @@ const promiseResolver = new dns.promises.Resolver();
addresses.DNS4_SERVER,
{
address: addresses.DNS4_SERVER
}
},
].forEach((val) => {
const errObj = {
code: 'ERR_INVALID_ARG_TYPE',
@ -54,8 +54,8 @@ const promiseResolver = new dns.promises.Resolver();
[
{
address: addresses.DNS4_SERVER
}
]
},
],
].forEach((val) => {
const errObj = {
code: 'ERR_INVALID_ARG_TYPE',
@ -104,8 +104,8 @@ const promiseResolver = new dns.promises.Resolver();
[
{
address: addresses.DNS4_SERVER
}
]
},
],
].forEach((val) => {
const errObj = {
code: 'ERR_INVALID_ARG_TYPE',

View file

@ -61,7 +61,7 @@ assert(existing.length > 0);
assert.deepStrictEqual(dns.getServers(), [
'127.0.0.1',
'192.168.1.1',
'0.0.0.0'
'0.0.0.0',
]);
}
@ -75,7 +75,7 @@ assert(existing.length > 0);
// Check for REDOS issues.
':'.repeat(100000),
'['.repeat(100000),
'['.repeat(100000) + ']'.repeat(100000) + 'a'
'['.repeat(100000) + ']'.repeat(100000) + 'a',
];
invalidServers.forEach((serv) => {
assert.throws(
@ -383,7 +383,7 @@ assert.throws(() => {
retry: 900,
expire: 1800,
minttl: 3333333333
}
},
] },
];

View file

@ -191,7 +191,7 @@ const tests = [
});
});
});
}
},
];
if (process.argv[2] === 'child') {

View file

@ -11,7 +11,7 @@ const domain = require('domain');
// https://github.com/nodejs/node/issues/28275 is fixed in debug mode.
for (const something of [
42, null, undefined, false, () => {}, 'string', Symbol('foo')
42, null, undefined, false, () => {}, 'string', Symbol('foo'),
]) {
const d = new domain.Domain();
d.run(common.mustCall(() => {

View file

@ -10,7 +10,7 @@ const domain = require('domain');
const d = new domain.Domain();
const values = [
42, null, undefined, false, () => {}, 'string', Symbol('foo')
42, null, undefined, false, () => {}, 'string', Symbol('foo'),
];
d.on('error', common.mustCall((err) => {

View file

@ -13,7 +13,7 @@ const { internalBinding } = require('internal/test/binding');
internalBinding('udp_wrap').UDP.prototype.send6,
internalBinding('tcp_wrap').TCP.prototype.bind,
internalBinding('udp_wrap').UDP.prototype.close,
internalBinding('tcp_wrap').TCP.prototype.open
internalBinding('tcp_wrap').TCP.prototype.open,
].forEach((binding, i) => {
assert.strictEqual('prototype' in binding, false, `Test ${i} failed`);
});

View file

@ -9,7 +9,7 @@ common.expectWarning({
'DEP0111'],
['Directly calling process.binding(\'uv\').errname(<val>) is being ' +
'deprecated. Please make sure to use util.getSystemErrorName() instead.',
'DEP0119']
'DEP0119'],
]
});

View file

@ -14,7 +14,7 @@ new RuleTester().run('alphabetize-errors', rule, {
E('AAA', 'foo');
E('BBB', 'bar');
E('CCC', 'baz');
`
`,
],
invalid: [
{
@ -24,6 +24,6 @@ new RuleTester().run('alphabetize-errors', rule, {
E('CCC', 'baz');
`,
errors: [{ message: 'Out of ASCIIbetical order - BBB >= AAA', line: 3 }]
}
},
]
});

Some files were not shown because too many files have changed in this diff Show more