summaryrefslogtreecommitdiffstats
path: root/test/lua/busted/modules/luacov.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/lua/busted/modules/luacov.lua')
-rw-r--r--test/lua/busted/modules/luacov.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lua/busted/modules/luacov.lua b/test/lua/busted/modules/luacov.lua
new file mode 100644
index 000000000..99cfc8f56
--- /dev/null
+++ b/test/lua/busted/modules/luacov.lua
@@ -0,0 +1,22 @@
+return function()
+ -- Function to initialize luacov if available
+ local loadLuaCov = function()
+ local result, luacov = pcall(require, 'luacov.runner')
+
+ if not result then
+ return print('LuaCov not found on the system, try running without --coverage option, or install LuaCov first')
+ end
+
+ -- call it to start
+ luacov()
+
+ -- exclude busted files
+ table.insert(luacov.configuration.exclude, 'busted_bootstrap$')
+ table.insert(luacov.configuration.exclude, 'busted%.')
+ table.insert(luacov.configuration.exclude, 'luassert%.')
+ table.insert(luacov.configuration.exclude, 'say%.')
+ table.insert(luacov.configuration.exclude, 'pl%.')
+ end
+
+ return loadLuaCov
+end