From 4b7c6049ef9d40394eb823859c82cbf8d293430d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 31 Jan 2024 22:15:22 -0500 Subject: refactor: load bytes in deno_graph (#22212) Upgrades deno_graph to 0.64 where deno_graph is now responsible for turning bytes into a string. This is in preparation for Wasm modules. --- cli/tests/integration/compile_tests.rs | 29 +++++++++++++++++++++++++++++ cli/tests/integration/npm_tests.rs | 6 +++--- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'cli/tests/integration') diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index d6c7febd5..cf3bf023d 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -1149,3 +1149,32 @@ fn granular_unstable_features() { output.assert_exit_code(0); output.assert_matches_text("Kv {}\n"); } + +#[test] +fn dynamic_import_bad_data_uri() { + let context = TestContextBuilder::new().build(); + let dir = context.temp_dir(); + let exe = if cfg!(windows) { + dir.path().join("app.exe") + } else { + dir.path().join("app") + }; + let file = dir.path().join("bad_data_uri.ts"); + file.write("await import('data:application/')"); + let output = context + .new_command() + .args_vec([ + "compile", + "--output", + &exe.to_string_lossy(), + &file.to_string_lossy(), + ]) + .run(); + output.assert_exit_code(0); + output.skip_output_check(); + let output = context.new_command().name(&exe).run(); + output.assert_exit_code(1); + output.assert_matches_text( + "[WILDCARD]TypeError: Unable to decode data url.[WILDCARD]", + ); +} diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index e3b1196b9..a63253260 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -12,14 +12,14 @@ use util::TestContextBuilder; // NOTE: See how to make test npm packages at ./testdata/npm/README.md -itest!(esm_module { +itest!(es_module { args: "run --allow-read --allow-env npm/esm/main.js", output: "npm/esm/main.out", envs: env_vars_for_npm_tests(), http_server: true, }); -itest!(esm_module_eval { +itest!(es_module_eval { args_vec: vec![ "eval", "import chalk from 'npm:chalk@5'; console.log(chalk.green('chalk esm loads'));", @@ -29,7 +29,7 @@ itest!(esm_module_eval { http_server: true, }); -itest!(esm_module_deno_test { +itest!(es_module_deno_test { args: "test --allow-read --allow-env npm/esm/test.js", output: "npm/esm/test.out", envs: env_vars_for_npm_tests(), -- cgit v1.2.3