npm run jest coverage code example
Example 1: jest command coverage
# in package.json
# "scripts": {
# "test": "jest --coverage"
# },
# using yarn
yarn test
# using npm
npm run test
Example 2: npm run test:coverage command in jest
npm test -- --coverage