feat: run tests independent from user's nvim config
This commit is contained in:
parent
bc3ce343a8
commit
3d49d58fd2
4 changed files with 36 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
playground/
|
/playground/
|
||||||
|
/.tests/
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ tasks:
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- |
|
||||||
nvim --headless \
|
nvim --headless \
|
||||||
-u ./spec/minimal_init.vim\
|
-u ./spec/minimal_init.lua\
|
||||||
-c "PlenaryBustedDirectory spec \
|
-c "PlenaryBustedDirectory spec \
|
||||||
{minimal_init='./spec/minimal_init.lua'\
|
{minimal_init='./spec/minimal_init.lua'\
|
||||||
,sequential=true}"
|
,sequential=true}"
|
||||||
|
|
|
||||||
33
spec/minimal_init.lua
Normal file
33
spec/minimal_init.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
local function root(p)
|
||||||
|
local f = debug.getinfo(1, "S").source:sub(2)
|
||||||
|
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (p or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function install_plug(plugin)
|
||||||
|
local name = plugin:match ".*/(.*)"
|
||||||
|
local package_root = root ".tests/site/pack/deps/start/"
|
||||||
|
if not vim.loop.fs_stat(package_root .. name) then
|
||||||
|
print("Installing " .. plugin)
|
||||||
|
vim.fn.mkdir(package_root, "p")
|
||||||
|
vim.fn.system {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth=1",
|
||||||
|
"https://github.com/" .. plugin .. ".git",
|
||||||
|
package_root .. "/" .. name,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd [[set runtimepath=$VIMRUNTIME]]
|
||||||
|
vim.opt.runtimepath:append(root())
|
||||||
|
vim.opt.packpath = { root ".tests/site" }
|
||||||
|
vim.notify = print
|
||||||
|
|
||||||
|
install_plug "nvim-lua/plenary.nvim"
|
||||||
|
install_plug "nvim-treesitter/nvim-treesitter"
|
||||||
|
|
||||||
|
vim.env.XDG_CONFIG_HOME = root ".tests/config"
|
||||||
|
vim.env.XDG_DATA_HOME = root ".tests/data"
|
||||||
|
vim.env.XDG_STATE_HOME = root ".tests/state"
|
||||||
|
vim.env.XDG_CACHE_HOME = root ".tests/cache"
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
set rtp+=.
|
|
||||||
packadd plenary.nvim
|
|
||||||
packadd nvim-treesitter
|
|
||||||
packadd nvim-dap
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue