@@ -86,9 +86,6 @@ T["DAP-E2E-03 runs and terminates a hermetic adapter through AstroNvim mappings"
8686 vim.env.ASTRONVIM_E2E_DAP_SOURCE = %s
8787 local nvim = vim.fn.exepath "nvim"
8888 if nvim == "" then nvim = vim.env.ASTRONVIM_TEST_NVIM or vim.v.progpath end
89- _G.astronvim_test_child_nvim = nvim
90- local probe = vim.system({ nvim, "--headless", "--clean", "-u", "NONE", "+qa" }, { text = true }):wait()
91- assert(probe.code == 0, ("Unable to launch the child Neovim executable: %%s"):format(vim.inspect(probe)))
9289 dap.adapters.astronvim_fixture = {
9390 type = "executable",
9491 command = nvim,
@@ -131,30 +128,9 @@ T["DAP-E2E-03 runs and terminates a hermetic adapter through AstroNvim mappings"
131128 mapping.callback()
132129 ]]
133130
134- local function wait_for_dap (expression , description )
135- local ok , err = pcall (helpers .wait_until , child , expression , description )
136- if ok then return end
137- local diagnostics = child .lua_get (([=[ (function()
138- local log = {}
139- if vim.fn.filereadable(%s) == 1 then log = vim.fn.readfile(%s) end
140- local notifications = {}
141- for _, notification in ipairs(Snacks.notifier.get_history()) do
142- table.insert(notifications, notification.msg)
143- end
144- return {
145- nvim = _G.astronvim_test_child_nvim,
146- progpath = vim.v.progpath,
147- exepath = vim.fn.exepath("nvim"),
148- session = require("dap").session() ~= nil,
149- log = log,
150- notifications = notifications,
151- }
152- end)()]=] ):format (vim .inspect (log ), vim .inspect (log )))
153- error ((" %s\n DAP diagnostics: %s" ):format (err , vim .inspect (diagnostics )), 0 )
154- end
155-
156- wait_for_dap (" require('dap').session() ~= nil" , " DAP adapter session" )
157- wait_for_dap (
131+ helpers .wait_until (child , " require('dap').session() ~= nil" , " DAP adapter session" )
132+ helpers .wait_until (
133+ child ,
158134 ([[ (function()
159135 if vim.fn.filereadable(%s) == 0 then return false end
160136 local commands = {}
@@ -167,7 +143,7 @@ T["DAP-E2E-03 runs and terminates a hermetic adapter through AstroNvim mappings"
167143 end)()]] ):format (vim .inspect (log ), vim .inspect (log )),
168144 " DAP adapter initialization"
169145 )
170- wait_for_dap ( " #vim.api.nvim_list_wins() > 1" , " DAP UI open" )
146+ helpers . wait_until ( child , " #vim.api.nvim_list_wins() > 1" , " DAP UI open" )
171147
172148 local commands = child .lua_get (([[ (function()
173149 local commands = {}
@@ -199,8 +175,8 @@ T["DAP-E2E-03 runs and terminates a hermetic adapter through AstroNvim mappings"
199175 assert(type(mapping.callback) == "function")
200176 mapping.callback()
201177 ]]
202- wait_for_dap ( " require('dap').session() == nil" , " DAP session termination" )
203- wait_for_dap ( " #vim.api.nvim_list_wins() == 1" , " DAP UI close" )
178+ helpers . wait_until ( child , " require('dap').session() == nil" , " DAP session termination" )
179+ helpers . wait_until ( child , " #vim.api.nvim_list_wins() == 1" , " DAP UI close" )
204180
205181 commands = child .lua_get (([[ (function()
206182 local commands = {}
0 commit comments