From 164cab405bc68b96db61dabe01d7c53dd5abd53d Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Thu, 29 Jan 2026 16:25:02 +0200 Subject: [PATCH] test(pack): cover that events work when installing from the lockfile --- test/functional/plugin/pack_spec.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/functional/plugin/pack_spec.lua b/test/functional/plugin/pack_spec.lua index 0f2e7898dc..bf9598aa90 100644 --- a/test/functional/plugin/pack_spec.lua +++ b/test/functional/plugin/pack_spec.lua @@ -612,6 +612,7 @@ describe('vim.pack', function() -- Mock clean initial install, but with lockfile present vim.fs.rm(pack_get_dir(), { force = true, recursive = true }) n.clear() + watch_events({ 'PackChangedPre', 'PackChanged' }) local basic_rev = git_get_hash('feat-branch', 'basic') local defbranch_rev = git_get_hash('HEAD', 'defbranch') @@ -637,6 +638,17 @@ describe('vim.pack', function() eq(true, pack_exists('defbranch')) eq(false, exec_lua('return pcall(require, "defbranch")')) + -- Should trigger `kind=install` events + local log = exec_lua('return _G.event_log') + local find_event = make_find_packchanged(log) + local installpre_basic = find_event('Pre', 'install', 'basic', 'feat-branch', false) + local installpre_defbranch = find_event('Pre', 'install', 'defbranch', nil, false) + local install_basic = find_event('', 'install', 'basic', 'feat-branch', false) + local install_defbranch = find_event('', 'install', 'defbranch', nil, false) + eq(4, #log) + eq(true, installpre_basic < install_basic) + eq(true, installpre_defbranch < install_defbranch) + -- Running `update()` should still update to use `main` exec_lua(function() vim.pack.update({ 'basic' }, { force = true })