diff options
author | Yusuke Tanaka <yusuktan@maguro.dev> | 2021-01-12 16:53:58 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 23:53:58 -0800 |
commit | 5c6ab75de1e5817df3620a5cdd85eba748b2a8a6 (patch) | |
tree | 4ff1e1f2777d09cbcf0e40a42da567b4f8d4bf42 /cli/tests | |
parent | f18ae461a81f9323aef1a4a8c4b945fb58f63499 (diff) |
fix(watcher): keep working even when imported file has invalid syntax (#9091)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 1bffe9ba9..feb3f7f04 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1571,6 +1571,21 @@ fn run_watch() { assert!(stdout_lines.next().unwrap().contains("42")); wait_for_process_finished("Process", &mut stderr_lines); + // Update the content of the imported file with invalid syntax + std::fs::write(&another_file, "syntax error ^^").expect("error writing file"); + std::thread::sleep(std::time::Duration::from_secs(1)); + assert!(stderr_lines.next().unwrap().contains("Restarting")); + assert!(stderr_lines.next().unwrap().contains("error:")); + wait_for_process_finished("Process", &mut stderr_lines); + + // Modify the imported file and make sure that restarting occurs + std::fs::write(&another_file, "export const foo = 'modified!';") + .expect("error writing file"); + std::thread::sleep(std::time::Duration::from_secs(1)); + assert!(stderr_lines.next().unwrap().contains("Restarting")); + assert!(stdout_lines.next().unwrap().contains("modified!")); + wait_for_process_finished("Process", &mut stderr_lines); + // the watcher process is still alive assert!(child.try_wait().unwrap().is_none()); |