- When writing a tests driven projects, we find it best to set
jestcoverageThresholdoption to 100, because each untested code will fail the build and be noticed. - Sometimes a code can't be tested for various reasons, but setting
coverageThresholdto less than 100 will make newly untested code harder to find. - Therefore we find it best to use
coverageThresholdset to 100, and add//istanbul ignore(coverage ignore) comments instead of settingcoverageThresholdto anything less. istanbul-auto-ignorehelps an existing project withcoverageThreshold < 100to get to 100 by adding//istanbul ignorecomments next to uncovered code.
- Make sure your project have a
coverage/coverage-final.jsonfile. In order to generate one runjestwithcollectCoverageset totrueandcoverageReportersset to["json"]. - run
npx istanbul-ignore-legacy