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

Test Explorer: Only supports unit tests (of main crate) #16874

Closed
CryZe opened this issue Mar 18, 2024 · 4 comments · Fixed by #16880
Closed

Test Explorer: Only supports unit tests (of main crate) #16874

CryZe opened this issue Mar 18, 2024 · 4 comments · Fixed by #16880
Labels
A-test-explorer Issues related to the test explorer lsp extension and vscode test api C-bug Category: bug

Comments

@CryZe
Copy link
Contributor

CryZe commented Mar 18, 2024

The test explorer seems to only work for the unit tests of the main crate. While all other tests are shown, it's not possible to run them. This includes unit tests of other crates in the workspace, as well as integration tests in general.

image

rust-analyzer version: 0.4.1884-standalone (b6d1887 2024-03-17)

rustc version: rustc 1.76.0 (07dca489a 2024-02-04)

relevant settings:

"rust-analyzer.testExplorer": true,

repository link: https://github.com/LiveSplit/livesplit-core

@CryZe CryZe added the C-bug Category: bug label Mar 18, 2024
@CryZe CryZe changed the title Test Explorer: Only supports unit tests Test Explorer: Only supports unit tests (of main crate) Mar 18, 2024
@HKalbasi HKalbasi added the A-test-explorer Issues related to the test explorer lsp extension and vscode test api label Mar 18, 2024
@HKalbasi
Copy link
Member

I looked at this a bit, and found out that the problem of not running integration tests is a bug, and if you expand each integration test manually it will run it. But the problem of not running unit tests in other crates is bigger. Currently, it is assumed that a single cargo test will run all tests in a workspace, which is false in your project. Is there any single cargo command that can run all of your tests?

@CryZe
Copy link
Contributor Author

CryZe commented Mar 18, 2024

image

cargo test --workspace seems to work. Or --package the-crate for an individual crate.

What's surprising is that the rest of rust-analyzer (the test code lenses and co.) can run these tests just fine. I assume the code is not (properly?) shared between both aspects of rust-analyzer?

@HKalbasi
Copy link
Member

Yes the code sharing here is less than ideal, but here it wouldn't help much as with the code lenses there were no way to run all tests at the same time, so there were no command emitting --workspace.

@CryZe
Copy link
Contributor Author

CryZe commented Mar 18, 2024

Thank you so much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-test-explorer Issues related to the test explorer lsp extension and vscode test api C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants