diff options
author | Grigoriy Levanov <glevanov@gmail.com> | 2019-11-06 15:31:36 +0300 |
---|---|---|
committer | Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> | 2019-11-12 17:19:22 -0800 |
commit | 35ec01097b2a397ad0a22aac536fe07514876e21 (patch) | |
tree | 05424c9d13243458c7f466fbbb876b401b019288 /test | |
parent | 1e0679e56d8e340821fc803073df215c1145dc5b (diff) | |
download | android-node-v8-35ec01097b2a397ad0a22aac536fe07514876e21.tar.gz android-node-v8-35ec01097b2a397ad0a22aac536fe07514876e21.tar.bz2 android-node-v8-35ec01097b2a397ad0a22aac536fe07514876e21.zip |
test: replace Object.assign with object spread
Replaces Object.assign with spread where object is simply cloned
PR-URL: https://github.com/nodejs/node/pull/30306
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-trace-events-async-hooks-dynamic.js | 8 | ||||
-rw-r--r-- | test/parallel/test-trace-events-async-hooks-worker.js | 8 | ||||
-rw-r--r-- | test/parallel/test-util-inspect.js | 2 | ||||
-rw-r--r-- | test/parallel/test-whatwg-url-custom-properties.js | 2 | ||||
-rw-r--r-- | test/sequential/test-async-wrap-getasyncid.js | 2 | ||||
-rw-r--r-- | test/sequential/test-inspector-open.js | 2 | ||||
-rw-r--r-- | test/sequential/test-inspector-port-cluster.js | 10 |
7 files changed, 17 insertions, 17 deletions
diff --git a/test/parallel/test-trace-events-async-hooks-dynamic.js b/test/parallel/test-trace-events-async-hooks-dynamic.js index 318f94b182..9cb0d41c54 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, { - '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 338f0f9c09..153ef30187 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, { - '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-util-inspect.js b/test/parallel/test-util-inspect.js index fc0bb345da..e7804eec2f 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; diff --git a/test/parallel/test-whatwg-url-custom-properties.js b/test/parallel/test-whatwg-url-custom-properties.js index 1fbc3ab623..23742a8e74 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); diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index cc823cc17f..7e9f77cd7a 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'); diff --git a/test/sequential/test-inspector-open.js b/test/sequential/test-inspector-open.js index a0d2eaf1f3..967ebe49bf 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'); diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 7b541eb156..7579f51dee 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, { - 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); |