This is the "scripts" section of the package.json file that was initially generated using create-react-app:
"scripts": {
  "start": "concurrently \"react-scripts start\" \"node server.js\"",
  "build": "react-scripts build",
  "eject": "react-scripts eject",
  "test": "react-scripts test --env=jsdom --coverage --watchAll",
  "start:server": "node server"
},
I would like to configure Jest to have a coverage threshold like this:
"jest": {
  "coverageThreshold": {
    "global": {
      "branches": 100,
      "functions": 100,
      "lines": 100,
      "statements": 100
    }
  }
}
However, when I run yarn test it does not look like the "jest" portion is being executed. Is there something extra I need to add b/c this project was built with create-react-app? 
Thanks!
package.jsonnpm script to coverage"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "coverage": "npm test -- --coverage",
    "eject": "react-scripts eject"
}
jest config
"jest": {
    "coverageThreshold": {
      "global": {
        "statements": 100,
        "branches": 50,
        "functions": 100,
        "lines": 100
      }
    }
  },
npm run coverage 
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