feat(test): support and document lua test case debugging

Similar to how there is a `GDB` environment variable to let the nvim
test instances to be run under `gdbserver` this adds a `OSV_PORT`
variable to start nvim test instances with `osv` in blocking mode to let
a debug client attach to it for debugging of `exec_lua` code blocks.
This commit is contained in:
Mathias Fussenegger
2024-12-23 12:37:01 +01:00
committed by Mathias Fußenegger
parent 14ee1de7e5
commit 34cd94812d
2 changed files with 170 additions and 0 deletions

View File

@@ -48,6 +48,16 @@ M.nvim_argv = {
'unlet g:colors_name',
'--embed',
}
if os.getenv('OSV_PORT') then
table.insert(M.nvim_argv, '--cmd')
table.insert(
M.nvim_argv,
string.format(
"lua require('osv').launch({ port = %s, blocking = true })",
os.getenv('OSV_PORT')
)
)
end
-- Directory containing nvim.
M.nvim_dir = M.nvim_prog:gsub('[/\\][^/\\]+$', '')