mirror of
https://github.com/vxcontrol/soldr-modules.git
synced 2026-07-01 12:47:17 -04:00
Merge pull request #38 from vxcontrol/fix-luacov-import
fix importing luacov for tests running
This commit is contained in:
+2
-1
@@ -19,5 +19,6 @@ tmpdir/*
|
||||
|
||||
luacov-html
|
||||
luacov.*
|
||||
!luacov.lua
|
||||
coverage-report
|
||||
junit.xml
|
||||
junit.xml
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
return function()
|
||||
-- Function to initialize luacov if available
|
||||
local loadLuaCov = function(config)
|
||||
local result, luacov = pcall(require, 'luacov.runner')
|
||||
|
||||
if not result then
|
||||
return nil, 'LuaCov not found on the system, try running without --coverage option, or install LuaCov first'
|
||||
end
|
||||
|
||||
-- call it to start
|
||||
luacov(config)
|
||||
|
||||
-- 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%.')
|
||||
return true
|
||||
end
|
||||
|
||||
return loadLuaCov
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
--- Loads `luacov.runner` and immediately starts it.
|
||||
-- Useful for launching scripts from the command-line. Returns the `luacov.runner` module.
|
||||
-- @class module
|
||||
-- @name luacov
|
||||
-- @usage lua -lluacov sometest.lua
|
||||
local runner = require("luacov.runner")
|
||||
runner.init()
|
||||
return runner
|
||||
Reference in New Issue
Block a user