Question 8 of 10Pro Only

What is code coverage in testing? How do you generate and interpret a coverage report with Jest?

Sample answer preview

Code coverage measures what proportion of your code is executed by your tests. It is a useful but insufficient indicator of test quality. To generate a coverage report, run npm test with the coverage flag. Or add a script in package.json with jest and the coverage flag.

coveragestatementsbranchesfunctionslinescoverageThreshold

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Frontend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime