Jest codeCoverage not working as expected

I’ve covered every eventuality with my tests, however when I append --codeCoverage to my test runner, I get so many uncovered lines, namely, all of the return statements.

I’m testing using a very simliar method to what is mentioned in the docs, but still the code coverage tool is giving these unexpected results.

Anyone have any idea or experience in this area?

Could you share a few code samples of your tests?

Hi, thanks for your response. I solved it last night; it turns out I wasn’t using asynchronous javascript with the Jest waitFor() function.

1 Like