I have CI setup for a GitLab repository and the job contains the following output to the STDOUT.
=============================== Coverage summary ===============================
Statements : 94.25% ( 291/333 )
Branches : 62.29% ( 53/75 )
Functions : 73.32% ( 170/196 )
Lines : 94.68% ( 533/569 )
================================================================================
In the .gitlab-ci.yml
file for the job I have the coverage: /^Statements\s*:\s*([^%]+)/
. As well, in the CI/CD settings for the repository I have ^Statements\s*:\s*([^%]+)
set.
Yet code coverage appears to be Unknown
on the code coverage badge.
Turns out that the build needs to be passing. So a Mocha exception for example of a failing test will prevent code coverage from being extracted.