Skip to content

Stop using --nocapture in test runner #13040

Closed as not planned
Closed as not planned
@dnut

Description

@dnut

The test runner automatically adds --no-capture when running cargo test.

This is an annoyance for me because the amount of output makes the terminal completely unintelligible. I never even see the test result because the terminal can't handle the quantity of output produced by the tests. So the code lens feature is totally useless because I can only determine whether a test passed if I run it from the command line.

Why is this argument even included? There is a reason why cargo captures the output by default. The inclusion of this cli argument by rust-analyzer is a strong opinionated message to the cargo developers: "you are wrong, output should never be captured." Is that really the case? Are we correcting a mistake that was made in cargo?

I don't think so. There's a good reason for this feature: you can run tests without being overwhelmed by pointless output. I only need to see the output when a test fails, and cargo always outputs that.

I am strongly in favor of simply removing this argument. It doesn't even need to be configurable, just take it out. In the rare case that you need to see the output from a passing test, you can run cargo manually from the command line. But that's an unusual use case if you ask me. If made configurable, the default should not include --no-capture.

If you want rust-analyzer to be embraced as a core part of the rust ecosystem, how about we have some consistency with how cargo works rather than contradicting its reasonable design decisions. It's confusing to get different behavior from cargo depending on whether I trigger it from a click vs the cli. A good test about whether --no-capture should be the default would be if we can convince the cargo team to adopt it as the default behavior of cargo test.

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