mirror of
https://github.com/akinsho/toggleterm.nvim
synced 2024-09-16 21:34:03 +02:00
ci(tests): use minimal init.lua for tests
This commit is contained in:
parent
0aa936445b
commit
50f58a0624
4 changed files with 40 additions and 9 deletions
6
.github/workflows/test.yaml
vendored
6
.github/workflows/test.yaml
vendored
|
@ -21,12 +21,6 @@ jobs:
|
||||||
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.deb -O /tmp/nvim.deb
|
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.deb -O /tmp/nvim.deb
|
||||||
sudo dpkg -i /tmp/nvim.deb
|
sudo dpkg -i /tmp/nvim.deb
|
||||||
|
|
||||||
- name: Fetch dependencies
|
|
||||||
run: |
|
|
||||||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
|
|
||||||
git clone --depth 1 https://github.com/kyazdani42/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
|
|
||||||
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
nvim --version
|
nvim --version
|
||||||
|
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.tests/
|
|
@ -1,3 +0,0 @@
|
||||||
set rtp+=.
|
|
||||||
set rtp+=../plenary.nvim
|
|
||||||
runtime! plugin/plenary.vim
|
|
39
tests/minimal_init.lua
Normal file
39
tests/minimal_init.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.root(root)
|
||||||
|
local f = debug.getinfo(1, "S").source:sub(2)
|
||||||
|
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param plugin string
|
||||||
|
function M.load(plugin)
|
||||||
|
local name = plugin:match(".*/(.*)")
|
||||||
|
local package_root = M.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
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.cmd([[set runtimepath=$VIMRUNTIME]])
|
||||||
|
vim.opt.runtimepath:append(M.root())
|
||||||
|
vim.opt.packpath = { M.root(".tests/site") }
|
||||||
|
M.load("nvim-lua/plenary.nvim")
|
||||||
|
vim.env.XDG_CONFIG_HOME = M.root(".tests/config")
|
||||||
|
vim.env.XDG_DATA_HOME = M.root(".tests/data")
|
||||||
|
vim.env.XDG_STATE_HOME = M.root(".tests/state")
|
||||||
|
vim.env.XDG_CACHE_HOME = M.root(".tests/cache")
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.swapfile = false
|
||||||
|
_G.__TEST = true
|
||||||
|
|
||||||
|
M.setup()
|
Loading…
Reference in a new issue