chore: configure coverage

This commit is contained in:
Aire-One 2023-05-08 23:12:16 +02:00
parent efb54bf92b
commit 3bf9ac4ebd
5 changed files with 59 additions and 7 deletions

View File

@ -8,13 +8,7 @@ charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.lua] [*.{lua,tl,d.tl,busted,luacheckrc,luacov}]
indent_size = 3
[*.{tl,d.tl}]
indent_size = 3
[.busted]
indent_size = 3 indent_size = 3
[justfile] [justfile]

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
lua_modules lua_modules
generated generated
build build
luacov

46
.luacov Normal file
View File

@ -0,0 +1,46 @@
-- -- Per https://github.com/lunarmodules/luacov/blob/c915f4b95e8df5dbfaf2b1f04f0b7da04506fc7a/src/luacov/reporter.lua#L102
-- -- > The option includeuntestedfiles requires the lfs module (from luafilesystem) to be installed.
-- -- So I'm ok with including it here, since it's already an hard dependency.
-- local lfs = require "lfs"
-- local function walk(dir, callback)
-- for file in lfs.dir(dir) do
-- if file ~= "." and file ~= ".." then
-- local path = dir .. "/" .. file
-- local attr = lfs.attributes(path)
-- if attr.mode == "directory" then
-- walk(path, callback)
-- else
-- callback(path)
-- end
-- end
-- end
-- end
-- local teal_files = {}
-- for _, path in pairs { "spec", "src" } do
-- walk(path, function(file)
-- if file:match "%.tl$" then
-- table.insert(teal_files, file)
-- end
-- end)
-- end
return {
statsfile = "luacov/luacov.stats.out",
reporter = "html",
reportfile = "luacov/luacov.report.html",
include = {
"spec",
"src",
},
exclude = {
"lua_modules",
"spec/tlconfig.lua",
"src/awesome.d.tl/types",
"types",
},
-- runreport = true, -- For some reason, it makes my computer crash
-- includeuntestedfiles = teal_files,
includeuntestedfiles = true,
}

View File

@ -15,6 +15,7 @@
"getcontent", "getcontent",
"gitea", "gitea",
"htmlparser", "htmlparser",
"includeuntestedfiles",
"isdir", "isdir",
"justfile", "justfile",
"libc", "libc",
@ -22,6 +23,7 @@
"lpath", "lpath",
"Luacheck", "Luacheck",
"luacheckrc", "luacheckrc",
"luacov",
"luafilesystem", "luafilesystem",
"lualogging", "lualogging",
"Luarocks", "Luarocks",
@ -29,8 +31,11 @@
"luasocket", "luasocket",
"mkdir", "mkdir",
"modname", "modname",
"reportfile",
"rockspec", "rockspec",
"runreport",
"setopt", "setopt",
"statsfile",
"stringx", "stringx",
"Stylua", "Stylua",
"sublist", "sublist",
@ -47,6 +52,7 @@
"files.associations": { "files.associations": {
".busted": "lua", ".busted": "lua",
".luacheckrc": "lua", ".luacheckrc": "lua",
".luacov": "lua",
"*.rockspec": "lua" "*.rockspec": "lua"
} }
} }

View File

@ -49,3 +49,8 @@ validate:
test: test:
busted busted
# Requires a patched version of luacov (https://github.com/lunarmodules/luacov/issues/98#issuecomment-1530491759)
coverage:
busted --coverage
luacov