From 66197dde7084484c9d23fa488b2288bcae364ba7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Sep 2024 18:34:35 +0800 Subject: [PATCH] test(api/buffer_updates_spec): prevent flakiness (#30521) Use poke_eventloop() to wait for Nvim to finish processing input. --- test/functional/api/buffer_updates_spec.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua index e030b45396..527394bfd1 100644 --- a/test/functional/api/buffer_updates_spec.lua +++ b/test/functional/api/buffer_updates_spec.lua @@ -27,12 +27,10 @@ end local function sendkeys(keys) api.nvim_input(keys) - -- give nvim some time to process msgpack requests before possibly sending + -- Wait for Nvim to fully process pending input before possibly sending -- more key presses - otherwise they all pile up in the queue and get -- processed at once - local ntime = os.clock() + 0.1 - repeat - until os.clock() > ntime + n.poke_eventloop() end local function open(activate, lines)