josecelano / cargo-pretty-test

A Rust command that prettifies the ugly `cargo test` output into a beautiful one.
https://users.rust-lang.org/t/cargo-test-output-with-indentation/100149
135 stars 1 forks source link

bump to v0.2.4: better error handling especially in parsing by using Result #33

Closed zjp-CN closed 11 months ago

zjp-CN commented 11 months ago

close https://github.com/josecelano/cargo-pretty-test/issues/24

(unfortunately no color)

e.g. invalid argument

✗ cargo pretty-test --w
Error from cargo-pretty-test:
"" should contain `running (?P<amount>\d+) tests?` pattern

Error from cargo test:
error: unexpected argument '--w' found

  tip: a similar argument exists: '--workspace'

Usage: cargo test --workspace [TESTNAME] [-- [args]...]

For more information, try '--help'.

e.g. error in source code

✗ cargo pretty-test a
Error from cargo-pretty-test:
"" should contain `running (?P<amount>\d+) tests?` pattern

Error from cargo test:
   Compiling cargo-pretty-test v0.2.3 (/rust/tmp/urlo/pretty-test)
error[E0308]: mismatched types
  --> tests/mocking_project.rs:33:29
   |
33 |         Cache { raw_output, info }
   |                             ^^^^ expected `Vec<TestInfo<'_>>`, found `Result<Vec<TestInfo<'_>>, String>`
   |
   = note: expected struct `Vec<TestInfo<'static>>`
                found enum `Result<Vec<TestInfo<'_>>, std::string::String>`

For more information about this error, try `rustc --explain E0308`. error: could not compile `cargo-pretty-test` (test "mocking_project") due to previous error
harksin commented 11 months ago

thanks :+1: