neotest adapter for dotnet
Last updated Jun 26, 2026
51
Stars
20
Forks
4
Issues
0
Stars/day
Attention Score
50
Language breakdown
Lua 55.8%
F# 43.1%
C# 0.9%
Makefile 0.2%
โธ Files
click to expand
README
Neotest VSTest
Neotest adapter for dotnet
- Based on the VSTest for dotnet allowing test functionality similar to those found in IDEs like Rider and Visual Studio.
- Supports all testing frameworks.
- DAP strategy for attaching debug adapter to test execution.
- Supports
C#andF#. - No external dependencies, only the
dotnet sdkrequired. - Can run tests on many groupings including:
Pre-requisites
neotest-vstest makes a number of assumptions about your environment:
- The
dotnet sdk, and thedotnetcli executable in the users runtime path. - (For Debugging)
netcoredbgis installed andnvim-dapplugin has been configured fornetcoredbg(see debug config for more details) - (recommended) treesitter parser for either
C#orF#allowing run test in file functionality. neovim v0.10.0or later
Installation
lazy.nvim
{
"nsidorenco/neotest-vstest"
}
Usage
require("neotest").setup({
adapters = {
require("neotest-vstest")
}
})
The adapter optionally supports extra settings:
-- NOTE: This should be set before calling require("neotest-vstest")
--- @type neotest_vstest.Config
vim.g.neotest_vstest = {
-- Path to dotnet sdk path.
-- Used in cases where the sdk path cannot be auto discovered.
sdk_path = "/usr/local/dotnet/sdk/9.0.101/",
-- table is passed directly to DAP when debugging tests.
dap_settings = {
type = "netcoredbg",
},
-- If multiple solutions exists the adapter will ask you to choose one.
-- If you have a different heuristic for choosing a solution you can provide a function here.
solution_selector = function(solutions)
return nil -- return the solution you want to use or nil to let the adapter choose.
end,
-- If multiple .runsettings/testconfig.json files are present in the test project directory
-- you will be given the choice of file to use when setting up the adapter.
-- Or you can provide a function here
-- default nil to select from all files in project directory
settingsselector = function(projectdir)
return nil -- return the .runsettings/testconfig.json file you want to use or let the adapter choose
end,
build_opts = {
-- Arguments that will be added to all dotnet build and dotnet msbuild commands
additional_args = {}
},
-- If project contains directories which are not supposed to be searched for solution files
discoverydirectoryfilter = function(search_path)
-- ignore hidden directories
return search_path:match("/%.")
end,
-- if no obvious parent solution is found, broadly scan downward for solution files from current path. This can freeze Neovim when started from broad directories.
broadrecursivediscovery = true,
timeout_ms = 30 5 1000 -- number of milliseconds to wait before timeout while communicating with adapter client
}
require("neotest").setup({ adapters = { require("neotest-vstest") } })
Debugging adapter
- Install
netcoredbgto a location of your choosing and configurenvim-dapto point to the correct path
neotest. Run it like so:
lua require("neotest").run.run({strategy = "dap"})
Acknowledgements
- Issafalcon for the original neotest-dotnet adapter which inspired this adapter.
- Wayne Bowie for helping test and troubleshoot the adapter.
- Dynge for testing and contributing to the adapter.
๐ More in this category