1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Merge pull request #1 from dovakin0007/DENO_ROOT_INSTALL_fix2

added test
This commit is contained in:
Gowtham K 2024-11-18 21:37:16 +05:30 committed by GitHub
commit bd3f468ac3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -160,7 +160,6 @@ fn install_custom_dir_env_var() {
let context = TestContext::with_http_server();
let temp_dir = context.temp_dir();
let temp_dir_str = temp_dir.path().to_string();
let temp_bin_dir_str = temp_dir.path().join("bin").to_string();
context
.new_command()
@ -169,7 +168,48 @@ fn install_custom_dir_env_var() {
.envs([
("HOME", temp_dir_str.as_str()),
("USERPROFILE", temp_dir_str.as_str()),
("DENO_INSTALL_ROOT", temp_bin_dir_str.as_str()),
("DENO_INSTALL_ROOT", temp_dir_str.as_str()),
])
.run()
.skip_output_check()
.assert_exit_code(0);
let mut file_path = temp_dir.path().join("bin/echo_test");
assert!(file_path.exists());
if cfg!(windows) {
file_path = file_path.with_extension("cmd");
}
let content = file_path.read_to_string();
if cfg!(windows) {
assert_contains!(
content,
r#""run" "--check" "--no-config" "http://localhost:4545/echo.ts""#
);
} else {
assert_contains!(
content,
r#"run --check --no-config 'http://localhost:4545/echo.ts'"#
);
}
}
#[test]
fn installer_test_custom_dir_with_bin() {
let context = TestContext::with_http_server();
let temp_dir = context.temp_dir();
let temp_dir_str = temp_dir.path().to_string();
let temp_dir_with_bin = temp_dir.path().join("bin").to_string();
context
.new_command()
.current_dir(util::root_path()) // different cwd
.args("install --check --name echo_test -g http://localhost:4545/echo.ts")
.envs([
("HOME", temp_dir_str.as_str()),
("USERPROFILE", temp_dir_str.as_str()),
("DENO_INSTALL_ROOT", temp_dir_with_bin.as_str()),
])
.run()
.skip_output_check()