From 3046aa7f3dc095c032219555626d1df65f9f9399 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 15:31:36 +0300 Subject: [PATCH 01/10] url: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/parallel/test-whatwg-url-custom-properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-whatwg-url-custom-properties.js b/test/parallel/test-whatwg-url-custom-properties.js index 1fbc3ab6238ea3..49acc909a20286 100644 --- a/test/parallel/test-whatwg-url-custom-properties.js +++ b/test/parallel/test-whatwg-url-custom-properties.js @@ -152,7 +152,7 @@ assert.strictEqual(url.searchParams, oldParams); // contains the Symbols that Node uses for brand checking, but not the data // properties, which are getters. Verify that urlToOptions() can handle such // a case. - const copiedUrlObj = Object.assign({}, urlObj); + const copiedUrlObj = {...urlObj}; const copiedOpts = urlToOptions(copiedUrlObj); assert.strictEqual(copiedOpts instanceof URL, false); assert.strictEqual(copiedOpts.protocol, undefined); From 1e3d014c462642ad54f9cbb6061a3cd91e9912b6 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 15:41:19 +0300 Subject: [PATCH 02/10] util: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/parallel/test-util-inspect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index fc0bb345da95ce..06d6d706754bd7 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1366,7 +1366,7 @@ if (typeof Symbol !== 'undefined') { const arr = new Array(101).fill(); const obj = { a: { a: { a: { a: 1 } } } }; - const oldOptions = Object.assign({}, util.inspect.defaultOptions); + const oldOptions = {...util.inspect.defaultOptions}; // Set single option through property assignment. util.inspect.defaultOptions.maxArrayLength = null; From 8e40d02902a7db2446d79ce68270973a41353ce4 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:04:19 +0300 Subject: [PATCH 03/10] url: fix linter warnings --- test/parallel/test-whatwg-url-custom-properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-whatwg-url-custom-properties.js b/test/parallel/test-whatwg-url-custom-properties.js index 49acc909a20286..23742a8e7493e2 100644 --- a/test/parallel/test-whatwg-url-custom-properties.js +++ b/test/parallel/test-whatwg-url-custom-properties.js @@ -152,7 +152,7 @@ assert.strictEqual(url.searchParams, oldParams); // contains the Symbols that Node uses for brand checking, but not the data // properties, which are getters. Verify that urlToOptions() can handle such // a case. - const copiedUrlObj = {...urlObj}; + const copiedUrlObj = { ...urlObj }; const copiedOpts = urlToOptions(copiedUrlObj); assert.strictEqual(copiedOpts instanceof URL, false); assert.strictEqual(copiedOpts.protocol, undefined); From 65a1dad34ce4757b296b4e43fa2317fb7ef40b6c Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:04:52 +0300 Subject: [PATCH 04/10] util: fix linter warnings --- test/parallel/test-util-inspect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 06d6d706754bd7..e7804eec2f2bc0 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1366,7 +1366,7 @@ if (typeof Symbol !== 'undefined') { const arr = new Array(101).fill(); const obj = { a: { a: { a: { a: 1 } } } }; - const oldOptions = {...util.inspect.defaultOptions}; + const oldOptions = { ...util.inspect.defaultOptions }; // Set single option through property assignment. util.inspect.defaultOptions.maxArrayLength = null; From 3776cb66d9ea2da34fce1420597444f0b26b1323 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:06:33 +0300 Subject: [PATCH 05/10] test: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/parallel/test-trace-events-async-hooks-dynamic.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-trace-events-async-hooks-dynamic.js b/test/parallel/test-trace-events-async-hooks-dynamic.js index 318f94b182c5c1..bf0c938892ef66 100644 --- a/test/parallel/test-trace-events-async-hooks-dynamic.js +++ b/test/parallel/test-trace-events-async-hooks-dynamic.js @@ -29,10 +29,10 @@ const proc = cp.spawnSync( ['-e', enable + code ], { cwd: tmpdir.path, - env: Object.assign({}, process.env, { + env: { ...process.env, ...{ 'NODE_DEBUG_NATIVE': 'tracing', 'NODE_DEBUG': 'tracing' - }) + } } }); console.log('process exit with signal:', proc.signal); From bd7b1c11428710dceed12bb516f1d0b1c737c8da Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:08:03 +0300 Subject: [PATCH 06/10] test: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/parallel/test-trace-events-async-hooks-worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-trace-events-async-hooks-worker.js b/test/parallel/test-trace-events-async-hooks-worker.js index 338f0f9c09e534..3e07fcb4a6eb80 100644 --- a/test/parallel/test-trace-events-async-hooks-worker.js +++ b/test/parallel/test-trace-events-async-hooks-worker.js @@ -36,10 +36,10 @@ const proc = cp.spawnSync( [ '--trace-event-categories', 'node.async_hooks', '-e', worker ], { cwd: tmpdir.path, - env: Object.assign({}, process.env, { + env: { ...process.env, ...{ 'NODE_DEBUG_NATIVE': 'tracing', 'NODE_DEBUG': 'tracing' - }) + } } }); console.log('process exit with signal:', proc.signal); From 7cfb6192c08e04d7baaef4bc5575f04ab0f3be67 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:11:41 +0300 Subject: [PATCH 07/10] test: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/sequential/test-async-wrap-getasyncid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index cc823cc17fa706..7e9f77cd7a4cc2 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -8,7 +8,7 @@ const fs = require('fs'); const v8 = require('v8'); const fsPromises = fs.promises; const net = require('net'); -const providers = Object.assign({}, internalBinding('async_wrap').Providers); +const providers = { ...internalBinding('async_wrap').Providers }; const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const { getSystemErrorName } = require('util'); From f201ccd68d710bc1fcaca5a111e7117390ecb107 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:15:50 +0300 Subject: [PATCH 08/10] test: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/sequential/test-inspector-open.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-inspector-open.js b/test/sequential/test-inspector-open.js index a0d2eaf1f3415a..78de7f292085dc 100644 --- a/test/sequential/test-inspector-open.js +++ b/test/sequential/test-inspector-open.js @@ -14,7 +14,7 @@ if (process.env.BE_CHILD) return beChild(); const child = fork(__filename, - { env: Object.assign({}, process.env, { BE_CHILD: 1 }) }); + { env: { ...process.env, ...{ BE_CHILD: 1 } } }); child.once('message', common.mustCall((msg) => { assert.strictEqual(msg.cmd, 'started'); From afbc5d3b589ab6875c8de1f82c90e501e4690587 Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 16:18:24 +0300 Subject: [PATCH 09/10] test: replace Object.assign with object spread Replaces Object.assign with spread where object is simply cloned --- test/sequential/test-inspector-port-cluster.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 7b541eb156e0cd..21adf040796bb8 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -328,11 +328,11 @@ function workerProcessMain() { function spawnMaster({ execArgv, workers, clusterSettings = {} }) { return new Promise((resolve) => { childProcess.fork(__filename, { - env: Object.assign({}, process.env, { + env: { ...process.env, ...{ workers: JSON.stringify(workers), clusterSettings: JSON.stringify(clusterSettings), testProcess: true - }), + } }, execArgv: execArgv.concat(['--expose-internals']) }).on('exit', common.mustCall((code, signal) => { checkExitCode(code, signal); From 621e12ff6738ca6a02b0484e3d8ef99ee641800f Mon Sep 17 00:00:00 2001 From: Grigoriy Levanov Date: Wed, 6 Nov 2019 17:16:37 +0300 Subject: [PATCH 10/10] test: fix object spread for inline objects Removes spread for inline objects - same can be achieved by discarding object literal --- test/parallel/test-trace-events-async-hooks-dynamic.js | 8 ++++---- test/parallel/test-trace-events-async-hooks-worker.js | 8 ++++---- test/sequential/test-inspector-open.js | 2 +- test/sequential/test-inspector-port-cluster.js | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-trace-events-async-hooks-dynamic.js b/test/parallel/test-trace-events-async-hooks-dynamic.js index bf0c938892ef66..9cb0d41c5494c6 100644 --- a/test/parallel/test-trace-events-async-hooks-dynamic.js +++ b/test/parallel/test-trace-events-async-hooks-dynamic.js @@ -29,10 +29,10 @@ const proc = cp.spawnSync( ['-e', enable + code ], { cwd: tmpdir.path, - env: { ...process.env, ...{ - 'NODE_DEBUG_NATIVE': 'tracing', - 'NODE_DEBUG': 'tracing' - } } + env: { ...process.env, + 'NODE_DEBUG_NATIVE': 'tracing', + 'NODE_DEBUG': 'tracing' + } }); console.log('process exit with signal:', proc.signal); diff --git a/test/parallel/test-trace-events-async-hooks-worker.js b/test/parallel/test-trace-events-async-hooks-worker.js index 3e07fcb4a6eb80..153ef301873151 100644 --- a/test/parallel/test-trace-events-async-hooks-worker.js +++ b/test/parallel/test-trace-events-async-hooks-worker.js @@ -36,10 +36,10 @@ const proc = cp.spawnSync( [ '--trace-event-categories', 'node.async_hooks', '-e', worker ], { cwd: tmpdir.path, - env: { ...process.env, ...{ - 'NODE_DEBUG_NATIVE': 'tracing', - 'NODE_DEBUG': 'tracing' - } } + env: { ...process.env, + 'NODE_DEBUG_NATIVE': 'tracing', + 'NODE_DEBUG': 'tracing' + } }); console.log('process exit with signal:', proc.signal); diff --git a/test/sequential/test-inspector-open.js b/test/sequential/test-inspector-open.js index 78de7f292085dc..967ebe49bfb764 100644 --- a/test/sequential/test-inspector-open.js +++ b/test/sequential/test-inspector-open.js @@ -14,7 +14,7 @@ if (process.env.BE_CHILD) return beChild(); const child = fork(__filename, - { env: { ...process.env, ...{ BE_CHILD: 1 } } }); + { env: { ...process.env, BE_CHILD: 1 } }); child.once('message', common.mustCall((msg) => { assert.strictEqual(msg.cmd, 'started'); diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 21adf040796bb8..7579f51deeb598 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -328,11 +328,11 @@ function workerProcessMain() { function spawnMaster({ execArgv, workers, clusterSettings = {} }) { return new Promise((resolve) => { childProcess.fork(__filename, { - env: { ...process.env, ...{ - workers: JSON.stringify(workers), - clusterSettings: JSON.stringify(clusterSettings), - testProcess: true - } }, + env: { ...process.env, + workers: JSON.stringify(workers), + clusterSettings: JSON.stringify(clusterSettings), + testProcess: true + }, execArgv: execArgv.concat(['--expose-internals']) }).on('exit', common.mustCall((code, signal) => { checkExitCode(code, signal);