diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index 3d21b57c3d..2ece84c5db 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -660,6 +660,13 @@ itest!(deno_run_cowsay { http_server: true, }); +itest!(deno_run_cowsay_with_node_modules_dir { + args: "run -A --quiet --node-modules-dir npm:cowsay@1.5.0 Hello", + output: "npm/deno_run_cowsay.out", + envs: env_vars_for_npm_tests_no_sync_download(), + http_server: true, +}); + itest!(deno_run_cowsay_explicit { args: "run -A --quiet npm:cowsay@1.5.0/cowsay Hello", output: "npm/deno_run_cowsay.out", diff --git a/cli/tests/testdata/.gitignore b/cli/tests/testdata/.gitignore new file mode 100644 index 0000000000..3c3629e647 --- /dev/null +++ b/cli/tests/testdata/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/ext/node/02_require.js b/ext/node/02_require.js index 2b4a9c16c2..d334a60a50 100644 --- a/ext/node/02_require.js +++ b/ext/node/02_require.js @@ -371,10 +371,9 @@ Module._findPath = function (request, paths, isMain, parentPath) { const isRelative = ops.op_require_is_request_relative( request, ); - const basePath = - (isDenoDirPackage && !isRelative && !usesLocalNodeModulesDir) - ? pathResolve(curPath, packageSpecifierSubPath(request)) - : pathResolve(curPath, request); + const basePath = (isDenoDirPackage && !isRelative) + ? pathResolve(curPath, packageSpecifierSubPath(request)) + : pathResolve(curPath, request); let filename; const rc = stat(basePath);