File src/luacov/runner.lua

Functions

runner.excludefile (name) Adds a file to the exclude list (see defaults.lua).
runner.excludetree (name, level) Adds a tree to the exclude list (see defaults.lua).
runner.includefile (name) Adds a file to the include list (see defaults.lua).
runner.includetree (name, level) Adds a tree to the include list (see defaults.lua).
runner.init (configuration) Initializes LuaCov runner to start collecting data.
runner.load_config (configuration) Loads a valid configuration.
runner.shutdown () Shuts down LuaCov's runner.


Functions

runner.excludefile (name)
Adds a file to the exclude list (see defaults.lua). If passed a function, then through debuginfo the source filename is collected. In case of a table it will recursively search teh table for a function, which is then resolved to a filename through debuginfo. If the parameter is a string, it will first check if a file by that name exists. If it doesn't exist it will call require(name) to load a module by that name, and the result of require (function or table expected) is used as described above to get the sourcefile.

Parameters

  • name: string; literal filename, string; modulename as passed to require(), function; where containing file is looked up, table; module table where containing file is looked up

Return value:

the pattern as added to the list, or nil + error
runner.excludetree (name, level)
Adds a tree to the exclude list (see defaults.lua). If name = 'luacov' and level = nil then module 'luacov' (luacov.lua) and the tree 'luacov' (containing `luacov/runner.lua` etc.) is excluded. If name = 'pl.path' and level = true then module 'pl' (pl.lua) and the tree 'pl' (containing `pl/path.lua` etc.) is excluded. NOTE: in case of an 'init.lua' file, the 'level' parameter will always be set

Parameters

  • name: see excludefile
  • level: if truthy then one level up is added, including the tree

Return value:

the 2 patterns as added to the list (file and tree), or nil + error
runner.includefile (name)
Adds a file to the include list (see defaults.lua).

Parameters

  • name: see excludefile

Return value:

the pattern as added to the list, or nil + error
runner.includetree (name, level)
Adds a tree to the include list (see defaults.lua).

Parameters

  • name: see excludefile
  • level: see includetree

Return value:

the 2 patterns as added to the list (file and tree), or nil + error
runner.init (configuration)
Initializes LuaCov runner to start collecting data.

Parameters

  • configuration: if string, filename of config file (used to call load_config). If table then config table (see file luacov.default.lua for an example)
runner.load_config (configuration)
Loads a valid configuration.

Parameters

  • configuration: user provided config (config-table or filename)

Return value:

existing configuration if already set, otherwise loads a new config from the provided data or the defaults
runner.shutdown ()
Shuts down LuaCov's runner. This should only be called from daemon processes or sandboxes which have disabled os.exit and other hooks that are used to determine shutdown.

Valid XHTML 1.0!