diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/watcher_tests.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration/watcher_tests.rs b/tests/integration/watcher_tests.rs index 3cec2f442..6203a62d9 100644 --- a/tests/integration/watcher_tests.rs +++ b/tests/integration/watcher_tests.rs @@ -3,6 +3,7 @@ use flaky_test::flaky_test; use test_util as util; use test_util::assert_contains; +use test_util::env_vars_for_npm_tests; use test_util::TempDir; use tokio::io::AsyncBufReadExt; use util::DenoChild; @@ -707,6 +708,42 @@ async fn run_watch_no_dynamic() { check_alive_then_kill(child); } +#[flaky_test(tokio)] +async fn run_watch_npm_specifier() { + let _g = util::http_server(); + let t = TempDir::new(); + + let file_to_watch = t.path().join("file_to_watch.txt"); + file_to_watch.write("Hello world"); + + let mut child = util::deno_cmd() + .current_dir(t.path()) + .envs(env_vars_for_npm_tests()) + .arg("run") + .arg("--watch=file_to_watch.txt") + .arg("-L") + .arg("debug") + .arg("npm:@denotest/bin/cli-cjs") + .arg("Hello world") + .env("NO_COLOR", "1") + .piped_output() + .spawn() + .unwrap(); + let (mut stdout_lines, mut stderr_lines) = child_lines(&mut child); + + wait_contains("Hello world", &mut stdout_lines).await; + wait_for_watcher("file_to_watch.txt", &mut stderr_lines).await; + + // Change content of the file + file_to_watch.write("Hello world2"); + + wait_contains("Restarting", &mut stderr_lines).await; + wait_contains("Hello world", &mut stdout_lines).await; + wait_for_watcher("file_to_watch.txt", &mut stderr_lines).await; + + check_alive_then_kill(child); +} + // TODO(bartlomieju): this test became flaky on macOS runner; it is unclear // if that's because of a bug in code or the runner itself. We should reenable // it once we upgrade to XL runners for macOS. |