Skip to content

Commit

Permalink
Fix running tests for non-default workspace packages
Browse files Browse the repository at this point in the history
Previously, we would fail to run tests for non-default workspace
packages.

For example, given:

```toml
[workspace]
members = ["path/to/member1", "path/to/member2", "path/to/member3/*"]
default-members = ["path/to/member2", "path/to/member3/foo"]
```

We would not be able to run tests in `path/to/member1`.

This also affected workspaces with a root package, e.g.:

```toml
[workspace]
members = ["bar", "foo"]

[package]
name = "test-ws"
version = "0.1.0"
edition = "2021"
```

We would not be able to run tests in `bar` or `foo`.

Fixes #51.
  • Loading branch information
rouge8 committed Sep 16, 2023
1 parent a9cd2ed commit c8894d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/neotest-rust/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ function adapter.build_spec(args)
"cargo",
"nextest",
"run",
"--workspace",
"--no-fail-fast",
"--config-file",
tmp_nextest_config,
Expand Down
2 changes: 1 addition & 1 deletion tests/init_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ describe("build_spec", function()

local spec = adapter.build_spec({ tree = tree })
assert.matches(
"cargo nextest run %-%-no%-fail%-fast %-%-config%-file %g+ %-%-profile neotest %-%-no%-capture %-%-test%-threads 3 %-%-test test_it ",
"cargo nextest run %-%-workspace %-%-no%-fail%-fast %-%-config%-file %g+ %-%-profile neotest %-%-no%-capture %-%-test%-threads 3 %-%-test test_it ",
spec.command
)
end)
Expand Down

0 comments on commit c8894d8

Please sign in to comment.