Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running individual tests with coverage #347

Open
Pzixel opened this issue Feb 20, 2024 · 2 comments
Open

Allow running individual tests with coverage #347

Pzixel opened this issue Feb 20, 2024 · 2 comments
Labels
C-documentation Category: related to documentation. C-question Category: A question

Comments

@Pzixel
Copy link

Pzixel commented Feb 20, 2024

There is a workaround currently to run individual tests and get coverage for them:

 cargo llvm-cov --lcov --output-path lcov.info  -- my::super::model::test_name --exact --nocapture

I think it is either worth documenting this as a recommended way of running individual tests or add an explicit option for this.
Currently cargo-llvm-cov looks highly tuned for CI workflow while I think local development flow is also valuable, which you want to run one or a couple of tests at once, not the entire test suite.

@taiki-e
Copy link
Owner

taiki-e commented Feb 22, 2024

I would accept a PR to improve docs. (It would be better to add it before or after the section on VSCode.)

It would not be so easy to add a dedicated command for this purpose. In fact, I don't think Cargo had it either.
That said, if someone has a concrete idea I can consider accepting it.

There is a workaround

Currently cargo-llvm-cov looks highly tuned for CI workflow

To be fair, we need the same thing when using cargo, right? it sounds a bit unfair to claim that this is "highly tuned for CI" for a tool that just doesn't support what cargo itself doesn't support as well.

(I guess it would also be possible to do the equivalent by adjusting the rust-analyzer's cargo test command settings.)

@taiki-e taiki-e added C-question Category: A question C-documentation Category: related to documentation. labels Feb 22, 2024
@Pzixel
Copy link
Author

Pzixel commented Feb 22, 2024

To be fair, we need the same thing when using cargo, right? it sounds a bit unfair to claim that this is "highly tuned for CI" for a tool that just doesn't support what cargo itself doesn't support as well.

Well for cargo purpose -- part that goes to rustc does the trick. With cargo-llvm-cov it's a bit less obvious and also it prints the large table with 0% coverage for all the tests except one that ran. if we could skip them that would be nice, but it's more of QoL feature which doesn't actually break anything, just annoys a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-documentation Category: related to documentation. C-question Category: A question
Projects
None yet
Development

No branches or pull requests

2 participants