mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 12:16:11 -05:00
fix(cli): Support using both --watch
and --inspect
at the same time (#20660)
Fixes #20525
This commit is contained in:
parent
48bb3b2b0f
commit
be7e2bd8c1
3 changed files with 46 additions and 6 deletions
|
@ -1828,12 +1828,7 @@ fn repl_subcommand() -> Command {
|
||||||
fn run_subcommand() -> Command {
|
fn run_subcommand() -> Command {
|
||||||
runtime_args(Command::new("run"), true, true)
|
runtime_args(Command::new("run"), true, true)
|
||||||
.arg(check_arg(false))
|
.arg(check_arg(false))
|
||||||
.arg(
|
.arg(watch_arg(true))
|
||||||
watch_arg(true)
|
|
||||||
.conflicts_with("inspect")
|
|
||||||
.conflicts_with("inspect-wait")
|
|
||||||
.conflicts_with("inspect-brk"),
|
|
||||||
)
|
|
||||||
.arg(no_clear_screen_arg())
|
.arg(no_clear_screen_arg())
|
||||||
.arg(executable_ext_arg())
|
.arg(executable_ext_arg())
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -1603,3 +1603,45 @@ async fn run_watch_dynamic_imports() {
|
||||||
|
|
||||||
check_alive_then_kill(child);
|
check_alive_then_kill(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn run_watch_inspect() {
|
||||||
|
let t = TempDir::new();
|
||||||
|
let file_to_watch = t.path().join("file_to_watch.js");
|
||||||
|
file_to_watch.write(
|
||||||
|
r#"
|
||||||
|
console.log("hello world");
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut child = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--watch")
|
||||||
|
.arg("--inspect")
|
||||||
|
.arg("-L")
|
||||||
|
.arg("debug")
|
||||||
|
.arg(&file_to_watch)
|
||||||
|
.env("NO_COLOR", "1")
|
||||||
|
.stdout(std::process::Stdio::piped())
|
||||||
|
.stderr(std::process::Stdio::piped())
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
let (mut stdout_lines, mut stderr_lines) = child_lines(&mut child);
|
||||||
|
|
||||||
|
wait_contains("Debugger listening", &mut stderr_lines).await;
|
||||||
|
wait_for_watcher("file_to_watch.js", &mut stderr_lines).await;
|
||||||
|
wait_contains("hello world", &mut stdout_lines).await;
|
||||||
|
|
||||||
|
file_to_watch.write(
|
||||||
|
r#"
|
||||||
|
console.log("updated file");
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
wait_contains("Restarting", &mut stderr_lines).await;
|
||||||
|
wait_contains("Debugger listening", &mut stderr_lines).await;
|
||||||
|
wait_contains("updated file", &mut stdout_lines).await;
|
||||||
|
|
||||||
|
check_alive_then_kill(child);
|
||||||
|
}
|
||||||
|
|
|
@ -359,6 +359,9 @@ async fn pump_websocket_messages(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else => {
|
||||||
|
break 'pump;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue