Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 895 Bytes

File metadata and controls

37 lines (26 loc) · 895 Bytes

Jest Code Coverage :

coverage : is a process of collecting all reports about our unit tests that display uncovered lines to be reviewed again. we use the following command.

npm test -- --coverage

alt text

The preceding command creates a coverage directory that contains all reports about your unit tests.

alt text

We can automate the coverage process to be done after each modification you do in the file.test.js by adding jest options for the package.json file as follows.

{
	...
	"jest": {
		"collectCoverage": true, // coverage process iteratively.
		"coverageReports": ['html'] // types of reports.
	}
}

Then we run the following command.

npm test

⬅️ previous ➡️ next 🚪index