I want to have coverage report for only one file that I am working on at the moment.
It is a bit overwhelming to have the full table of coverage for the whole application files and then search for the one I need.
What I tried was to run test for one file and add --coverage
. But it shows coverage for all files:
package.json
...
"test": "react-scripts test",
...
My command
npm test my-component.test --coverage
Is there an option that I can add to this command to show me only my-component.tsx
coverage?
--collectCoverageFrom='["packages/**/index.js"]' --coverage
. Original Ref: github.com/facebook/jest/issues/1932 – Primordial