diff --git a/test/parallel/test-child-process-spawnsync-env.js b/test/parallel/test-child-process-spawnsync-env.js index bc7c5aa3dd6c14..3147bdd91c0a17 100644 --- a/test/parallel/test-child-process-spawnsync-env.js +++ b/test/parallel/test-child-process-spawnsync-env.js @@ -7,9 +7,12 @@ if (process.argv[2] === 'child') { console.log(process.env.foo); } else { var expected = 'bar'; - var child = cp.spawnSync(process.execPath, [__filename, 'child'], { - env: {foo: expected} - }); + var opt = { + env: process.env + }; + opt.env.foo = expected; + + var child = cp.spawnSync(process.execPath, [__filename, 'child'], opt); assert.equal(child.stdout.toString().trim(), expected); } diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index c198d7d0ebc638..2256ea6c6de200 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -25,13 +25,15 @@ function test(env, cb) { }); } -test({ NODE_DEBUG: '' }, function(data) { +process.env.NODE_DEBUG = ''; +test(process.env, function(data) { assert(/EISDIR/.test(data)); assert(!/test-fs-readfile-error/.test(data)); callbacks++; }); -test({ NODE_DEBUG: 'fs' }, function(data) { +process.env.NODE_DEBUG = 'fs'; +test(process.env, function(data) { assert(/EISDIR/.test(data)); assert(/test-fs-readfile-error/.test(data)); callbacks++; diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js index 0478de55d62592..6cfa2c10500983 100644 --- a/test/sequential/test-net-GH-5504.js +++ b/test/sequential/test-net-GH-5504.js @@ -54,11 +54,9 @@ function parent() { var clientExited = false; var serverListened = false; var opt = { - env: { - NODE_DEBUG: 'net', - NODE_COMMON_PORT: process.env.NODE_COMMON_PORT, - } + env: process.env }; + opt.env.NODE_DEBUG = 'net'; process.on('exit', function() { assert(serverExited); diff --git a/test/sequential/test-stdin-script-child.js b/test/sequential/test-stdin-script-child.js index 8590df02d8efe9..426bada309461b 100644 --- a/test/sequential/test-stdin-script-child.js +++ b/test/sequential/test-stdin-script-child.js @@ -3,11 +3,12 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; -var child = spawn(process.execPath, [], { - env: { - NODE_DEBUG: process.argv[2] - } -}); +var opt = { + env: process.env +}; + +opt.env.NODE_DEBUG = process.argv[2]; +var child = spawn(process.execPath, [], opt); var wanted = child.pid + '\n'; var found = ''; diff --git a/test/sequential/test-util-debug.js b/test/sequential/test-util-debug.js index 834c21ec0e50b4..9ab2cdd8d362d4 100644 --- a/test/sequential/test-util-debug.js +++ b/test/sequential/test-util-debug.js @@ -26,14 +26,17 @@ function test(environ, shouldWrite) { var didTest = false; var spawn = require('child_process').spawn; - var child = spawn(process.execPath, [__filename, 'child'], { - // Lttng requires the HOME env variable or it prints to stderr, - // This is not really ideal, as it breaks this test, so the HOME - // env variable is passed to the child to make the test pass. - // this is fixed in the next version of lttng (2.7+), so we can - // remove it at sometime in the future. - env: { NODE_DEBUG: environ, HOME: process.env.HOME } - }); + var opt = { + env: process.env + }; + opt.env.NODE_DEBUG = environ; + // Lttng requires the HOME env variable or it prints to stderr, + // This is not really ideal, as it breaks this test, so the HOME + // env variable is passed to the child to make the test pass. + // this is fixed in the next version of lttng (2.7+), so we can + // remove it at sometime in the future. + opt.env.HOME = process.env.HOME; + var child = spawn(process.execPath, [__filename, 'child'], opt); expectErr = expectErr.split('%PID%').join(child.pid);