rouge8/neotest-rust

Running/listing tests in a workspace with a root package fails

Closed this issue · 3 comments

rouge8 commented

Issue

It looks like cargo nextest list isn't listing tests in the workspace members when a root package is present: https://doc.rust-lang.org/cargo/reference/workspaces.html#root-package, e.g. https://github.com/rouge8/test-ws-rust

Original report

I ran into the issue today. I create a simple repo to help reproducing the problem at https://github.com/tuanbass/test-ws-rust

open foo/src/lib.rs and try to run the test.

But the fix, while necessary, still does not resolve the root cause. No more crash, but the test was not run.
The root cause seem is occurred when determined the cwd to run cargo nextest command for rust project with workspace enable.
When open such project, the cwd is set to root project's path not the member's one. Hence cargo nextest cannot found any test/test suite.

Originally posted by @tuanbass in #33 (comment)

rouge8 commented

Some workspace packages succeed. For example, I can still run the tests in the Tokio package that I used to develop #27.

rouge8 commented

@tuanbass this should be fixed now. Thanks for the example repo!

@tuanbass this should be fixed now. Thanks for the example repo!

I can confirm that the issue is gone. Thanks for the fix.