test: run busted in sync mode (#4342)

* test: run busted in sync mode

* ci: update stable release version

* fix(mason): use recommended steps for sources sync
This commit is contained in:
kylo252 2023-08-27 08:44:07 +02:00 committed by GitHub
parent a587a45032
commit 10b9123b7d
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 35 deletions

View file

@ -34,10 +34,10 @@ body:
- type: input
id: nvim-version
attributes:
label: Neovim version (>= 0.9.0)
label: Neovim version (>= 0.9.1)
description: "Output of `nvim --version`"
placeholder: |
NVIM v0.9.0-dev-983+g6dfabd014
NVIM v0.10.0-dev-670+g2ecba65b4
validations:
required: true
- type: input

View file

@ -27,10 +27,10 @@ body:
- type: input
id: nvim-version
attributes:
label: Neovim version (>= 0.9.0)
label: Neovim version (>= 0.9.1)
description: "Output of `nvim --version`"
placeholder: |
NVIM v0.9.0-dev-983+g6dfabd014
NVIM v0.10.0-dev-670+g2ecba65b4
validations:
required: true
- type: input

View file

@ -21,10 +21,10 @@ jobs:
include:
- runner: ubuntu-latest
os: linux
neovim: v0.9.0
neovim: v0.9.1
- runner: macos-latest
os: osx
neovim: v0.9.0
neovim: v0.9.1
- runner: ubuntu-22.04
os: linux
neovim: nightly
@ -78,7 +78,7 @@ jobs:
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.9.0
version: v0.9.1
- name: Install LunarVim
timeout-minutes: 4

View file

@ -55,7 +55,10 @@ end
---@param filter { filetype: string | string[] }?: (optional) Used to filter the list of server names.
---@return string[] list of names of supported servers
function M.get_supported_servers(filter)
-- force synchronous mode, see: |mason-registry.refresh()|
require("mason-registry").refresh()
require("mason-registry").get_all_packages()
local _, supported_servers = pcall(function()
return require("mason-lspconfig").get_available_servers(filter)
end)

View file

@ -1,8 +1,7 @@
local a = require "plenary.async_lib.tests"
local uv = vim.loop
local home_dir = uv.os_homedir()
a.describe("initial start", function()
describe("initial start", function()
before_each(function()
vim.cmd [[
let v:errmsg = ""
@ -23,31 +22,31 @@ a.describe("initial start", function()
local lvim_runtime_path = get_runtime_dir()
local lvim_cache_path = get_cache_dir()
a.it("should be able to detect test environment", function()
it("should be able to detect test environment", function()
assert.truthy(os.getenv "LVIM_TEST_ENV")
assert.falsy(package.loaded["lvim.impatient"])
end)
a.it("should be able to use lunarvim cache directory using vim.fn", function()
it("should be able to use lunarvim cache directory using vim.fn", function()
assert.equal(lvim_cache_path, vim.fn.stdpath "cache")
end)
a.it("should be to retrieve default neovim directories", function()
it("should be to retrieve default neovim directories", function()
local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config")
assert.equal(join_paths(xdg_config, "nvim"), vim.call("stdpath", "config"))
end)
a.it("should be able to read lunarvim directories", function()
it("should be able to read lunarvim directories", function()
local rtp_list = vim.opt.rtp:get()
assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim"))
assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path))
end)
a.it("should be able to run treesitter without errors", function()
it("should be able to run treesitter without errors", function()
assert.truthy(vim.treesitter.highlighter.active)
end)
a.it("should be able to pass basic checkhealth without errors", function()
it("should be able to pass basic checkhealth without errors", function()
vim.cmd "set cmdheight&"
vim.cmd "silent checkhealth nvim"
local errmsg = vim.fn.eval "v:errmsg"

View file

@ -1,8 +1,7 @@
local a = require "plenary.async_lib.tests"
local config = require "lvim.config"
local fmt = string.format
a.describe("config-loader", function()
describe("config-loader", function()
local user_config_path = join_paths(get_config_dir(), "config.lua")
local default_config_path = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua")
@ -23,15 +22,15 @@ a.describe("config-loader", function()
assert.True(vim.tbl_isempty(errors))
end)
a.it("should be able to find user-config", function()
it("should be able to find user-config", function()
assert.equal(user_config_path, get_config_dir() .. "/config.lua")
end)
a.it("should be able to load user-config without errors", function()
it("should be able to load user-config without errors", function()
config:load(user_config_path)
end)
a.it("should be able to reload user-config without errors", function()
it("should be able to reload user-config without errors", function()
config:load(user_config_path)
local test_path = "/tmp/lvim"
os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path))
@ -41,7 +40,7 @@ a.describe("config-loader", function()
end)
end)
a.it("should not get interrupted by errors in user-config", function()
it("should not get interrupted by errors in user-config", function()
local test_path = "/tmp/lunarvim"
os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path))
config:load(user_config_path)

View file

@ -1,9 +1,8 @@
local a = require "plenary.async_lib.tests"
local utils = require "lvim.utils"
local helpers = require "tests.lvim.helpers"
local spy = require "luassert.spy"
a.describe("lsp workflow", function()
describe("lsp workflow", function()
before_each(function()
vim.cmd [[
let v:errmsg = ""
@ -25,24 +24,26 @@ a.describe("lsp workflow", function()
local plugins = require "lvim.plugins"
require("lvim.plugin-loader").load { plugins, lvim.plugins }
a.it("should be able to delete ftplugin templates", function()
it("should be able to delete ftplugin templates", function()
if utils.is_directory(lvim.lsp.templates_dir) then
assert.equal(vim.fn.delete(lvim.lsp.templates_dir, "rf"), 0)
end
assert.False(utils.is_directory(lvim.lsp.templates_dir))
end)
a.it("should be able to generate ftplugin templates", function()
it("should be able to generate ftplugin templates", function()
if utils.is_directory(lvim.lsp.templates_dir) then
assert.equal(vim.fn.delete(lvim.lsp.templates_dir, "rf"), 0)
end
require("lvim.lsp").setup()
vim.wait(500)
assert.True(#vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1) > 0)
local template_files = vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1)
assert.False(vim.tbl_isempty(template_files))
end)
a.it("should not include blacklisted servers in the generated templates", function()
it("should not include blacklisted servers in the generated templates", function()
require("lvim.lsp").setup()
for _, server_name in ipairs(lvim.lsp.automatic_configuration.skipped_servers) do
@ -52,11 +53,13 @@ a.describe("lsp workflow", function()
end
end)
a.it("should only include one server per generated template", function()
it("should only include one server per generated template", function()
require("lvim.lsp").setup()
vim.wait(500)
local allowed_dupes = { "tailwindcss" }
for _, file in ipairs(vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1)) do
local template_files = vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1)
for _, file in ipairs(template_files) do
local content = {}
for entry in io.lines(file) do
local server_name = entry:match [[.*setup%("(.*)"%)]]
@ -76,7 +79,7 @@ a.describe("lsp workflow", function()
end
end)
a.it("should not attempt to re-generate ftplugin templates", function()
it("should not attempt to re-generate ftplugin templates", function()
local s = spy.on(require "lvim.lsp.templates", "generate_templates")
require("lvim.lsp").setup()

View file

@ -1,6 +1,4 @@
local a = require "plenary.async_lib.tests"
a.describe("plugin-loader", function()
describe("plugin-loader", function()
local plugins = require "lvim.plugins"
local loader = require "lvim.plugin-loader"
@ -9,7 +7,7 @@ a.describe("plugin-loader", function()
package.loaded["lvim.core.log"] = nil
end)
a.it("should be able to load default packages without errors", function()
it("should be able to load default packages without errors", function()
vim.go.loadplugins = true
loader.load { plugins, lvim.plugins }
@ -23,7 +21,7 @@ a.describe("plugin-loader", function()
end
end)
a.it("should be able to load lsp packages without errors", function()
it("should be able to load lsp packages without errors", function()
require("lvim.lsp").setup()
local lsp_packages = {