summaryrefslogtreecommitdiff
path: root/cli/tests/integration/run_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration/run_tests.rs')
-rw-r--r--cli/tests/integration/run_tests.rs113
1 files changed, 53 insertions, 60 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 4ca0616f7..f5ac82e9c 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -144,7 +144,7 @@ itest!(_033_import_map {
itest!(_033_import_map_remote {
args:
- "run --quiet --reload --import-map=http://127.0.0.1:4545/cli/tests/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts",
+ "run --quiet --reload --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts",
output: "033_import_map_remote.out",
http_server: true,
});
@@ -155,8 +155,7 @@ itest!(_034_onload {
});
itest!(_035_cached_only_flag {
- args:
- "run --reload --cached-only http://127.0.0.1:4545/cli/tests/019_media_types.ts",
+ args: "run --reload --cached-only http://127.0.0.1:4545/019_media_types.ts",
output: "035_cached_only_flag.out",
exit_code: 1,
http_server: true,
@@ -203,8 +202,7 @@ itest!(_048_media_types_jsx {
});
itest!(_052_no_remote_flag {
- args:
- "run --reload --no-remote http://127.0.0.1:4545/cli/tests/019_media_types.ts",
+ args: "run --reload --no-remote http://127.0.0.1:4545/019_media_types.ts",
output: "052_no_remote_flag.out",
exit_code: 1,
http_server: true,
@@ -239,7 +237,7 @@ itest!(_071_location_unset {
});
itest!(_072_location_relative_fetch {
- args: "run --location http://127.0.0.1:4545/cli/tests/ --allow-net 072_location_relative_fetch.ts",
+ args: "run --location http://127.0.0.1:4545/ --allow-net 072_location_relative_fetch.ts",
output: "072_location_relative_fetch.ts.out",
http_server: true,
});
@@ -288,18 +286,17 @@ itest!(_082_prepare_stack_trace_throw {
fn _083_legacy_external_source_map() {
let _g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
- let module_url = url::Url::parse(
- "http://localhost:4545/cli/tests/083_legacy_external_source_map.ts",
- )
- .unwrap();
+ let module_url =
+ url::Url::parse("http://localhost:4545/083_legacy_external_source_map.ts")
+ .unwrap();
// Write a faulty old external source map.
let faulty_map_path = deno_dir.path().join("gen/http/localhost_PORT4545/9576bd5febd0587c5c4d88d57cb3ac8ebf2600c529142abe3baa9a751d20c334.js.map");
std::fs::create_dir_all(faulty_map_path.parent().unwrap())
.expect("Failed to create faulty source map dir.");
- std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/cli/tests/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map.");
+ std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map.");
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
.arg(module_url.to_string())
.output()
@@ -394,10 +391,11 @@ itest!(lock_write_fetch {
});
itest!(lock_check_ok {
- args: "run --lock=lock_check_ok.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts",
- output: "003_relative_import.ts.out",
- http_server: true,
- });
+ args:
+ "run --lock=lock_check_ok.json http://127.0.0.1:4545/003_relative_import.ts",
+ output: "003_relative_import.ts.out",
+ http_server: true,
+});
itest!(lock_check_ok2 {
args: "run --lock=lock_check_ok2.json 019_media_types.ts",
@@ -406,14 +404,14 @@ itest!(lock_check_ok2 {
});
itest!(lock_dynamic_imports {
- args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/cli/tests/013_dynamic_import.ts",
+ args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/013_dynamic_import.ts",
output: "lock_dynamic_imports.out",
exit_code: 10,
http_server: true,
});
itest!(lock_check_err {
- args: "run --lock=lock_check_err.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts",
+ args: "run --lock=lock_check_err.json http://127.0.0.1:4545/003_relative_import.ts",
output: "lock_check_err.out",
exit_code: 10,
http_server: true,
@@ -452,7 +450,7 @@ itest!(config_types_remote {
itest!(empty_typescript {
args: "run --reload subdir/empty.ts",
- output_str: Some("Check file:[WILDCARD]tests/subdir/empty.ts\n"),
+ output_str: Some("Check file:[WILDCARD]/subdir/empty.ts\n"),
});
itest!(error_001 {
@@ -649,14 +647,14 @@ itest!(error_type_definitions {
});
itest!(error_local_static_import_from_remote_ts {
- args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.ts",
+ args: "run --reload http://localhost:4545/error_local_static_import_from_remote.ts",
exit_code: 1,
http_server: true,
output: "error_local_static_import_from_remote.ts.out",
});
itest!(error_local_static_import_from_remote_js {
- args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.js",
+ args: "run --reload http://localhost:4545/error_local_static_import_from_remote.js",
exit_code: 1,
http_server: true,
output: "error_local_static_import_from_remote.js.out",
@@ -938,14 +936,14 @@ itest!(_053_import_compression {
});
itest!(disallow_http_from_https_js {
- args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.js",
+ args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.js",
output: "disallow_http_from_https_js.out",
http_server: true,
exit_code: 1,
});
itest!(disallow_http_from_https_ts {
- args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.ts",
+ args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.ts",
output: "disallow_http_from_https_ts.out",
http_server: true,
exit_code: 1,
@@ -1175,9 +1173,9 @@ itest!(worker_close_race {
#[test]
fn no_validate_asm() {
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/no_validate_asm.js")
+ .arg("no_validate_asm.js")
.stderr(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped())
.spawn()
@@ -1192,10 +1190,10 @@ fn no_validate_asm() {
#[test]
fn exec_path() {
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
.arg("--allow-read")
- .arg("cli/tests/exec_path.ts")
+ .arg("exec_path.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@@ -1223,7 +1221,7 @@ fn run_deno_script_constrained(
script_path: std::path::PathBuf,
constraints: WinProcConstraints,
) -> Result<(), i64> {
- let file_path = "cli/tests/DenoWinRunner.ps1";
+ let file_path = "DenoWinRunner.ps1";
let constraints = match constraints {
WinProcConstraints::NoStdIn => "1",
WinProcConstraints::NoStdOut => "2",
@@ -1244,7 +1242,7 @@ fn run_deno_script_constrained(
#[test]
fn should_not_panic_on_no_stdin() {
let output = run_deno_script_constrained(
- util::tests_path().join("echo.ts"),
+ util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdIn,
);
output.unwrap();
@@ -1254,7 +1252,7 @@ fn should_not_panic_on_no_stdin() {
#[test]
fn should_not_panic_on_no_stdout() {
let output = run_deno_script_constrained(
- util::tests_path().join("echo.ts"),
+ util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdOut,
);
output.unwrap();
@@ -1264,7 +1262,7 @@ fn should_not_panic_on_no_stdout() {
#[test]
fn should_not_panic_on_no_stderr() {
let output = run_deno_script_constrained(
- util::tests_path().join("echo.ts"),
+ util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdErr,
);
output.unwrap();
@@ -1274,9 +1272,9 @@ fn should_not_panic_on_no_stderr() {
#[test]
fn should_not_panic_on_undefined_home_environment_variable() {
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/echo.ts")
+ .arg("echo.ts")
.env_remove("HOME")
.spawn()
.unwrap()
@@ -1288,9 +1286,9 @@ fn should_not_panic_on_undefined_home_environment_variable() {
#[test]
fn should_not_panic_on_undefined_deno_dir_environment_variable() {
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/echo.ts")
+ .arg("echo.ts")
.env_remove("DENO_DIR")
.spawn()
.unwrap()
@@ -1303,9 +1301,9 @@ fn should_not_panic_on_undefined_deno_dir_environment_variable() {
#[test]
fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() {
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/echo.ts")
+ .arg("echo.ts")
.env_remove("DENO_DIR")
.env_remove("HOME")
.spawn()
@@ -1319,9 +1317,9 @@ fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() {
fn rust_log() {
// Without RUST_LOG the stderr is empty.
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/001_hello.js")
+ .arg("001_hello.js")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@@ -1332,9 +1330,9 @@ fn rust_log() {
// With RUST_LOG the stderr is not empty.
let output = util::deno_cmd()
- .current_dir(util::root_path())
+ .current_dir(util::testdata_path())
.arg("run")
- .arg("cli/tests/001_hello.js")
+ .arg("001_hello.js")
.env("RUST_LOG", "debug")
.stderr(std::process::Stdio::piped())
.spawn()
@@ -1352,7 +1350,7 @@ mod permissions {
fn with_allow() {
for permission in &util::PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}", permission))
.arg("permission_test.ts")
@@ -1384,12 +1382,15 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
- util::root_path().into_os_string().into_string().unwrap()
+ util::testdata_path()
+ .into_os_string()
+ .into_string()
+ .unwrap()
))
.arg("complex_permissions_test.ts")
.arg(permission)
@@ -1411,9 +1412,7 @@ mod permissions {
&format!(
"run --allow-{0}={1} complex_permissions_test.ts {0} {2}",
permission,
- util::root_path()
- .join("cli")
- .join("tests")
+ util::testdata_path()
.into_os_string()
.into_string()
.unwrap(),
@@ -1436,14 +1435,12 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
- util::root_path()
- .join("cli")
- .join("tests")
+ util::testdata_path()
.into_os_string()
.into_string()
.unwrap()
@@ -1462,9 +1459,7 @@ mod permissions {
#[test]
fn rw_outside_test_and_js_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
- let test_dir = util::root_path()
- .join("cli")
- .join("tests")
+ let test_dir = util::testdata_path()
.into_os_string()
.into_string()
.unwrap();
@@ -1498,9 +1493,7 @@ mod permissions {
#[test]
fn rw_inside_test_and_js_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
- let test_dir = util::root_path()
- .join("cli")
- .join("tests")
+ let test_dir = util::testdata_path()
.into_os_string()
.into_string()
.unwrap();
@@ -1511,7 +1504,7 @@ mod permissions {
.unwrap();
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir))
.arg("complex_permissions_test.ts")
@@ -1530,7 +1523,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}=.", permission))
.arg("complex_permissions_test.ts")
@@ -1549,7 +1542,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
- .current_dir(&util::tests_path())
+ .current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}=tls/../", permission))
.arg("complex_permissions_test.ts")