fix tests

disable Windows tests for now (hang on parser compile)
This commit is contained in:
Christian Clason 2023-05-30 14:27:54 +02:00
parent 7681249bbd
commit 008cc677d2
12 changed files with 73 additions and 65 deletions

View file

@ -104,17 +104,20 @@ local ok, result = pcall(do_check)
local allowed_to_fail = vim.split(vim.env.ALLOWED_INSTALLATION_FAILURES or '', ',', true)
for k, v in pairs(require('nvim-treesitter.parsers').configs) do
if #vim.api.nvim_get_runtime_file('parser/' .. k .. '.*', false) == 0 then
-- On CI all parsers that can be installed from C files should be installed
if
vim.env.CI
and not v.install_info.requires_generate_from_grammar
and not vim.list_contains(allowed_to_fail, k)
then
io_print('Error: parser for ' .. k .. ' is not installed')
vim.cmd('cq')
else
io_print('Warning: parser for ' .. k .. ' is not installed')
if v.install_info then
-- skip "query only" languages
if #vim.api.nvim_get_runtime_file('parser/' .. k .. '.*', false) == 0 then
-- On CI all parsers that can be installed from C files should be installed
if
vim.env.CI
and not v.install_info.requires_generate_from_grammar
and not vim.list_contains(allowed_to_fail, k)
then
io_print('Error: parser for ' .. k .. ' is not installed')
vim.cmd('cq')
else
io_print('Warning: parser for ' .. k .. ' is not installed')
end
end
end
end

15
scripts/install-parsers.lua Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env -S nvim -l
vim.opt.runtimepath:append('.')
-- needed on CI
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
local done = false
require('nvim-treesitter.install').install('all', {}, function()
done = true
end)
vim.wait(6000000, function()
return done
end)

View file

@ -2,11 +2,11 @@ vim.opt.runtimepath:append('.')
vim.cmd.runtime({ 'plugin/plenary.vim', bang = true })
vim.cmd.runtime({ 'plugin/nvim-treesitter.lua', bang = true })
vim.cmd.runtime({ 'plugin/query_predicates.lua', bang = true })
vim.cmd.runtime({ 'plugin/filetypes.lua', bang = true })
vim.filetype.add({
extension = {
conf = 'hocon',
cmm = 't32',
hurl = 'hurl',
ncl = 'nickel',
tig = 'tiger',
@ -24,6 +24,6 @@ require('nvim-treesitter').setup()
vim.api.nvim_create_autocmd('FileType', {
callback = function(args)
pcall(vim.treesitter.start)
vim.bo[args.buffer].indentexpr = 'v:lua.require"nvim-treesitter".indentexpr()'
vim.bo[args.buf].indentexpr = 'v:lua.require"nvim-treesitter".indentexpr()'
end,
})

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Can be used as a pre-push hook
# Just symlink this file to .git/hooks/pre-push
echo "Running linter..."
luacheck .
echo "Checking formatting..."
stylua --check .

View file

@ -4,7 +4,7 @@ HERE="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
cd $HERE/..
run() {
nvim --headless --noplugin -u scripts/minimal_init.lua \
nvim --headless --noplugin -u scripts/minimal_init.lua \
-c "PlenaryBustedDirectory $1 { minimal_init = './scripts/minimal_init.lua' }"
}