summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorYusuke Tanaka <yusuktan@maguro.dev>2020-10-28 20:41:18 +0900
committerGitHub <noreply@github.com>2020-10-28 12:41:18 +0100
commitbfce376c685694569be2cbf0716dd58f898c111e (patch)
tree7ab1c2d1303080ecd74ab41dc2b33905761b653a /cli/tests/integration_tests.rs
parent07359b795758179e1cffee23eae86e859898054b (diff)
refactor(watch): create single watcher for whole process (#8083)
This commit rewrites file watcher used with --watch flag. Instead of creating new watcher after each restart, only a single watcher is created for whole process. Additionally debouncing mechanism has been added to prevent infinite restart loops if multiple files were changed in quick succession. Co-authored-by: bartossh <lenart.consulting@gmail.com>
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index f7b4c345a..0bba369fe 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -1210,6 +1210,9 @@ fn run_watch() {
std::fs::write(&file_to_watch, "console.log('Hello world2');")
.expect("error writing file");
+ // Events from the file watcher is "debounced", so we need to wait for the next execution to start
+ std::thread::sleep(std::time::Duration::from_secs(1));
+
assert!(stderr_lines.next().unwrap().contains("Restarting"));
assert!(stdout_lines.next().unwrap().contains("Hello world2"));
assert!(stderr_lines.next().unwrap().contains("Process terminated"));