solfmt
Formats output of Solana's cargo test-bpf/test-sbf
command.
Installation
cargo install solfmt
Usage
- Run the your test command as usual (
cargo test-sbf -- --test-threads=1
) - Pipe
stderr
intostdout
(2>&1
) - Pipe the result to
solfmt
(| sofmt
)
cargo test-sbf -- --test-threads=1 2>&1 | solfmt
- 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