I tried testing code coverage of untested source js files of my React application using jest but was shocked to see that it mostly gave 0% code coverage for all files. Is it fine to test code coverage of component.js
files of React using Jest or am I doing anything incorrect here.
Here is my jest configuration specified in package.json:
"jest": {
"testEnvironment": "node",
"collectCoverageFrom" : ["**/src/**/*.js"]
}
my coverage snapshot:
I don't believe that 0% of my code statements are executing for all files. Any thing I am missing here? Is this report fine for es6 app? I even tested the code coverage of react boilerplate app created using react cli create-react-app by ejecting webpack. Even the boilerplate app shows code coverage as 0% for untested js files. This is 100% false. Any idea on this results?