Skip to content

luatest does not report LuaCov reporter errors clearly when --coverage is enabled #469

Description

@tulzke

Summary

When luatest is started with --coverage, errors raised by LuaCov during report generation are not handled by luatest. A test suite can finish successfully, but then the process exits with a fatal Tarantool error instead of a clear luatest failure explaining that LuaCov failed.

In the reproduced case, .luacov references a reporter that is not installed. LuaCov raises module 'luacov.reporter.missing_reporter' not found, but luatest does not catch/report it as a normal test runner error.

Environment

  • Tarantool: 3.7.0
  • luatest: 1.4.4
  • luacov: 0.13.0
  • Commands: luatest --coverage, luacov .

Minimal Reproducer

.luacov:

return {
  runreport = true,
  reporter = "missing_reporter",
}

test/pass_test.lua:

local t = require('luatest')

local g = t.group('pass')

g.test_pass = function()
    t.assert_equals(1 + 1, 2)
end

Run:

luatest --coverage

Actual Behavior

The test itself succeeds, but the process exits with a fatal Tarantool error after LuaCov tries to generate the report.

Example output:

Tarantool version is 3.7.0-0-g78b01ace947d
started logging into a pipe, SIGHUP log rotation disabled
luatest | 2026-06-26 07:07:52.897 [1] main/104/luatest/luatest.log runner.lua:306 I> Bootstrap finished: 1 test(s), 0 group(s)
.2026-06-26 07:07:52.922 [1] main say.c:88 F> fatal error, exiting the event loop

Ran 1 tests in 0.007 seconds, 1 succeeded, 0 failed

The original LuaCov error can be obtained by running LuaCov explicitly:

luacov .

In that case, LuaCov reports the real configuration/dependency problem directly, while the same problem is obscured when LuaCov is executed indirectly via luatest --coverage.

Expected Behavior

luatest should surface LuaCov failures as a normal runner error, for example:

luatest | 2026-06-26 07:07:52.897 [1] main/104/luatest/luatest.log runner.lua:306 I> Bootstrap finished: 1 test(s), 0 group(s)
Ran 1 tests in 0.007 seconds, 1 succeeded, 0 failed

Coverage report generation failed:
/.rocks/share/tarantool/luacov/runner.lua:134: module 'luacov.reporter.missing_reporter' not found:
        no field package.preload['luacov.reporter.missing_reporter']

and exit with a non-zero status without Tarantool's generic fatal error, exiting the event loop.

Ideally, luatest should wrap LuaCov initialization/shutdown/report generation with pcall/xpcall, print the original LuaCov error and traceback, and return a regular failure status.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions