Ask Your Question
0

Why aren't my tests visible in the lcov-report\index.html even after running the npx jest --coverage command?

asked 2021-11-25 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-07-03 10:00:00 +0000

bukephalos gravatar image

There could be a few possible reasons:

  1. The tests have not been run successfully: Check if the test suite runs without errors and if all the tests are passing. If there are any errors, fix them and run the tests again.

  2. The lcov-report is not generated: Ensure that the npx jest --coverage command has been run successfully and that the lcov-report folder exists in the project root directory. If the folder is not there, run the command again.

  3. The coverage threshold has not been met: By default, Jest will only generate coverage reports for files that have more than 50% coverage. Check the coverage thresholds in your Jest configuration file and ensure that the tests have sufficient coverage to be included in the report.

  4. The files are excluded from the report: Verify that the files that contain the tests are not excluded from the coverage report in the Jest configuration file. By default, Jest excludes files in the node_modules and build folders, as well as files that end with .test.js, .spec.js or .jsx. Ensure that your test files are not excluded in a similar manner.

  5. Jest configuration has not been set up correctly: Check that your Jest configuration is set up correctly and that the path for the coverage report is configured properly. If it is not, Jest may not be able to find the lcov-report folder to generate the report.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-11-25 11:00:00 +0000

Seen: 7 times

Last updated: Jul 03 '21