From 34cd94812d42bb6b9ddd54229eb497f660736b4d Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Mon, 23 Dec 2024 12:37:01 +0100 Subject: 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. --- test/functional/testnvim.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/functional') diff --git a/test/functional/testnvim.lua b/test/functional/testnvim.lua index 43c38d18c0..675ad9e3d7 100644 --- a/test/functional/testnvim.lua +++ b/test/functional/testnvim.lua @@ -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('[/\\][^/\\]+$', '') -- cgit