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
insert_final_newline = true
[*.lua]
indent_size = 3
[*.{tl,d.tl}]
indent_size = 3
[.busted]
[*.{lua,tl,d.tl,busted,luacheckrc,luacov}]
indent_size = 3
[justfile]

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
lua_modules
generated
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",
"gitea",
"htmlparser",
"includeuntestedfiles",
"isdir",
"justfile",
"libc",
@ -22,6 +23,7 @@
"lpath",
"Luacheck",
"luacheckrc",
"luacov",
"luafilesystem",
"lualogging",
"Luarocks",
@ -29,8 +31,11 @@
"luasocket",
"mkdir",
"modname",
"reportfile",
"rockspec",
"runreport",
"setopt",
"statsfile",
"stringx",
"Stylua",
"sublist",
@ -47,6 +52,7 @@
"files.associations": {
".busted": "lua",
".luacheckrc": "lua",
".luacov": "lua",
"*.rockspec": "lua"
}
}

View File

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