chore: setup luacov for test coverage (#85)
This commit is contained in:
parent
b9e06deb33
commit
632a11fa33
|
@ -47,3 +47,9 @@ doc/tags
|
|||
|
||||
# panvimdoc
|
||||
/panvimdoc/
|
||||
|
||||
# luacov
|
||||
luacov.report
|
||||
luacov.report.index
|
||||
luacov.stats
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
include = {
|
||||
"lua/lualine$",
|
||||
"lua/lualine_require$",
|
||||
"lua/lualine%/.+$",
|
||||
},
|
||||
exclude = {
|
||||
"lua/lualine/themes%/.+$",
|
||||
"lua/lualine/extensions%/.+$",
|
||||
},
|
||||
modules = {
|
||||
["lualine"] = "lua/lualine.lua",
|
||||
["lualine_require"] = "lua/lualine_require.lua",
|
||||
["lualine.*"] = "lua/",
|
||||
},
|
||||
statsfile = 'luacov.stats',
|
||||
reportfile = 'luacov.report',
|
||||
includeuntestedfiles = true,
|
||||
}
|
||||
-- vim:ft=lua
|
20
Makefile
20
Makefile
|
@ -9,7 +9,25 @@ format:
|
|||
@stylua --config-path=.stylua.toml lua/ examples/
|
||||
|
||||
test:
|
||||
@nvim --headless -u lua/tests/minimal_init.lua -c "PlenaryBustedDirectory lua/tests/ { minimal_init = './lua/tests/minimal_init.lua' }"
|
||||
@mkdir -p tmp_home
|
||||
@export XDG_DATA_HOME='./tmp_home' && \
|
||||
export XDG_CONFIG_HOME='./tmp_home' && \
|
||||
nvim --headless --noplugin --clean -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })"
|
||||
@rmdir tmp_home
|
||||
|
||||
# Install luacov & luacov-console from luarocks
|
||||
testcov:
|
||||
@mkdir -p tmp_home
|
||||
@export XDG_DATA_HOME='./tmp_home' && \
|
||||
export XDG_CONFIG_HOME='./tmp_home' && \
|
||||
export TEST_COV=true && \
|
||||
nvim --headless --noplugin --clean -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })"
|
||||
@luacov-console lua/
|
||||
@luacov-console -s
|
||||
ifeq ($(NOCLEAN), )
|
||||
@rm luacov.*
|
||||
endif
|
||||
@rmdir tmp_home
|
||||
|
||||
docgen:
|
||||
@bash ./scripts/docgen.sh
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- MIT license, see LICENSE for more details.
|
||||
|
||||
if os.getenv('TEST_COV') then
|
||||
require('luacov')
|
||||
end
|
||||
-- load lualine and plenary
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
vim.cmd [[
|
||||
set rtp+=.
|
||||
set rtp+=../plenary.nvim
|
||||
]],
|
||||
false
|
||||
)
|
||||
runtime plugin/plenary.vim
|
||||
]]
|
||||
|
|
Loading…
Reference in New Issue