7 releases

0.2.5 Oct 14, 2023
0.2.4 Sep 30, 2023
0.1.0 Sep 21, 2023

#92 in Cargo plugins

Download history 111/week @ 2024-01-01 84/week @ 2024-01-08 65/week @ 2024-01-15 109/week @ 2024-01-22 133/week @ 2024-01-29 22/week @ 2024-02-05 58/week @ 2024-02-12 104/week @ 2024-02-19 61/week @ 2024-02-26 49/week @ 2024-03-04 135/week @ 2024-03-11 108/week @ 2024-03-18 55/week @ 2024-03-25 75/week @ 2024-04-01 137/week @ 2024-04-08 189/week @ 2024-04-15

464 downloads per month
Used in taskrs-server

MIT OR GPL-3.0

40KB
745 lines

Cargo Pretty Test ✨

Testing Crates.io docs.rs

A Rust command-line tool that prettifies the ugly cargo test output into a beautiful output.

This crate can be also used as a library that fully parses the output from cargo test.

$ cargo pretty-test --workspace --no-fail-fast

Error details from `cargo test` if any ... (Omitted here)

Generated by cargo-pretty-test
├── (OK) cargo_pretty_test ... (4 tests in 0.16s: ✅ 4)
   ├── (OK) tests/golden_master_test.rs ... (1 tests in 0.00s: ✅ 1)
   │   └─ ✅ golden_master_test
   ├── (OK) tests/mocking_project.rs ... (2 tests in 0.16s: ✅ 2)
   │   ├─ ✅ snapshot_testing_for_parsed_output
   │   └─ ✅ snapshot_testing_for_pretty_output
   └── (OK) tests/parsing.rs ... (1 tests in 0.00s: ✅ 1)
       └─ ✅ parse_stderr_stdout
├── (FAIL) integration ... (10 tests in 0.00s: ✅ 6;  2; 🔕 2)
   ├── (FAIL) src/lib.rs ... (8 tests in 0.00s: ✅ 4;  2; 🔕 2)
   │   ├── 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
   ├── (OK) src/main.rs ... (1 tests in 0.00s: ✅ 1)
   │   └─ ✅ from_main_rs
   └── (OK) tests/parsing.rs ... (1 tests in 0.00s: ✅ 1)
       └─ ✅ from_integration
└── (OK) Doc Tests ... (2 tests in 0.41s: ✅ 2)
    ├── (OK) cargo-pretty-test ... (1 tests in 0.20s: ✅ 1)
       └─ ✅ src/doc.rs - doc (line 3)
    └── (OK) integration ... (1 tests in 0.21s: ✅ 1)
        └─ ✅ tests/integration/src/lib.rs - doc (line 41)

Status: FAIL; total 16 tests in 0.57s: 12 passed; 2 failed; 2 ignored; 0 measured; 0 filtered out

More screenshots.

Usage

Install:

cargo install cargo-pretty-test

Run in your project:

cargo pretty-test

Note: all the arguments passed to cargo pretty-test are forwarded to cargo test.


Run in CI as a summary: demo

      - id: pretty-test
        name: Run cargo pretty-test
        run: |
          cargo install cargo-pretty-test
          cargo pretty-test --color=always
          echo '```text' >> $GITHUB_STEP_SUMMARY
          echo "$(cargo pretty-test --color=never)" >> $GITHUB_STEP_SUMMARY
          echo '```' >> $GITHUB_STEP_SUMMARY

Note: --color=always produces texts in color when running CI, and --color=never strips ANSI escapes before written to summary.

Credits

Dependencies

~1–11MB
~79K SLoC