Add script for neovim tests

This will be used to check the indentation queries.
This commit is contained in:
Bruno BELANYI 2022-06-13 10:03:40 +02:00
parent c90d9d8212
commit d253cca017
2 changed files with 29 additions and 0 deletions

View file

@ -54,6 +54,14 @@
overlays = [ self.overlays.default ];
};
nvim-test = pkgs.writeShellScriptBin "nvim-test" ''
export NVIM_PLENARY='${pkgs.vimPlugins.plenary-nvim}'
export NVIM_TREESITTER='${pkgs.vimPlugins.nvim-treesitter}'
${pkgs.neovim}/bin/nvim --headless --noplugin -u scripts/minimal_init.lua \
-c "PlenaryBustedDirectory test/ { minimal_init = './scripts/minimal_init.lua' }"
'';
tree-sitter-env = pkgs.stdenv.mkDerivation {
name = "tree-sitter-env";
@ -94,6 +102,13 @@
enable = true;
};
nvim-test = {
enable = true;
name = "nvim tests";
entry = "${nvim-test}/bin/nvim-test";
pass_filenames = false;
};
tree-sitter = {
enable = true;
name = "tree-sitter tests";
@ -115,6 +130,7 @@
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
nvim-test
(tree-sitter.override { webUISupport = true; })
];

13
scripts/minimal_init.lua Normal file
View file

@ -0,0 +1,13 @@
vim.cmd([[set runtimepath+=$NVIM_PLENARY]])
vim.cmd([[set runtimepath+=$NVIM_TREESITTER]])
vim.cmd([[runtime! plugin/plenary.vim]])
vim.cmd([[runtime! plugin/nvim-treesitter.lua]])
vim.o.swapfile = false
vim.bo.swapfile = false
require("nvim-treesitter.configs").setup({
indent = { enable = true },
highlight = { enable = true },
})