Skip to content

Commit aaedc06

Browse files
Grigoriy LevanovMylesBorins
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 <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>
1 parent b8b6f25 commit aaedc06

7 files changed

Lines changed: 17 additions & 17 deletions

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

Lines changed: 4 additions & 4 deletions
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‎

Lines changed: 4 additions & 4 deletions
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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ if (typeof Symbol !== 'undefined') {
13631363
constarr=newArray(101).fill();
13641364
constobj={a: {a: {a: {a: 1}}}};
13651365

1366-
constoldOptions=Object.assign({},util.inspect.defaultOptions);
1366+
constoldOptions={ ...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‎

Lines changed: 1 addition & 1 deletion
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-
constcopiedUrlObj=Object.assign({},urlObj);
155+
constcopiedUrlObj={ ...urlObj};
156156
constcopiedOpts=urlToOptions(copiedUrlObj);
157157
assert.strictEqual(copiedOptsinstanceofURL,false);
158158
assert.strictEqual(copiedOpts.protocol,undefined);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const fs = require('fs');
88
constv8=require('v8');
99
constfsPromises=fs.promises;
1010
constnet=require('net');
11-
constproviders=Object.assign({},internalBinding('async_wrap').Providers);
11+
constproviders={ ...internalBinding('async_wrap').Providers};
1212
constfixtures=require('../common/fixtures');
1313
consttmpdir=require('../common/tmpdir');
1414
const{ getSystemErrorName }=require('util');

‎test/sequential/test-inspector-open.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (process.env.BE_CHILD)
1414
returnbeChild();
1515

1616
constchild=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‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ function workerProcessMain() {
328328
functionspawnMaster({ execArgv, workers, clusterSettings ={}}){
329329
returnnewPromise((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)