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

Fix Golden Master Test #14

Closed josecelano closed 11 months ago

josecelano commented 11 months ago

Red color hidden chars were added to the pretty output and the snapshot was updated.

zjp-CN commented 11 months ago

Good catch. I found it too, and there is a nuance here.

colored crate will rely on is-terminal crate to determin whether the String needs to be colored. Say when you redirect the output, like cargo prettt-test > out.txt, you'll see out.txt doesn't contain the escape characters.

And now CI still fail on stable and nightly Rust, because I guess non-escaping vs escaping happens in there

So the real fix I think is to use cargo test --features "colored/no-color" ...rest arguments to prevent any escaping in testing.

zjp-CN commented 11 months ago

I've opened PR https://github.com/josecelano/cargo-pretty-test/pull/19 to replace this.