mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
test: fix flaky watchfiles tests (#22637)
This commit is contained in:
@@ -126,6 +126,8 @@ describe('vim._watch', function()
|
||||
expected_events = expected_events + 1
|
||||
wait_for_events()
|
||||
|
||||
vim.wait(100)
|
||||
|
||||
local watched_path = root_dir .. '/file'
|
||||
local watched, err = io.open(watched_path, 'w')
|
||||
assert(not err, err)
|
||||
|
@@ -3783,7 +3783,8 @@ describe('LSP', function()
|
||||
|
||||
local expected_messages = 2 -- initialize, initialized
|
||||
|
||||
local msg_wait_timeout = require('vim.lsp._watchfiles')._watchfunc == vim._watch.poll and 2500 or 200
|
||||
local watchfunc = require('vim.lsp._watchfiles')._watchfunc
|
||||
local msg_wait_timeout = watchfunc == vim._watch.poll and 2500 or 200
|
||||
local function wait_for_messages()
|
||||
assert(vim.wait(msg_wait_timeout, function() return #server.messages == expected_messages end), 'Timed out waiting for expected number of messages. Current messages seen so far: ' .. vim.inspect(server.messages))
|
||||
end
|
||||
@@ -3807,6 +3808,10 @@ describe('LSP', function()
|
||||
},
|
||||
}, { client_id = client_id })
|
||||
|
||||
if watchfunc == vim._watch.poll then
|
||||
vim.wait(100)
|
||||
end
|
||||
|
||||
local path = root_dir .. '/watch'
|
||||
local file = io.open(path, 'w')
|
||||
file:close()
|
||||
|
Reference in New Issue
Block a user