mirror of
https://github.com/zoriya/lz.n.git
synced 2025-12-06 06:36:11 +00:00
fix(hooks): regression preventing beforeAll from being run (#101)
This commit is contained in:
@@ -23,7 +23,7 @@ end
|
||||
---@param plugins table<string, lz.n.Plugin>
|
||||
local function run_before_all(plugins)
|
||||
---@param plugin lz.n.Plugin
|
||||
vim.iter(plugins):each(function(plugin)
|
||||
vim.iter(plugins):each(function(_, plugin)
|
||||
if plugin.beforeAll then
|
||||
xpcall(
|
||||
plugin.beforeAll,
|
||||
|
||||
43
spec/hooks_spec.lua
Normal file
43
spec/hooks_spec.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
local lz = require("lz.n")
|
||||
vim.g.lz_n = {
|
||||
load = function() end,
|
||||
}
|
||||
|
||||
describe("hooks", function()
|
||||
it("beforeAll", function()
|
||||
local beforeAllRun = false
|
||||
lz.load({
|
||||
{
|
||||
"neorg",
|
||||
beforeAll = function()
|
||||
beforeAllRun = true
|
||||
end,
|
||||
},
|
||||
})
|
||||
assert.True(beforeAllRun)
|
||||
end)
|
||||
it("before", function()
|
||||
local beforeRun = false
|
||||
lz.load({
|
||||
{
|
||||
"neorg",
|
||||
before = function()
|
||||
beforeRun = true
|
||||
end,
|
||||
},
|
||||
})
|
||||
assert.True(beforeRun)
|
||||
end)
|
||||
it("after", function()
|
||||
local afterRun = false
|
||||
lz.load({
|
||||
{
|
||||
"neorg",
|
||||
beforeAll = function()
|
||||
afterRun = true
|
||||
end,
|
||||
},
|
||||
})
|
||||
assert.True(afterRun)
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user