diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-04-12 11:27:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 12:27:34 +0200 |
commit | f3cddb96881c2067e9741c41a216b4cfc6a2b2f4 (patch) | |
tree | 259052c239645faf221c482379f2e27cfa25d402 | |
parent | c92f1186529b1d7e134647ae5c277ac0154b35f1 (diff) |
test(compile): dynamic JSR imports are working correctly (#23306)
Adds a test that ensure that dynamic import from JSR are working
correctly for `deno compile`.
-rw-r--r-- | tests/integration/compile_tests.rs | 26 | ||||
-rw-r--r-- | tests/testdata/compile/jsr_dynamic_import/main.ts | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/integration/compile_tests.rs b/tests/integration/compile_tests.rs index 9258da89f..898a7d9f9 100644 --- a/tests/integration/compile_tests.rs +++ b/tests/integration/compile_tests.rs @@ -1243,3 +1243,29 @@ fn standalone_config_file_respects_compiler_options() { output.assert_exit_code(0); output.assert_matches_text("[WILDCARD]C.test() called[WILDCARD]"); } + +#[test] +fn standalone_jsr_dynamic_import() { + let context = TestContextBuilder::for_jsr().build(); + let dir = context.temp_dir(); + let exe = if cfg!(windows) { + dir.path().join("jsr_dynamic_import.exe") + } else { + dir.path().join("jsr_dynamic_import") + }; + context + .new_command() + .args_vec([ + "compile", + "--output", + &exe.to_string_lossy(), + "./compile/jsr_dynamic_import/main.ts", + ]) + .run() + .skip_output_check() + .assert_exit_code(0); + let output = context.new_command().name(&exe).run(); + + output.assert_exit_code(0); + output.assert_matches_text("Hello world\n"); +} diff --git a/tests/testdata/compile/jsr_dynamic_import/main.ts b/tests/testdata/compile/jsr_dynamic_import/main.ts new file mode 100644 index 000000000..3d6dc343e --- /dev/null +++ b/tests/testdata/compile/jsr_dynamic_import/main.ts @@ -0,0 +1,2 @@ +await import("jsr:@denotest/add"); +console.log("Hello world"); |