Skip to content

Commit

Permalink
test: replace Object.assign with object spread
Browse files Browse the repository at this point in the history
Replaces Object.assign with spread where object is simply cloned

PR-URL: #30306
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Grigoriy Levanov authored and trivikr committed Nov 13, 2019
1 parent 1e0679e commit 35ec010
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions test/parallel/test-trace-events-async-hooks-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-trace-events-async-hooks-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-custom-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-async-wrap-getasyncid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-open.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions test/sequential/test-inspector-port-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 35ec010

Please sign in to comment.