mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
added test to practice change
This commit is contained in:
parent
941eb3172f
commit
fb8dba6854
2 changed files with 43 additions and 2 deletions
|
@ -287,8 +287,11 @@ where
|
||||||
.clone_from(&received_changed_paths);
|
.clone_from(&received_changed_paths);
|
||||||
let excluded_paths = &exclude_set_cloned;
|
let excluded_paths = &exclude_set_cloned;
|
||||||
let received_changed_paths_cloned = received_changed_paths.clone();
|
let received_changed_paths_cloned = received_changed_paths.clone();
|
||||||
let is_excluded_file_changed =
|
let is_excluded_file_changed = received_changed_paths_cloned
|
||||||
received_changed_paths_cloned.unwrap().iter().any(|path| {
|
.clone()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.any(|path| {
|
||||||
excluded_paths.matches_path(path)
|
excluded_paths.matches_path(path)
|
||||||
|| excluded_paths.inner().iter().any(|excluded_path| {
|
|| excluded_paths.inner().iter().any(|excluded_path| {
|
||||||
excluded_path.base_path().unwrap().is_dir()
|
excluded_path.base_path().unwrap().is_dir()
|
||||||
|
@ -306,6 +309,11 @@ where
|
||||||
let _ = changed_paths_tx.send(received_changed_paths);
|
let _ = changed_paths_tx.send(received_changed_paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log::debug!(
|
||||||
|
"Following file content changed, but excluded from watch: {:?}",
|
||||||
|
received_changed_paths_cloned.unwrap()[0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1625,6 +1625,39 @@ async fn run_watch_with_excluded_paths() {
|
||||||
check_alive_then_kill(child);
|
check_alive_then_kill(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[flaky_test(tokio)]
|
||||||
|
async fn watch_directory_with_excluded_file_in_same_directory() {
|
||||||
|
let t = TempDir::new();
|
||||||
|
|
||||||
|
let file_to_exclude = t.path().join("file_to_exclude.js");
|
||||||
|
file_to_exclude.write("export const foo = 0;");
|
||||||
|
|
||||||
|
let file_to_watch = t.path().join("file_to_watch.js");
|
||||||
|
file_to_watch.write("console.log('hello')");
|
||||||
|
|
||||||
|
let mut child = util::deno_cmd()
|
||||||
|
.current_dir(t.path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--watch=.")
|
||||||
|
.arg("--watch-exclude=file_to_exclude.js")
|
||||||
|
.arg("-L")
|
||||||
|
.arg("debug")
|
||||||
|
.arg(&file_to_watch)
|
||||||
|
.env("NO_COLOR", "1")
|
||||||
|
.piped_output()
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
let (_stdout_lines, mut stderr_lines) = child_lines(&mut child);
|
||||||
|
wait_contains("Watching paths", &mut stderr_lines).await;
|
||||||
|
file_to_exclude.write("console.log(\"This file's content has been changed, but it's excluded from watch.\")");
|
||||||
|
wait_contains(
|
||||||
|
"Following file content changed, but excluded from watch: ",
|
||||||
|
&mut stderr_lines,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
check_alive_then_kill(child);
|
||||||
|
}
|
||||||
|
|
||||||
#[flaky_test(tokio)]
|
#[flaky_test(tokio)]
|
||||||
async fn run_hmr_server() {
|
async fn run_hmr_server() {
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
|
|
Loading…
Reference in a new issue