Skip to content

Commit db32ed9

Browse files
committed
make server start to accept clean option and use it on tests
1 parent 87e3231 commit db32ed9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lua/eca/server.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ end
9898
---in testing
9999
---@param opts? eca.ServerStartOpts
100100
function M:start(opts)
101-
opts = opts or { initialize = true }
101+
opts = vim.tbl_deep_extend("force", { initialize = true }, opts or {})
102102

103103
local this_file = debug.getinfo(1, "S").source:sub(2)
104104
local proj_root = vim.fn.fnamemodify(this_file, ":p:h:h:h")
@@ -112,7 +112,7 @@ function M:start(opts)
112112

113113
local lua_cmd = string.format("lua ServerPath.run(%s)", Utils.lua_quote(Config.server_path or ""))
114114

115-
local cmd = { nvim_exe, "--headless", "--noplugin", "-u", script_path, "-c", lua_cmd }
115+
local cmd = { nvim_exe, "--headless", "--noplugin", (opts.clean and " --clean" or ""), "-u", script_path, "-c", lua_cmd }
116116

117117
vim.system(cmd, { text = true }, function(out)
118118
if out.code ~= 0 then

tests/test_server_integration.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ end
4040
T["server"] = MiniTest.new_set()
4141

4242
T["server"]["start"] = function()
43-
child.lua("_G.server:start()")
43+
child.lua("_G.server:start({ clean = true })")
4444
child.lua([[
4545
_G.server_started = vim.wait(10000, function()
4646
return _G.server and _G.server:is_running()
@@ -52,7 +52,7 @@ T["server"]["start"] = function()
5252
end
5353

5454
T["server"]["start without initialize"] = function()
55-
child.lua("_G.server:start({ initialize = false })")
55+
child.lua("_G.server:start({ clean = true, initialize = false })")
5656
child.lua([[
5757
_G.server_started = vim.wait(10000, function()
5858
return _G.server and _G.server:is_running()
@@ -67,7 +67,7 @@ T["server"]["start with inexistent path"] = function()
6767
child.lua([[
6868
Config = require("eca.config")
6969
Config.setup({ server_path = "non-existing-path" } )
70-
_G.server:start()
70+
_G.server:start({ clean = true })
7171
]])
7272
child.lua([[
7373
_G.server_started = vim.wait(1000, function()

0 commit comments

Comments
 (0)