|
| 1 | +<p align="center"> |
| 2 | +<a href="https://github.com/nsidorenco/neotest-vstest/releases"> |
| 3 | + <img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/nsidorenco/neotest-vstest?style=for-the-badge"> |
| 4 | +</a> |
| 5 | +<a href="https://luarocks.org/modules/nsidorenco/neotest-vstest"> |
| 6 | + <img alt="LuaRocks Package" src="https://img.shields.io/luarocks/v/nsidorenco/neotest-vstest?logo=lua&color=purple&style=for-the-badge"> |
| 7 | +</a> |
| 8 | +</p> |
| 9 | + |
| 10 | +# Neotest VSTest |
| 11 | + |
| 12 | +Neotest adapter for dotnet |
| 13 | + |
| 14 | +- Integrates with the VSTest runner to support all testing frameworks. |
| 15 | +- DAP strategy for attaching debug adapter to test execution. |
| 16 | +- Supports both C# and F# projects. |
| 17 | +- Fine-grained test discovery and execution allowing running individual parameterized tests. |
| 18 | + |
| 19 | +## Pre-requisites |
| 20 | + |
| 21 | +neotest-vstest requires makes a number of assumptions about your environment: |
| 22 | + |
| 23 | +1. The `dotnet sdk`, and the `dotnet` cli executable in the users runtime path. |
| 24 | +2. (For Debugging) `netcoredbg` is installed and `nvim-dap` plugin has been configured for `netcoredbg` (see debug config for more details) |
| 25 | +3. Requires treesitter parser for either `C#` or `F#` |
| 26 | +4. `neovim v0.10.0` or later |
| 27 | + |
| 28 | +## Installation |
| 29 | + |
| 30 | +### [lazy.nvim](https://github.com/folke/lazy.nvim) |
| 31 | + |
| 32 | +``` |
| 33 | +{ |
| 34 | + "nvim-neotest/neotest-vstest" |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +```lua |
| 41 | +require("neotest").setup({ |
| 42 | + adapters = { |
| 43 | + require("neotest-vstest") |
| 44 | + } |
| 45 | +}) |
| 46 | +``` |
| 47 | + |
| 48 | +The adapter optionally supports extra settings: |
| 49 | + |
| 50 | +```lua |
| 51 | +require("neotest").setup({ |
| 52 | + adapters = { |
| 53 | + require("neotest-vstest")({ |
| 54 | + -- Path to dotnet sdk path. |
| 55 | + -- Used in cases where the sdk path cannot be auto discovered. |
| 56 | + sdk_path = "/usr/local/dotnet/sdk/9.0.101/", |
| 57 | + -- table is passed directly to DAP when debugging tests. |
| 58 | + dap_settings = { |
| 59 | + adapter = "netcoredbg", |
| 60 | + } |
| 61 | + }) |
| 62 | + } |
| 63 | +}) |
| 64 | +``` |
| 65 | + |
| 66 | +## Debugging adapter |
| 67 | + |
| 68 | +- Install `netcoredbg` to a location of your choosing and configure `nvim-dap` to point to the correct path |
| 69 | + |
| 70 | +This adapter uses that standard dap strategy in `neotest`. Run it like so: |
| 71 | + |
| 72 | +- `lua require("neotest").run.run({strategy = "dap"})` |
| 73 | + |
| 74 | +## Acknowledgements |
| 75 | + |
| 76 | +- [Issafalcon](https://github.com/Issafalcon) for the original [neotest-dotnet](https://github.com/Issafalcon/neotest-dotnet) adapter which inspired this adapter. |
| 77 | +- [Wayne Bowie](https://github.com/waynebowie99) for helping test and troubleshoot the adapter. |
| 78 | +- [Dynge](https://github.com/Dynge) for testing and contributing to the adapter. |
0 commit comments