I am using the following code to run Jest test on specific file.
jest utils.spec.js --collectCoverageFrom=**/utils.js
If i want to test whole directory i use
jest someDirectory --collectCoverageFrom=**/someDirectory
But the code coverage does not work here why is so?
Thanks.
You need to add this pattern /**/*.js
, that match all the files in all sub directories:
jest someDirectory --collectCoverageFrom=**/someDirectory/**/*.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With