Tia.Recorder (tia v0.1.0)

Copy Markdown View Source

Reads which source files have run since the last reset/1.

It uses the JIT's native function counters (:code.set_coverage_mode/1, OTP 27+). Unlike :cover they need no recompilation, and reading or zeroing them is cheap enough to do between every two test files. A module counts as executed when any of its functions was entered, which is the only thing the map needs to know.

Summary

Functions

Returns the sorted files behind the modules that executed since reset/1: each module's source plus its @external_resource files, which is how templates and other compiled-in data end up in the map.

Zeroes the counters of the given modules.

Switches to function counters and reloads the application's modules under them. Must run before the application starts: a module loaded earlier has no counters.

Functions

executed_sources(modules, root)

@spec executed_sources([module()], Path.t()) :: [String.t()]

Returns the sorted files behind the modules that executed since reset/1: each module's source plus its @external_resource files, which is how templates and other compiled-in data end up in the map.

reset(modules)

@spec reset([module()]) :: :ok

Zeroes the counters of the given modules.

start(app)

@spec start(atom()) :: [module()]

Switches to function counters and reloads the application's modules under them. Must run before the application starts: a module loaded earlier has no counters.