Generate correct branch coverage for JavaScript tests

Description

For some reason, Zanata's frontend builds don't include branch data in cobertura-coverage.xml, which causes the Cobertura plugin to show 100% branch coverage for JavaScript code, which is quite wrong. Also, if we start converting JaCoCo to Cobertura for consistent reporting (ZNTA-1682), this "100%" coverage will affect the overall average for branch coverage.

Pantheon-Web uses Karma for coverage, with the Cobertura reporting format, and it does include branch/conditional coverage data, so it is possible. Also, Jest's own HTML coverage reports do include branch coverage. It must be just a reporting problem. This bug suggests that the Cobertura support may be a bit lacking: https://github.com/gotwarlost/istanbul/issues/729

We need to investigate, and come up with a coverage solution which includes branch information.

Some options which might be investigated:

  • tweak reporting format options in Jest/Istanbul

  • create bug fix for Cobertura reporting format in Jest/Istanbul

  • run tests with Karma instead

  • generate another format (like lcov) and convert to cobertura format. (Jenkins can only display JaCoCo or Cobertura.) https://github.com/eriwen/lcov-to-cobertura-xml

Assignee

Unassigned

Reporter

Sean Flanigan

Labels

Tested Version/s

None

Priority

unspecified
Configure