Lua Coverage Tester

Coverage measurements for testing mods. This is a developer tool, not meant for actual gameplay. It is intentionally desync unsafe. Do not use it in multiplayer.
13 days ago
Owner: justarandomgeek
Source: justarandomgeek/factorio-coverage
Homepage: N/A
License: MIT
Created: 19 days ago
Latest Version: 0.17.1 (13 days ago)
Factorio version: 0.17
Downloaded: 12 times

Factorio Coverage Tester

A coverage tool for Factorio Mods, by justarandomgeek.


/startCoverage testname (Command)

Coverage.Start("testname") or"coverage","start","testname") (Script)

Start line counting for all participating mods. Each mod will collect data independently, to be gathered after tests complete.

/stopCoverage (Command)

Coverage.Stop() or"coverage","stop") (Script)

Stop line counting for all participating mods.

/reportCoverage (Command)

Coverage.Report() or"coverage","report") (Script)

Collect test data from all participating mods and write it out to script-outputs\ Automatically stops counting if a test was still running.

Most scripts simply need to pcall(require,'__coverage__/coverage.lua') to be included in line counts. Scenarios/campaign scripts must also provide a path hint to translate "level" to a correct path:

CoverageLoaded,Coverage = pcall(require,'__coverage__/coverage.lua')
if CoverageLoaded then

This form is also useful to provide the Coverage object for Start()/Stop() API calls.

There is a mod setting to enable line counting immediately on control.lua initialization, but this is disabled by default because it makes starting a game very slow.