Skip to content

rtk cargo test -- --nocapture drops the panic message of a failing test #5063

Description

@KuSh

With --nocapture the harness prints a failing test's panic directly instead of in the failures: section, and the cargo test filter keeps only the test result: line:

$ rtk cargo test -- --nocapture        # crate with one failing assert_eq!(1, 2, "boom")
[full output: rtk recall …]
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Raw cargo prints thread 'tests::fails' panicked at src/main.rs:10:26: assertion left == right failed: boom with left/right. The same happens with the t alias. Reproduced on develop 08a261a and unchanged since v1.2.0 (src/cmds/rust/cargo_cmd.rs and src/core/stream.rs have no diff since the tag). Expected: a failed run keeps the panic text of each failing test.

Activity

  1. rtk-wshm-sync-bot commented on Nov 10, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 90%

    Summary

    With --nocapture, rtk's cargo test filter drops panic/assertion details for failing tests, leaving only the summary line.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/rust/cargo_cmd.rs
    • src/core/stream.rs

    Suggested Actions

    1. Reproduce with rtk cargo test -- --nocapture on a crate with a failing assert_eq! to confirm
    2. Inspect how src/cmds/rust/cargo_cmd.rs filters streamed output when --nocapture is passed
    3. Check src/core/stream.rs for logic that only preserves the failures: section, not inline panics
    4. Compare against pytest filter reports "No tests collected" for runs that executed and passed (false negative summary) #5016 and rtk pytest / pipe -f pytest list each failing test twice (FAILURES block and short summary line) #4897, which involve related cargo/pytest test-output filtering regressions

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. added a commit that references this issue on Nov 17, 2026
    c1a59c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions