Add way to get lcov code coverage in studio, engine, and in open-cloud luau-execution-session-task

Add way to get lcov code coverage in studio, engine, and in open-cloud luau-execution-session-task.

As a Roblox developer, it is currently too hard to get code-coverage stats from our unit testing runs. This prevents us from tracking coverage and code quality through code-coverage. Code coverage is a metric that measures the extent to which a program’s source code has been executed during testing, helping identify areas that might need more attention. While luau and luau-cli has the ability to output lcov files - a standard code coverage format, the Roblox engine itself has no such mechanism.

While unit testing games is typically a bad idea, we have many core libraries which we depend upon. We want unit tests to ensure we don’t break these during refactors. And while code coverage is often a bad statistic to force in terms of velocity, just reporting code coverage itself can be a powerful mechanism to increase test quality.

Proposed workflows

  1. Write unit test
  2. Roblox studio reports lcov coverage and a plugin can report the actual coverage percentage
  3. Unit test runs in open cloud
  4. A script extracts the lcov files and sends them back to github action
  5. A standard lcov github action bot can parse the files and report coverage

This would make a big difference, and is a core requirement for higher code quality and more professional development on Roblox. This is also a feature we can’t do without Roblox’s help.

14 Likes