Skip to content

Commit d2ab2bb

Browse files
Grigoriy Levanovtargos
Grigoriy Levanov
authored andcommitted
test: replace Object.assign with object spread
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]>
1 parent 8274875 commit d2ab2bb

7 files changed

+17
-17
lines changed

test/parallel/test-trace-events-async-hooks-dynamic.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const proc = cp.spawnSync(
2929
['-e', enable + code ],
3030
{
3131
cwd: tmpdir.path,
32-
env: Object.assign({}, process.env, {
33-
'NODE_DEBUG_NATIVE': 'tracing',
34-
'NODE_DEBUG': 'tracing'
35-
})
32+
env: { ...process.env,
33+
'NODE_DEBUG_NATIVE': 'tracing',
34+
'NODE_DEBUG': 'tracing'
35+
}
3636
});
3737

3838
console.log('process exit with signal:', proc.signal);

test/parallel/test-trace-events-async-hooks-worker.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const proc = cp.spawnSync(
3636
[ '--trace-event-categories', 'node.async_hooks', '-e', worker ],
3737
{
3838
cwd: tmpdir.path,
39-
env: Object.assign({}, process.env, {
40-
'NODE_DEBUG_NATIVE': 'tracing',
41-
'NODE_DEBUG': 'tracing'
42-
})
39+
env: { ...process.env,
40+
'NODE_DEBUG_NATIVE': 'tracing',
41+
'NODE_DEBUG': 'tracing'
42+
}
4343
});
4444

4545
console.log('process exit with signal:', proc.signal);

test/parallel/test-util-inspect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ if (typeof Symbol !== 'undefined') {
13631363
const arr = new Array(101).fill();
13641364
const obj = { a: { a: { a: { a: 1 } } } };
13651365

1366-
const oldOptions = Object.assign({}, util.inspect.defaultOptions);
1366+
const oldOptions = { ...util.inspect.defaultOptions };
13671367

13681368
// Set single option through property assignment.
13691369
util.inspect.defaultOptions.maxArrayLength = null;

test/parallel/test-whatwg-url-custom-properties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ assert.strictEqual(url.searchParams, oldParams);
152152
// contains the Symbols that Node uses for brand checking, but not the data
153153
// properties, which are getters. Verify that urlToOptions() can handle such
154154
// a case.
155-
const copiedUrlObj = Object.assign({}, urlObj);
155+
const copiedUrlObj = { ...urlObj };
156156
const copiedOpts = urlToOptions(copiedUrlObj);
157157
assert.strictEqual(copiedOpts instanceof URL, false);
158158
assert.strictEqual(copiedOpts.protocol, undefined);

test/sequential/test-async-wrap-getasyncid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const fs = require('fs');
88
const v8 = require('v8');
99
const fsPromises = fs.promises;
1010
const net = require('net');
11-
const providers = Object.assign({}, internalBinding('async_wrap').Providers);
11+
const providers = { ...internalBinding('async_wrap').Providers };
1212
const fixtures = require('../common/fixtures');
1313
const tmpdir = require('../common/tmpdir');
1414
const { getSystemErrorName } = require('util');

test/sequential/test-inspector-open.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (process.env.BE_CHILD)
1414
return beChild();
1515

1616
const child = fork(__filename,
17-
{ env: Object.assign({}, process.env, { BE_CHILD: 1 }) });
17+
{ env: { ...process.env, BE_CHILD: 1 } });
1818

1919
child.once('message', common.mustCall((msg) => {
2020
assert.strictEqual(msg.cmd, 'started');

test/sequential/test-inspector-port-cluster.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ function workerProcessMain() {
328328
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
329329
return new Promise((resolve) => {
330330
childProcess.fork(__filename, {
331-
env: Object.assign({}, process.env, {
332-
workers: JSON.stringify(workers),
333-
clusterSettings: JSON.stringify(clusterSettings),
334-
testProcess: true
335-
}),
331+
env: { ...process.env,
332+
workers: JSON.stringify(workers),
333+
clusterSettings: JSON.stringify(clusterSettings),
334+
testProcess: true
335+
},
336336
execArgv: execArgv.concat(['--expose-internals'])
337337
}).on('exit', common.mustCall((code, signal) => {
338338
checkExitCode(code, signal);

0 commit comments

Comments
 (0)