[neotest] Hide folder/filenames + don't show folders/modules containing no tests #780
-
Checked other resources
DescriptionI'm not sure if this belongs here or with neotest, but since rustaceanvim is providing the list of tests, I think it belongs here. For the neotest summary: Is there a way to:
I couldn't find any configuration (neither here nor in neotest) to do this. Context
// accesscontrol.rs
#[cfg(test)]
mod tests {
mod check;
mod rule;
} Ideally the summary output would be like this (only crate, module and test function names, combined where possible):
Example Code-- Sorry for no minimal example, but I think this happens with the default configuration, too.
require("neotest").setup({
adapters = {
require("rustaceanvim.neotest"),
},
}) Neovim version (nvim -v)v0.11.1 Operating system/versionArch Output of :checkhealth rustaceanvim==============================================================================
rustaceanvim: require("rustaceanvim.health").check()
Checking for Lua dependencies ~
- ✅ OK optional dependency nvim-dap not installed. Needed for debugging features [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)
Checking external dependencies ~
- ✅ OK rust-analyzer: found rust-analyzer 1.86.0 (05f9846 2025-03-31)
- ✅ OK Cargo: found cargo 1.86.0 (adf9b6ad1 2025-02-28)
- ✅ OK rustc: found rustc 1.86.0 (05f9846f8 2025-03-31)
Checking config ~
- ✅ OK No errors found in config.
Checking for conflicting plugins ~
- ✅ OK No conflicting plugins detected.
Checking for tree-sitter parser ~
- ✅ OK tree-sitter parser for Rust detected. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey 👋 The underlying issue is that neotest's adapter interface requires the implementation of an This doesn't work with rust, because any file could contain test modules. You'd have to read and parse the file (not great for performance) to determine if it contains test modules. I'm fine with that - I've never needed the summary because I never use neotest to run the whole suite (I use Nix for that). So I won't put any energy into fixing this. If someone wants to contribute, you're more than welcome and I'll be happy to review and guide. |
Beta Was this translation helpful? Give feedback.
Hey 👋
The underlying issue is that neotest's adapter interface requires the implementation of an
is_test_file
function.This doesn't work with rust, because any file could contain test modules. You'd have to read and parse the file (not great for performance) to determine if it contains test modules.
Because I don't want that complexity and potential performance issues in rustaceanvim, I decided not to do that. And that's why the neotest summary output doesn't work great with rustaceanvim's neotest adapter.
I'm fine with that - I've never needed the summary because I never use neotest to run the whole suite (I use Nix for that). So I won't put any energy into fixing this.
If someone wants…