diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-09-03 01:27:37 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 17:27:37 +0200 |
commit | bc51eca70000e809ef3b64f66e9482316768e02a (patch) | |
tree | d9972377959be338e7192e7e53f94584432c263c /tests/integration/watcher_tests.rs | |
parent | 503f95a54fe290471b0807157e37d2d996ff0357 (diff) |
BREAKING: remove `deno bundle` (#25339)
`deno bundle` now produces:
```
error: ⚠️ `deno bundle` was removed in Deno 2.
See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
```
`deno bundle --help` now produces:
```
⚠️ `deno bundle` was removed in Deno 2.
See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
Usage: deno bundle [OPTIONS]
Options:
-q, --quiet Suppress diagnostic output
--unstable Enable all unstable features and APIs. Instead of using this flag, consider enabling individual unstable features
To view the list of individual unstable feature flags, run this command again with --help=unstable
```
Diffstat (limited to 'tests/integration/watcher_tests.rs')
-rw-r--r-- | tests/integration/watcher_tests.rs | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/tests/integration/watcher_tests.rs b/tests/integration/watcher_tests.rs index abc5365b8..91ac5611f 100644 --- a/tests/integration/watcher_tests.rs +++ b/tests/integration/watcher_tests.rs @@ -10,8 +10,6 @@ use util::DenoChild; use util::assert_not_contains; -const CLEAR_SCREEN: &str = r#"[2J"#; - /// Logs to stderr every time next_line() is called struct LoggingLines<R> where @@ -492,143 +490,6 @@ async fn fmt_check_all_files_on_each_change_test() { } #[flaky_test(tokio)] -async fn bundle_js_watch() { - use std::path::PathBuf; - // Test strategy extends this of test bundle_js by adding watcher - let t = TempDir::new(); - let file_to_watch = t.path().join("file_to_watch.ts"); - file_to_watch.write("console.log('Hello world');"); - assert!(file_to_watch.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod6.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(t.path()) - .arg("bundle") - .arg(&file_to_watch) - .arg(&bundle) - .arg("--watch") - .env("NO_COLOR", "1") - .piped_output() - .spawn() - .unwrap(); - - let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); - - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Warning"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "deno_emit"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle started" - ); - let line = next_line(&mut stderr_lines).await.unwrap(); - assert_contains!(line, "file_to_watch.ts"); - assert_contains!(line, "Check"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Bundle"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "mod6.bundle.js" - ); - let file = PathBuf::from(&bundle); - assert!(file.is_file()); - - wait_contains("Bundle finished", &mut stderr_lines).await; - - file_to_watch.write("console.log('Hello world2');"); - - let line = next_line(&mut stderr_lines).await.unwrap(); - // Should not clear screen, as we are in non-TTY environment - assert_not_contains!(&line, CLEAR_SCREEN); - assert_contains!(&line, "File change detected!"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Check"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "file_to_watch.ts" - ); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "mod6.bundle.js" - ); - let file = PathBuf::from(&bundle); - assert!(file.is_file()); - wait_contains("Bundle finished", &mut stderr_lines).await; - - // Confirm that the watcher keeps on working even if the file is updated and has invalid syntax - file_to_watch.write("syntax error ^^"); - - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "File change detected!" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "error: "); - wait_contains("Bundle failed", &mut stderr_lines).await; - check_alive_then_kill(deno); -} - -/// Confirm that the watcher continues to work even if module resolution fails at the *first* attempt -#[flaky_test(tokio)] -async fn bundle_watch_not_exit() { - let t = TempDir::new(); - let file_to_watch = t.path().join("file_to_watch.ts"); - file_to_watch.write("syntax error ^^"); - let target_file = t.path().join("target.js"); - - let mut deno = util::deno_cmd() - .current_dir(t.path()) - .arg("bundle") - .arg(&file_to_watch) - .arg(&target_file) - .arg("--watch") - .env("NO_COLOR", "1") - .piped_output() - .spawn() - .unwrap(); - let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); - - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Warning"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "deno_emit"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle started" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "error:"); - assert_eq!(next_line(&mut stderr_lines).await.unwrap(), ""); - assert_eq!( - next_line(&mut stderr_lines).await.unwrap(), - " syntax error ^^" - ); - assert_eq!( - next_line(&mut stderr_lines).await.unwrap(), - " ~~~~~" - ); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle failed" - ); - // the target file hasn't been created yet - assert!(!target_file.is_file()); - - // Make sure the watcher actually restarts and works fine with the proper syntax - file_to_watch.write("console.log(42);"); - - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "File change detected" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Check"); - let line = next_line(&mut stderr_lines).await.unwrap(); - // Should not clear screen, as we are in non-TTY environment - assert_not_contains!(&line, CLEAR_SCREEN); - assert_contains!(line, "file_to_watch.ts"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "target.js"); - - wait_contains("Bundle finished", &mut stderr_lines).await; - - // bundled file is created - assert!(target_file.is_file()); - check_alive_then_kill(deno); -} - -#[flaky_test(tokio)] async fn run_watch_no_dynamic() { let t = TempDir::new(); let file_to_watch = t.path().join("file_to_watch.js"); |