summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-01-31 22:15:22 -0500
committerGitHub <noreply@github.com>2024-02-01 03:15:22 +0000
commit4b7c6049ef9d40394eb823859c82cbf8d293430d (patch)
tree61e6de7c69c9d00faeef0ff7e6c223224a53de9e /cli/tests
parent830d096b66696ad9f4e67b3ed8460fb1ff7a9170 (diff)
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.
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/compile_tests.rs29
-rw-r--r--cli/tests/integration/npm_tests.rs6
-rw-r--r--cli/tests/testdata/fmt/invalid_data.out3
-rw-r--r--cli/tests/testdata/npm/cjs_require_esm_error/main.out2
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_es_module.js (renamed from cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_esm_module.js)0
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/index.js2
6 files changed, 37 insertions, 5 deletions
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(),
diff --git a/cli/tests/testdata/fmt/invalid_data.out b/cli/tests/testdata/fmt/invalid_data.out
index 7fd5046ee..dee00fcc5 100644
--- a/cli/tests/testdata/fmt/invalid_data.out
+++ b/cli/tests/testdata/fmt/invalid_data.out
@@ -1 +1,4 @@
error: [WILDCARD] is not a valid UTF-8 file
+
+Caused by:
+ invalid data
diff --git a/cli/tests/testdata/npm/cjs_require_esm_error/main.out b/cli/tests/testdata/npm/cjs_require_esm_error/main.out
index f24675de9..b6ade6904 100644
--- a/cli/tests/testdata/npm/cjs_require_esm_error/main.out
+++ b/cli/tests/testdata/npm/cjs_require_esm_error/main.out
@@ -1,2 +1,2 @@
-error: Uncaught (in promise) Error: require() of ES Module [WILDCARD]my_esm_module.js from [WILDCARD]index.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
+error: Uncaught (in promise) Error: require() of ES Module [WILDCARD]my_es_module.js from [WILDCARD]index.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
[WILDCARD]
diff --git a/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_esm_module.js b/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_es_module.js
index 0613f1911..0613f1911 100644
--- a/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_esm_module.js
+++ b/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/esm/my_es_module.js
diff --git a/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/index.js
index 6db336dba..ba630f93b 100644
--- a/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/index.js
+++ b/cli/tests/testdata/npm/registry/@denotest/cjs-require-esm-error/1.0.0/index.js
@@ -1 +1 @@
-module.exports.Test = require("./esm/my_esm_module.js");
+module.exports.Test = require("./esm/my_es_module.js");