tests: improve testing (#80)
* chore: setup mini.test * chore(ci): setup new test runner, install plugin deps * chore(ci): test only on stable and nightly releases * test: iferr * test: struct_tags * test: impl * test: gotests
This commit is contained in:
parent
0ed14a40d9
commit
da960189c1
34 changed files with 435 additions and 101 deletions
|
|
@ -6,7 +6,7 @@ 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
|
||||
if not vim.uv.fs_stat(package_root .. name) then
|
||||
print("Installing " .. plugin)
|
||||
vim.fn.mkdir(package_root, "p")
|
||||
vim.fn.system {
|
||||
|
|
@ -19,6 +19,11 @@ local function install_plug(plugin)
|
|||
end
|
||||
end
|
||||
|
||||
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"
|
||||
|
||||
vim.cmd [[set runtimepath=$VIMRUNTIME]]
|
||||
vim.opt.runtimepath:append(root())
|
||||
vim.opt.packpath = { root ".tests/site" }
|
||||
|
|
@ -27,8 +32,18 @@ vim.notify = print
|
|||
install_plug "nvim-lua/plenary.nvim"
|
||||
install_plug "nvim-treesitter/nvim-treesitter"
|
||||
install_plug "echasnovski/mini.doc" -- used for docs generation
|
||||
install_plug "echasnovski/mini.test"
|
||||
|
||||
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"
|
||||
-- install go treesitter parse
|
||||
require("nvim-treesitter.install").ensure_installed_sync "go"
|
||||
|
||||
-- setup mini.test only when running headless nvim
|
||||
if #vim.api.nvim_list_uis() == 0 then
|
||||
require("mini.test").setup {
|
||||
collect = {
|
||||
find_files = function()
|
||||
return vim.fn.globpath("spec", "**/*_test.lua", true, true)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue