summaryrefslogtreecommitdiff
path: root/cli/tests/integration/jsr_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-09-18 10:46:44 -0400
committerGitHub <noreply@github.com>2023-09-18 10:46:44 -0400
commit0709c051f83c181206f6653396f5428df66ed74f (patch)
tree9360ce6cfc2c3f3f53a8a7af0f9d3bdc9e1ee553 /cli/tests/integration/jsr_tests.rs
parent4fcd9a0de815a756e5f173e1bc1f84d90ba39ec7 (diff)
feat(unstable): package manager (#20517)
Adds an experimental unstable built-in package manager to Deno, but it is currently not usable because the registry infrastructure hasn't been setup and it points to a non-existent url by default. The default registry url can be configured via the `DENO_REGISTRY_URL` environment variable.
Diffstat (limited to 'cli/tests/integration/jsr_tests.rs')
-rw-r--r--cli/tests/integration/jsr_tests.rs99
1 files changed, 99 insertions, 0 deletions
diff --git a/cli/tests/integration/jsr_tests.rs b/cli/tests/integration/jsr_tests.rs
new file mode 100644
index 000000000..d1706d84b
--- /dev/null
+++ b/cli/tests/integration/jsr_tests.rs
@@ -0,0 +1,99 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+use deno_lockfile::Lockfile;
+use test_util as util;
+use util::env_vars_for_jsr_tests;
+use util::TestContextBuilder;
+
+itest!(no_module_graph_run {
+ args: "run jsr/no_module_graph/main.ts",
+ output: "jsr/no_module_graph/main.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(no_module_graph_info {
+ args: "info jsr/no_module_graph/main.ts",
+ output: "jsr/no_module_graph/main_info.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(same_package_multiple_versions {
+ args: "run --quiet jsr/no_module_graph/multiple.ts",
+ output: "jsr/no_module_graph/multiple.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(module_graph_run {
+ args: "run jsr/module_graph/main.ts",
+ output: "jsr/module_graph/main.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(module_graph_info {
+ args: "info jsr/module_graph/main.ts",
+ output: "jsr/module_graph/main_info.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(deps_run {
+ args: "run jsr/deps/main.ts",
+ output: "jsr/deps/main.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(deps_info {
+ args: "info jsr/deps/main.ts",
+ output: "jsr/deps/main_info.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
+itest!(version_not_found {
+ args: "run jsr/version_not_found/main.ts",
+ output: "jsr/version_not_found/main.out",
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+ exit_code: 1,
+});
+
+#[test]
+fn specifiers_in_lockfile() {
+ let test_context = TestContextBuilder::for_jsr().use_temp_cwd().build();
+ let temp_dir = test_context.temp_dir();
+
+ temp_dir.write(
+ "main.ts",
+ r#"import version from "jsr:@denotest/no_module_graph@0.1/mod.ts";
+
+console.log(version);"#,
+ );
+ temp_dir.write("deno.json", "{}"); // to automatically create a lockfile
+
+ test_context
+ .new_command()
+ .args("run --quiet main.ts")
+ .run()
+ .assert_matches_text("0.1.1\n");
+
+ let lockfile_path = temp_dir.path().join("deno.lock");
+ let mut lockfile = Lockfile::new(lockfile_path.to_path_buf(), false).unwrap();
+ *lockfile
+ .content
+ .packages
+ .specifiers
+ .get_mut("jsr:@denotest/no_module_graph@0.1")
+ .unwrap() = "jsr:@denotest/no_module_graph@0.1.0".to_string();
+ lockfile_path.write(lockfile.as_json_string());
+
+ test_context
+ .new_command()
+ .args("run --quiet main.ts")
+ .run()
+ .assert_matches_text("0.1.0\n");
+}