Skip to content

Checking the coverage of changed and added files

License

Notifications You must be signed in to change notification settings

denwakeup/jest-coverage-gate

Repository files navigation

Jest Coverage Gate

npm

Checking the coverage of changed and added files

example


Features

  • Separate coverage threshold settings for new and changed files
  • Ability to specify target branch relative to which diff will be calculated

Usage

  1. Install:
npm i jest-coverage-gate -D
  1. Add jest-coverage-gate to the coverageReporters list of your Jest configuration:
{
  coverageReporters: [
    "clover", "json", "lcov", "text", // default
    [
      'jest-coverage-gate',
      {
        since: 'develop', // origin/develop, OR origin/develop...HEAD, OR commitHash...commitHash
        modified: {
          branches: 50,
          functions: 50,
          lines: 50,
          statements: 50,
        },
        added: {
          branches: 80,
          functions: 80,
          lines: 80,
          statements: 80,
        },
      },
    ],
  ],
}
  1. Run Jest:
jest --coverage

About

Checking the coverage of changed and added files

Resources

License

Stars

Watchers

Forks

Packages

No packages published