Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rouge8/neotest-rust
Neotest adapter for Rust, using cargo-nextest.
https://github.com/rouge8/neotest-rust
neotest neovim neovim-plugin rust
Last synced: about 1 month ago
JSON representation
Neotest adapter for Rust, using cargo-nextest.
- Host: GitHub
- URL: https://github.com/rouge8/neotest-rust
- Owner: rouge8
- License: mit
- Created: 2022-07-23T18:43:31.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T20:55:08.000Z (5 months ago)
- Last Synced: 2024-07-05T11:38:15.483Z (2 months ago)
- Topics: neotest, neovim, neovim-plugin, rust
- Language: Lua
- Homepage:
- Size: 103 KB
- Stars: 89
- Watchers: 2
- Forks: 27
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# neotest-rust
[Neotest](https://github.com/rcarriga/neotest) adapter for Rust, using
[cargo-nextest](https://nexte.st/).Requires [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
and the parser for Rust.```lua
require("neotest").setup({
adapters = {
require("neotest-rust")
}
})
```If you wish to give additional arguments to the `cargo nextest`,
you can specify the args when initializing the adapter.```lua
require("neotest").setup({
adapters = {
require("neotest-rust") {
args = { "--no-capture" },
}
}
})
```Supports standard library tests, [`rstest`](https://github.com/la10736/rstest),
Tokio's `[#tokio::test]`, and more. Does not support `rstest`'s parametrized
tests.## Debugging Tests
Codelldb is the default adapter used for debugging.
Alternatives can be specified via the `dap_adapter` property during initialization.```lua
require("neotest").setup({
adapters = {
require("neotest-rust") {
args = { "--no-capture" },
dap_adapter = "lldb",
}
}
})
```See [nvim-dap](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation),
and [rust-tools#debugging](https://github.com/simrat39/rust-tools.nvim/wiki/Debugging) if you are using rust-tools.nvim,
for more information.## Limitations
The following limitations apply to both running and debugging tests.
- Assumes unit tests in `main.rs`, `mod.rs`, and `lib.rs` are in a `tests`
module.
- Does not support `rstest`'s `#[case]` macro.
- When running tests for a `main.rs` in an integration test subdirectory (e.g.
`tests/testsuite/main.rs`), all tests in that subdirectory will be run (e.g.
all tests in `tests/testsuite/`). This is because Cargo lacks the capability
to specify a test file.Additionally, when debugging tests, no output from failed tests will be captured in the results provided to Neotest.