This is an adapter for using the neotest framework with Swift Testing.
The plugin is tested with Xcode 16 only but might work with earlier versions as well. Thanks to Emmet Murray for his neotest-swift plugin which I used as a starting point. I focused on Swift Testing only, legacy XCTest is not supported but might work.
- - Run Swift Test suites and tests
- - Debug tests cases with neotest dap support
- - Show parametrized tests in the test list
Add the following configuration file (e.q. neovim-dap.lua for Lazy) to enable debugging of Swift code with nvim-dap
:
return {
"mfussenegger/nvim-dap",
optional = true,
dependencies = "williamboman/mason.nvim",
opts = function()
local dap = require("dap")
if not dap.adapters.lldb then
local xcode_path = vim.fn.trim(vim.fn.system("xcode-select -p"))
dap.adapters.lldb = {
type = "executable",
command = xcode_path .. "/usr/bin/lldb-dap",
name = "lldb",
}
end
dap.configurations.swift = {
{
name = "Launch file",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
}
end,
}
Feel free to start a pull request if you have any improvements or bug fixes.