summaryrefslogtreecommitdiff
path: root/cli/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration')
-rw-r--r--cli/tests/integration/check_tests.rs7
-rw-r--r--cli/tests/integration/compile_tests.rs11
-rw-r--r--cli/tests/integration/info_tests.rs4
-rw-r--r--cli/tests/integration/jsr_tests.rs99
-rw-r--r--cli/tests/integration/mod.rs1
-rw-r--r--cli/tests/integration/npm_tests.rs22
-rw-r--r--cli/tests/integration/run_tests.rs16
7 files changed, 123 insertions, 37 deletions
diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs
index 402f683c8..ca80ffa94 100644
--- a/cli/tests/integration/check_tests.rs
+++ b/cli/tests/integration/check_tests.rs
@@ -2,7 +2,6 @@
use test_util as util;
use util::env_vars_for_npm_tests;
-use util::env_vars_for_npm_tests_no_sync_download;
use util::TestContext;
use util::TestContextBuilder;
@@ -61,7 +60,7 @@ itest!(bundle_jsximportsource_importmap_config {
itest!(jsx_not_checked {
args: "check check/jsx_not_checked/main.jsx",
output: "check/jsx_not_checked/main.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 1,
});
@@ -272,7 +271,7 @@ itest!(package_json_basic {
itest!(package_json_fail_check {
args: "check --quiet fail_check.ts",
output: "package_json/basic/fail_check.check.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
cwd: Some("package_json/basic"),
copy_temp_dir: Some("package_json/basic"),
@@ -284,7 +283,7 @@ itest!(package_json_with_deno_json {
output: "package_json/deno_json/main.check.out",
cwd: Some("package_json/deno_json/"),
copy_temp_dir: Some("package_json/deno_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 1,
});
diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs
index f43b1cff9..657d17d7d 100644
--- a/cli/tests/integration/compile_tests.rs
+++ b/cli/tests/integration/compile_tests.rs
@@ -792,10 +792,7 @@ fn dynamic_import_unanalyzable() {
#[test]
fn compile_npm_specifiers() {
- let context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
- .use_temp_cwd()
- .build();
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
let temp_dir = context.temp_dir();
temp_dir.write(
@@ -1012,10 +1009,7 @@ struct RunNpmBinCompileOptions<'a> {
}
fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) {
- let context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
- .use_temp_cwd()
- .build();
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
let temp_dir = context.temp_dir();
let testdata_path = context.testdata_path();
@@ -1066,7 +1060,6 @@ fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) {
#[test]
fn compile_node_modules_symlink_outside() {
let context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
.use_copy_temp_dir("compile/node_modules_symlink_outside")
.cwd("compile/node_modules_symlink_outside")
.build();
diff --git a/cli/tests/integration/info_tests.rs b/cli/tests/integration/info_tests.rs
index aeabf8208..bfba40080 100644
--- a/cli/tests/integration/info_tests.rs
+++ b/cli/tests/integration/info_tests.rs
@@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use test_util as util;
-use util::env_vars_for_npm_tests_no_sync_download;
+use util::env_vars_for_npm_tests;
use util::TestContextBuilder;
#[test]
@@ -141,7 +141,7 @@ itest!(with_config_override {
itest!(package_json_basic {
args: "info --quiet main.ts",
output: "package_json/basic/main.info.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
cwd: Some("package_json/basic"),
copy_temp_dir: Some("package_json/basic"),
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");
+}
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs
index 39a694c26..80b316432 100644
--- a/cli/tests/integration/mod.rs
+++ b/cli/tests/integration/mod.rs
@@ -121,6 +121,7 @@ mod inspector;
mod install;
#[path = "js_unit_tests.rs"]
mod js_unit_tests;
+mod jsr_tests;
#[path = "lint_tests.rs"]
mod lint;
#[path = "lsp_tests.rs"]
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index ff600637c..edd100d7d 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -8,7 +8,6 @@ use std::process::Stdio;
use test_util as util;
use util::assert_contains;
use util::env_vars_for_npm_tests;
-use util::env_vars_for_npm_tests_no_sync_download;
use util::http_server;
use util::TestContextBuilder;
@@ -461,7 +460,7 @@ fn parallel_downloading() {
],
None,
// don't use the sync env var
- Some(env_vars_for_npm_tests_no_sync_download()),
+ Some(env_vars_for_npm_tests()),
true,
);
assert!(out.contains("chalk cjs loads"));
@@ -742,7 +741,7 @@ fn deno_run_cjs_module() {
itest!(deno_run_cowsay {
args: "run -A --quiet npm:cowsay@1.5.0 Hello",
output: "npm/deno_run_cowsay.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
@@ -750,21 +749,21 @@ itest!(deno_run_cowsay_with_node_modules_dir {
args: "run -A --quiet --node-modules-dir npm:cowsay@1.5.0 Hello",
temp_cwd: true,
output: "npm/deno_run_cowsay.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
itest!(deno_run_cowsay_explicit {
args: "run -A --quiet npm:cowsay@1.5.0/cowsay Hello",
output: "npm/deno_run_cowsay.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
itest!(deno_run_cowthink {
args: "run -A --quiet npm:cowsay@1.5.0/cowthink Hello",
output: "npm/deno_run_cowthink.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
@@ -1553,7 +1552,6 @@ fn auto_discover_lock_file() {
#[test]
fn peer_deps_with_copied_folders_and_lockfile() {
let context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
.use_copy_temp_dir("npm/peer_deps_with_copied_folders")
.cwd("npm/peer_deps_with_copied_folders")
.build();
@@ -1749,10 +1747,7 @@ fn reload_info_not_found_cache_but_exists_remote() {
// This tests that when a local machine doesn't have a version
// specified in a dependency that exists in the npm registry
- let test_context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
- .use_temp_cwd()
- .build();
+ let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let deno_dir = test_context.deno_dir();
let temp_dir = test_context.temp_dir();
temp_dir.write(
@@ -1955,7 +1950,6 @@ fn reload_info_not_found_cache_but_exists_remote() {
#[test]
fn binary_package_with_optional_dependencies() {
let context = TestContextBuilder::for_npm()
- .use_sync_npm_download()
.use_copy_temp_dir("npm/binary_package")
.cwd("npm/binary_package")
.build();
@@ -2171,7 +2165,7 @@ itest!(dynamic_import_json {
itest!(check_package_file_dts_dmts_dcts {
args: "check npm/file_dts_dmts_dcts/main.ts",
output: "npm/file_dts_dmts_dcts/main.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 1,
});
@@ -2179,7 +2173,7 @@ itest!(check_package_file_dts_dmts_dcts {
itest!(require_resolve_url_paths {
args: "run -A --quiet --node-modules-dir url_paths.ts",
output: "npm/require_resolve_url/url_paths.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 0,
cwd: Some("npm/require_resolve_url/"),
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 0a5e86b1f..1dff1f6d6 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -15,7 +15,7 @@ use trust_dns_client::serialize::txt::Lexer;
use trust_dns_client::serialize::txt::Parser;
use util::assert_contains;
use util::assert_not_contains;
-use util::env_vars_for_npm_tests_no_sync_download;
+use util::env_vars_for_npm_tests;
use util::PathRef;
use util::TestContext;
use util::TestContextBuilder;
@@ -3122,7 +3122,7 @@ itest!(package_json_auto_discovered_for_local_script_arg {
cwd: Some("run/with_package_json/"),
// prevent creating a node_modules dir in the code directory
copy_temp_dir: Some("run/with_package_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
@@ -3134,7 +3134,7 @@ itest!(
output: "run/with_package_json/with_stop/main.out",
cwd: Some("run/with_package_json/"),
copy_temp_dir: Some("run/with_package_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 1,
}
@@ -3165,7 +3165,7 @@ itest!(
output: "run/with_package_json/no_deno_json/sub_dir/main.out",
cwd: Some("run/with_package_json/no_deno_json/sub_dir"),
copy_temp_dir: Some("run/with_package_json/no_deno_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
}
);
@@ -3175,7 +3175,7 @@ itest!(package_json_auto_discovered_for_npm_binary {
output: "run/with_package_json/npm_binary/main.out",
cwd: Some("run/with_package_json/npm_binary/"),
copy_temp_dir: Some("run/with_package_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
http_server: true,
});
@@ -4565,21 +4565,21 @@ fn permission_prompt_strips_ansi_codes_and_control_chars() {
itest!(node_builtin_modules_ts {
args: "run --quiet --allow-read run/node_builtin_modules/mod.ts hello there",
output: "run/node_builtin_modules/mod.ts.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
exit_code: 0,
});
itest!(node_builtin_modules_js {
args: "run --quiet --allow-read run/node_builtin_modules/mod.js hello there",
output: "run/node_builtin_modules/mod.js.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
exit_code: 0,
});
itest!(node_prefix_missing {
args: "run --quiet run/node_prefix_missing/main.ts",
output: "run/node_prefix_missing/main.ts.out",
- envs: env_vars_for_npm_tests_no_sync_download(),
+ envs: env_vars_for_npm_tests(),
exit_code: 1,
});