diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-10-25 14:39:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 14:39:00 -0400 |
commit | be97170a193e8cecc5ce03ecd3c1d0add4a06bf7 (patch) | |
tree | fab7d266e208db93dcf0870dda70f7da56ade735 /cli/tests/integration/compile_tests.rs | |
parent | 093b3eee58181ec45839d0fe10b8157326a102b2 (diff) |
feat(unstable): ability to `npm install` then `deno run main.ts` (#20967)
This PR adds a new unstable "bring your own node_modules" (BYONM)
functionality currently behind a `--unstable-byonm` flag (`"unstable":
["byonm"]` in a deno.json).
This enables users to run a separate install command (ex. `npm install`,
`pnpm install`) then run `deno run main.ts` and Deno will respect the
layout of the node_modules directory as setup by the separate install
command. It also works with npm/yarn/pnpm workspaces.
For this PR, the behaviour is opted into by specifying
`--unstable-byonm`/`"unstable": ["byonm"]`, but in the future we may
make this the default behaviour as outlined in
https://github.com/denoland/deno/issues/18967#issuecomment-1761248941
This is an extremely rough initial implementation. Errors are
terrible in this and the LSP requires frequent restarts. Improvements
will be done in follow up PRs.
Diffstat (limited to 'cli/tests/integration/compile_tests.rs')
-rw-r--r-- | cli/tests/integration/compile_tests.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 657d17d7d..3ca57a35f 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -29,7 +29,7 @@ fn compile_basic() { .run(); output.assert_exit_code(0); output.skip_output_check(); - let output = context.new_command().command_name(&exe).run(); + let output = context.new_command().name(&exe).run(); output.assert_matches_text("Welcome to Deno!\n"); } @@ -42,7 +42,7 @@ fn compile_basic() { .new_command() // it should fail creating this, but still work .env("DENO_DIR", readonly_sub_dir) - .command_name(exe) + .name(exe) .run(); output.assert_matches_text("Welcome to Deno!\n"); } @@ -688,11 +688,7 @@ fn workers_not_in_module_map() { output.assert_exit_code(0); output.skip_output_check(); - let output = context - .new_command() - .command_name(exe) - .env("NO_COLOR", "") - .run(); + let output = context.new_command().name(exe).env("NO_COLOR", "").run(); output.assert_exit_code(1); output.assert_matches_text(concat!( "error: Uncaught (in worker \"\") Module not found: [WILDCARD]", @@ -825,7 +821,7 @@ fn compile_npm_specifiers() { output.assert_exit_code(0); output.skip_output_check(); - let output = context.new_command().command_name(&binary_path).run(); + let output = context.new_command().name(&binary_path).run(); output.assert_matches_text( r#"Node esm importing node cjs =========================== @@ -881,7 +877,7 @@ testing[WILDCARD]this output.assert_exit_code(0); output.skip_output_check(); - let output = context.new_command().command_name(binary_path).run(); + let output = context.new_command().name(binary_path).run(); output.assert_matches_text("2\n"); } @@ -1050,7 +1046,7 @@ fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) { }; let output = context .new_command() - .command_name(binary_path) + .name(binary_path) .args_vec(opts.run_args) .run(); output.assert_matches_file(opts.output_file); @@ -1114,6 +1110,6 @@ fn compile_node_modules_symlink_outside() { // run let binary_path = project_dir.join(if cfg!(windows) { "bin.exe" } else { "bin" }); - let output = context.new_command().command_name(binary_path).run(); + let output = context.new_command().name(binary_path).run(); output.assert_matches_file("compile/node_modules_symlink_outside/main.out"); } |