Skip to content

Commit d5fd2a4

Browse files
committed
ci: better wait condition for screenshots
1 parent 2b78bae commit d5fd2a4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lua/fzf-lua/test/helpers.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ M.new_child_neovim = function()
133133
%s
134134
winopts = {
135135
on_create = function() _G._fzf_lua_on_create = true end,
136-
on_close = function() _G._fzf_lua_on_create = nil end,
136+
on_close = function()
137+
_G._fzf_lua_on_create = nil
138+
_G._fzf_postprocess_called = nil
139+
end,
137140
},
138141
keymap = { fzf = {
139142
true,

tests/file/ui_spec.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,26 @@ T["files()"] = new_set()
2424
T["files()"]["start and abort"] = new_set({ parametrize = { { "<esc>" }, { "<c-c>" } } }, {
2525
function(key)
2626
-- sort output and remove cwd in prompt as will be different on CI
27-
child.lua([[FzfLua.files({
27+
eq(child.lua_get([[_G._fzf_postprocess_called]]), vim.NIL)
28+
child.lua([==[FzfLua.files({
2829
hidden = false,
2930
previewer = false,
3031
cwd_prompt = false,
3132
cmd = "rg --files --sort=path",
32-
})]])
33+
requires_processing = true, -- for __mt_postprocess
34+
__mt_postprocess = [[return function()
35+
local chan_id = vim.fn.sockconnect("pipe", _G._fzf_lua_server, { rpc = true })
36+
vim.rpcrequest(chan_id, "nvim_exec_lua", "_G._fzf_postprocess_called=true", {})
37+
vim.fn.chanclose(chan_id)
38+
end]],
39+
})]==])
3340
eq(child.lua_get([[_G._fzf_lua_on_create]]), true)
3441
child.wait_until(function()
3542
return child.lua_get([[_G._fzf_load_called]]) == true
3643
end)
44+
child.wait_until(function()
45+
return child.lua_get([[_G._fzf_postprocess_called]]) == true
46+
end)
3747
-- Ignore last "-- TERMINAL --" line and paths on Windows (separator is "\")
3848
local screen_opts = { ignore_lines = { 28 }, normalize_paths = helpers.IS_WIN() }
3949
-- NOTE: we compare screen lines without "attrs"

0 commit comments

Comments
 (0)