1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00

chore: fix serve_watch_all test (#26725)

It's been failing a ton lately, it looks like the test is just
incorrectly using TS syntax in a JS file
https://github.com/denoland/deno/actions/runs/11672972415/job/32502710624?pr=26724#step:43:2791

I'm not really sure how this ever passes
This commit is contained in:
Nathan Whitaker 2024-11-04 17:09:17 -08:00 committed by GitHub
parent 25ed90baae
commit 44eca0505c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -572,16 +572,19 @@ async fn serve_watch_all() {
let main_file_to_watch = t.path().join("main_file_to_watch.js");
main_file_to_watch.write(
"export default {
fetch(_request: Request) {
fetch(_request) {
return new Response(\"aaaaaaqqq!\");
},
};",
);
let another_file = t.path().join("another_file.js");
another_file.write("");
let mut child = util::deno_cmd()
.current_dir(t.path())
.arg("serve")
.arg("--watch=another_file.js")
.arg(format!("--watch={another_file}"))
.arg("-L")
.arg("debug")
.arg(&main_file_to_watch)
@ -596,7 +599,7 @@ async fn serve_watch_all() {
// Change content of the file
main_file_to_watch.write(
"export default {
fetch(_request: Request) {
fetch(_request) {
return new Response(\"aaaaaaqqq123!\");
},
};",
@ -604,18 +607,20 @@ async fn serve_watch_all() {
wait_contains("Restarting", &mut stderr_lines).await;
wait_for_watcher("main_file_to_watch.js", &mut stderr_lines).await;
let another_file = t.path().join("another_file.js");
another_file.write("export const foo = 0;");
// Confirm that the added file is watched as well
wait_contains("Restarting", &mut stderr_lines).await;
wait_for_watcher("main_file_to_watch.js", &mut stderr_lines).await;
main_file_to_watch
.write("import { foo } from './another_file.js'; console.log(foo);");
wait_contains("Restarting", &mut stderr_lines).await;
wait_for_watcher("main_file_to_watch.js", &mut stderr_lines).await;
wait_contains("0", &mut stdout_lines).await;
another_file.write("export const foo = 42;");
wait_contains("Restarting", &mut stderr_lines).await;
wait_for_watcher("main_file_to_watch.js", &mut stderr_lines).await;
wait_contains("42", &mut stdout_lines).await;
// Confirm that watch continues even with wrong syntax error
@ -623,10 +628,11 @@ async fn serve_watch_all() {
wait_contains("Restarting", &mut stderr_lines).await;
wait_contains("error:", &mut stderr_lines).await;
wait_for_watcher("main_file_to_watch.js", &mut stderr_lines).await;
main_file_to_watch.write(
"export default {
fetch(_request: Request) {
fetch(_request) {
return new Response(\"aaaaaaqqq!\");
},
};",