repl: fix require('3rdparty') regression
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 9 Dec 2015 20:55:29 +0000 (21:55 +0100)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:30 +0000 (11:52 -0800)
commit41882e4077f5938c9b969024f4a73581496c0d83
treee47f4c04880c7cf074edb742b1737f68d42cdc6d
parent3080bdc7d78a225d835c69f279592b30c9da7dde
repl: fix require('3rdparty') regression

Fix module loading of third-party modules in the REPL by inheriting
module.paths from the REPL's parent module.

Commit ee72ee7 ("module,repl: remove repl require() hack") introduced
a regression where require() of modules in node_modules directories
no longer worked in the REPL (and fortunately only in the REPL.)
It turns out we didn't have test coverage for that but we do now.

Fixes: https://github.com/nodejs/node/issues/4208
PR-URL: https://github.com/nodejs/node/pull/4215
Reviewed-By: Roman Reiss <me@silverwind.io>
lib/repl.js
test/fixtures/node_modules/baz/index.js
test/parallel/test-repl-require.js [new file with mode: 0644]