diff options
author | Jon Huhn <nojnhuh@users.noreply.github.com> | 2023-03-26 04:41:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 10:41:27 +0100 |
commit | 6a6191174afd7604b82fcc04b9a27b8d51133c9f (patch) | |
tree | c1dc59db706eef980c6ca52ce920f4bb299d00c7 | |
parent | 4863ca6b8902c5b0aab95f2af640118cd417d379 (diff) | |
download | rneovim-6a6191174afd7604b82fcc04b9a27b8d51133c9f.tar.gz rneovim-6a6191174afd7604b82fcc04b9a27b8d51133c9f.tar.bz2 rneovim-6a6191174afd7604b82fcc04b9a27b8d51133c9f.zip |
test: fix flaky watchfiles tests (#22637)
-rw-r--r-- | test/functional/lua/watch_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index 19bb411ce6..554480c2b3 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -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) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 8b5e7d56ac..3de4c6275e 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -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() |