Skip to content

jest

Jest suites: test lint rules, and passing tests before every push. Level all adds a coverage minimum. It requires javascript. Guide: Tests.

A scope has a filename jest.config.*, or a dependency on jest.

Runs Jest with coverage, and fails on a failed test or when lines, branches, functions, or statements fall under their minimums.

Runs at the push stage, once per scope, and loads your code.

A coverage minimum keeps new code from arriving untested.

Fix each failed test, and add tests for the code that the report marks uncovered. Lower a minimum under coverage only with a reason.

Jest reports coverage threshold for lines (90%) not met: 85%. Add tests for the lines its report marks uncovered.

gspot ignore jest/tests --paths "<path>" --reason "<why>"

To silence one place, write a comment such as:

/* v8 ignore next -- reason: only a full disk reaches this branch */
Setting What it sets
coverage.min_line_percent The minimum percentage of source lines covered by tests.
coverage.min_branch_percent The minimum percentage of source branches covered by tests.
coverage.min_function_percent The minimum percentage of source functions covered by tests.
coverage.min_statement_percent The minimum percentage of source statements covered by tests.
Tool Version
jest Any, install it yourself
eslint-plugin-jest 29.17.0