diff --git a/test/parallel/test-benchmark-crypto.js b/test/parallel/test-benchmark-crypto.js index 682c1276430609..5750a4e2afdadf 100644 --- a/test/parallel/test-benchmark-crypto.js +++ b/test/parallel/test-benchmark-crypto.js @@ -26,8 +26,9 @@ const argv = ['--set', 'algo=sha256', '--set', 'v=crypto', '--set', 'writes=1', 'crypto']; - -const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); +const env = Object.assign({}, process.env, + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); +const child = fork(runjs, argv, { env }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/parallel/test-benchmark-timers.js b/test/parallel/test-benchmark-timers.js index 27844b427ccd1d..991ffda7186e72 100644 --- a/test/parallel/test-benchmark-timers.js +++ b/test/parallel/test-benchmark-timers.js @@ -15,7 +15,10 @@ const argv = ['--set', 'type=depth', '--set', 'thousands=0.001', 'timers']; -const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); +const env = Object.assign({}, process.env, + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); + +const child = fork(runjs, argv, { env }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/parallel/test-env-var-no-warnings.js b/test/parallel/test-env-var-no-warnings.js index 3a99cbc112d8b9..e2a11656f33df2 100644 --- a/test/parallel/test-env-var-no-warnings.js +++ b/test/parallel/test-env-var-no-warnings.js @@ -6,7 +6,8 @@ const cp = require('child_process'); if (process.argv[2] === 'child') { process.emitWarning('foo'); } else { - function test(env) { + function test(newEnv) { + const env = Object.assign({}, process.env, newEnv); const cmd = `"${process.execPath}" "${__filename}" child`; cp.exec(cmd, { env }, common.mustCall((err, stdout, stderr) => { diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index ece93f33539d71..5c6e47d52a654a 100644 --- a/test/parallel/test-tls-env-bad-extra-ca.js +++ b/test/parallel/test-tls-env-bad-extra-ca.js @@ -15,10 +15,10 @@ if (process.env.CHILD) { return tls.createServer({}); } -const env = { +const env = Object.assign({}, process.env, { CHILD: 'yes', NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/no-such-file-exists`, -}; +}); const opts = { env: env, diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js index f55167c53c58c9..80d9cc9ec3ecef 100644 --- a/test/parallel/test-tls-env-extra-ca.js +++ b/test/parallel/test-tls-env-extra-ca.js @@ -32,11 +32,11 @@ const server = tls.createServer(options, common.mustCall(function(s) { s.end('bye'); server.close(); })).listen(0, common.mustCall(function() { - const env = { + const env = Object.assign({}, process.env, { CHILD: 'yes', PORT: this.address().port, NODE_EXTRA_CA_CERTS: fixtures.path('keys', 'ca1-cert.pem') - }; + }); fork(__filename, { env: env }).on('exit', common.mustCall(function(status) { assert.strictEqual(status, 0, 'client did not succeed in connecting'); diff --git a/test/sequential/test-benchmark-child-process.js b/test/sequential/test-benchmark-child-process.js index 168f99445d96ba..f993238549fca4 100644 --- a/test/sequential/test-benchmark-child-process.js +++ b/test/sequential/test-benchmark-child-process.js @@ -8,13 +8,22 @@ const path = require('path'); const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js'); -const child = fork(runjs, ['--set', 'dur=0', - '--set', 'n=1', - '--set', 'len=1', - '--set', 'params=1', - '--set', 'methodName=execSync', - 'child_process'], - { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); +const env = Object.assign({}, process.env, + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); + +const child = fork( + runjs, + [ + '--set', 'dur=0', + '--set', 'n=1', + '--set', 'len=1', + '--set', 'params=1', + '--set', 'methodName=execSync', + 'child_process' + ], + { env } +); + child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/sequential/test-benchmark-net.js b/test/sequential/test-benchmark-net.js index 43f712701d7f89..b2d360328504fb 100644 --- a/test/sequential/test-benchmark-net.js +++ b/test/sequential/test-benchmark-net.js @@ -15,12 +15,14 @@ const path = require('path'); const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js'); +const env = Object.assign({}, process.env, + { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); const child = fork(runjs, ['--set', 'dur=0', '--set', 'len=1024', '--set', 'type=buf', 'net'], - { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); + { env }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null);