From b111775c494105045803f65c66029012ffeb4d9a Mon Sep 17 00:00:00 2001 From: Viorel Craescu Date: Thu, 8 Feb 2024 11:03:00 +0200 Subject: [PATCH] make command to setup local tests (#426) --- Makefile | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fc90ebe..91c11d8 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,29 @@ +PACKER_DIR = ~/.local/share/nvim/site/pack/vendor/start + test: nvim --headless --noplugin -u lua/tests/minimal.vim -c "PlenaryBustedDirectory lua/tests/ {minimal_init = 'lua/tests/minimal.vim'}" -localfailed: +localfailed: localtestsetup nvim --headless --noplugin -u lua/tests/init.vim -c "PlenaryBustedDirectory lua/tests/failed {minimal_init = 'lua/tests/init.vim'}" -localtest: +localtest: localtestsetup nvim --headless --noplugin -u lua/tests/init.vim -c "PlenaryBustedDirectory lua/tests/ {minimal_init = 'lua/tests/init.vim'}" -localtestfile: +localtestfile: localtestsetup nvim --headless --noplugin -u lua/tests/init.vim -c "PlenaryBustedFile lua/tests/go_comment_spec.lua" lint: luacheck lua/go + +localtestsetup: + @mkdir -p $(PACKER_DIR) + @mkdir -p ~/tmp + + @test -d $(PACKER_DIR)/plenary.nvim ||\ + git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $(PACKER_DIR)/plenary.nvim + + @test -d $(PACKER_DIR)/nvim-lspconfig ||\ + git clone --depth 1 https://github.com/neovim/nvim-lspconfig $(PACKER_DIR)/nvim-lspconfig + + @test -d $(PACKER_DIR)/nvim-treesitter ||\ + git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter $(PACKER_DIR)/nvim-treesitter + + @test -d $(PACKER_DIR)/go.nvim || ln -s ${shell pwd} $(PACKER_DIR) + + nvim --headless -u lua/tests/minimal.vim -i NONE -c "TSUpdateSync go" -c "q"