Skip to content

Commit

Permalink
fix(hooks): regression preventing beforeAll from being run
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Oct 15, 2024
1 parent de27f80 commit 2b726a1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/lz/n/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
43 changes: 43 additions & 0 deletions spec/hooks_spec.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 2b726a1

Please sign in to comment.