Skip to content

Commit ac3deb1

Browse files
Trottaddaleax
authored andcommitted
tools: remove NODE_PATH from environment for tests
Unset NODE_PATH environment variable when running tests. On Ubuntu 16.04, some users experience test failures due to internal libraries being installed in /usr/lib/nodejs/internal and NODE_PATH including /usr/lib/nodejs. Tests that expect internal libraries to be off limits without the --expose-internals flag will fail in this situation. Currently, those tests are test/parallel/test-repl.js and test/parallel/test-internal-modules.js. This situation seems to (probably) be caused by some not-entirely-uncommon package that gets installed. Regardless, tests should ignore the user's NODE_PATH. (NODE_PATH is tested in test/parallel/test-module-globalpaths-nodepath.js and test/parallel/test-require-dot.js.) PR-URL: #11612 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Bryan English <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Refs: https://twitter.com/trott/status/835729396900061184
1 parent 02dbae6 commit ac3deb1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/test.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,13 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
702702
fd_in = 0
703703
pty_out = None
704704

705-
# Extend environment
706705
env_copy = os.environ.copy()
706+
707+
# Remove NODE_PATH
708+
if "NODE_PATH" in env_copy:
709+
del env_copy["NODE_PATH"]
710+
711+
# Extend environment
707712
for key, value in env.iteritems():
708713
env_copy[key] = value
709714

0 commit comments

Comments
 (0)