Nsidorenco
neotest-vstest
Lua

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

GitHub release (latest SemVer) LuaRocks Package

test discovery sample

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.
- Will use the new Microsoft.Testing.Platform when available for newer projects.
  • Supports all testing frameworks.
  • DAP strategy for attaching debug adapter to test execution.
  • Supports C# and F#.
  • No external dependencies, only the dotnet sdk required.
  • Can run tests on many groupings including:
- All tests - Test projects - Test files - Test all methods in class - Test individual cases of parameterized tests

Pre-requisites

neotest-vstest makes a number of assumptions about your environment:

  • The dotnet sdk, and the dotnet cli executable in the users runtime path.
  • (For Debugging) netcoredbg is installed and nvim-dap plugin has been configured for netcoredbg (see debug config for more details)
  • (recommended) treesitter parser for either C# or F# allowing run test in file functionality.
  • neovim v0.10.0 or 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 netcoredbg to a location of your choosing and configure nvim-dap to point to the correct path
This adapter uses that standard dap strategy in neotest. Run it like so:
  • lua require("neotest").run.run({strategy = "dap"})

Acknowledgements

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท Nsidorenco/neotest-vstest ยท Updated daily from GitHub