Skip to content

Commit 212fa23

Browse files
authored
Merge pull request #850 from IQSS/docs-coverage
docs: add more details about coverage
2 parents 6ac9379 + 975662b commit 212fa23

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

DEVELOPER_GUIDE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -944,15 +944,14 @@ However, we prioritize user-centric testing over coverage numbers.
944944
- **Coverage Threshold:** We aim for a test coverage of 95% for the unit tests. This threshold is set in the `.nycrc.json` file.
945945
- **Coverage Reports:** We use [nyc](https://www.npmjs.com/package/nyc) to generate coverage reports, which are available
946946
in the `coverage` folder after running the tests. These reports are also published to [Coveralls](https://coveralls.io/github/IQSS/dataverse-frontend?branch=develop)
947-
with every pull request and merge. The coverage badge is displayed at the top of the README.
947+
with every pull request and merge. The coverage badge is displayed at the top of the README. See "include" and "exclude" in `.nycrc.json` to learn about which source files are included in coverage reports.
948948
- **Tests included in the coverage:** We include all unit tests in the coverage report.
949949
950950
#### How to run the code coverage
951951
952-
To generate the code coverage, you first need to run the tests with the `test:unit` script. After running the tests, you
953-
can check the coverage with the `test:coverage` script.
952+
To generate the code coverage, you first need to run the tests with the `test:unit` script. This can take a while! After running the tests, you can check the coverage with the `test:coverage` script. This will simply report the total coverage.
954953
955-
If you want to see the coverage report in the browser, you can open the `coverage/lcov-report/index.html` file in the browser.
954+
To see which lines are not covered, you can open the coverage report in the browser: `coverage/lcov-report/index.html`.
956955
957956
```bash
958957
# root project directory
@@ -964,8 +963,12 @@ npm run test:unit
964963
# Check the coverage
965964
966965
npm run test:coverage
966+
967+
# See detailed report at coverage/lcov-report/index.html
967968
```
968969
970+
Note that it's easy for the `lcov-report` report to get overwritten. For example, running any test with `npm run cy:open-unit` will overwrite it. For this reason you might want to copy the `lcov-report` directory elsewhere for safe keeping. That’s mainly useful for debugging previous coverage results and improving them.
971+
969972
<p align="right">(<a href="#readme-top">back to top</a>)</p>
970973
<br>
971974

0 commit comments

Comments
 (0)