summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2020-03-28 14:42:29 -0700
committerGitHub <noreply@github.com>2020-03-28 17:42:29 -0400
commit2f7842246ecce1d69e13144931fd3b6417f4fdb0 (patch)
tree6a6b10dc0e1acbfe03c1bc1cdecb62178cfa192c /cli/tests/integration_tests.rs
parentad198b1cf175a1b88a6f698510bb0122e569f3ac (diff)
fix(inspector): proper error message on port collision (#4514)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 02cccf9cf..112b86038 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -2072,6 +2072,44 @@ async fn inspector_pause() {
child.kill().unwrap();
}
+#[cfg(not(target_os = "linux"))] // TODO(ry) broken on github actions.
+#[tokio::test]
+async fn inspector_port_collision() {
+ let script = deno::test_util::root_path()
+ .join("cli")
+ .join("tests")
+ .join("inspector1.js");
+ let mut child1 = util::deno_cmd()
+ .arg("run")
+ .arg("--inspect=127.0.0.1:9231")
+ .arg(script.clone())
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+ let ws_url_1 = extract_ws_url_from_stderr(child1.stderr.as_mut().unwrap());
+ println!("ws_url {}", ws_url_1);
+
+ let mut child2 = util::deno_cmd()
+ .arg("run")
+ .arg("--inspect=127.0.0.1:9231")
+ .arg(script)
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+
+ use std::io::Read;
+ let mut stderr_str_2 = String::new();
+ child2
+ .stderr
+ .as_mut()
+ .unwrap()
+ .read_to_string(&mut stderr_str_2)
+ .unwrap();
+ assert!(stderr_str_2.contains("Cannot start inspector server"));
+ child1.kill().unwrap();
+ let _ = child2.kill();
+}
+
mod util {
use deno::colors::strip_ansi_codes;
pub use deno::test_util::*;