How to read Test Coverage report generated using Jest.

krishankant singhal
2 min readFeb 6, 2019

Jest come with functionality of generating report which help us in understanding test coverages. this coverage include statement , functional , branch coverages.

This is one example of test coverage report generated for test react app. This Report says it has 84% statement coverage , 100% branches and 100% functional and 84% lines coverage overall. than it display component wise report.

so what is mean of statement, Branches , functions , lines coverages etc.

  • Function coverage Has each function (or subroutine) in the program been called?
  • Statement coverage Has each statement in the program been executed?
  • Branch coverage Has each branch (also called DD-path) of each control structure (such as in if and case statements) been executed? For example, given an if statement, have both the true and false branches been executed? Another way of saying this is, has every edge in the program been executed?
  • Line coverage has each executable line in the source file been executed?

For each case, the percentage represents executed code vs not-executed code, which equals each fraction in percent format (e.g: 50% branches, 1/2).

--

--

krishankant singhal
krishankant singhal

Written by krishankant singhal

Angular,Vuejs,Android,Java,Git developer. i am nerd who want to learn new technologies, goes in depth.

Responses (5)