Error attempt to get length of field 'testsuite' (a nil value)
avucic opened this issue · 1 comments
avucic commented
I have cargo workspace setup:
project/Cargo.toml
project/mylib/Cargo.toml
project/mylib/src/foo.rs
My test looks something like
// foo.rs
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_it_returns_something() {
assert_eq!(true, true);
}
}
I tried the following commands:
lua require('neotest').run.run()
lua require("neotest").run.run({vim.fn.expand("%")})
And I'm getting this error
Error executing vim.schedule lua callback: ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...l/share/nvim/lazy/neotest-rust/lua/neotest-rust/init.lua:253: attempt to get length of field 'testsuite' (a nil value)
When I try this:
lua require("neotest").run.run(vim.fn.getcwd())
Nothing happened.
I run this command from the project/mylib/
cargo nextest run test_it_returns_something
It works as expected.
I'm new to Rust/Cargo. Not sure if I can help you more.
tuanbass commented
I have cargo workspace setup:
project/Cargo.toml project/mylib/Cargo.toml project/mylib/src/foo.rs
I ran into the same problem.
Seem it was caused because of the cwd
when launching cargo nextest
is wrong. It's set to workspace path instead of member path, when cargo nextest
requires member path.
After some debug, seem it's set by intention, but I cannot figure out the result behind.
A simple patch fixes the problem with workspace, but I'm not sure whether it causes other problem :lol