| Crates.io | protest-cli |
| lib.rs | protest-cli |
| version | 1.1.0 |
| created_at | 2025-11-01 19:10:38.462599+00 |
| updated_at | 2025-11-02 17:26:34.141025+00 |
| description | Command-line tool for managing Protest property test failures |
| homepage | |
| repository | https://github.com/shrynx/protest |
| max_upload_size | |
| id | 1912313 |
| size | 61,660 |
Command-line tool for managing Protest property test failures.
cargo install --path .
Or use directly from the workspace:
cargo run -p protest-cli -- <command>
protest [OPTIONS] <COMMAND>
Commands:
list List all tests with saved failures
show Show details of failures for a specific test
clean Remove saved failures
stats Show statistics about saved failures
generate Generate regression tests from saved failures
help Print help information
Options:
-d, --dir <DIR> Path to the failures directory [default: .protest/failures]
-h, --help Print help
-V, --version Print version
# Basic list
protest list
# Verbose output with details
protest list --verbose
protest show my_test_name
Output includes:
protest stats
Shows aggregated statistics across all failures:
# Remove a specific failure by seed
protest clean my_test --seed 12345
# Remove all failures for a test
protest clean my_test
# Remove all failures (with confirmation)
protest clean
# Skip confirmation prompt
protest clean my_test -y
Convert saved failures into permanent regression test files that can be committed to your repository.
# Generate regression tests for a specific test
protest generate my_test
# Generate for all tests with failures
protest generate
# Specify custom output directory
protest generate my_test --output tests/regressions
# Skip confirmation prompt
protest generate -y
Generated test files include:
Example generated test:
/// Regression test for failure with seed 12345
///
/// Original error: Property failed: Value too large
/// Input: 571962454
/// Discovered: 2025-01-02 16:00:00 UTC
/// Shrink steps: 15
#[test]
fn regression_my_test_seed_12345() {
// TODO: Implement regression test for seed 12345
// You can reproduce this failure using:
// PropertyTestBuilder::new()
// .seed(12345)
// .run(generator, property);
}
Workflow:
protest generate to create test filestests/regressions/cargo test to verify the regression tests passprotest --dir .custom/failures list
protest --dir /path/to/failures show my_test
# Exit with error if any failures exist
protest list && exit 1 || exit 0
# Automatically generate regression tests from failures
protest generate --output tests/regressions -y
# Commit generated tests (optional)
git add tests/regressions/
git commit -m "Add regression tests from property test failures"
# After fixing bugs, clean old failures
protest clean -y
# Export stats to a file (pipe the output)
protest stats > failure_report.txt
name: Property Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run property tests
run: cargo test --features persistence
continue-on-error: true
- name: Check for failures
run: |
if protest list | grep -q "failure"; then
echo "Property test failures detected"
protest list --verbose
protest generate -y
exit 1
fi
- name: Upload generated tests
if: failure()
uses: actions/upload-artifact@v2
with:
name: regression-tests
path: tests/regressions/
The CLI uses colored output for better readability:
Colors can be disabled by setting NO_COLOR=1 environment variable.