diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-16 17:29:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 17:29:35 -0500 |
commit | ceca097e6f2215fce29f2e6aaca7702fa0a99404 (patch) | |
tree | d57c2ea1c9048a3aaa01e9cc787fc0fbfd242cb3 /cli/tests/integration/npm_tests.rs | |
parent | b572abfcb3fadbfdd3ce671a27463d67bcb77534 (diff) |
fix(npm): support cjs entrypoint in node_modules folder (#21224)
Closes #21109
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r-- | cli/tests/integration/npm_tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index 4f03e4e80..95ffd71cd 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -2653,3 +2653,24 @@ pub fn different_nested_dep_byonm() { .run(); output.assert_matches_file("npm/different_nested_dep/main.out"); } + +#[test] +pub fn run_cjs_in_node_modules_folder() { + let test_context = TestContextBuilder::for_npm().use_temp_cwd().build(); + let temp_dir = test_context.temp_dir(); + temp_dir.write("package.json", "{}"); + temp_dir.write("deno.json", r#"{ "unstable": ["byonm"] }"#); + let pkg_dir = temp_dir.path().join("node_modules/package"); + pkg_dir.create_dir_all(); + pkg_dir + .join("package.json") + .write(r#"{ "name": "package" }"#); + pkg_dir + .join("main.js") + .write("console.log('hi'); module.exports = 'hi';"); + test_context + .new_command() + .args("run node_modules/package/main.js") + .run() + .assert_matches_text("hi\n"); +} |