Files
unkin-agent 1568334840
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
Load the working tree, not an installed arti-pack
Neovim's runtimepath searcher outranks package.path, so `make test` on a
machine with arti-pack installed tests the installed copy.

- Give the repository the first package loader slot in the test harness
- Run the suite under `nvim --clean` so site packages stay off the rtp
- Assert modules resolve inside the repository, even with a copy on the rtp
2026-09-12 12:52:55 +10:00

27 lines
729 B
Lua

local M = { root = nil, sources = {} }
local uv = vim.uv or vim.loop
-- Neovim inserts its runtimepath searcher ahead of the package.path one, so an
-- installed copy of arti-pack resolves before the working tree. Claim the first
-- slot for the repository instead.
function M.install(root)
M.root = root
table.insert(package.loaders, 1, function(name)
local rel = name:gsub('%.', '/')
for _, candidate in ipairs({
root .. '/lua/' .. rel .. '.lua',
root .. '/lua/' .. rel .. '/init.lua',
root .. '/' .. rel .. '.lua',
}) do
if uv.fs_stat(candidate) then
M.sources[name] = candidate
return assert(loadfile(candidate))
end
end
return nil
end)
end
return M