Update generated neovim config
This commit is contained in:
@ -40,7 +40,6 @@ Helpers.new_child_neovim = function()
|
||||
local child = MiniTest.new_child_neovim()
|
||||
|
||||
local prevent_hanging = function(method)
|
||||
-- stylua: ignore
|
||||
if not child.is_blocked() then return end
|
||||
|
||||
local msg = string.format('Can not use `child.%s` because child process is blocked.', method)
|
||||
@ -157,6 +156,9 @@ Helpers.new_child_neovim = function()
|
||||
MiniTest.expect.reference_screenshot(child.get_screenshot(screenshot_opts), path, opts)
|
||||
end
|
||||
|
||||
-- Poke child's event loop to make it up to date
|
||||
child.poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
|
||||
return child
|
||||
end
|
||||
|
||||
@ -170,7 +172,41 @@ end
|
||||
-- Detect CI
|
||||
Helpers.is_ci = function() return os.getenv('CI') ~= nil end
|
||||
Helpers.skip_in_ci = function(msg)
|
||||
if Helpers.is_ci() then MiniTest.skip(msg) end
|
||||
if Helpers.is_ci() then MiniTest.skip(msg or 'Does not test properly in CI') end
|
||||
end
|
||||
|
||||
-- Detect OS
|
||||
Helpers.is_windows = function() return vim.fn.has('win32') == 1 end
|
||||
Helpers.skip_on_windows = function(msg)
|
||||
if Helpers.is_windows() then MiniTest.skip(msg or 'Does not test properly on Windows') end
|
||||
end
|
||||
|
||||
Helpers.is_macos = function() return vim.fn.has('mac') == 1 end
|
||||
Helpers.skip_on_macos = function(msg)
|
||||
if Helpers.is_macos() then MiniTest.skip(msg or 'Does not test properly on MacOS') end
|
||||
end
|
||||
|
||||
-- Standardized way of dealing with time
|
||||
Helpers.is_slow = function() return Helpers.is_ci() and (Helpers.is_windows() or Helpers.is_macos()) end
|
||||
Helpers.skip_if_slow = function(msg)
|
||||
if Helpers.is_slow() then MiniTest.skip(msg or 'Does not test properly in slow context') end
|
||||
end
|
||||
|
||||
Helpers.get_time_const = function(delay)
|
||||
local coef = 1
|
||||
if Helpers.is_ci() then
|
||||
if Helpers.is_windows() then coef = 5 end
|
||||
if Helpers.is_macos() then coef = 15 end
|
||||
end
|
||||
return coef * delay
|
||||
end
|
||||
|
||||
Helpers.sleep = function(ms, child, skip_slow)
|
||||
if skip_slow then
|
||||
Helpers.skip_if_slow('Skip because state checks after sleep are hard to make robust in slow context')
|
||||
end
|
||||
vim.loop.sleep(math.max(ms, 1))
|
||||
if child ~= nil then child.poke_eventloop() end
|
||||
end
|
||||
|
||||
return Helpers
|
||||
|
||||
Reference in New Issue
Block a user