summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/compile_tests.rs8
-rw-r--r--tests/integration/lsp_tests.rs29
-rw-r--r--tests/integration/node_unit_tests.rs1
-rw-r--r--tests/integration/npm_tests.rs124
-rw-r--r--tests/integration/run_tests.rs2
5 files changed, 48 insertions, 116 deletions
diff --git a/tests/integration/compile_tests.rs b/tests/integration/compile_tests.rs
index 60451e005..54a82b913 100644
--- a/tests/integration/compile_tests.rs
+++ b/tests/integration/compile_tests.rs
@@ -989,7 +989,7 @@ fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) {
args.extend(opts.compile_args.iter().map(|s| s.to_string()));
if opts.node_modules_local {
- args.push("--node-modules=local-auto".to_string());
+ args.push("--node-modules-dir=auto".to_string());
}
if let Some(bin_name) = opts.input_name {
@@ -1052,7 +1052,7 @@ fn compile_node_modules_symlink_outside() {
// compile folder
let output = context
.new_command()
- .args("compile --allow-read --node-modules=local-auto --output bin main.ts")
+ .args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_file(
@@ -1075,7 +1075,7 @@ fn compile_node_modules_symlink_outside() {
// compile
let output = context
.new_command()
- .args("compile --allow-read --node-modules=local-auto --output bin main.ts")
+ .args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_file(
@@ -1105,7 +1105,7 @@ console.log(getValue());"#,
// compile folder
let output = context
.new_command()
- .args("compile --allow-read --node-modules=local-auto --output bin main.ts")
+ .args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_text(
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs
index f20fbcc9c..c3f2f9daa 100644
--- a/tests/integration/lsp_tests.rs
+++ b/tests/integration/lsp_tests.rs
@@ -9035,7 +9035,7 @@ fn lsp_completions_node_specifier_node_modules_dir() {
temp_dir.write(
temp_dir.path().join("deno.json"),
json!({
- "nodeModulesDir": true,
+ "nodeModulesDir": "auto",
})
.to_string(),
);
@@ -9442,7 +9442,7 @@ fn lsp_npmrc() {
temp_dir.write(
temp_dir.path().join("deno.json"),
json!({
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
@@ -12372,7 +12372,7 @@ fn lsp_node_modules_dir() {
temp_dir.write(
"deno.json",
json!({
- "nodeModules": "global-auto",
+ "nodeModulesDir": "none",
})
.to_string(),
);
@@ -12413,7 +12413,7 @@ fn lsp_node_modules_dir() {
temp_dir.write(
temp_dir.path().join("deno.json"),
- "{ \"nodeModules\": \"local-auto\", \"lock\": false }\n",
+ "{ \"nodeModulesDir\": \"auto\", \"lock\": false }\n",
);
let refresh_config = |client: &mut LspClient| {
client.change_configuration(json!({ "deno": {
@@ -12449,7 +12449,7 @@ fn lsp_node_modules_dir() {
// now add a lockfile and cache
temp_dir.write(
temp_dir.path().join("deno.json"),
- "{ \"nodeModules\": \"local-auto\" }\n",
+ "{ \"nodeModulesDir\": \"auto\" }\n",
);
refresh_config(&mut client);
cache(&mut client);
@@ -13056,21 +13056,21 @@ fn lsp_deno_json_scopes_node_modules_dir() {
temp_dir.write(
"project1/deno.json",
json!({
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
temp_dir.write(
"project2/deno.json",
json!({
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
temp_dir.write(
"project2/project3/deno.json",
json!({
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
@@ -14247,7 +14247,7 @@ fn lsp_deno_json_workspace_node_modules_dir() {
"project1/deno.json",
json!({
"workspace": ["project2"],
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
@@ -14383,7 +14383,7 @@ fn lsp_npm_workspace() {
temp_dir.write(
"deno.json",
json!({
- "nodeModules": "local-auto",
+ "nodeModulesDir": "auto",
})
.to_string(),
);
@@ -14625,11 +14625,8 @@ fn lsp_jupyter_byonm_diagnostics() {
}
#[test]
-fn lsp_deno_future_env_byonm() {
- let context = TestContextBuilder::for_npm()
- .env("DENO_FUTURE", "1")
- .use_temp_cwd()
- .build();
+fn lsp_byonm() {
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
let temp_dir = context.temp_dir();
temp_dir.path().join("package.json").write_json(&json!({
"dependencies": {
@@ -15187,7 +15184,6 @@ fn lsp_cjs_internal_types_default_export() {
.use_http_server()
.use_temp_cwd()
.add_npm_env_vars()
- .env("DENO_FUTURE", "1")
.build();
let temp_dir = context.temp_dir();
temp_dir.write("deno.json", r#"{}"#);
@@ -15236,7 +15232,6 @@ fn lsp_cjs_import_dual() {
.use_http_server()
.use_temp_cwd()
.add_npm_env_vars()
- .env("DENO_FUTURE", "1")
.build();
let temp_dir = context.temp_dir();
temp_dir.write("deno.json", r#"{}"#);
diff --git a/tests/integration/node_unit_tests.rs b/tests/integration/node_unit_tests.rs
index b44cd629a..dfe15a11c 100644
--- a/tests/integration/node_unit_tests.rs
+++ b/tests/integration/node_unit_tests.rs
@@ -107,7 +107,6 @@ fn node_unit_test(test: String) {
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
- .env("DENO_FUTURE", "1")
.arg("test")
.arg("--config")
.arg(deno_config_path())
diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs
index b6591c332..db63d4533 100644
--- a/tests/integration/npm_tests.rs
+++ b/tests/integration/npm_tests.rs
@@ -140,7 +140,7 @@ itest!(mixed_case_package_name_global_dir {
itest!(mixed_case_package_name_local_dir {
args:
- "run --node-modules=local-auto -A $TESTDATA/npm/mixed_case_package_name/local.ts",
+ "run --node-modules-dir=auto -A $TESTDATA/npm/mixed_case_package_name/local.ts",
output: "npm/mixed_case_package_name/local.out",
exit_code: 0,
envs: env_vars_for_npm_tests(),
@@ -374,7 +374,7 @@ itest!(permissions_outside_package {
});
itest!(run_existing_npm_package {
- args: "run --allow-read --node-modules=local-auto npm:@denotest/bin",
+ args: "run --allow-read --node-modules-dir=auto npm:@denotest/bin",
output: "npm/run_existing_npm_package/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -385,7 +385,7 @@ itest!(run_existing_npm_package {
itest!(run_existing_npm_package_with_subpath {
args:
- "run --allow-read --node-modules=local-auto npm:@denotest/bin/cli-esm dev --help",
+ "run --allow-read --node-modules-dir=auto npm:@denotest/bin/cli-esm dev --help",
output: "npm/run_existing_npm_package_with_subpath/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -813,7 +813,7 @@ itest!(builtin_module_module {
itest!(node_modules_dir_require_added_node_modules_folder {
args:
- "run --node-modules=local-auto -A --quiet $TESTDATA/npm/require_added_nm_folder/main.js",
+ "run --node-modules-dir=auto -A --quiet $TESTDATA/npm/require_added_nm_folder/main.js",
output: "npm/require_added_nm_folder/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -831,7 +831,7 @@ itest!(node_modules_dir_require_main_entry {
});
itest!(node_modules_dir_with_deps {
- args: "run --allow-read --allow-env --node-modules=local-auto $TESTDATA/npm/cjs_with_deps/main.js",
+ args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_with_deps/main.js",
output: "npm/cjs_with_deps/main_node_modules.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -839,7 +839,7 @@ itest!(node_modules_dir_with_deps {
});
itest!(node_modules_dir_yargs {
- args: "run --allow-read --allow-env --node-modules=local-auto $TESTDATA/npm/cjs_yargs/main.js",
+ args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_yargs/main.js",
output: "npm/cjs_yargs/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -855,7 +855,7 @@ fn node_modules_dir_cache() {
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
.current_dir(deno_dir.path())
.arg("cache")
- .arg("--node-modules=local-auto")
+ .arg("--node-modules-dir=auto")
.arg("--quiet")
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
.envs(env_vars_for_npm_tests())
@@ -888,7 +888,7 @@ fn node_modules_dir_cache() {
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
.current_dir(deno_dir.path())
.arg("run")
- .arg("--node-modules=local-auto")
+ .arg("--node-modules-dir=auto")
.arg("--quiet")
.arg("-A")
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
@@ -1496,7 +1496,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
// now run with local node modules
let output = context
.new_command()
- .args("run -A --node-modules=local-auto main.ts")
+ .args("run -A --node-modules-dir=auto main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_file(
@@ -1514,7 +1514,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
// now again run with local node modules
let output = context
.new_command()
- .args("run -A --node-modules=local-auto main.ts")
+ .args("run -A --node-modules-dir=auto main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_text("1\n2\n");
@@ -1522,7 +1522,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
// now ensure it works with reloading
let output = context
.new_command()
- .args("run -A --reload --node-modules=local-auto main.ts")
+ .args("run -A --reload --node-modules-dir=auto main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_file(
@@ -1532,7 +1532,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
// now ensure it works with reloading and no lockfile
let output = context
.new_command()
- .args("run -A --reload --node-modules=local-auto --no-lock main.ts")
+ .args("run -A --reload --node-modules-dir=auto --no-lock main.ts")
.run();
output.assert_exit_code(0);
output.assert_matches_file(
@@ -1880,7 +1880,7 @@ fn binary_package_with_optional_dependencies() {
let output = context
.new_command()
- .args("run -A --node-modules=local-auto main.js")
+ .args("run -A --node-modules-dir=auto main.js")
.run();
#[cfg(target_os = "windows")]
@@ -1971,7 +1971,7 @@ fn node_modules_dir_config_file() {
let node_modules_dir = temp_dir.path().join("node_modules");
let rm_node_modules = || std::fs::remove_dir_all(&node_modules_dir).unwrap();
- temp_dir.write("deno.json", r#"{ "nodeModules": "local-auto" }"#);
+ temp_dir.write("deno.json", r#"{ "nodeModulesDir": "auto" }"#);
temp_dir.write("main.ts", "import 'npm:@denotest/esm-basic';");
let deno_cache_cmd = test_context.new_command().args("cache --quiet main.ts");
@@ -1985,7 +1985,7 @@ fn node_modules_dir_config_file() {
assert!(node_modules_dir.exists());
rm_node_modules();
- temp_dir.write("deno.json", r#"{ "nodeModules": "global-auto" }"#);
+ temp_dir.write("deno.json", r#"{ "nodeModulesDir": "none" }"#);
deno_cache_cmd.run();
assert!(!node_modules_dir.exists());
@@ -1996,7 +1996,7 @@ fn node_modules_dir_config_file() {
test_context
.new_command()
- .args("cache --quiet --node-modules=local-auto main.ts")
+ .args("cache --quiet --node-modules-dir=auto main.ts")
.run();
assert!(node_modules_dir.exists());
@@ -2004,7 +2004,7 @@ fn node_modules_dir_config_file() {
rm_node_modules();
test_context
.new_command()
- .args("cache --quiet --node-modules=global-auto --vendor main.ts")
+ .args("cache --quiet --node-modules-dir=none --vendor main.ts")
.run();
assert!(!node_modules_dir.exists());
}
@@ -2021,7 +2021,7 @@ fn top_level_install_package_json_explicit_opt_in() {
// when the node_modules_dir is explicitly opted into, we should always
// ensure a top level package.json install occurs
- temp_dir.write("deno.json", "{ \"nodeModules\": \"local-auto\" }");
+ temp_dir.write("deno.json", "{ \"nodeModulesDir\": \"auto\" }");
temp_dir.write(
"package.json",
"{ \"dependencies\": { \"@denotest/esm-basic\": \"1.0\" }}",
@@ -2110,7 +2110,7 @@ itest!(check_package_file_dts_dmts_dcts {
});
itest!(require_resolve_url_paths {
- args: "run -A --quiet --node-modules=local-auto url_paths.ts",
+ args: "run -A --quiet --node-modules-dir=auto url_paths.ts",
output: "npm/require_resolve_url/url_paths.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -2121,10 +2121,7 @@ itest!(require_resolve_url_paths {
#[test]
fn byonm_cjs_esm_packages() {
- let test_context = TestContextBuilder::for_npm()
- .env("DENO_UNSTABLE_BYONM", "1")
- .use_temp_cwd()
- .build();
+ let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let dir = test_context.temp_dir();
test_context.run_npm("init -y");
@@ -2206,10 +2203,7 @@ console.log(getKind());
#[test]
fn future_byonm_cjs_esm_packages() {
- let test_context = TestContextBuilder::for_npm()
- .env("DENO_FUTURE", "1")
- .use_temp_cwd()
- .build();
+ let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let dir = test_context.temp_dir();
test_context.run_npm("init -y");
@@ -2290,59 +2284,13 @@ console.log(getKind());
}
#[test]
-fn byonm_import_map() {
+fn node_modules_dir_manual_import_map() {
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let dir = test_context.temp_dir();
dir.write(
"deno.json",
r#"{
- "imports": {
- "basic": "npm:@denotest/esm-basic"
- },
- "unstable": [ "byonm" ]
-}"#,
- );
- dir.write(
- "package.json",
- r#"{
- "name": "my-project",
- "version": "1.0.0",
- "type": "module",
- "dependencies": {
- "@denotest/esm-basic": "^1.0"
- }
-}"#,
- );
- test_context.run_npm("install");
-
- dir.write(
- "main.ts",
- r#"
-// import map should resolve
-import { getValue } from "basic";
-// and resolving via node resolution
-import { setValue } from "@denotest/esm-basic";
-
-setValue(5);
-console.log(getValue());
-"#,
- );
- let output = test_context.new_command().args("run main.ts").run();
- output.assert_matches_text("5\n");
- let output = test_context.new_command().args("check main.ts").run();
- output.assert_matches_text("Check file:///[WILDCARD]/main.ts\n");
-}
-
-#[test]
-fn future_byonm_import_map() {
- let test_context = TestContextBuilder::for_npm()
- .env("DENO_FUTURE", "1")
- .use_temp_cwd()
- .build();
- let dir = test_context.temp_dir();
- dir.write(
- "deno.json",
- r#"{
+ "nodeModulesDir": "manual",
"imports": {
"basic": "npm:@denotest/esm-basic"
}
@@ -2381,10 +2329,7 @@ console.log(getValue());
#[test]
fn byonm_package_specifier_not_installed_and_invalid_subpath() {
- let test_context = TestContextBuilder::for_npm()
- .env("DENO_UNSTABLE_BYONM", "1")
- .use_temp_cwd()
- .build();
+ let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let dir = test_context.temp_dir();
dir.path().join("package.json").write_json(&json!({
"dependencies": {
@@ -2525,10 +2470,7 @@ console.log(getValue());
#[test]
fn future_byonm_npm_workspaces() {
- let test_context = TestContextBuilder::for_npm()
- .env("DENO_FUTURE", "1")
- .use_temp_cwd()
- .build();
+ let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
let dir = test_context.temp_dir();
dir.write(
@@ -2781,7 +2723,7 @@ fn cjs_export_analysis_import_cjs_directly_relative_import() {
itest!(imports_package_json {
args:
- "run --no-lock --node-modules=global-auto npm/imports_package_json/main.js",
+ "run --no-lock --node-modules-dir=none npm/imports_package_json/main.js",
output: "npm/imports_package_json/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
@@ -2789,7 +2731,7 @@ itest!(imports_package_json {
itest!(imports_package_json_import_not_defined {
args:
- "run --no-lock --node-modules=global-auto npm/imports_package_json/import_not_defined.js",
+ "run --no-lock --node-modules-dir=none npm/imports_package_json/import_not_defined.js",
output: "npm/imports_package_json/import_not_defined.out",
envs: env_vars_for_npm_tests(),
exit_code: 1,
@@ -2798,7 +2740,7 @@ itest!(imports_package_json_import_not_defined {
itest!(imports_package_json_sub_path_import_not_defined {
args:
- "run --no-lock --node-modules=global-auto npm/imports_package_json/sub_path_import_not_defined.js",
+ "run --no-lock --node-modules-dir=none npm/imports_package_json/sub_path_import_not_defined.js",
output: "npm/imports_package_json/sub_path_import_not_defined.out",
envs: env_vars_for_npm_tests(),
exit_code: 1,
@@ -2806,7 +2748,7 @@ itest!(imports_package_json_sub_path_import_not_defined {
});
itest!(different_nested_dep_node_modules_dir_false {
- args: "run --quiet --no-lock --node-modules=global-auto npm/different_nested_dep/main.js",
+ args: "run --quiet --no-lock --node-modules-dir=none npm/different_nested_dep/main.js",
output: "npm/different_nested_dep/main.out",
envs: env_vars_for_npm_tests(),
exit_code: 0,
@@ -2814,7 +2756,7 @@ itest!(different_nested_dep_node_modules_dir_false {
});
itest!(different_nested_dep_node_modules_dir_true {
- args: "run --no-lock --quiet --node-modules=local-auto main.js",
+ args: "run --no-lock --quiet --node-modules-dir=auto main.js",
output: "npm/different_nested_dep/main.out",
copy_temp_dir: Some("npm/different_nested_dep/"),
cwd: Some("npm/different_nested_dep/"),
@@ -2848,11 +2790,7 @@ fn different_nested_dep_byonm_future() {
test_context.run_npm("install");
- let output = test_context
- .new_command()
- .args("run main.js")
- .env("DENO_FUTURE", "1")
- .run();
+ let output = test_context.new_command().args("run main.js").run();
output.assert_matches_file("npm/different_nested_dep/main.out");
}
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs
index 4d3374173..e85033ffa 100644
--- a/tests/integration/run_tests.rs
+++ b/tests/integration/run_tests.rs
@@ -1106,7 +1106,7 @@ fn lock_deno_json_package_json_deps_workspace() {
// deno.json
let deno_json = temp_dir.join("deno.json");
deno_json.write_json(&json!({
- "nodeModules": "local-auto"
+ "nodeModulesDir": "auto"
}));
// package.json