summaryrefslogtreecommitdiff
path: root/cli/tests/integration/watcher_tests.rs
diff options
context:
space:
mode:
author2shiori17 <98276492+2shiori17@users.noreply.github.com>2022-07-14 05:01:09 +0900
committerGitHub <noreply@github.com>2022-07-13 22:01:09 +0200
commit0aca3f06904d2582b4f520e0b03b56bb2255c03e (patch)
tree0e493cb1593ffe07740514951cf3d264170f83f4 /cli/tests/integration/watcher_tests.rs
parent5273259eef712a04224c8a3db96d3dc824e7bb86 (diff)
fix(cli): Improve error message in watch mode (#15184)
Diffstat (limited to 'cli/tests/integration/watcher_tests.rs')
-rw-r--r--cli/tests/integration/watcher_tests.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs
index 1e79a219d..dee198740 100644
--- a/cli/tests/integration/watcher_tests.rs
+++ b/cli/tests/integration/watcher_tests.rs
@@ -789,6 +789,36 @@ fn run_watch_with_import_map_and_relative_paths() {
}
#[test]
+fn run_watch_error_messages() {
+ let t = TempDir::new();
+ let file_to_watch = t.path().join("file_to_watch.js");
+ write(
+ &file_to_watch,
+ "throw SyntaxError(`outer`, {cause: TypeError(`inner`)})",
+ )
+ .unwrap();
+
+ let mut child = util::deno_cmd()
+ .current_dir(util::testdata_path())
+ .arg("run")
+ .arg("--watch")
+ .arg(&file_to_watch)
+ .env("NO_COLOR", "1")
+ .stdout(std::process::Stdio::piped())
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+ let (_, mut stderr_lines) = child_lines(&mut child);
+
+ wait_contains("Process started", &mut stderr_lines);
+ wait_contains("error: Uncaught SyntaxError: outer", &mut stderr_lines);
+ wait_contains("Caused by: TypeError: inner", &mut stderr_lines);
+ wait_contains("Process finished", &mut stderr_lines);
+
+ check_alive_then_kill(child);
+}
+
+#[test]
fn test_watch() {
let t = TempDir::new();