From b5e6f44c0820d3785c770ba0f3939c22c8f3f10d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Sep 2025 08:01:21 +0800 Subject: [PATCH] test(ui/messages2_spec): close unfinished timers at end of test (#35817) The vim._extui.messages module uses multiple timers that last 2 or 4 seconds. If these timers aren't finished when a test ends, there will be a 2-second delay on exit with ASAN or TSAN. --- test/functional/ui/messages2_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index a192ac2270..7b7953b221 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -17,6 +17,17 @@ describe('messages2', function() require('vim._extui').enable({}) end) end) + after_each(function() + -- Since vim._extui lasts until Nvim exits, there may be unfinished timers. + -- Close unfinished timers to avoid 2s delay on exit with ASAN or TSAN. + exec_lua(function() + vim.uv.walk(function(handle) + if not handle:is_closing() then + handle:close() + end + end) + end) + end) it('multiline messages and pager', function() command('echo "foo\nbar"')