diff options
Diffstat (limited to 'cli/tests/integration')
-rw-r--r-- | cli/tests/integration/mod.rs | 15 | ||||
-rw-r--r-- | cli/tests/integration/run_tests.rs | 17 | ||||
-rw-r--r-- | cli/tests/integration/watcher_tests.rs | 40 |
3 files changed, 60 insertions, 12 deletions
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 9cd1b2c11..b04f552e8 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -382,13 +382,14 @@ fn ts_reload() { // check the output of the the bundle program. let output_path = hello_ts.canonicalize().unwrap(); - assert!(std::str::from_utf8(&output.stderr) - .unwrap() - .trim() - .contains(&format!( - "host.getSourceFile(\"{}\", Latest)", - url::Url::from_file_path(&output_path).unwrap().as_str() - ))); + assert!( + dbg!(std::str::from_utf8(&output.stderr).unwrap().trim()).contains( + &format!( + "host.getSourceFile(\"{}\", Latest)", + url::Url::from_file_path(&output_path).unwrap().as_str() + ) + ) + ); } #[test] diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index c04e4731c..d36d0de1b 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1583,6 +1583,23 @@ itest!(worker_close_in_wasm_reactions { output: "worker_close_in_wasm_reactions.js.out", }); +itest!(reference_types_error { + args: "run reference_types_error.js", + output: "reference_types_error.js.out", + exit_code: 1, +}); + +itest!(reference_types_error_no_check { + args: "run --no-check reference_types_error.js", + output_str: Some(""), +}); + +itest!(jsx_import_source_error { + args: "run --config jsx/deno-jsx-error.jsonc jsx_import_source_no_pragma.tsx", + output: "jsx_import_source_error.out", + exit_code: 1, +}); + #[test] fn no_validate_asm() { let output = util::deno_cmd() diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs index 02367d780..f0431e301 100644 --- a/cli/tests/integration/watcher_tests.rs +++ b/cli/tests/integration/watcher_tests.rs @@ -394,7 +394,7 @@ fn bundle_js_watch() { use std::path::PathBuf; // Test strategy extends this of test bundle_js by adding watcher let t = TempDir::new().unwrap(); - let file_to_watch = t.path().join("file_to_watch.js"); + let file_to_watch = t.path().join("file_to_watch.ts"); write(&file_to_watch, "console.log('Hello world');").unwrap(); assert!(file_to_watch.is_file()); let t = TempDir::new().unwrap(); @@ -418,7 +418,7 @@ fn bundle_js_watch() { let next_line = stderr_lines.next().unwrap(); assert_contains!(&next_line, CLEAR_SCREEN); assert_contains!(&next_line, "Bundle started"); - assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.js"); + assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.ts"); assert_contains!(stderr_lines.next().unwrap(), "mod6.bundle.js"); let file = PathBuf::from(&bundle); assert!(file.is_file()); @@ -430,7 +430,7 @@ fn bundle_js_watch() { let next_line = stderr_lines.next().unwrap(); assert_contains!(&next_line, CLEAR_SCREEN); assert_contains!(&next_line, "File change detected!"); - assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.js"); + assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.ts"); assert_contains!(stderr_lines.next().unwrap(), "mod6.bundle.js"); let file = PathBuf::from(&bundle); assert!(file.is_file()); @@ -449,7 +449,7 @@ fn bundle_js_watch() { #[test] fn bundle_watch_not_exit() { let t = TempDir::new().unwrap(); - let file_to_watch = t.path().join("file_to_watch.js"); + let file_to_watch = t.path().join("file_to_watch.ts"); write(&file_to_watch, "syntax error ^^").unwrap(); let target_file = t.path().join("target.js"); @@ -482,7 +482,7 @@ fn bundle_watch_not_exit() { let next_line = stderr_lines.next().unwrap(); assert_contains!(&next_line, CLEAR_SCREEN); assert_contains!(&next_line, "File change detected!"); - assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.js"); + assert_contains!(stderr_lines.next().unwrap(), "file_to_watch.ts"); assert_contains!(stderr_lines.next().unwrap(), "target.js"); wait_for("Bundle finished", &mut stderr_lines); @@ -967,3 +967,33 @@ fn test_watch_doc() { assert_contains!(skip_restarting_line(&mut stderr_lines), "foo.ts$3-6"); check_alive_then_kill(child); } + +#[test] +fn test_watch_module_graph_error_referrer() { + let t = TempDir::new().unwrap(); + let file_to_watch = t.path().join("file_to_watch.js"); + write(&file_to_watch, "import './nonexistent.js';").unwrap(); + let mut child = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--watch") + .arg("--unstable") + .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); + let line1 = stderr_lines.next().unwrap(); + assert_contains!(&line1, CLEAR_SCREEN); + assert_contains!(&line1, "Process started"); + let line2 = stderr_lines.next().unwrap(); + assert_contains!(&line2, "error: Cannot load module"); + assert_contains!(&line2, "nonexistent.js"); + let line3 = stderr_lines.next().unwrap(); + assert_contains!(&line3, " at "); + assert_contains!(&line3, "file_to_watch.js"); + wait_for("Process failed", &mut stderr_lines); + check_alive_then_kill(child); +} |