I am trying to inspect a single test so I run:
npm test alerts.actionCreators.test.js
The test passes, and then I get a huge printout of code coverage and then a failure for not meeting global standards. Can I skip this part of testing while I focus on the just whether the test passes or fails?
I found a hack that mostly works: --collectCoverageOnlyFrom ''. With this the coverage table will be empty and take only about 5 lines.
I would recommend adding a second test command to your package.json :
{
"test:watch": "jest --watch-all",
...
}
Jest will watch for changes in your tests/implementation and re-run the tests automatically. It should not cover the tests in watch mode.
It's good idea to run a coverage on your code from time to time. To make sure jest excluded code you don't want to cover, make sure to configure your jest config accordingly:
{
collectCoverageFrom: ["src/**/{!(*.d.ts),}.{ts,js,.tsx,.jsx}"],
...
}
More information about jest configuration can be found here.
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