mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat: lots of improvements to pipeline runner and converted all tasks to new system
This commit is contained in:
parent
4de10f9578
commit
fb84c081b0
13 changed files with 381 additions and 200 deletions
|
@ -19,33 +19,65 @@ describe("runner", function()
|
|||
package.loaded["lazy.manage.task.test"]["test" .. i] = {
|
||||
---@param task LazyTask
|
||||
run = function(task)
|
||||
table.insert(runs, { plugin = task.plugin.name, task = task.type })
|
||||
table.insert(runs, { plugin = task.plugin.name, task = task.name })
|
||||
end,
|
||||
}
|
||||
package.loaded["lazy.manage.task.test"]["error" .. i] = {
|
||||
---@param task LazyTask
|
||||
run = function(task)
|
||||
table.insert(runs, { plugin = task.plugin.name, task = task.type })
|
||||
table.insert(runs, { plugin = task.plugin.name, task = task.name })
|
||||
error("error" .. i)
|
||||
end,
|
||||
}
|
||||
package.loaded["lazy.manage.task.test"]["async" .. i] = {
|
||||
---@param task LazyTask
|
||||
run = function(task)
|
||||
task:schedule(function()
|
||||
table.insert(runs, { plugin = task.plugin.name, task = task.name })
|
||||
end)
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
it("runs the pipeline", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.test1", "test.test2" } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
|
||||
it("waits", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.test1", "wait", "test.test2" } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
|
||||
it("handles async", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.async1", "wait", "test.async2" } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
|
||||
it("handles skips", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.test1", "test.skip", "test.test2" } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
|
||||
it("handles opts", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.test1", { "test.test2", foo = "bar" } } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
|
||||
it("aborts on error", function()
|
||||
local runner = Runner.new({ plugins = plugins, pipeline = { "test.test1", "test.error1", "test.test2" } })
|
||||
runner:start()
|
||||
runner:wait()
|
||||
assert.equal(4, #runs)
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue