1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

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`.
This commit is contained in:
Bartek Iwańczuk 2024-04-12 11:27:34 +01:00 committed by GitHub
parent c92f118652
commit f3cddb9688
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View file

@ -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");
}

View file

@ -0,0 +1,2 @@
await import("jsr:@denotest/add");
console.log("Hello world");