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 integration doesn't work in monorepo #17022

Closed
sazzer opened this issue Apr 6, 2024 · 1 comment · Fixed by #17056
Closed

Test Explorer integration doesn't work in monorepo #17022

sazzer opened this issue Apr 6, 2024 · 1 comment · Fixed by #17056
Labels
A-test-explorer Issues related to the test explorer lsp extension and vscode test api C-bug Category: bug

Comments

@sazzer
Copy link

sazzer commented Apr 6, 2024

I've just discovered that the VSCode rust-analyzer extension now has support for the Test Explorer, which is awesome. :)

However, it doesn't seem to work for monorepos. That is, cases where the Rust project is not at the root of the repository but rather inside a child directory.

It successfully discovers all of the tests, but running them instead returns:

error: could not find `Cargo.toml` in `/Users/sazzer/source/project` or any parent directory

(Where the Rust project is actually in /Users/sazzer/source/project/service)

So it appears to be trying to run the tests from the repository root instead of the Rust project root.

rust-analyzer version: rust-analyzer version: 0.3.1906-standalone (e4a405f 2024-03-31)

rustc version: rustc 1.77.1 (7cf61ebde 2024-03-27)

editor or extension: VSCode - Extension version v0.3.1906

Cheers

@sazzer sazzer added the C-bug Category: bug label Apr 6, 2024
@sazzer
Copy link
Author

sazzer commented Apr 6, 2024

In addition to this:

  • The "Go to Test" button takes me to the correct line of the correct file, so it does know exactly where the tests are located.
  • The "Debug Test" button actually works correctly! However, this always gives me a warning of "You can debug only one test at a time" regardless of what I pressed to debug.

So it's only the "Run Test" button - at all levels of the hierarchy - that gets this wrong.

Cheers

@lnicola lnicola added the A-test-explorer Issues related to the test explorer lsp extension and vscode test api label Apr 6, 2024
@bors bors closed this as completed in 07ae540 Apr 13, 2024
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