commit 164cab405bc68b96db61dabe01d7c53dd5abd53d
parent 1aa81290a4116f9e15039ee10c4bfa2ae76f0d31
Author: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Date: Thu, 29 Jan 2026 16:25:02 +0200
test(pack): cover that events work when installing from the lockfile
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git 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 })