diff --git a/test/functional/core/server_spec.lua b/test/functional/core/server_spec.lua index 7a1f79b12e..5ec6cc5979 100644 --- a/test/functional/core/server_spec.lua +++ b/test/functional/core/server_spec.lua @@ -270,28 +270,24 @@ end) describe('startup --listen', function() -- Tests Nvim output when failing to start, with and without "--headless". - -- TODO(justinmk): clear() should have a way to get stdout if Nvim fails to start. local function _test(args, env, expected) local function run(cmd) - return n.exec_lua(function(cmd_, env_) - return vim - .system(cmd_, { - text = true, - env = vim.tbl_extend( - 'force', - -- Avoid noise in the logs; we expect failures for these tests. - { NVIM_LOG_FILE = testlog }, - env_ or {} - ), - }) - :wait() - end, cmd, env) --[[@as vim.SystemCompleted]] + return n.spawn_wait { + merge = false, + args = cmd, + env = vim.tbl_extend( + 'force', + -- Avoid noise in the logs; we expect failures for these tests. + { NVIM_LOG_FILE = testlog }, + env or {} + ), + } end - local cmd = vim.list_extend({ n.nvim_prog, '+qall!', '--headless' }, args) + local cmd = vim.list_extend({ '--clean', '+qall!', '--headless' }, args) local r = run(cmd) - eq(1, r.code) - matches(expected, (r.stderr .. r.stdout):gsub('\\n', ' ')) + eq(1, r.status) + matches(expected, r:output():gsub('\\n', ' ')) if is_os('win') then return -- On Windows, output without --headless is garbage. @@ -299,8 +295,8 @@ describe('startup --listen', function() table.remove(cmd, 3) -- Remove '--headless'. assert(not vim.tbl_contains(cmd, '--headless')) r = run(cmd) - eq(1, r.code) - matches(expected, (r.stderr .. r.stdout):gsub('\\n', ' ')) + eq(1, r.status) + matches(expected, r:output():gsub('\\n', ' ')) end it('validates', function() diff --git a/test/functional/testnvim.lua b/test/functional/testnvim.lua index 5d9e9f69e7..937011aa1e 100644 --- a/test/functional/testnvim.lua +++ b/test/functional/testnvim.lua @@ -458,7 +458,9 @@ end --- Starts a new, global Nvim session and clears the current one. --- ---- Note: Use `new_session()` to start a session without replacing the current one. +--- Note: +--- - Use `new_session()` to start a session without replacing the current one. +--- - Use `spawn_wait()` to start Nvim without connecting a RPC session. --- --- Parameters are interpreted as startup args, OR a map with these keys: --- - args: List: Args appended to the default `nvim_argv` set. @@ -488,7 +490,7 @@ local n_processes = 0 --- Does not replace the current global session, unlike `clear()`. --- --- @param keep boolean (default: false) Don't close the current global session. ---- @param ... string Nvim CLI args (or see overload) +--- @param ... string Nvim CLI args --- @return test.Session --- @overload fun(keep: boolean, opts: test.session.Opts): test.Session function M.new_session(keep, ...)