Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.)

Refs: https://twitter.com/trott/status/835729396900061184
  • Loading branch information
Trott committed Feb 28, 2017
commit c99ba2dd34d5de67a54157671ba5332ecd6b47fd
7 changes: 6 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,13 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
fd_in = 0
pty_out = None

# Extend environment
env_copy = os.environ.copy()

# Remove NODE_PATH
if "NODE_PATH" in env_copy:
del env_copy["NODE_PATH"]

# Extend environment
for key, value in env.iteritems():
env_copy[key] = value

Expand Down