From b29f4c060b105bd4bca4011cf86d16537ae55b67 Mon Sep 17 00:00:00 2001 From: Stephen Heitman Date: Fri, 12 Oct 2018 09:51:28 -0700 Subject: [PATCH 1/9] test-http2-respond-file-fd-invalid: remove unused "e" from catch --- test/parallel/test-http2-respond-file-fd-invalid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http2-respond-file-fd-invalid.js b/test/parallel/test-http2-respond-file-fd-invalid.js index 21fcf790b449eb..7630b93bc63942 100644 --- a/test/parallel/test-http2-respond-file-fd-invalid.js +++ b/test/parallel/test-http2-respond-file-fd-invalid.js @@ -25,7 +25,7 @@ server.on('stream', (stream) => { // Get first known bad file descriptor. try { while (fs.fstatSync(++fd)); - } catch (e) { + } catch { // do nothing; we now have an invalid fd } From c006bcb18e6e406eef7426ded7d88b03efff746b Mon Sep 17 00:00:00 2001 From: ashleysimpson Date: Fri, 12 Oct 2018 10:01:24 -0700 Subject: [PATCH 2/9] test: inline common module boolean --- test/addons/load-long-path/test.js | 2 +- test/common/README.md | 5 ----- test/common/index.js | 2 -- test/common/index.mjs | 2 -- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index ee09230676b5e8..7d1a37bd96055e 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -1,6 +1,6 @@ 'use strict'; const common = require('../../common'); -if (common.isWOW64) +if (common.isWindows && (process.env.PROCESSOR_ARCHITEW6432 !== undefined)) common.skip('doesn\'t work on WOW64'); const fs = require('fs'); diff --git a/test/common/README.md b/test/common/README.md index e63c83fd806dfb..0a2281b091b267 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -213,11 +213,6 @@ Platform check for SunOS. Platform check for Windows. -### isWOW64 -* [<boolean>] - -Platform check for Windows 32-bit on Windows 64-bit. - ### localhostIPv4 * [<string>] diff --git a/test/common/index.js b/test/common/index.js index e76dfcce8b0b8f..9cbf9189690600 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -46,7 +46,6 @@ const isMainThread = (() => { })(); const isWindows = process.platform === 'win32'; -const isWOW64 = isWindows && (process.env.PROCESSOR_ARCHITEW6432 !== undefined); const isAIX = process.platform === 'aix'; const isLinuxPPCBE = (process.platform === 'linux') && (process.arch === 'ppc64') && @@ -721,7 +720,6 @@ module.exports = { isOSX, isSunOS, isWindows, - isWOW64, localIPv6Hosts, mustCall, mustCallAsync, diff --git a/test/common/index.mjs b/test/common/index.mjs index bb17d9d37171a6..bead7333d12e81 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -5,7 +5,6 @@ import common from './index.js'; const { isMainThread, isWindows, - isWOW64, isAIX, isLinuxPPCBE, isSunOS, @@ -54,7 +53,6 @@ const { export { isMainThread, isWindows, - isWOW64, isAIX, isLinuxPPCBE, isSunOS, From 71f0c0e61137084f8b003773d81dc0cbabde6f9a Mon Sep 17 00:00:00 2001 From: Paige Kato Date: Fri, 12 Oct 2018 09:50:47 -0700 Subject: [PATCH 3/9] test: remove unused variable from catch --- test/parallel/test-readline-interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 0550019e64f46f..ec553832c42d68 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -509,7 +509,7 @@ function isWarned(emitter) { }); try { fi.emit('data', 'fooX'); - } catch (e) { } + } catch { } fi.emit('data', 'bar'); assert.strictEqual(keys.join(''), 'fooXbar'); rli.close(); From 60c040752c058b1dc533a5465406ad6b441678c1 Mon Sep 17 00:00:00 2001 From: Michal Hynek Date: Fri, 12 Oct 2018 09:20:12 -0700 Subject: [PATCH 4/9] test: removed unused variable Removed an unused variable in test-buffer-failed-alloc-typed-arrays.js. --- test/parallel/test-buffer-failed-alloc-typed-arrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-failed-alloc-typed-arrays.js b/test/parallel/test-buffer-failed-alloc-typed-arrays.js index fd9c2744e55f69..59cc7bc8d95e03 100644 --- a/test/parallel/test-buffer-failed-alloc-typed-arrays.js +++ b/test/parallel/test-buffer-failed-alloc-typed-arrays.js @@ -26,7 +26,7 @@ for (const allocator of allocators) { // These allocations are known to fail. If they do, // Uint32Array should still produce a zeroed out result. allocator(size); - } catch (e) { + } catch { assert.deepStrictEqual(new Uint32Array(10), zeroArray); } } From b54dd17f6beea6b0dd0968f239bc1fb985ec791a Mon Sep 17 00:00:00 2001 From: Rock Hu Date: Fri, 12 Oct 2018 10:06:36 -0700 Subject: [PATCH 5/9] test: fix assert.strictEqual params order --- test/sequential/test-pipe.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/sequential/test-pipe.js b/test/sequential/test-pipe.js index bc2084295d738d..c5bff3563be1e6 100644 --- a/test/sequential/test-pipe.js +++ b/test/sequential/test-pipe.js @@ -75,7 +75,7 @@ const tcp = net.Server(common.mustCall((s) => { s.on('data', (d) => { tcpLengthSeen += d.length; for (let j = 0; j < d.length; j++) { - assert.strictEqual(buffer[i], d[j]); + assert.strictEqual(d[j], buffer[i]); i++; } }); @@ -103,7 +103,7 @@ function startClient() { }, common.mustCall((res) => { res.setEncoding('utf8'); res.on('data', common.mustCall((string) => { - assert.strictEqual('thanks', string); + assert.strictEqual(string, 'thanks'); gotThanks = true; })); })); @@ -113,5 +113,5 @@ function startClient() { process.on('exit', () => { assert.ok(gotThanks); - assert.strictEqual(bufferSize, tcpLengthSeen); + assert.strictEqual(tcpLengthSeen, bufferSize); }); From 8c8e8830ffd3e33dbbaddc0c5e3ee343ea7d3ac7 Mon Sep 17 00:00:00 2001 From: Anna Zhao Date: Fri, 12 Oct 2018 10:06:42 -0700 Subject: [PATCH 6/9] test: change to arrow functions in send-bad-arguments --- test/parallel/test-dgram-send-bad-arguments.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-dgram-send-bad-arguments.js b/test/parallel/test-dgram-send-bad-arguments.js index e96a01de3281f2..4eb7dca7a38e5d 100644 --- a/test/parallel/test-dgram-send-bad-arguments.js +++ b/test/parallel/test-dgram-send-bad-arguments.js @@ -28,17 +28,17 @@ const buf = Buffer.from('test'); const host = '127.0.0.1'; const sock = dgram.createSocket('udp4'); -assert.throws(function() { +assert.throws(() => { sock.send(); }, TypeError); // First argument should be a buffer. // send(buf, offset, length, port, host) -assert.throws(function() { sock.send(buf, 1, 1, -1, host); }, RangeError); -assert.throws(function() { sock.send(buf, 1, 1, 0, host); }, RangeError); -assert.throws(function() { sock.send(buf, 1, 1, 65536, host); }, RangeError); +assert.throws(() => { sock.send(buf, 1, 1, -1, host); }, RangeError); +assert.throws(() => { sock.send(buf, 1, 1, 0, host); }, RangeError); +assert.throws(() => { sock.send(buf, 1, 1, 65536, host); }, RangeError); // send(buf, port, host) -assert.throws(function() { sock.send(23, 12345, host); }, TypeError); +assert.throws(() => { sock.send(23, 12345, host); }, TypeError); // send([buf1, ..], port, host) -assert.throws(function() { sock.send([buf, 23], 12345, host); }, TypeError); +assert.throws(() => { sock.send([buf, 23], 12345, host); }, TypeError); From 3743a72e80ae26cd5183173f08f48af8f41e3c06 Mon Sep 17 00:00:00 2001 From: Claire Liu Date: Fri, 12 Oct 2018 09:56:36 -0700 Subject: [PATCH 7/9] lib: remove an unused variable --- lib/internal/bootstrap/node.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index d3bd5d74e08095..2f638555ee28ce 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -632,7 +632,9 @@ const { kExpandStackSymbol } = NativeModule.require('internal/util'); if (typeof er[kExpandStackSymbol] === 'function') er[kExpandStackSymbol](); - } catch (er) {} + } catch { + // Nothing to be done about it at this point. + } return false; } From a0e7710851a5996ca0d2b478069837fe3572d88b Mon Sep 17 00:00:00 2001 From: Stacey Date: Fri, 12 Oct 2018 09:56:31 -0700 Subject: [PATCH 8/9] test: fix argument order for assert.strictEqual --- test/sequential/test-inspector-scriptparsed-context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-inspector-scriptparsed-context.js b/test/sequential/test-inspector-scriptparsed-context.js index e1ec209994f18e..56cc41dd86a397 100644 --- a/test/sequential/test-inspector-scriptparsed-context.js +++ b/test/sequential/test-inspector-scriptparsed-context.js @@ -81,7 +81,7 @@ async function runTests() { await session.waitForBreakOnLine(0, 'evalmachine.'); await session.runToCompletion(); - assert.strictEqual(0, (await instance.expectShutdown()).exitCode); + assert.strictEqual((await instance.expectShutdown()).exitCode, 0); } runTests(); From d2acacd38a1a61fce5fbc453c5a9c2157332d6f2 Mon Sep 17 00:00:00 2001 From: Matt Jiles Date: Fri, 12 Oct 2018 12:50:41 -0400 Subject: [PATCH 9/9] tls: update try catch syntax try catch syntax allows elimination of function arguments so removed unused err argument --- lib/tls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tls.js b/lib/tls.js index f771a661d07692..57228ca273cb98 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -176,7 +176,7 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { let uri; try { uri = new URL(name.slice(4)); - } catch (err) { + } catch { uri = url.parse(name.slice(4)); if (!urlWarningEmitted && !process.noDeprecation) { urlWarningEmitted = true;