MCover also works fine with UTest library:
import mcover.coverage.MCoverage;
import mcover.coverage.client.LcovPrintClient;
import utest.Runner;
import utest.ui.Report;
/** Runs the test suite. **/
class TestAll {
/** The test cases. **/
static final tests = [
new Test1(),
new Test2()
];
/** Application entry point. **/
static function main(): Void {
final runner = new Runner();
runner.onComplete.add(_ -> {
final logger = MCoverage.getLogger();
logger.addClient(new LcovPrintClient("coverage", "var/lcov.info"));
logger.report();
});
Report.create(runner);
for (test in tests) runner.addCase(test);
runner.run();
}
}
Beware that coverage can be incomplete if you use the “no-brace function syntax” (whatever test library you’re using):