solfmt

Crates.iosolfmt
lib.rssolfmt
version0.3.1
sourcesrc
created_at2022-12-13 04:46:43.868085
updated_at2024-03-15 23:06:18.142023
descriptionFormats output of Solana's `cargo test-bpf/test-sbf` command
homepage
repositoryhttps://github.com/thlorenz/solfmt
max_upload_size
id735530
size1,116,710
Thorsten Lorenz (thlorenz)

documentation

README

solfmt

Formats output of Solana's cargo test-bpf/test-sbf command.

fmt-logs

Installation

cargo install solfmt

Usage

  1. Run the your test command as usual (cargo test-sbf -- --test-threads=1)
  2. Pipe stderr into stdout (2>&1)
  3. Pipe the result to solfmt (| sofmt)
cargo test-sbf -- --test-threads=1 2>&1 | solfmt
  1. Enjoy more readable logs

Preserving Colorful Build Output

Since we're piping the output of cargo test-sbf into solfmt it doesn't print in colors by default.

We can fix that by setting the CARGO_TERM_COLOR env var appropriately.

CARGO_TERM_COLOR=always cargo test-sbf -- --nocapture --test-threads=1 2>&1 | solfmt

Since this is a lot to type you should add a reusable function to your bashrc.

The below defined in my dotfiles allows to focus on a simple test as well by providing it as an argument.

function cg-tsbf() {
  clear; 
  CARGO_TERM_COLOR=always cargo test-sbf $1 -- --nocapture --test-threads=1 2>&1 | solfmt
}

LICENSE

MIT

Commit count: 12

cargo fmt