Skip to content

Add cargo nextest support with failures-only output #106

@ilaborie

Description

@ilaborie

Summary

Add token-optimized filtering for cargo nextest output. cargo-nextest is a popular next-generation Rust test runner used as an alternative to cargo test.

Motivation

cargo nextest run produces verbose output with compilation lines, PASS lines for every test, and post-summary recaps. For LLM consumption, only failures and a compact summary are needed.

Proposed Behavior

  • rtk cargo nextest [args...] routes through a dedicated filter
  • Strip compilation noise (Compiling, Finished, Starting lines)
  • Strip all PASS lines
  • Show only failure details (FAIL lines, stdout/stderr, backtraces)
  • Show a compact summary line (e.g., "301 passed, 0 failed")
  • Strip post-summary recap sections
  • Verbose mode (-v) shows full output

Expected Token Savings

90%+ reduction on typical test runs (similar to rtk cargo test).

Implementation Notes

  • New CargoCommand::Nextest variant in cargo_cmd.rs
  • New Nextest subcommand in CargoCommands enum in main.rs
  • Reuses the existing run_cargo_filtered infrastructure
  • Extracts flush_failure_block helper to DRY up failure block collection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions