jest
Jest suites: test lint rules, and passing tests before every push. Level all adds a coverage minimum. It requires javascript. Guide: Tests.
Selected when
Section titled “Selected when”A scope has a filename jest.config.*, or a dependency on jest.
Checks
Section titled “Checks”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.
What to do
Section titled “What to do”Fix each failed test, and add tests for the code that the report marks uncovered. Lower a minimum under coverage only with a reason.
Example
Section titled “Example”Jest reports coverage threshold for lines (90%) not met: 85%. Add tests for the lines its report marks uncovered.
Turn it off
Section titled “Turn it off”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 */Settings
Section titled “Settings”| 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. |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| jest | Any, install it yourself |
| eslint-plugin-jest | 29.17.0 |