diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-08-31 01:22:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-31 00:22:20 +0000 |
commit | c29e5b9d1edc7fb8a67e58ba43ca95eb417025a2 (patch) | |
tree | fe82868cc22372e0ed36b2f2f34e80211e535fe8 /tests/integration/upgrade_tests.rs | |
parent | a527b3a5de86d8753f7881faff694fbe3797d93d (diff) |
fix(upgrade): more informative information on invalid version (#25319)
Before:
```
$ deno upgrade v1.xx
error: Invalid version passed
```
After:
```
$ deno upgrade v1.xx
error: Invalid version passed (v1.xx)
Example usage:
deno upgrade | deno upgrade 1.46 | deno upgrade canary
```
Also updates help text to use "shorthand version" without flags, but a
positional arg.
Diffstat (limited to 'tests/integration/upgrade_tests.rs')
-rw-r--r-- | tests/integration/upgrade_tests.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs index d18e6412b..0eb468a3f 100644 --- a/tests/integration/upgrade_tests.rs +++ b/tests/integration/upgrade_tests.rs @@ -4,6 +4,7 @@ use std::process::Command; use std::process::Stdio; use std::time::Instant; use test_util as util; +use test_util::assert_starts_with; use test_util::TempDir; use test_util::TestContext; use util::TestContextBuilder; @@ -163,9 +164,10 @@ fn upgrade_invalid_stable_version() { .wait_with_output() .unwrap(); assert!(!output.status.success()); - assert_eq!( - "error: Invalid version passed\n", - util::strip_ansi_codes(&String::from_utf8(output.stderr).unwrap()) + assert_starts_with!( + &util::strip_ansi_codes(&String::from_utf8(output.stderr.clone()).unwrap()) + .to_string(), + "error: Invalid version passed (foobar)" ); } @@ -188,9 +190,10 @@ fn upgrade_invalid_canary_version() { .wait_with_output() .unwrap(); assert!(!output.status.success()); - assert_eq!( - "error: Invalid commit hash passed\n", - util::strip_ansi_codes(&String::from_utf8(output.stderr).unwrap()) + assert_starts_with!( + &util::strip_ansi_codes(&String::from_utf8(output.stderr.clone()).unwrap()) + .to_string(), + "error: Invalid commit hash passed (foobar)" ); } @@ -221,9 +224,10 @@ fn upgrade_invalid_lockfile() { .unwrap(); assert!(!output.status.success()); // should make it here instead of erroring on an invalid lockfile - assert_eq!( - "error: Invalid version passed\n", - util::strip_ansi_codes(&String::from_utf8(output.stderr).unwrap()) + assert_starts_with!( + &util::strip_ansi_codes(&String::from_utf8(output.stderr.clone()).unwrap()) + .to_string(), + "error: Invalid version passed (foobar)" ); } @@ -251,7 +255,7 @@ fn upgrade_prompt() { pty.expect_any(&[ " 99999.99.99 Run `deno upgrade` to install it.", // it builds canary releases on main, so check for this in that case - "Run `deno upgrade --canary` to install it.", + "Run `deno upgrade canary` to install it.", ]); }); } |