When writing test suites for programs that wrap the Solana CLI, test runner logs get populated with unnecessary print statements (in the context of running tests) that makes the logs cluttered and difficult to read.
In a test runner (regardless of language or framework) the CLI error ends up printing to the same process as the test runner. For example, a test that's covering a failure scenario shows
......Error: Bad parameter: SIGNATURE
.error: Invalid value for '--signer <PUBKEY>': No such file or directory (os error 2)
.Error: Invalid signature
.
Finished in 0.39404 seconds (files took 3.66 seconds to load)
9 examples, 0 failures
Proposed Solution
It would be nice for the CLI to support error or log suppression (the opposite of the currently supported --verbose flag). When set, commands wouldn't print any contextual information or errors to the console and only return the data that they are being run to collect - or a blank value.
Example solution:
# Current
$ solana balance -k invalid_keypair
=> Error: Dynamic program error: No default signer found, run "solana-keygen new -o not_a_keypair" to create a new one
$ solana balance -k valid_keypair
=> 10 SOL
# Solution
$ solana balance -k invalid_keypair --silent
=>
$ solana balance -k valid_keypair --silent
=> 10 SOL
Problem
When writing test suites for programs that wrap the Solana CLI, test runner logs get populated with unnecessary print statements (in the context of running tests) that makes the logs cluttered and difficult to read.
In a test runner (regardless of language or framework) the CLI error ends up printing to the same process as the test runner. For example, a test that's covering a failure scenario shows
Proposed Solution
It would be nice for the CLI to support error or log suppression (the opposite of the currently supported
--verbose
flag). When set, commands wouldn't print any contextual information or errors to the console and only return the data that they are being run to collect - or a blank value.Example solution: