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

feat: show distinct types of testing in one tree #9

Closed zjp-CN closed 1 year ago

zjp-CN commented 1 year ago
$ cargo r -q
Generated by cargo-pretty-test
├── cargo_pretty_test
│   ├── tests/golden_master_test.rs
│   │   └─ ✅ golden_master_test
│   ├── tests/mocking_project.rs
│   │   ├─ ✅ snapshot_testing_for_parsed_output
│   │   └─ ✅ snapshot_testing_for_pretty_output
│   └── tests/parsing.rs
│       └─ ✅ parse_stderr_stdout
└── Doc
    └── cargo-pretty-test
        └─ ✅ src/doc.rs - doc (line 3)
$ cargo r -q -- --workspace --no-fail-fast
failures:

---- submod::panic::panicked stdout ----
thread 'submod::panic::panicked' panicked at tests/integration/src/lib.rs:9:13:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- submod::panic::should_panic_but_didnt stdout ----
note: test did not panic as expected

failures:
    submod::panic::panicked
    submod::panic::should_panic_but_didnt

*************************************************************

Generated by cargo-pretty-test
├── cargo_pretty_test
│   ├── tests/golden_master_test.rs
│   │   └─ ✅ golden_master_test
│   ├── tests/mocking_project.rs
│   │   ├─ ✅ snapshot_testing_for_parsed_output
│   │   └─ ✅ snapshot_testing_for_pretty_output
│   └── tests/parsing.rs
│       └─ ✅ parse_stderr_stdout
├── integration
│   ├── src/lib.rs
│   │   ├── submod
│   │   │   ├─ 🔕 ignore
│   │   │   ├─ 🔕 ignore_without_reason
│   │   │   ├─ ✅ normal_test
│   │   │   └── panic
│   │   │       ├─ ❌ panicked
│   │   │       ├─ ✅ should_panic - should panic
│   │   │       ├─ ❌ should_panic_but_didnt - should panic
│   │   │       └─ ✅ should_panic_without_reanson - should panic
│   │   └─ ✅ works
│   ├── src/main.rs
│   │   └─ ✅ from_main_rs
│   └── tests/parsing.rs
│       └─ ✅ from_integration
└── Doc
    ├── cargo-pretty-test
    │   └─ ✅ src/doc.rs - doc (line 3)
    └── integration
        └─ ✅ tests/integration/src/lib.rs - doc (line 41)
zjp-CN commented 1 year ago

@josecelano This PR can be merged now and it deserves a new release.

You can invite me on crates.io to be a cooperator. https://doc.rust-lang.org/cargo/reference/publishing.html#cargo-owner i.e. cargo owner --add zjp-CN

josecelano commented 1 year ago

@josecelano This PR can be merged now, and it deserves a new release.

You can invite me on crates.io to be a cooperator. https://doc.rust-lang.org/cargo/reference/publishing.html#cargo-owner i.e. cargo owner --add zjp-CN

Hi @zjp-CN you've done a great job! I haven't had time to read the code carefully, but I would like to do it. I've seen a lot of interesting things.

I wanted to take a look at what other test runners are doing, like https://nexte.st/, but I've been busy. They are generating formatted output: https://nexte.st/book/junit.html. I was wondering if It would be easier to parse its output instead of the cargo test output. And I also was wondering if we could actually create a test runner. But no idea how all that stuff works.

I've sent an invitation to make you an owner on crates.io. Besides, I have also transferred this report to you since you've done all the work so far.