File: luacov.lua

package info (click to toggle)
lua-busted 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 820 kB
  • sloc: sh: 198; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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